Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: univer plugin holder start immediately

Wenzhao Hu8c3bb904ee44
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);