2013-09-23 24 views
4

我在這裏看到很多帖子,但其中每一個都太老了,它沒有與tinyMCE 4.x連接我正在從網上搜索網絡,我無法找到一個選項以只讀模式設置tinyMCE 4.x 。如何在tinyMCE 4.x中進行只讀操作?

在這一刻我只是隱藏工具欄和菜單欄,但我仍然可以刪除文本等等...

+0

查看答案http://stackoverflow.com/a/35982854/2614103爲TinyMCE的v4.3.x – grajsek

回答

4

這是我如何使它只讀。

tinymce.init({ 
    selector: "#id", 
    readonly: true, 
    toolbar: false, 
    menubar: false, 
    statusbar: false 
    // more inits... 
}); 

您可能需要調整自己的樣式以修復編輯器邊框。

+1

是,但我不能選擇文本,當我做到這一點。 ..文章中有代碼片段,用戶可以複製/粘貼,就像在tinymce版本3中一樣。http://www.tinymce.com/tryit/3_x/read_only_mode.php – cyrat

+0

這適用於我。 – dwarandae

0

這花了我一些時間來研究如何在只讀模式下進行錫酸鹽。

這裏的關鍵點設置readonly10,不truefalse。例如,下面是我的初始化代碼:

tinymce.init({ 
      selector: "#html-textarea", 
      menubar: false, 
      statusbar: false, 
      resize: "both", 
      plugins: [ 
       "textcolor image link preview code table media noneditable" 
      ], 
      readonly: status, // **status hold value 0 or 1, NOT true or false** 
      toolbar: 'preview | undo redo | removeformat | cut copy paste | formatselect fontselect fontsizeselect | forecolor backcolor | bold italic underline strikethrough subscript superscript | alignleft aligncenter alignright alignjustify | link unlink image media | code table | bullist numlist | outdent indent blockquote' 
     });