Com*_*ity 5 wordpress tinymce wordpress-plugin tinymce-4 wordpress-3.9
我有一个TinyMCE插件,使用以下代码打开popin:
editor.windowManager.open({
id : 'popin-div-id',
width : 500,
height : "auto",
wpDialog : true,
title : 'Edit Options'
});
Run Code Online (Sandbox Code Playgroud)
自从我更新到WordPress 3.9(嵌入TinyMCE 4)后,我在控制台中收到以下错误:
tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.
Run Code Online (Sandbox Code Playgroud)
如果我wpDialog : true从上面的代码中删除" "部分,我的popin不再出现(没有错误).
在TinyMCE 4中使用默认的windowManager需要更改什么?我检查了他们的网站,我找不到关于从div打开popin的文档,但只能从外部HTML页面查看:
小智 5
我有同样的问题.对于WordPress文档,TinyMCE文档没有帮助.我不得不深入研究TinyMCE代码,以弄清楚如何让我的简单自定义弹出窗口再次运行.
回答
使用html键在您传递给的对象中定义html windowManager.open.下面,我使用jQuery通过挂钩到WordPress after_wp_tiny_mce操作来选择我放在页面上的一些html .
tinymce.activeEditor.windowManager.open({
title: ed.getLang('mm_tiny_mce.element_attributes'),
width : 300,
height : 300,
html :
'<div id="mm-attrs-pop" class="mm-tinymce-popup" tabindex="-1">' +
jQuery('#mm-attrs-pop-tpl').html() +
'</div>',
buttons: [
{
text: 'Cancel',
onclick: 'close'
},
{
text: 'Set Attributes',
onclick: function(){
//some code here that modifies the selected node in TinyMCE
tinymce.activeEditor.windowManager.close();
}
}
]
});
Run Code Online (Sandbox Code Playgroud)
相关的TinyMCE代码classes/ui/Window.js,特别是renderHTML属性.https://github.com/tinymce/tinymce/blob/master/js/tinymce/classes/ui/Window.js
希望有所帮助.干杯,克里斯
| 归档时间: |
|
| 查看次数: |
1359 次 |
| 最近记录: |