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
fix(base-sheets): edit merged cell to save
Dushusirdbd2ad334c5a
diff --git a/packages/base-sheets/src/Controller/CellEditorController.ts b/packages/base-sheets/src/Controller/CellEditorController.tsindex 7268eb8346..febb9a9ea6 100644--- a/packages/base-sheets/src/Controller/CellEditorController.ts+++ b/packages/base-sheets/src/Controller/CellEditorController.ts@@ -121,7 +121,7 @@ export class CellEditorController {onKeyDownObservable.add((evt: KeyboardEvent) => {if (!evt.ctrlKey && isKeyPrintable(evt.key)) {// character key- this.handleEnter(true);+ this.enterEditMode(true);} else {// control keyswitch (evt.key) {@@ -129,8 +129,11 @@ export class CellEditorController {if (this.isEditMode) {this.exitEditMode();- // move to cell below- this._plugin.getSelectionManager().move(Direction.BOTTOM);+ const currentCell = this._plugin.getSelectionManager().getCurrentCellModel();+ if (!currentCell?.isMerged) {+ // move to cell below+ this._plugin.getSelectionManager().move(Direction.BOTTOM);+ }} else {this.enterEditMode();}@@ -427,14 +430,26 @@ export class CellEditorController {}setCurrentEditRangeData() {- const model = this._plugin.getSelectionManager().getCurrentCellModel();- if (!model) return;+ const currentCell = this._plugin.getSelectionManager().getCurrentCellModel();+ if (!currentCell) return;++ let row;+ let column;++ if (currentCell.isMerged) {+ const mergeInfo = currentCell.mergeInfo;+ row = mergeInfo.startRow;+ column = mergeInfo.startColumn;+ } else {+ row = currentCell.row;+ column = currentCell.column;+ }this.currentEditRangeData = {- startRow: model.row,- startColumn: model.column,- endRow: model.row,- endColumn: model.column,+ startRow: row,+ startColumn: column,+ endRow: row,+ endColumn: column,};}@@ -484,10 +499,6 @@ export class CellEditorController {// this._plugin.getMainComponent().makeDirty(true);}- handleEnter(clear: boolean = false) {- this.enterEditMode(clear);- }-handleBackSpace() {}handleDirection(direction: Direction) {