tinymce.ui简单文本组件
我正在使用tinymce a尝试扩展插件以显示具有特定布局的对话框:tinymce.ui简单文本组件,tinymce,tinymce-4,Tinymce,Tinymce 4,我正在使用tinymce a尝试扩展插件以显示具有特定布局的对话框: editor.windowManager.open({ title: 'Title of my dialog', body: [ {type: 'label', text: 'my label'}, { name:'my_input', type: 'textbox'}, // { type: 'text', html:'so
editor.windowManager.open({
title: 'Title of my dialog',
body: [
{type: 'label', text: 'my label'},
{ name:'my_input', type: 'textbox'},
// { type: 'text', html:'some content with <b>bold</b> if posilbe!'},
// { type: 'html', value:'<div>with custom formating</div>'}
]
}
editor.windowManager.open({
标题:“我的对话标题”,
正文:[
{键入:“标签”,文本:“我的标签”},
{name:'my_input',键入:'textbox'},
//{键入:'text',html:'some content with bold if posilbe!',
//{类型:'html',值:'with custom formating'}
]
}
我多次查看文档,但可以找到一种方法在对话框的构造函数中添加html或文本组件(如示例中的注释行)
我知道有一个选项可以使用现成的html模板进行对话。但是也有很多事件和触发器,因此使用构造函数和.ui组件更适合我的情况。我曾经使用JQuery ui对话框进行对话,但在TinyMCE 4.0之后遇到了一些问题 我有一个TinyMCE插件,可以让人们在WordPress编辑器中获取他们文章的纯文本版本。然后我使用以下内容向他们显示该文本:
var plain_block = {
type: 'container',
html: '<textarea style="margin: 10px; width: 550px !important; height: 450px !important; background-color: #eee;" readonly="readonly">Whatever plain text I need to show goes here</textarea>'
};
ed.windowManager.open({
title: "Plain Text of This Post",
spacing: 10,
padding: 10,
items: [
plain_block
],
buttons: [
{
text: "Close",
onclick: function() { ed.windowManager.close();}
}
]
});
var普通块={
类型:“容器”,
html:“我需要显示的任何纯文本都在这里”
};
ed.windowManager.open({
标题:“这篇文章的纯文本”,
间距:10,
填充:10,
项目:[
普通块
],
按钮:[
{
文本:“关闭”,
onclick:function(){ed.windowManager.close();}
}
]
});
最终的结果是一个非常简单的jane对话框,带有一些HTML和一个关闭按钮