我需要为 tinyMCE 4.0 开发一个小插件。 我必须根据输入的网址显示图像预览。 我不知道图像预览的类型。
有没有类似type="image"的东西
tinymce.PluginManager.add('uploadimage', function(editor, url) {
// Adds a menu item to the Insert menu
editor.addMenuItem('uploadimage', {
text: 'Example plugin',
context: 'insert',
onclick: function() {
editor.windowManager.open({
title: 'TinyMCE site',
width: 400,
height: 300,
buttons: [{
text: 'Close',
onclick: 'close'
}],
body: [
{
name: "path",
type: "textbox",
size: 40,
label: "File URL",
},
{
name: "fileList",
type: "listbox",
label: "Link list",
values: editor.settings.external_image_list_url,
onselect: function(e) {
this.parent().parent().find("#path").value(this.value());
}
},
{
name: "fieldset",
type:"image" //HERE I NEED TO PREVIEW IMAGE BUT THERE IS NO SUCH TYPE IMAGE
}
],
});
}
});
});
最佳答案
我认为最好的办法是将类型指定为“Container”,然后使用方法“renderHtml”手动设置 HTML 输出,如文档中所示:
http://www.tinymce.com/wiki.php/api4:class.tinymce.ui.Container
在该页面的右侧,您可以看到所有可用类型的列表。如果您决定编写自己的 Image 控件,这显然可以扩展。
关于javascript - tinymce 版本 4 中没有图像类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17210094/