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(sheet): clear custom field of selection (#2178)

FMWedd2af1cd893
diff --git a/packages/core/src/types/interfaces/i-cell-data.ts b/packages/core/src/types/interfaces/i-cell-data.ts
index 34f987890c..df7f1b51ee 100644
--- a/packages/core/src/types/interfaces/i-cell-data.ts
+++ b/packages/core/src/types/interfaces/i-cell-data.ts
@@ -116,7 +116,7 @@ export function isNullCell(cell: Nullable<ICellData>) {
return true;
}
- const { v, f, si, p, s } = cell;
+ const { v, f, si, p, s, custom } = cell;
if (!(v == null || (typeof v === 'string' && v.length === 0))) {
return false;
@@ -130,6 +130,10 @@ export function isNullCell(cell: Nullable<ICellData>) {
return false;
}
+ if (custom != null) {
+ return false;
+ }
+
return true;
}
diff --git a/packages/sheets/src/commands/commands/clear-selection-all.command.ts b/packages/sheets/src/commands/commands/clear-selection-all.command.ts
index 4673a0a078..a5f2e3cbe8 100644
--- a/packages/sheets/src/commands/commands/clear-selection-all.command.ts
+++ b/packages/sheets/src/commands/commands/clear-selection-all.command.ts
@@ -112,5 +112,5 @@ function generateNullCellValue(range: IRange[]): IObjectMatrixPrimitiveType<Null
}
});
- return cellValue.getData();
+ return cellValue.clone();
}
diff --git a/packages/sheets/src/commands/commands/clear-selection-content.command.ts b/packages/sheets/src/commands/commands/clear-selection-content.command.ts
index 2243ef4768..944c8d03a9 100644
--- a/packages/sheets/src/commands/commands/clear-selection-content.command.ts
+++ b/packages/sheets/src/commands/commands/clear-selection-content.command.ts
@@ -100,10 +100,11 @@ function generateNullCellValue(range: IRange[]): IObjectMatrixPrimitiveType<ICel
p: null,
f: null,
si: null,
+ custom: null,
});
}
}
});
- return cellValue.getData();
+ return cellValue.clone();
}
diff --git a/packages/sheets/src/commands/commands/clear-selection-format.command.ts b/packages/sheets/src/commands/commands/clear-selection-format.command.ts
index 03c5fa8c97..799b6e524c 100644
--- a/packages/sheets/src/commands/commands/clear-selection-format.command.ts
+++ b/packages/sheets/src/commands/commands/clear-selection-format.command.ts
@@ -118,5 +118,5 @@ export function generateNullCellValue(ranges: IRange[]): IObjectMatrixPrimitiveT
}
});
- return cellValue.getData();
+ return cellValue.clone();
}