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.

feat(sheet-numfmt-plugin):numfmt plugin optimization

eiji-thbc591c945eca
diff --git a/packages/sheets-plugin-numfmt/src/Const/index.ts b/packages/sheets-plugin-numfmt/src/Const/index.ts
new file mode 100644
index 0000000000..a1f79b393d
--- /dev/null
+++ b/packages/sheets-plugin-numfmt/src/Const/index.ts
@@ -0,0 +1,2 @@
+export * from './ACTION_NAMES';
+export * from './PLUGIN_NAME';
diff --git a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
index 6e6ea1afdc..47bc21f10a 100644
--- a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
+++ b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts
@@ -1,5 +1,5 @@
import { Command, ObjectMatrixPrimitiveType, Plugin } from '@univer/core';
-import { ACTION_NAMES } from 'src/Const/ACTION_NAMES';
+import { ACTION_NAMES } from '../Const';
import { NumfmtModel, NumfmtValue } from '../Model/NumfmtModel';
export class NumfmtController {
@@ -25,8 +25,8 @@ export class NumfmtController {
}
setNumfmt(sheetId: string, row: number, column: number, numfmt: string): void {
- const context = this._plugin.getContext();
- const commandManager = context.getCommandManager();
+ const pluginContext = this._plugin.getContext();
+ const commandManager = pluginContext.getCommandManager();
const config = {
actionName: ACTION_NAMES.SET_NUMFMT_ACTION,
sheetId,
@@ -34,7 +34,7 @@ export class NumfmtController {
column,
numfmt,
};
- const command = new Command(context.getWorkBook(), config);
+ const command = new Command(pluginContext.getWorkBook(), config);
commandManager.invoke(command);
}
}