From 8c3bb904ee44a76e2ee46dd014766c56c4e979e4 Mon Sep 17 00:00:00 2001 From: Wenzhao Hu Date: Mon, 22 Apr 2024 08:27:19 +0800 Subject: [PATCH] fix: univer plugin holder start immediately --- packages/core/src/services/plugin/plugin.service.ts | 6 ++---- packages/core/src/univer.ts | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/core/src/services/plugin/plugin.service.ts b/packages/core/src/services/plugin/plugin.service.ts index 3ef5fd4c1f..e5ead8d626 100644 --- a/packages/core/src/services/plugin/plugin.service.ts +++ b/packages/core/src/services/plugin/plugin.service.ts @@ -34,6 +34,7 @@ export class PluginService implements IDisposable { @Inject(Injector) private readonly _injector: Injector ) { this._pluginHolderForUniver = this._injector.createInstance(PluginHolder, true); + this._pluginHolderForUniver.start(); } dispose(): void { @@ -55,6 +56,7 @@ export class PluginService implements IDisposable { const { type } = plugin; if (type === UniverInstanceType.UNIVER) { this._pluginHolderForUniver.registerPlugin(plugin, config); + this._pluginHolderForUniver.flush(); } else { // If it's type is for specific document, we should run them at specific time. const holder = this._ensurePluginHolderForType(type); @@ -62,10 +64,6 @@ export class PluginService implements IDisposable { } } - start(): void { - this._pluginHolderForUniver.start(); - } - startPluginForType(type: UniverType): void { const holder = this._ensurePluginHolderForType(type); holder.start(); diff --git a/packages/core/src/univer.ts b/packages/core/src/univer.ts index 4b1bcc8136..2c6cc9ff15 100644 --- a/packages/core/src/univer.ts +++ b/packages/core/src/univer.ts @@ -70,6 +70,7 @@ export class Univer { logLevel && this._injector.get(ILogService).setLogLevel(logLevel); this._init(injector); + const _a = this._pluginService; } __getInjector(): Injector { @@ -119,8 +120,6 @@ export class Univer { const univerInstanceService = injector.get(IUniverInstanceService) as UniverInstanceService; univerInstanceService.__setCreateHandler( (type: UnitType, data, ctor) => { - this._pluginService.start(); - if (!this._startedTypes.has(type)) { this._pluginService.startPluginForType(type); this._startedTypes.add(type);