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: fixed the issue where the cell number format was cleared after a non-number was entered into the cell (#5152)

wpxp123456899227c1f24a
diff --git a/packages/sheets-numfmt-ui/src/controllers/numfmt.editor.controller.ts b/packages/sheets-numfmt-ui/src/controllers/numfmt.editor.controller.ts
index 083e679beb..057f3482e6 100644
--- a/packages/sheets-numfmt-ui/src/controllers/numfmt.editor.controller.ts
+++ b/packages/sheets-numfmt-ui/src/controllers/numfmt.editor.controller.ts
@@ -151,17 +151,17 @@ export class NumfmtEditorController extends Disposable {
context.row,
context.col
);
- const currentNumfmtType = (currentNumfmtValue && getPatternType(currentNumfmtValue.pattern)) ?? '';
- const clean = () => {
- currentNumfmtValue &&
- this._collectEffectMutation.add(
- context.unitId,
- context.subUnitId,
- context.row,
- context.col,
- null
- );
- };
+ // const currentNumfmtType = (currentNumfmtValue && getPatternType(currentNumfmtValue.pattern)) ?? '';
+ // const clean = () => {
+ // currentNumfmtValue &&
+ // this._collectEffectMutation.add(
+ // context.unitId,
+ // context.subUnitId,
+ // context.row,
+ // context.col,
+ // null
+ // );
+ // };
if (!value?.v && !value?.p) {
return next(value);
}
@@ -202,9 +202,10 @@ export class NumfmtEditorController extends Disposable {
}
const v = Number(numfmtInfo.v);
return next({ ...value, p: undefined, v, t: CellValueType.NUMBER });
- } else if (['date', 'time', 'datetime', 'percent'].includes(currentNumfmtType) || !isNumeric(content)) {
- clean();
}
+ // else if (['date', 'time', 'datetime', 'percent'].includes(currentNumfmtType) || !isNumeric(content)) {
+ // clean();
+ // }
return next(value);
},
})