2

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

任何线索它可能来自哪里?

编辑:

<script type="text/javascript">
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]
            })
        ;
    });
});
</script>
4

3 回答 3

2

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

我刚刚在 DOM 之后加载的脚本之上添加了以下代码,就在加载 tinyMCE 之前:

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

像魅力一样工作,而@Harry 发布的则没有。

于 2013-08-20T14:19:50.923 回答
2

来自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 );
    }
});
于 2013-08-15T20:46:54.990 回答
0

您的问题需要更多详细信息才能回答,但您可以试试这个:

tinymce.get('editor_id').getBody().setAttribute('contenteditable', 'false');
于 2013-06-24T09:06:56.687 回答