From e626767bd04973783d271c9f26470c211f92a1ec Mon Sep 17 00:00:00 2001 From: Igor Zotov Date: Tue, 31 Jan 2023 20:29:04 +0300 Subject: [PATCH] [se] By bug 60909: switch on search engine + fix only sheet option (#3305) --- cell/api.js | 31 +++++++++++++------------------ cell/utils/utils.js | 11 ++++++++++- cell/view/WorkbookView.js | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cell/api.js b/cell/api.js index 45a4b92fd0..a98689c8b8 100644 --- a/cell/api.js +++ b/cell/api.js @@ -4005,27 +4005,22 @@ var editor; spreadsheet_api.prototype.asc_findText = function(options, callback) { var result = null; - if (window["NATIVE_EDITOR_ENJINE"]) { - if (this.wb.findCellText(options)) { - var ws = this.wb.getWorksheet(); - var activeCell = this.wbModel.getActiveWs().selectionRange.activeCell; - result = [ws.getCellLeftRelative(activeCell.col, 0), ws.getCellTopRelative(activeCell.row, 0)]; - } - } else { - //***searchEngine - var SearchEngine = this.wb.Search(options); - var Id = this.wb.GetSearchElementId(!options || options.scanForward); - if (null != Id) { - this.wb.SelectSearchElement(Id); - } + //***searchEngine + var SearchEngine = this.wb.Search(options); + var Id = this.wb.GetSearchElementId(!options || options.scanForward); + if (null != Id) { + this.wb.SelectSearchElement(Id); + } + + if (window["NATIVE_EDITOR_ENJINE"]) { + var ws = this.wb.getWorksheet(); + var activeCell = this.wbModel.getActiveWs().selectionRange.activeCell; + result = [ws.getCellLeftRelative(activeCell.col, 0), ws.getCellTopRelative(activeCell.row, 0)]; + } else { result = SearchEngine.Count; - - /* var d = this.wb.findCellText(options); - this.controller.scroll(d); - result = !!d;*/ - } + } if (callback) callback(result); diff --git a/cell/utils/utils.js b/cell/utils/utils.js index 9c16e84fa5..0b591558c1 100644 --- a/cell/utils/utils.js +++ b/cell/utils/utils.js @@ -3131,7 +3131,16 @@ asc_CFindOptions.prototype.asc_setIsWholeCell = function (val) {this.isWholeCell = val;}; asc_CFindOptions.prototype.asc_setIsWholeWord = function (val) {this.isWholeWord = val;}; asc_CFindOptions.prototype.asc_changeSingleWord = function (val) { this.isChangeSingleWord = val; }; - asc_CFindOptions.prototype.asc_setScanOnOnlySheet = function (val) {this.scanOnOnlySheet = val;}; + asc_CFindOptions.prototype.asc_setScanOnOnlySheet = function (val) { + //TODO не стал менять native.js, поставил условие для scanOnOnlySheet + if (val === true) { + this.scanOnOnlySheet = Asc.c_oAscSearchBy.Sheet; + } else if (val === false) { + this.scanOnOnlySheet = Asc.c_oAscSearchBy.Workbook; + } else { + this.scanOnOnlySheet = val; + } + }; asc_CFindOptions.prototype.asc_setLookIn = function (val) {this.lookIn = val;}; asc_CFindOptions.prototype.asc_setReplaceWith = function (val) {this.replaceWith = val;}; asc_CFindOptions.prototype.asc_setIsReplaceAll = function (val) {this.isReplaceAll = val;}; diff --git a/cell/view/WorkbookView.js b/cell/view/WorkbookView.js index 6633acec83..6962abcac0 100644 --- a/cell/view/WorkbookView.js +++ b/cell/view/WorkbookView.js @@ -5334,7 +5334,7 @@ var elem = this.Elements[nId]; if (elem) { var ws = this.wb.getWorksheet(); - if (elem.index !== ws.index) { + if (elem.index !== ws.model.index) { this.wb.model.handlers.trigger('undoRedoHideSheet', elem.index); ws = this.wb.getWorksheet(elem.index); }