两次ajax调用后在tinyMCE中显示
在我的页面中,当单击按钮时,会出现一个带有文本区域(tinyMCE)的div。我有一个该 div 的关闭按钮。当我打开 div,完成我的工作,关闭 div,然后再次打开 div 时,tinyMCE 编辑器不会出现。 这是我的问题的摘要 1-) 单击按钮,onclick="doAjax()" 并将返回值显示在 DIV 中 2-) 在该DIV 中,有一个带有tinyMCE 的文本区域。一切都好 3-) 关闭div(实际上,只是fadeOut() DIV)一切正常 4-) 再次点击步骤1中的按钮,onclick="doAjax()" 并将返回值显示在DIV中 5-)在该DIV中,没有带有TINYMCE的文本区域! 我尝试使用其中一些,但无法使其工作
if (tinyMCE.get === 'undefined')
{
tinyMCE.execCommand('mceRemoveControl', false, 'message');
tinyMCE.execCommand('mceAddControl', false, 'message');
}
此代码仅第一次显示tinyMCE,第二次或以后不显示。有什么解决办法吗?
- - - - - - - - - - - -解决方案 - - - - - - - - - - - - - -------- 好的。我找到了一个解决方案
var oldEditor = tinyMCE.get('message');
if (oldEditor != undefined) {
tinymce.remove(oldEditor);
}
tinyMCE.execCommand('mceAddControl', false, 'message');
,效果很好!
In my page, when a button is clicked, a div appears which has a textarea(tinyMCE). I have a close button for that div. When I open the div, do my job, close the div, and open the div again, tinyMCE editor doesn't appear.
Here is the summary of my problem
1-) Click button, onclick="doAjax()" and display the returned value in a DIV
2-) In that DIV, there is a textarea with tinyMCE. Everything is OK
3-) Close the div(in fact, just fadeOut() the DIV) Everything is OK
4-) Click the button on step 1 again, onclick="doAjax()" and display the returned value in a DIV
5-)In that DIV, THERE IS NOT A TEXTAREA WITH TINYMCE!
I tried using some of them but couldn'T make it work
if (tinyMCE.get === 'undefined')
{
tinyMCE.execCommand('mceRemoveControl', false, 'message');
tinyMCE.execCommand('mceAddControl', false, 'message');
}
This code shows tinyMCE only for the first time, not for the second or later. Any solutions?
-----------------------SOLUTION----------------------------------
Okey. I found a solution
var oldEditor = tinyMCE.get('message');
if (oldEditor != undefined) {
tinymce.remove(oldEditor);
}
tinyMCE.execCommand('mceAddControl', false, 'message');
That works fine!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已发布您的评论作为答案。
如果您找到答案,请务必考虑花一些时间并发布答案。
谢谢,
斯沃鲁普
I have posted your comment as an answer.
Always consider taking some time and posting the answer if you found it.
Thanks,
Sworoop
遇到了同样的问题并通过在再次初始化之前基本上删除所有实例来解决它
came across the same problem and solved it by basically removing all of the instances before initializing it again