简体   繁体   English

tinymce禁用并启用编辑器并显示文本(不是HTML)

[英]tinymce disable and enable editor and show text (not as html)

I have 2 editors inside my page. 我的页面中有2位编辑者。 when i click a button i want them to become disabled. 当我单击一个按钮时,我希望他们被禁用。

If it is possible i would like it to become a regular textarea and to see the text inise of it as a regular text and not html. 如果可能的话,我希望它成为常规的textarea,并将其文本显示为常规文本而不是html。

I saw other questions for disabling but did not get them to work.. 我看到了其他有关禁用的问题,但没有使它们起作用。

This is my code: 这是我的代码:

function create_text_editor()
    {
            $('#remarks1').tinymce(
            {
                    script_url : 'resources/tinymce/jscripts/tiny_mce/tiny_mce.js',
                    theme : "advanced",
                    theme_advanced_buttons1 :         "cut,copy,paste,|,bold,italic,underline,|,undo,redo,|,justifyleft,justifycenter,justifyright,justifyfull,|" ,
                    theme_advanced_buttons2 :         "formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,|",
                    theme_advanced_buttons3 :         "",
                    theme_advanced_toolbar_location : "top",
                    theme_advanced_toolbar_align :    "left",
                    plugins :                         "paste" ,               
                    oninit : on_editor_init                                       });

             $('#remarks2').tinymce(
            {
                    script_url : 'resources/tinymce/jscripts/tiny_mce/tiny_mce.js',
                    theme : "advanced",
                    theme_advanced_buttons1 :         "cut,copy,paste,|,bold,italic,underline,|,undo,redo,|,justifyleft,justifycenter,justifyright,justifyfull,|" ,
                    theme_advanced_buttons2 :         "formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,|",
                    theme_advanced_buttons3 :         "",
                    theme_advanced_toolbar_location : "top",
                    theme_advanced_toolbar_align :    "left",
                    plugins :                         "paste" ,                 
                    oninit : on_editor_init                });
    }

'on_editor_init' is emtpy. 'on_editor_init'为空。

Any help will be appritiated, 任何帮助将不胜感激,

Thank's In Advance. 提前致谢。

You would need to call the save function and to shutdown tinymce. 您将需要调用save函数并关闭tinymce。 Of course you can execute this code when pushing a tinymce UI button (i guess you know how that works) 当然,您可以在按下tinymce UI按钮时执行此代码(我想您知道它的工作原理)

tinymce.get(editor_id).save();

tinymce.execCommand('mceRemoveControl', true, editor_id);

Now, you should be able to see the textarea that has been on the website before initializing tinymce. 现在,您应该能够在初始化tinymce之前查看网站上的文本区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM