gpt4 book ai didi

jquery - 为什么 Tinymce 第二次加载失败?

转载 作者:行者123 更新时间:2023-12-04 16:31:25 38 4
gpt4 key购买 nike

我有以下代码来渲染tinymce。之前一直运行正常,但不知道为什么突然坏了。首先它完美地呈现tinymce。第二次加载失败。第二个我找到了 tinymce.editors.length = 1 , 表示编辑器在那里。

tinyMCE.init({
paste_as_text: true,
mode: 'textareas',
plugins: ['paste link textcolor'],
force_br_newlines: true,
paste_remove_spans: true,
toolbar: "undo redo | bold italic underline forecolor | link unlink",
menubar: false,
statusbar: false,
browser_spellcheck: true,
forced_root_block: "",
setup: function (editor) {
editor.on('init', function() {
$('#loading_gfx').css('display', 'none');
});

}
});

我找到的解决方案
if (tinymce.editors.length > 0) {
tinymce.execCommand('mceFocus', true, textArea_id );
tinymce.execCommand('mceRemoveEditor',true, textArea_id);
tinymce.execCommand('mceAddEditor',true, textArea_id);
}

但我不明白为什么它突然中断,我有最新的微型 mce 版本 4.2.3
任何人都知道原因。

最佳答案

在尝试创建副本之前删除现有实例:

tinymce.remove("#editor");

tinymce.init({ target: document.getElementById('editor') });

关于jquery - 为什么 Tinymce 第二次加载失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32519169/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com