fix: univer plugin holder start immediately

This commit is contained in:
Wenzhao Hu
2024-04-22 08:31:31 +08:00
parent 5f5b0a76d9
commit 8c3bb904ee
2 changed files with 3 additions and 6 deletions
@@ -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();
+1 -2
View File
@@ -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);