Javascript 在NIT上禁用Tinymce工具栏
我使用的是Tinymce 4x,带有现代主题。我允许任何人拥有本编辑器的相同副本 但是只允许其中一个编辑它。我需要禁用tinymce工具栏以防止 这些用户需要通过它们。初始化编辑器时,我的编辑器工具栏如下所示:Javascript 在NIT上禁用Tinymce工具栏,javascript,tinymce,tinymce-4,Javascript,Tinymce,Tinymce 4,我使用的是Tinymce 4x,带有现代主题。我允许任何人拥有本编辑器的相同副本 但是只允许其中一个编辑它。我需要禁用tinymce工具栏以防止 这些用户需要通过它们。初始化编辑器时,我的编辑器工具栏如下所示: toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify ", toolbar2: "cut copy pa
toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter
alignright alignjustify ",
toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquoter",
toolbar3: "table | hr removeformat | subscript superscript |charmap emoticons|print fullscreen "
I need to disable toolbar1, toolbar2 and toolbar3 and I try to use :
/*tinymce.ui.toolbar1.setDisabled = true; for all these bars but it does not work. It seems that
this is only used for the user created toolbars.
Also I tried to add listener and then stop the propagation when the toolbar is clicked but also
it doesn't work
toolbarElement.addEventListener("click", function(e){
e.stopPropagation();
});
toolbarElement.style.pointerEvents = "none";
}
Please can someone help me. Thanks in advance for your suggestions.
设置一个变量,该变量决定toolbar1:值的大小。null可以由TinyMCE工具栏名称以外的任何内容填充
<script>
var tbSet1 = "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify";
if(true){tbSet1 = "null";}
var tbSet2 = "cut copy paste | searchreplace | bullist numlist | outdent indent"; blockquoter";
if(true){tbSet2 = "null";}
var tbSet3 = "table | hr removeformat | subscript superscript |charmap emoticons|print fullscreen ";
if(true){tbSet3 = "null";}
</script>
<script type="text/javascript" src="tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
toolbar1: tbSet1 ,
toolbar2: tbSet2 ,
toolbar3: tbSet3
CMIIW感谢您的回答“Panji”,但它不起作用,因为当我初始化编辑器时,它会接受空值并将其分配给工具栏。当我有oninit事件而不是init事件时,我需要更改此选项:/