在 wordpress 的 TinyMCE 模态中加载 TinyMCE 编辑器
Load a TinyMCE editor inside a TinyMCE modal in wordpress
我正在使用 TinyMCE 打开模式。在该模式中,我想添加一个 tinyMCE 实例。我正在打开模式 passing some objects. I followed 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 实例
可能是错误原因
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 模态。
我正在使用 TinyMCE 打开模式。在该模式中,我想添加一个 tinyMCE 实例。我正在打开模式 passing some objects. I followed 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 实例
可能是错误原因
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 模态。