2011-03-30 117 views
1

我在我的页面中有2个编辑器。当我点击一个按钮,我希望他们成为残疾人士。tinymce禁用和启用编辑器和显示文本(而不是html)

如果有可能,我希望它成为一个常规的textarea,并将其作为常规文本而不是html文本。

我看到了其他问题的禁用,但并没有让他们的工作..

这是我的代码:

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”不能为空。

任何帮助将被认为,

感谢提前。

回答

1

您需要调用save函数并关闭tinymce。当然你也可以推TinyMCE的UI按钮(我想你知道如何工作的)

tinymce.get(editor_id).save(); 

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

当现在执行这个代码,你应该能够看到,已经在网站上初始化TinyMCE的前textarea的。

相关问题