/** * axupimgs (Enhancement 1.7v) 2021-07-42 * * * https://github.com/Five-great/tinymce-plugins * * Copyright 2021, Five(Li Hailong) The Chengdu, China https://www.fivecc.cn/ * * Licensed under MIT */ tinymce.PluginManager.add('axupimgs', function(editor, url) { var pluginName='Ax多图片上传'; window.axupimgs={}; //扔外部公共变量,也可以扔一个自定义的位置 var baseURL=tinymce.baseURL; var iframe1 = baseURL+'/plugins/axupimgs/upfiles.html'; axupimgs.images_upload_handler = editor.getParam('images_upload_handler', undefined, 'function'); axupimgs.images_upload_base_path = editor.getParam('images_upload_base_path', '', 'string'); axupimgs.axupimgs_filetype = editor.getParam('axupimgs_filetype', '.png,.gif,.jpg,.jpeg', 'string'); axupimgs.tinymce = tinymce; axupimgs.res=[]; var openDialog = function() { return editor.windowManager.openUrl({ title: pluginName, size: 'large', url:iframe1, buttons: [ { type: 'cancel', text: 'Close' }, { type: 'custom', text: 'Save', name: 'save', primary: true }, ], onAction: function (api, details) { switch (details.name) { case 'save': var html = ''; var imgs = axupimgs.res; var len = imgs.length; for(let i=0;i'; } } editor.insertContent(html); axupimgs.res=[]; api.close(); break; default: break; } } }); }; editor.ui.registry.getAll().icons.axupimgs || editor.ui.registry.addIcon('axupimgs',''); editor.ui.registry.addButton('axupimgs', { icon: 'axupimgs', tooltip: pluginName, onAction: function() { openDialog(); } }); editor.ui.registry.addMenuItem('axupimgs', { icon: 'axupimgs', text: '图片批量上传...', onAction: function() { openDialog(); } }); return { getMetadata: function() { return { name: pluginName, url: "https://github.com/Five-great/tinymce-plugins", }; } }; });