我使用jsPanel在我的网站上出现了一些模式窗口。

在jsPanel初始化上,我用textarea和回调函数指定内容。

创建我的jsPanel后,我尝试在回调中初始化tinyMCE。我测试了tinyMCE实例,并且我的编辑器在实例列表中...但是在jsPanel中,它显示为普通的textarea,而不是tinyMCE。

任何的想法 ?
这是代码:

function oninitjspanel()
{
    console.log('before init modal mce');
    tinymce.init({
        selector: "#email_message",
        entity_encoding : "raw",
        encoding: "UTF-8",
        theme: "modern",
        height: "100%",
        width: "100%",
        plugins: [
        "advlist autolink lists link image charmap print preview hr anchor pagebreak",
        "searchreplace wordcount visualblocks visualchars code fullscreen",
        "insertdatetime media nonbreaking save table contextmenu directionality",
        "emoticons template paste textcolor colorpicker textpattern"
        ],
        toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image preview media | forecolor backcolor emoticons",
        image_advtab: true,
    });
    console.log('after init modal mce');
    for (var i = 0; i < tinymce.editors.length; i++)
    {
        console.log(i + " Editor id:", tinymce.editors[i].id);
    }
}

$('#new_document').click (function () {
    var content = '<div id="choix_document"><textarea id="email_message"></textarea></div>';
    $.jsPanel({
        content:        content,
        position:       "center",
        theme:          "success",
        title:          "Nouveau document/email",
        size:           {   width:  function(){ return $(window).width()*0.75 },
                            height: function(){ return $(window).height()*0.75 } },
        toolbarFooter:  "<div class='email_submit'>Envoyer email</div><div id='email_returnmessage'></div>",
        callback:       oninitjspanel(),
    });

});


控制台日志:

before init modal mce
after init modal mce
0 Editor id: model_editor
1 Editor id: email_message


编辑:另一件事,由于tinyMCE在模态中存在焦点问题,因此我在页面上加载了以下内容以防止出现此问题:

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

最佳答案

看看https://github.com/Flyer53/jsPanel/issues/51

但是我想您是在GitHub的jsPanel问题页面上问相同问题的人吗?

关于javascript - tinyMCE不要在jsPanel中初始化,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34066255/

10-08 21:59