[SSE] Search: fix message when document is changed

This commit is contained in:
JuliaSvinareva 2022-08-23 17:33:00 +03:00
parent b7ee795365
commit 7cb996c360
3 changed files with 31 additions and 9 deletions
apps
common/main
lib/view
resources/less
spreadsheeteditor/main/locale

View file

@ -285,8 +285,7 @@ define([
}); });
} }
Common.NotificationCenter.on('window:resize', function() { Common.NotificationCenter.on('window:resize', function() {
me.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); me.updateResultsContainerHeight();
me.$resultsContainer.scroller.update({alwaysVisibleY: true});
}); });
} }
@ -299,8 +298,7 @@ define([
Common.UI.BaseView.prototype.show.call(this,arguments); Common.UI.BaseView.prototype.show.call(this,arguments);
this.fireEvent('show', this ); this.fireEvent('show', this );
this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); this.updateResultsContainerHeight();
this.$resultsContainer.scroller.update({alwaysVisibleY: true});
}, },
hide: function () { hide: function () {
@ -328,6 +326,13 @@ define([
ChangeSettings: function(props) { ChangeSettings: function(props) {
}, },
updateResultsContainerHeight: function () {
if (this.$resultsContainer) {
this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight());
this.$resultsContainer.scroller.update({alwaysVisibleY: true});
}
},
updateResultsNumber: function (current, count) { updateResultsNumber: function (current, count) {
var text; var text;
if (count > 300) { if (count > 300) {
@ -335,10 +340,19 @@ define([
} else { } else {
text = current === 'no-results' ? this.textNoSearchResults : text = current === 'no-results' ? this.textNoSearchResults :
(current === 'stop' ? this.textSearchHasStopped : (current === 'stop' ? this.textSearchHasStopped :
(current === 'content-changed' ? this.textContentChanged : (current === 'content-changed' ? (this.textContentChanged + ' ' + Common.Utils.String.format(this.textSearchAgain, '<a class="search-again">','</a>')) :
(!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); if (current === 'content-changed') {
var me = this;
this.$reaultsNumber.html(text);
this.$reaultsNumber.find('.search-again').on('click', function () {
me.fireEvent('search:next', [me.inputText.getValue(), true]);
});
} else {
this.$reaultsNumber.text(text);
}
this.updateResultsContainerHeight();
!window.SSE && this.disableReplaceButtons(!count); !window.SSE && this.disableReplaceButtons(!count);
}, },
@ -368,8 +382,7 @@ define([
this.$searchOptionsBlock[this.extendedOptions ? 'removeClass' : 'addClass']('no-expand'); this.$searchOptionsBlock[this.extendedOptions ? 'removeClass' : 'addClass']('no-expand');
Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions); Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions);
this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); this.updateResultsContainerHeight();
this.$resultsContainer.scroller.update({alwaysVisibleY: true});
}, },
setFindText: function (val) { setFindText: function (val) {
@ -424,7 +437,8 @@ define([
textValue: 'Value', textValue: 'Value',
textFormula: 'Formula', textFormula: 'Formula',
textSearchHasStopped: 'Search has stopped', textSearchHasStopped: 'Search has stopped',
textContentChanged: 'Document content has changed.' textContentChanged: 'Document content has changed.',
textSearchAgain: '{0}Search again{1} to make sure the results are current.'
}, Common.Views.SearchPanel || {})); }, Common.Views.SearchPanel || {}));
}); });

View file

@ -159,6 +159,12 @@
width: calc(100% - 48px); width: calc(100% - 48px);
color: @text-secondary-ie; color: @text-secondary-ie;
color: @text-secondary; color: @text-secondary;
.search-again {
color: @text-secondary;
cursor: pointer;
text-decoration: underline;
}
} }
.search-nav-btns { .search-nav-btns {

View file

@ -423,6 +423,8 @@
"Common.Views.SearchPanel.textWorkbook": "Workbook", "Common.Views.SearchPanel.textWorkbook": "Workbook",
"Common.Views.SearchPanel.tipNextResult": "Next result", "Common.Views.SearchPanel.tipNextResult": "Next result",
"Common.Views.SearchPanel.tipPreviousResult": "Previous result", "Common.Views.SearchPanel.tipPreviousResult": "Previous result",
"Common.Views.SearchPanel.textContentChanged": "Document content has changed.",
"Common.Views.SearchPanel.textSearchAgain": "{0}Search again{1} to make sure the results are current.",
"Common.Views.SelectFileDlg.textLoading": "Loading", "Common.Views.SelectFileDlg.textLoading": "Loading",
"Common.Views.SelectFileDlg.textTitle": "Select Data Source", "Common.Views.SelectFileDlg.textTitle": "Select Data Source",
"Common.Views.SignDialog.textBold": "Bold", "Common.Views.SignDialog.textBold": "Bold",