From 679a6d70ccb5487924f034cea089ff30daeeb7fd Mon Sep 17 00:00:00 2001 From: Igor Zotov Date: Sat, 21 Feb 2026 14:21:14 +0300 Subject: [PATCH] [se] Fix bug 76532 --- cell/view/CellEditorView.js | 4 ++-- cell/view/WorkbookView.js | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cell/view/CellEditorView.js b/cell/view/CellEditorView.js index 87cc5bb956..02368514de 100644 --- a/cell/view/CellEditorView.js +++ b/cell/view/CellEditorView.js @@ -426,7 +426,7 @@ function (window, undefined) { // Reset editor state t._setEditorState(c_oAscCellEditorState.editEnd); - t.handlers.trigger("closed"); + t.handlers.trigger("closed", saveValue); t.closeAction(); if (callback) { @@ -483,7 +483,7 @@ function (window, undefined) { // Reset editor state this._setEditorState(c_oAscCellEditorState.editEnd); - this.handlers.trigger("closed"); + this.handlers.trigger("closed", saveValue); t.closeAction(); if (callback) { diff --git a/cell/view/WorkbookView.js b/cell/view/WorkbookView.js index 866361f603..2fbb3544e1 100644 --- a/cell/view/WorkbookView.js +++ b/cell/view/WorkbookView.js @@ -2302,8 +2302,9 @@ return this.closeCellEditor(); }; - WorkbookView.prototype._onCloseCellEditor = function() { + WorkbookView.prototype._onCloseCellEditor = function(saveValue) { var isCellEditMode = this.getCellEditMode(); + var isFormulaEditMode = this.isFormulaEditMode; this.setCellEditMode(false); if (isCellEditMode) { @@ -2332,7 +2333,9 @@ this.updateTargetForCollaboration(); this.sendCursor(); - this.externalSelectionController.sendExternalCloseEditor(); + if (isFormulaEditMode) { + this.externalSelectionController.sendExternalCloseEditor(saveValue); + } }; WorkbookView.prototype._onEmpty = function() { @@ -7613,7 +7616,7 @@ }); window.addEventListener && window.addEventListener('unload', function() { - if (isClosing) { + if (isClosing && oThis.wb.isFormulaEditMode) { oThis.sendExternalCloseEditor(); } }); @@ -7672,6 +7675,10 @@ return; } + if (!this.wb.isFormulaEditMode && !this.getExternalFormulaEditMode()) { + return; + } + this.lockSendChangeSelection = true; if ((!this.getExternalFormulaEditMode() && !this._isEqualEditorState(data)) || !this.supportVisibilityChangeOption) { this.wb.setFormulaEditMode(true); @@ -7697,10 +7704,16 @@ return; } const isExternalFormulaEditMode = this.getExternalFormulaEditMode(); + + if (!data.isClose && this.wb.isCellEditMode) { + return; + } + this.setExternalFormulaEditMode(!data.isClose ? {id: data.id} : null); - if (this.wb.getCellEditMode() && data.isClose && (isExternalFormulaEditMode || !this.supportVisibilityChangeOption)) { - this.wb.closeCellEditor(!data.saveValue); + if (this.wb.getCellEditMode() && data.isClose && (isExternalFormulaEditMode || this.wb.isFormulaEditMode)) { + var cancelClose = isExternalFormulaEditMode ? true : !data.saveValue; + this.wb.closeCellEditor(cancelClose); this.clean(); } else if (!this.supportVisibilityChangeOption && !this.wb.getCellEditMode() && !data.isClose) { this.onOpenCellEditor();