JQuery模式中的TinyMCE模态不可编辑

我在JQuery UI模式对话框中运行一个tinyMCE编辑器。 一切都运行正常,除了那些本身打开一个新模态(例如链接)的tinyMCE的function。 这些模态显示正常,但输入区域不可编辑。 根据Firebug,js代码是可以的,HTML非常简单。

它可能来自哪里?

编辑:

 tinymce.init({ selector: "textarea", plugins: "autolink link table textcolor", menubar: false, toolbar: "undo redo | styleselect | forecolor backcolor | bold italic | link unlink | table" }); $(document).ready(function(){ $(".sendmail") .button({ icons: { primary: "ui-icon-mail-closed" }, text: false }) .click(function(){ $("#sendmailform").dialog("open"); }) ; $(function(){ $("#sendmailform") .dialog({ autoOpen: false, title: "Send mail confirmation", modal:true, width: 750, [buttons & ajax] }) ; }); });  

来自http://www.tinymce.com/develop/bugtracker_view.php?id=5917

对于jQuery UI对话框,您可以这样做:

 $.widget("ui.dialog", $.ui.dialog, { _allowInteraction: function(event) { return !!$(event.target).closest(".mce-container").length || this._super( event ); } }); 

感谢@Harry,TinyMCE bugtracker上的优秀人员提供了解决方案。

我刚刚在加载tinyMCE之前加载了在DOM之后加载的脚本之上的代码:

 $(document).on('focusin', function(e) { if ($(event.target).closest(".mce-window").length) { e.stopImmediatePropagation(); } }); 

工作就像一个魅力,而@Harry发布的那个没有。

您的问题需要更多细节才能回答,但您可以尝试这样做:

 tinymce.get('editor_id').getBody().setAttribute('contenteditable', 'false');