简体   繁体   English

重新初始化 tinyMCE

[英]Re-init tinyMCE

I have modal, which is started with button.我有模态,它以按钮开头。 Then this code is executed, where "form" variable contains also textarea.tinymce然后执行此代码,其中“form”变量还包含 textarea.tinymce

$(".modal-body").empty();
....
var form = ....
...
$(".modal-body").append(form);
 tinyMCE.init({
    mode: "specific_textareas",
    editor_selector: "tinymce",
    height : "350"
});

But when I close and reopen modal, the textarea won`t become tinymce, but normal textarea.但是当我关闭并重新打开模式时,textarea 不会变成 tinymce,而是正常的 textarea。 Any ideas?有任何想法吗?

Both mode and editor_selector are options from TinyMCE 3. In TinyMCE 5 you should use the selector option which is documented here: modeeditor_selector都是 TinyMCE 3 的选项。在 TinyMCE 5 中,您应该使用这里记录的selector选项:
https://www.tiny.cloud/docs/configure/integration-and-setup/#selector https://www.tiny.cloud/docs/configure/integration-and-setup/#selector

If that doesn't fix the problem then you will need to provide more information about how you are hiding and showing the modal.如果这不能解决问题,那么您将需要提供有关如何隐藏和显示模态的更多信息。 If you are hiding it with CSS then it should be possible to load TinyMCE however if you are removing it from the DOM then TinyMCE won't work.如果您使用 CSS 隐藏它,那么应该可以加载 TinyMCE,但是如果您从 DOM 中删除它,则 TinyMCE 将无法工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM