在wordpress中的TinyMCE模式中加载TinyMCE编辑器

时间:2022-10-06 09:59:10

I'm using TinyMCE to open a modal. And inside that modal i would want to add an instance of tinyMCE. I'm opening the modal passing some objects. I followed this guide

我正在使用TinyMCE打开一个模态。在该模态中,我想添加一个tinyMCE的实例。我打开传递一些物体的模态。我按照这个指南

            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
                }
            );

In the tinymce-dialog.html

在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] );
} );

This actually creates an instance of TinyMce which is not working though

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

在wordpress中的TinyMCE模式中加载TinyMCE编辑器

probably the reason is an error

可能原因是错误

TypeError: elm is undefined

TypeError:elm未定义

which points to

哪个指向

    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;
    },

what could be causing this?

什么可能导致这个?

1 个解决方案

#1


0  

In the end, I had to stop using TinyMce modal and use bootstrap modals.

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

#1


0  

In the end, I had to stop using TinyMce modal and use bootstrap modals.

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