From d826505f9b4dacd9e8c031251bb24d5be3323693 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 29 Aug 2022 18:44:00 +0300 Subject: [PATCH 1/2] [embed] Fix bug 58743 --- apps/spreadsheeteditor/embed/js/SearchBar.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/embed/js/SearchBar.js b/apps/spreadsheeteditor/embed/js/SearchBar.js index 447bfb0d5..441239be3 100644 --- a/apps/spreadsheeteditor/embed/js/SearchBar.js +++ b/apps/spreadsheeteditor/embed/js/SearchBar.js @@ -58,6 +58,7 @@ api = appApi; if (api) { api.asc_registerCallback('asc_onSetSearchCurrent', onApiUpdateSearchCurrent); + api.asc_registerCallback('asc_onActiveSheetChanged', onActiveSheetChanged); } }; @@ -125,7 +126,7 @@ } }; - var onQuerySearch = function (d, w) { + var onQuerySearch = function (d, isNeedRecalc) { var options = new Asc.asc_CFindOptions(); options.asc_setFindWhat(_state.searchText); options.asc_setScanForward(d != 'back'); @@ -134,6 +135,8 @@ options.asc_setScanOnOnlySheet(Asc.c_oAscSearchBy.Sheet); options.asc_setScanByRows(true); options.asc_setLookIn(Asc.c_oAscFindLookIn.Formulas); + options.asc_setNeedRecalc(isNeedRecalc); + options.asc_setNotSearchEmptyCells(true); if (!api.asc_findText(options)) { common.view.SearchBar.disableNavButtons(); return false; @@ -162,6 +165,10 @@ } }; + var onActiveSheetChanged = function () { + onQuerySearch(undefined, true); + }; + return { init: function(config) { appConfig = config; }, setApi: setApi, From b4977d2a97ae9c7b8a7d86b7a63dbfd91ba457c1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 29 Aug 2022 20:02:27 +0300 Subject: [PATCH 2/2] [embed] Fix bug 58605 --- apps/spreadsheeteditor/embed/js/SearchBar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/embed/js/SearchBar.js b/apps/spreadsheeteditor/embed/js/SearchBar.js index 441239be3..02d62f3ce 100644 --- a/apps/spreadsheeteditor/embed/js/SearchBar.js +++ b/apps/spreadsheeteditor/embed/js/SearchBar.js @@ -118,7 +118,7 @@ if ((new Date()) - _lastInputChange < 400) return; _state.searchText = _state.newSearchText; - (_state.newSearchText !== '') && onQuerySearch(); + onQuerySearch(); clearInterval(_searchTimer); _searchTimer = undefined; }, 10); @@ -145,7 +145,7 @@ }; var onSearchNext = function (type, text, e) { - if (text && text.length > 0 && (type === 'keydown' && e.keyCode === 13 || type !== 'keydown')) { + if (type === 'keydown' && e.keyCode === 13 || type !== 'keydown') { _state.searchText = text; if (onQuerySearch(type) && _searchTimer) { clearInterval(_searchTimer);