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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(sheet-numfmt-plugin):numfmt plugin optimization
eiji-th2968a0525025
diff --git a/packages/sheets-plugin-numfmt/src/Const/ACTION_NAMES.ts b/packages/sheets-plugin-numfmt/src/Const/ACTION_NAMES.tsnew file mode 100644index 0000000000..de12ce920b--- /dev/null+++ b/packages/sheets-plugin-numfmt/src/Const/ACTION_NAMES.ts@@ -0,0 +1,3 @@+export enum ACTION_NAMES {+ SET_NUMFMT_ACTION = 'SetNumfmtAction',+}diff --git a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.tsindex 3bdb380731..6e6ea1afdc 100644--- a/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts+++ b/packages/sheets-plugin-numfmt/src/Controller/NumfmtController.ts@@ -1,4 +1,5 @@-import { ObjectMatrixPrimitiveType, Plugin } from '@univer/core';+import { Command, ObjectMatrixPrimitiveType, Plugin } from '@univer/core';+import { ACTION_NAMES } from 'src/Const/ACTION_NAMES';import { NumfmtModel, NumfmtValue } from '../Model/NumfmtModel';export class NumfmtController {@@ -24,6 +25,16 @@ export class NumfmtController {}setNumfmt(sheetId: string, row: number, column: number, numfmt: string): void {- this._model.setNumfmtValue(sheetId, row, column, numfmt);+ const context = this._plugin.getContext();+ const commandManager = context.getCommandManager();+ const config = {+ actionName: ACTION_NAMES.SET_NUMFMT_ACTION,+ sheetId,+ row,+ column,+ numfmt,+ };+ const command = new Command(context.getWorkBook(), config);+ commandManager.invoke(command);}}