What to do with tinyMCE when replacing DOM partitions with ajaxSubmit?

On a multi-tab page, some submit tabs process the contents of other tabs through ajaxSubmit . If another tab has active tinyMCE changes, what should I do on this tab before replacing its contents, and what should I do (if any) after replacing?

Currently, the code is executing tinyMCE.execCommand("mceRemoveControl", true, ed_id); for all editors on the target tab and relies on the normal functionality of the system to return them after the change. Is that all that is needed? After the change, I experience vague exceptions in tinyMCE code, but it's hard to find the cause.

SCRIPT5022 error itself: IndexSizeError is tiny_mce.js (1,78075), but I doubt it is especially relevant.

TinyMCE v3.4.5

+8
javascript jquery ajax tabs tinymce-3
source share
1 answer

As I said in my comments, TinyMCE does not work well with AJAX, it has a lot of problems. I tried many times to make it work.

In the end, I switched to CKEditor, so if you want to try and use it, you can specify the code here that you need for ajaxSubmit() options

 beforeSubmit:function{ for(var instanceName in CKEDITOR.instances) { try{ CKEDITOR.instances[instanceName].destroy(); }catch(e){ } } } 

the above code will completely remove CKEditor before sending the following: how to reinitialize CKEditor when your ajax has finished again, this is an option for ajaxSubmit() :

 success:function(){ // do what you need to update your DOM and then final call is $("editorSelector").ckeditor(options); } 
+4
source share

All Articles