为什么一旦jquery对话框关闭并重新打开,Tinymce就无法启动?
我有一个包含tinymce的jquery UI对话框,第一次打开该对话框时,tinymce工作正常,但一旦关闭并重新打开该对话框,我会看到tinymce编辑器,但我无法在其中键入任何内容,就好像它被禁用一样。这里的问题看起来很清楚。关闭jQuery对话框时没有正确关闭tinymce实例 要关闭edtor实例,请使用:为什么一旦jquery对话框关闭并重新打开,Tinymce就无法启动?,jquery,jquery-ui,tinymce,jquery-dialog,Jquery,Jquery Ui,Tinymce,Jquery Dialog,我有一个包含tinymce的jquery UI对话框,第一次打开该对话框时,tinymce工作正常,但一旦关闭并重新打开该对话框,我会看到tinymce编辑器,但我无法在其中键入任何内容,就好像它被禁用一样。这里的问题看起来很清楚。关闭jQuery对话框时没有正确关闭tinymce实例 要关闭edtor实例,请使用: tinymce.execCommand('mceRemoveControl',true,'editor_id'); 更新:您应该使用document.ready-函数,以避免编辑
tinymce.execCommand('mceRemoveControl',true,'editor_id');
更新:您应该使用document.ready-函数,以避免编辑器初始化延迟太多(如果在1,4秒后加载文档,则会破坏1,6秒,并让用户等待):
我已通过延迟功能解决了问题:
setTimeout(function() {
g = {};
g.oEditor = new tinymce.Editor (
"notesComments",
{
// General options
mode : "none",
theme : "advanced",
height : 350,
plugins : "style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect",
theme_advanced_buttons3 : "undo,redo,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen|,nonbreaking,pagebreak,hr",
theme_advanced_buttons4 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote",
theme_advanced_buttons5 : "link,unlink,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons6 : "tablecontrols,|,removeformat,visualaid",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false
});
g.oEditor.render();
}, 3000);
这个很有魅力:
if(tinyMCE.execCommand('mceRemoveEditor', false, 'editorId')) {
// re-init..
}
这是我从收到的,请附上您的代码。。。我的水晶球今天玩起来了…我把它添加到我的beforeclose函数中,但它仍然不起作用。是的,我这么做了,我认为这与DOM没有很快准备好有关。在这种情况下,你应该使用一个文档准备好的函数,以避免延迟初始化太多!查看我的编辑答案
if(tinyMCE.execCommand('mceRemoveEditor', false, 'editorId')) {
// re-init..
}