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(crosshair): fix no plugin name for the plugin

Wenzhao Hu19564c7630f7
diff --git a/packages/core/src/services/plugin/plugin.service.ts b/packages/core/src/services/plugin/plugin.service.ts
index 05a807b779..4f01f2a8eb 100644
--- a/packages/core/src/services/plugin/plugin.service.ts
+++ b/packages/core/src/services/plugin/plugin.service.ts
@@ -123,11 +123,11 @@ export class PluginService implements IDisposable {
const { type, pluginName } = ctor;
if (type === UniverInstanceType.UNRECOGNIZED) {
- throw new Error(`[PluginService]: invalid plugin type for ${ctor}. Please assign a "type" to your plugin.`);
+ throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
}
- if (pluginName === '') {
- throw new Error(`[PluginService]: no plugin name for ${ctor}. Please assign a "pluginName" to your plugin.`);
+ if (!pluginName) {
+ throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
}
if (this._seenPlugins.has(pluginName)) {
diff --git a/packages/sheets-crosshair-highlight/src/plugin.ts b/packages/sheets-crosshair-highlight/src/plugin.ts
index df790400a1..2c9cbb86bf 100644
--- a/packages/sheets-crosshair-highlight/src/plugin.ts
+++ b/packages/sheets-crosshair-highlight/src/plugin.ts
@@ -24,6 +24,9 @@ import type { IUniverSheetsCrosshairHighlightConfig } from './controllers/config
import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
export class UniverSheetsCrosshairHighlightPlugin extends Plugin {
+ static override pluginName: string = 'UNIVER_SHEETS_CROSSHAIR_HIGHLIGHT';
+ static override type = UniverInstanceType.UNIVER_SHEET;
+
constructor(
private readonly _config: Partial<IUniverSheetsCrosshairHighlightConfig> = defaultPluginConfig,
@Inject(Injector) protected readonly _injector: Injector,