Anyon e634118a22 refactor(plugin): 迁移 v8 插件化组件体系
将 v6 中直接放在本地 app 的后台与微信能力迁移为 v8 插件组件,并把运行时基础能力沉淀到独立插件包。

主要内容:

- 新增 think-library、system、worker、static、install 等基础插件包。

- 新增 account、payment、wechat-client、wechat-service、wemall、wuma 等业务插件包。

- 移除 v6 的 app/admin 与 app/wechat 本地应用实现,改由插件分发接管。

- 将 Helper 能力彻底并入 System,统一为 plugin\system\helper\* 命名空间。

- 同步插件迁移发布清单与根 route 占位,保证安装发布流程可复现。
2026-05-08 15:30:46 +08:00

67 lines
2.7 KiB
PHP

(function () {
let editor = window.wangEditor;
window.createEditor = function (ele, option) {
if ($(ele).data('editorLayout')) return;
const $layout = $('<div style="border:1px solid #ccc;z-index:1001;"><div style="border-bottom:1px solid #ccc;"></div><div style="height:400px;"></div></div>');
$(ele).hide().data('editorLayout', $layout).after($layout).parent();
// 创建编辑器
const _editor = editor.createEditor({
html: '<p><br></p>',
selector: $layout.find("div:last").get(0),
config: {
height: (option || {}).height || 500,
MENU_CONF: {
uploadImage: {
async customUpload(file, insertFn) {
if (window.SystemUploadAdapter) {
new window.SystemUploadAdapter().upload([file], url => insertFn(url, file.name))
} else {
let reader = new window.FileReader();
reader.addEventListener('load', () => insertFn(reader.result, file.name));
reader.readAsDataURL(file);
}
}
},
uploadVideo: {
async customUpload(file, insertFn) {
if (window.SystemUploadAdapter) {
new window.SystemUploadAdapter().upload([file], url => insertFn(url, file.name))
} else {
let reader = new window.FileReader();
reader.addEventListener('load', () => insertFn(reader.result, file.name));
reader.readAsDataURL(file);
}
}
}
},
placeholder: 'Type here...',
onCreated(editor) {
editor.setHtml($(ele).val());
},
onChange(editor) {
$(ele).val(editor.getHtml())
}
},
mode: 'default', // or 'simple'
})
// 设置工具栏
editor.createToolbar({
editor: _editor,
selector: $layout.find('div:first').get(0),
config: {
excludeKeys: ['fullScreen']
},
mode: 'default',
})
// 兼容其他版本
_editor.getData = function () {
return _editor.getHtml()
}
_editor.setData = function (html) {
return _editor.setHtml(html)
}
return _editor;
}
})();