fix: 修复 demo 问题

This commit is contained in:
liujuping 2022-12-13 11:31:34 +08:00
parent 5312614d30
commit 5d5af1db2c
3 changed files with 11 additions and 3 deletions

View File

@ -27,7 +27,7 @@ const logger = getLogger({ level: 'warn', bizName: 'designer:pluginManager' });
export class LowCodePluginManager implements ILowCodePluginManager {
private plugins: ILowCodePlugin[] = [];
private pluginsMap: Map<string, ILowCodePlugin> = new Map();
pluginsMap: Map<string, ILowCodePlugin> = new Map();
private pluginPreference?: PluginPreference = new Map();

View File

@ -83,7 +83,7 @@ const config = engineConfig;
const event = new Event(editor, { prefix: 'common' });
const logger = getLogger({ level: 'warn', bizName: 'common' });
const common = new Common(editor, innerSkeleton);
let plugins: any;
let plugins: Plugins;
const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
assembleApis: (context: ILowCodePluginContextPrivate) => {

View File

@ -10,7 +10,7 @@ import { pluginsSymbol } from './symbols';
const innerPluginsSymbol = Symbol('plugin');
export default class Plugins implements IPublicApiPlugins {
private readonly [innerPluginsSymbol]: LowCodePluginManager;
get [pluginsSymbol]() {
get [pluginsSymbol](): LowCodePluginManager {
if (this.workspaceMode) {
return this[innerPluginsSymbol];
}
@ -34,6 +34,14 @@ export default class Plugins implements IPublicApiPlugins {
await this[pluginsSymbol].register(pluginConfigCreator, options, registerOptions);
}
async init(registerOptions: any) {
await this[pluginsSymbol].init(registerOptions);
}
async getPluginPreference(pluginName: string) {
await this[pluginsSymbol].getPluginPreference(pluginName);
}
toProxy() {
return new Proxy(this, {
get(target, prop, receiver) {