diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js index 4bb2bd81c..11dc0ebdb 100644 --- a/apps/common/main/lib/view/SearchPanel.js +++ b/apps/common/main/lib/view/SearchPanel.js @@ -285,8 +285,7 @@ define([ }); } Common.NotificationCenter.on('window:resize', function() { - me.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); - me.$resultsContainer.scroller.update({alwaysVisibleY: true}); + me.updateResultsContainerHeight(); }); } @@ -299,8 +298,7 @@ define([ Common.UI.BaseView.prototype.show.call(this,arguments); this.fireEvent('show', this ); - this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); - this.$resultsContainer.scroller.update({alwaysVisibleY: true}); + this.updateResultsContainerHeight(); }, hide: function () { @@ -328,6 +326,13 @@ define([ 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) { var text; if (count > 300) { @@ -335,10 +340,19 @@ define([ } else { text = current === 'no-results' ? this.textNoSearchResults : (current === 'stop' ? this.textSearchHasStopped : - (current === 'content-changed' ? this.textContentChanged : + (current === 'content-changed' ? (this.textContentChanged + ' ' + Common.Utils.String.format(this.textSearchAgain, '','')) : (!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); }, @@ -368,8 +382,7 @@ define([ this.$searchOptionsBlock[this.extendedOptions ? 'removeClass' : 'addClass']('no-expand'); Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions); - this.$resultsContainer.outerHeight($('#search-box').outerHeight() - $('#search-header').outerHeight() - $('#search-adv-settings').outerHeight()); - this.$resultsContainer.scroller.update({alwaysVisibleY: true}); + this.updateResultsContainerHeight(); }, setFindText: function (val) { @@ -424,7 +437,8 @@ define([ textValue: 'Value', textFormula: 'Formula', 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 || {})); }); \ No newline at end of file diff --git a/apps/common/main/resources/less/searchdialog.less b/apps/common/main/resources/less/searchdialog.less index f134428be..e96e720ef 100644 --- a/apps/common/main/resources/less/searchdialog.less +++ b/apps/common/main/resources/less/searchdialog.less @@ -159,6 +159,12 @@ width: calc(100% - 48px); color: @text-secondary-ie; color: @text-secondary; + + .search-again { + color: @text-secondary; + cursor: pointer; + text-decoration: underline; + } } .search-nav-btns { diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index e08453090..11f8a3328 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -423,6 +423,8 @@ "Common.Views.SearchPanel.textWorkbook": "Workbook", "Common.Views.SearchPanel.tipNextResult": "Next 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.textTitle": "Select Data Source", "Common.Views.SignDialog.textBold": "Bold",