tinymce.PluginManager.add('gallery', function (editor, url) { // 注册一个工具栏按钮名称 editor.ui.registry.addButton('gallery', { text: '素材库', onAction: function (e) { $Gallery.GalleryDialogOpen({ max: 10, size: 100, is_new: 1, suffix: 'bmp,gif,jpg,jpeg,png', type: '1', tabs: true, multiple: true, callback: function (res) { $.each(res, function (key, val) { if (parseInt(val.type) === 1) { var html = '
`; editor.insertContent(html); } }) } }); } }); return { getMetadata: function () { return { //插件名和链接会显示在“帮助”→“插件”→“已安装的插件”中 name: "gallery",//插件名称 url: "http://exampleplugindocsurl.com", //作者网址 }; } }; });