How to save TinyMCE after postback in UpdatePanel

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

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

 g.win.document is null 

I got the old instance, but I also delete the control ( tinyMCE.execCommand('mceRemoveControl',false,'Editor'); ) after calling save. Despite this, he is still out of order a second time.

How to fix it?

+6
c # tinymce
source share
4 answers

After a lot of confusion, I found that the fix that @ AndrΓ© Gadonski posted no longer works in TinyMCE 4. This not only does not work, but also does not provide feedback on the console error!

New mceRemoveEditor

Source: http://www.tinymce.com/forum/viewtopic.php?id=31256

I found that this can either be used immediately before reinitializing TinyMCE, or just before updating the ASP update pane using

 var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_beginRequest(BeginRequestHandler); function BeginRequestHandler(sender, args) { tinymce.execCommand('mceRemoveEditor', true, 'EditorID'); } 
+2
source share

tinyMCE.execCommand ('mceRemoveControl', however, the editor ');

Before leaving UpdatePanel, it will force tinyMCE to completely be deleted, and then when you add it again, it will not work.

+6
source share

For tinymce 3.2.x, use the following to remove the tinyMCE instance in IE8 or any other browser. Because the tinymce.execCommand function makes the input fields immutable in IE8.

 tinyMCE.remove(editor); //editor is instance of tinymce editor and not editor id 

This will fix the "Allow Failure" error without disabling other input fields on the same page.

+2
source share

I have the same problem. For correction, you can add script code for the create post back element. my button creates the message back, I add it to OnClientClick ():

 <asp:LinkButton ID="lbnSave" OnClick="lbnSave_Click" ToolTip="Add New" OnClientClick="dotim()" runat="server">save</asp:LinkButton> 

and script:

 function dotim() { tinyMCE.triggerSave(); } // this is my attempt at a fix 
+2
source share

All Articles