【问题标题】:No type for image in tinymce version 4tinymce 版本 4 中没有图像类型
【发布时间】:2013-06-20 09:28:39
【问题描述】:

我需要为 tinyMCE 4.0 开发一个小插件。 我必须根据输入的 url 显示图像的预览。 我无法确定图像预览的类型。

有没有类似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
                    }
                ],
            });
        }
    });
});

【问题讨论】:

    标签: javascript plugins tinymce


    【解决方案1】:

    我认为最好的办法是将类型指定为“Container”,然后使用“renderHtml”方法手动设置 HTML 输出,如以下文档所示:

    http://www.tinymce.com/wiki.php/api4:class.tinymce.ui.Container

    在该页面的右侧,您可以看到所有可用类型的列表。如果您决定编写自己的图像控件,这显然可以扩展。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-21
      • 1970-01-01
      • 1970-01-01
      • 2020-05-13
      • 2021-08-03
      • 1970-01-01
      相关资源
      最近更新 更多