开发者

tinyMCE problems with removing

开发者 https://www.devze.com 2023-02-25 13:41 出处:网络
well, i am using tinyMCE in a backoffice that works mostly thr开发者_如何学Cough ajax. I have fancybox and jqueryui accordion loading the php that contains the textarea and javascript tinyMCE.init.

well, i am using tinyMCE in a backoffice that works mostly thr开发者_如何学Cough ajax. I have fancybox and jqueryui accordion loading the php that contains the textarea and javascript tinyMCE.init.

When i save my content, through an independent button, and close the fancybox it was on, i can never use another fancybox or accordion , or even the same without reloading the page, because tinyMCE content comes out empty and uneditable. I tried tinyMCE.remove(); tinyMCE.destroy(); when closing and it still happens.

So i tried a different approach, every time the user cancels or saves the content, i refresh the page. But i keep getting an alert message:

"This page is asking you to confirm that you want to leave - data you have entered may not be saved. (this is in firefox, i get the same message in other words in other browsers)

How can i prevent the browser from doing this?

Thank you


You might need to shut down tinymce correctly

tinyMCE.execCommand('mceRemoveControl', false, editor_id);

and reinitialize it afterwards correctly

tinyMCE.execCommand('mceAddControl', false, editor_id);


You should not have to refresh your page to have several instances of a tinyMCE object.

After you create a new textarea and set its name and id to be 'editContent', you should be able to redraw the tinyMCE boxes using the following command:

tinyMCE.execCommand('mceAddControl', false, 'editContent');

Remeber, do this only AFTER you've created the textarea's, and assigned their ids/names

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号