Can't type in tinyMCE 4 instance after mceAddEditor

↘锁芯ラ 提交于 2019-12-11 06:16:58

问题


Pre-note: This issue occurs whether or not I already have a textarea on the page.

I have a button that triggers an ajax request first...writing something to a database and returning the key. I use that key in my ID for the textarea that is then dynamically added to page. Keep in mind that tinyMCE is already initialized.

tinymce.init({
        selector: ".editor",
        setup: function(ed) {
            ed.on('change', function(e) {
                tinymce.triggerSave();
                $('form').trigger('checkform.areYouSure');
            });
            ed.on('init', function(e) {
                autoresize_max_height: 500
            });
        },
        plugins: [
            "advlist autolink link responsivefilemanager lists charmap print preview hr anchor pagebreak spellchecker",
            "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
            "save table contextmenu directionality template paste textcolor colorpicker responsivefilemanager autoresize"
        ],
        toolbar: "undo redo | styleselect | bold italic | forecolor backcolor | alignleft aligncenter alignright | bullist numlist | outdent indent | table | link responsivefilemanager",
        image_advtab: true ,

        external_filemanager_path:"/filemanager/",
        filemanager_title:"Filemanager" ,
        external_plugins: { "filemanager" : "/filemanager/plugin.min.js"},
    });

After the textarea is dynamically created, I add some default 'Lorem Ipsum' text and call mceAddEditor

tinymce.execCommand('mceAddEditor', false, "custom-html_" + data.c2akey);

data.c2akey is the key returned from the ajax call.

The tinymce instance is created successfully.

Here's the problem:

1) I can not type in this newly created instance

2) The instance is super tall. Unless I set a static height on the parent container the textarea is, the editor is really tall. See tinyMCE 4 instance after mceAddEditor really tall

So I need help figuring out why I can't type in this instance.

来源:https://stackoverflow.com/questions/26737588/cant-type-in-tinymce-4-instance-after-mceaddeditor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!