Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep TinyMCE after postback in an UpdatePanel

When I click a button that causes a postback on the UpdatePanel it calls the tinyMCE.triggerSave().

It reloads the panel and the editor show up again, but when I try to call tinyMCE.triggerSave() the second time I get the following error:

g.win.document is null

I though it was getting the old instance, but I'm also removing the control (tinyMCE.execCommand('mceRemoveControl',false,'Editor');) after I call the save. Even so it still crashes the second time.

How should I fix it?

like image 934
BrunoLM Avatar asked Aug 17 '10 13:08

BrunoLM


1 Answers

tinyMCE.execCommand('mceRemoveControl',true,'Editor');

Before leaving the UpdatePanel, it will force tinyMCE to remove completely and then when you add again it won't crash.

like image 82
Gadonski Avatar answered Sep 19 '22 21:09

Gadonski