我正在使用ajax请求重新加载div的内容。
<div>
<textarea id="content-value" rows="15" cols="40" class="tinymce" style="width:100%"></textarea>
</div>
在这个div中,我有一个用tinymce初始化的文本区域......
tinyMCE.init({
mode: "specific_textareas",
editor_selector: "tinymce",
theme : "advanced",
theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|formatselect,fontsizeselect,|,code",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_buttons4: "",
height: "340",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false
});
使用AJAX请求加载内容后,我删除编辑器,替换内容,然后尝试将编辑器重新添加到tinyMCE。
function OnCreateResponse(response) {
if(response.success) {
tinymce.EditorManager.execCommand('mceRemoveControl',true, 'content-value');
$(dlgElem).html(response.html);
tinymce.EditorManager.execCommand('mceAddControl', true, 'content-value');
}
}
}
重新添加tinyMCE后会出现以下错误
错误:tinyMCE.get(“content-value”)是 未定义
执行时......
tinymce.EditorManager.execCommand('mceAddControl', true, 'content-value');
有没有人对我做错了什么有任何想法?