[英]What should I do with tinyMCE when replacing sections of the DOM using ajaxSubmit?
On a multi-tab page, some tabs submit
process changes the content of other tabs through an ajaxSubmit
. 在多选项卡页面上,某些选项卡的submit
过程通过ajaxSubmit
更改其他选项卡的内容。 If the other tab contains active tinyMCE
edits what should I do to that tab before replacing it's content and what should I do (if anything) after the replacement? 如果另一个选项卡包含活动的tinyMCE
,则在替换其内容之前我应该对该选项卡进行什么操作,替换后应该做什么(如果有)?
Currently the code performs tinyMCE.execCommand("mceRemoveControl", true, ed_id);
当前,代码执行tinyMCE.execCommand("mceRemoveControl", true, ed_id);
on all editors in the target tab and relies on the normal functionality of the system to bring them back after the change. 在“目标”选项卡中的所有编辑器上运行,并依靠系统的正常功能将它们在更改后恢复。 Is that all that is necessary? 这就是所有必要的吗? I am experiencing obscure exceptions within the tinyMCE
code after the change but it is difficult to discover the cause. 更改后,我在tinyMCE
代码中遇到了难以理解的异常,但是很难找到原因。
The error itself is SCRIPT5022: IndexSizeError - tiny_mce.js (1,78075) but I doubt that is specifically relevant. 错误本身是SCRIPT5022:IndexSizeError-tiny_mce.js(1,78075),但我怀疑这是否特别相关。
TinyMCE v3.4.5 TinyMCE v3.4.5
As i said in my Comments TinyMCE does not play well with AJAX there are loads of problems with it i have tried many times to get it to work. 正如我在我的评论中说的那样,TinyMCE在AJAX上不能很好地发挥作用,但它有很多问题,我已经尝试过很多次才能使其正常工作。
In the end i switched to CKEditor so if you would like to try and use it you can here is the code you need for the ajaxSubmit()
options 最后,我切换到了CKEditor,因此,如果您想尝试使用它,可以在这里找到ajaxSubmit()
选项所需的代码。
beforeSubmit:function{
for(var instanceName in CKEDITOR.instances) {
try{
CKEDITOR.instances[instanceName].destroy();
}catch(e){
}
}
}
the above code will remove CKEditor cleanly before you submit the following is how to re-inistialize CKEditor when your ajax has finished again this is a option for ajaxSubmit()
: 上面的代码将在提交之前彻底清除CKEditor,以下是当ajax重新完成后如何重新初始化CKEditor的方法,这是ajaxSubmit()
一个选项:
success:function(){
// do what you need to update your DOM and then final call is
$("editorSelector").ckeditor(options);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.