在onit上禁用Tinymce工具栏

时间:2014-10-27 13:29:42

标签: javascript tinymce tinymce-4

我正在使用具有现代主题的Tinymce 4x。我允许人们拥有该编辑器的相同副本     但只允许其中一个人编辑它。我需要禁用tinymce工具栏以防止其中一个     这些用户要经历它们。我初始化编辑器时的编辑器工具栏如下所示:

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. 

1 个答案:

答案 0 :(得分:0)

设置一个高于<script type="text/javascript" src="tinymce.min.js"></script>的变量,用于确定toolbar1:值&#39; s。 "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