[SSE] Fix replacing empty cells

This commit is contained in:
JuliaSvinareva 2022-06-27 15:56:14 +03:00
parent 9e9470315e
commit 31ba6dde66
2 changed files with 21 additions and 23 deletions

View file

@ -331,7 +331,7 @@ define([
(!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count))); (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count)));
} }
this.$reaultsNumber.text(text); this.$reaultsNumber.text(text);
this.disableReplaceButtons(!count); !window.SSE && this.disableReplaceButtons(!count);
}, },
onClickClosePanel: function() { onClickClosePanel: function() {

View file

@ -225,10 +225,10 @@ define([
if (me.view.$el.is(':visible')) { if (me.view.$el.is(':visible')) {
me.api.asc_StartTextAroundSearch(); me.api.asc_StartTextAroundSearch();
} }
me.view.disableReplaceButtons(false); //me.view.disableReplaceButtons(false);
} else if (me._state.newSearchText === '') { } else if (me._state.newSearchText === '') {
me.view.updateResultsNumber('no-results'); me.view.updateResultsNumber('no-results');
me.view.disableReplaceButtons(true); //me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);
me.searchTimer = undefined; me.searchTimer = undefined;
@ -265,7 +265,7 @@ define([
if (!this.api.asc_findText(options)) { if (!this.api.asc_findText(options)) {
this.resultItems = []; this.resultItems = [];
this.view.updateResultsNumber(undefined, 0); this.view.updateResultsNumber(undefined, 0);
this.view.disableReplaceButtons(true); //this.view.disableReplaceButtons(true);
this._state.currentResult = 0; this._state.currentResult = 0;
this._state.resultsNumber = 0; this._state.resultsNumber = 0;
this.view.disableNavButtons(); this.view.disableNavButtons();
@ -275,23 +275,21 @@ define([
}, },
onQueryReplace: function(textSearch, textReplace) { onQueryReplace: function(textSearch, textReplace) {
if (textSearch !== '') { this.api.isReplaceAll = false;
this.api.isReplaceAll = false; var options = new Asc.asc_CFindOptions();
var options = new Asc.asc_CFindOptions(); options.asc_setFindWhat(textSearch);
options.asc_setFindWhat(textSearch); options.asc_setReplaceWith(textReplace);
options.asc_setReplaceWith(textReplace); options.asc_setIsMatchCase(this._state.matchCase);
options.asc_setIsMatchCase(this._state.matchCase); options.asc_setIsWholeCell(this._state.matchWord);
options.asc_setIsWholeCell(this._state.matchWord); options.asc_setScanOnOnlySheet(this._state.withinSheet);
options.asc_setScanOnOnlySheet(this._state.withinSheet); if (this._state.withinSheet === Asc.c_oAscSearchBy.Range) {
if (this._state.withinSheet === Asc.c_oAscSearchBy.Range) { options.asc_setSpecificRange(this._state.selectedRange);
options.asc_setSpecificRange(this._state.selectedRange);
}
options.asc_setScanByRows(this._state.searchByRows);
options.asc_setLookIn(this._state.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(false);
this.api.asc_replaceText(options);
} }
options.asc_setScanByRows(this._state.searchByRows);
options.asc_setLookIn(this._state.lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
options.asc_setIsReplaceAll(false);
this.api.asc_replaceText(options);
}, },
onQueryReplaceAll: function(textSearch, textReplace) { onQueryReplaceAll: function(textSearch, textReplace) {
@ -348,7 +346,7 @@ define([
this.resultItems = []; this.resultItems = [];
this.hideResults(); this.hideResults();
this.view.updateResultsNumber(undefined, 0); this.view.updateResultsNumber(undefined, 0);
this.view.disableReplaceButtons(true); //this.view.disableReplaceButtons(true);
this._state.currentResult = 0; this._state.currentResult = 0;
this._state.resultsNumber = 0; this._state.resultsNumber = 0;
this.view.disableNavButtons(); this.view.disableNavButtons();
@ -495,13 +493,13 @@ define([
this.hideResults(); this.hideResults();
if (text && text !== '' && text === this._state.searchText) { // search was made if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false); //this.view.disableReplaceButtons(false);
this.api.asc_StartTextAroundSearch(); this.api.asc_StartTextAroundSearch();
} else if (text && text !== '') { // search wasn't made } else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text); this.onInputSearchChange(text);
} else { } else {
this.resultItems = []; this.resultItems = [];
this.view.disableReplaceButtons(true); //this.view.disableReplaceButtons(true);
this.view.clearResultsNumber(); this.view.clearResultsNumber();
} }
this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber); this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber);