You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
4 weeks ago
|
/**
|
||
|
* 创建插件
|
||
|
* https://www.tiny.cloud/docs/advanced/creating-a-plugin/
|
||
|
*/
|
||
|
tinymce.PluginManager.add('batchUploadImage', function (editor, url) {
|
||
|
var pluginName = '批量上传图片';
|
||
|
|
||
|
window.BatchUploadImage = {
|
||
|
editor: editor,
|
||
|
activeEditor: function() {
|
||
|
return tinymce.activeEditor
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function openDialog() {
|
||
|
// https://www.tiny.cloud/docs/ui-components/urldialog/
|
||
|
editor.execCommand('ToggleToolbarDrawer');
|
||
|
BatchUploadImage.dialog = editor.windowManager.openUrl({
|
||
|
title: pluginName,
|
||
|
url: url + '/index.html',
|
||
|
width: 775,
|
||
|
height: 508,
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 注册工具栏图标
|
||
|
* https://www.tiny.cloud/docs/advanced/editor-icon-identifiers/
|
||
|
*/
|
||
|
editor.ui.registry.addButton('batchUploadImage', {
|
||
|
icon: 'gallery',
|
||
|
tooltip: pluginName,
|
||
|
onAction: function () {
|
||
|
openDialog();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* 注册菜单
|
||
|
*/
|
||
|
editor.ui.registry.addMenuItem('batchUploadImage', {
|
||
|
icon: 'gallery',
|
||
|
text: pluginName,
|
||
|
onAction: function () {
|
||
|
openDialog();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* 插件信息会在【帮助】/【插件】中显示
|
||
|
*/
|
||
|
return {
|
||
|
getMetadata: function () {
|
||
|
return {
|
||
|
name: pluginName,
|
||
|
url: "https://gitee.com/leifuping/batch-upload-image",
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
});
|