小编JPa*_*doe的帖子

完全删除JQuery tinyMCE

我已经像这样初始化了tinyMCE:

$('#text').tinymce({
    // Location of TinyMCE script, optional, already loaded in page.
    script_url : '../adminContent/js/tiny_mce/tiny_mce.js',

    // General options
    theme : "advanced",
    plugins : "table,advimage,advlink,iespell,inlinepopups,preview,contextmenu,paste,visualchars",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,removeformat,cleanup,code,|,preview,tablecontrols,|,hr,visualaid,|,charmap,iespell",
    theme_advanced_buttons3 : "",

    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true
});
Run Code Online (Sandbox Code Playgroud)

上面的代码非常有效.问题是当我尝试删除tinyMCE时.

我的删除代码是:

$('#text').tinymce().execCommand('mceRemoveControl', false, 'text');
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

$('#text').remove();
Run Code Online (Sandbox Code Playgroud)

$('#text').tinymce().remove();
Run Code Online (Sandbox Code Playgroud)

第一个似乎没有做任何事情.最后两个给我这个错误:

未捕获的ReferenceError:未定义t

虽然通过HTML文档加载了tinymce,但我正在使用以下命令加载另一个脚本:

$.getScript(viewPath + '/mod/adminContent/js/editContent.js', function(){
    initEditContent(popup);
});
Run Code Online (Sandbox Code Playgroud)

popup是对加载了tinymce的弹出窗口的引用.它只是一个使用jquery创建的div.div的内容使用jquery ajax加载.

editContent.js看起来像这样:

var contentID;
function initEditContent(popup){
    contentID = $('#contentID').val();

    tinyMCE.execCommand("mceAddControl", true, 'text'); …
Run Code Online (Sandbox Code Playgroud)

jquery tinymce

5
推荐指数
1
解决办法
7940
查看次数

标签 统计

jquery ×1

tinymce ×1