javascript - 在 WordPress 中的 TinyMCE 模式中加载 TinyMCE 编辑器

标签 javascript jquery wordpress tinymce tinymce-4

我正在使用 TinyMCE 打开模式。在该模式中,我想添加一个tinyMCE 的实例。我正在打开模式 passing some objects 。我关注了this guide

            editor.windowManager.open(
                //  Properties of the window.
                {
                    title: "TDSK's Dumb Shortcode Creator",   //    The title of the dialog window.
                    file:  url + '/tinymce-dialog.html',      //    The HTML file with the dialog contents.
                    width: 1000,                               //    The width of the dialog
                    height: 600,                              //    The height of the dialog
                    inline: 1                                 //    Whether to use modal dialog instead of separate browser window.
                },

                //  Parameters and arguments we want available to the window.
                {
                    editor: editor,   //    This is a reference to the current editor. We'll need this to insert the shortcode we create.

                    jquery: $,        //    If you want jQuery in the dialog, you must pass it here.
                    tinymce: tinymce
                }
            );

在tinymce-dialog.html中

var passed_arguments = top.tinymce.activeEditor.windowManager.getParams();
var $ = passed_arguments.jquery;

var jq_context = document.getElementsByTagName("body")[0];
$( function() {
    passed_arguments.tinymce.execCommand( 'mceAddEditor', false, $( '#sectionContent_1', jq_context )[0] );
} );

这实际上创建了一个 TinyMce 实例,但它不起作用

enter image description here

可能原因是错误

TypeError: elm is undefined

指向

    aria: function(name, value) {
        var self = this, elm = self.getEl(self.ariaTarget);

        if (typeof value === "undefined") {
            return self._aria[name];
        }

        self._aria[name] = value;

        if (self.state.get('rendered')) {
            elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
        }

        return self;
    },

这可能是什么原因造成的?

最佳答案

最后,我不得不停止使用 TinyMce 模态并使用 bootstrap 模态。

关于javascript - 在 WordPress 中的 TinyMCE 模式中加载 TinyMCE 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33684207/

相关文章:

javascript - 同步 AJAX 调用之前的代码在 Chrome 中卡住

javascript - 无法通过ajax获取完整数组

javascript - Rails/Javascript : Data attribute not returned through partial, 但存在于 DOM 中

html - Wordpress 顶部面板上的 float 社交图标

css - sass 集合作为变量名

WordPress 永久链接 'not found on this server'

javascript - 对象中的预设选项并查看它是否不存在于允许的属性中

javascript - 如何在不使用 :after? 的情况下在 div 上创建三 Angular 形

javascript - 如何在javascript中验证两个复选框

jquery - 在 jQuery 中向上滑动的元素在 IE 8 中被弄乱了