Displayin TinyMCE的两次AJAX调用后, [英] Displayin tinyMCE after twice ajax call

查看:132
本文介绍了Displayin TinyMCE的两次AJAX调用后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网页,点击一个按钮时,一个div出现其中有一个文本区域(TinyMCE的)。我有该div关闭按钮。当我打开分区,做我的工作,关闭DIV,并再次打开分区,tinyMCE的编辑不会出现。 这里是我的问题的总结 1-)点击按钮,的onclick =doAjax(),并显示在一个DIV返回值 2-)在该DIV,有TinyMCE中一个textarea。一切都好 3)关闭格(其实只是淡出()的DIV)一切都OK 4-)点击按钮的步骤1再次的onclick =doAjax(),并显示在一个DIV返回值 5)在该DIV,没有TinyMCE中一个textarea! 我尝试使用他们中的一些,但不能使它工作

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');
 }

此$ C $ 1c示出了tinyMCE只在第一次,而不是为第二次或以后。任何解决办法?

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');

这工作得很好!

推荐答案

遇到了同样的问题,通过重新初始化之前

came across the same problem and solved it by basically removing all of the instances before initializing it again

tinymce.remove();
tinymce.init({selector: 'textarea'});

这篇关于Displayin TinyMCE的两次AJAX调用后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆