diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js
index 85b47446db..b41a1caaab 100644
--- a/apps/common/main/lib/view/SearchPanel.js
+++ b/apps/common/main/lib/view/SearchPanel.js
@@ -283,6 +283,7 @@ define([
minScrollbarLength: 40,
alwaysVisibleY: true
});
+ this.$resultsTable = this.$resultsContainer.find('.search-table');
} else {
this.$resultsContainer.scroller = new Common.UI.Scroller({
el: this.$resultsContainer,
@@ -356,14 +357,20 @@ define([
updateResultsNumber: function (current, count) {
var text;
- if (count > 300) {
- text = this.textTooManyResults;
- } else {
- text = current === 'no-results' ? this.textNoSearchResults :
- (current === 'stop' ? this.textSearchHasStopped :
- (current === 'content-changed' ? (this.textContentChanged + ' ' + Common.Utils.String.format(this.textSearchAgain, '','')) :
- (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count))));
+ if (this.$resultsContainer) {
+ if (count > 300) {
+ this.showToManyResults();
+ } else if (current !== 'content-changed') {
+ this.$resultsContainer.find('.many-results').remove();
+ if (window.SSE) {
+ this.$resultsTable.show();
+ }
+ }
}
+ text = current === 'no-results' ? this.textNoSearchResults :
+ (current === 'stop' ? this.textSearchHasStopped :
+ (current === 'content-changed' ? (this.textContentChanged + ' ' + Common.Utils.String.format(this.textSearchAgain, '','')) :
+ (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count))));
if (current === 'content-changed') {
var me = this;
this.$reaultsNumber.html(text);
@@ -377,6 +384,20 @@ define([
!window.SSE && this.disableReplaceButtons(!count);
},
+ showToManyResults: function () {
+ if (!window.SSE) {
+ this.$resultsContainer.empty();
+ } else {
+ this.$resultsTable.hide();
+ this.$resultsTable.find('.search-items').empty();
+ this.$resultsContainer.find('.many-results').remove();
+ }
+ this.$resultsContainer.append('
' + this.textTooManyResults + '
');
+ if (!this.$resultsContainer.is(':visible')) {
+ this.$resultsContainer.show();
+ }
+ },
+
onClickClosePanel: function() {
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
this.fireEvent('hide', this );
diff --git a/apps/common/main/resources/less/searchdialog.less b/apps/common/main/resources/less/searchdialog.less
index 9ffcb7e545..e0f4cd875f 100644
--- a/apps/common/main/resources/less/searchdialog.less
+++ b/apps/common/main/resources/less/searchdialog.less
@@ -288,6 +288,13 @@
}
}
+ .many-results {
+ padding: 6px 30px 0;
+ text-align: center;
+ color: @text-secondary-ie;
+ color: @text-secondary;
+ }
+
.ps-scrollbar-y-rail {
&.set-left {
right: 11px !important;
diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js
index 545837edc6..f4be7bdad1 100644
--- a/apps/documenteditor/main/app/controller/Search.js
+++ b/apps/documenteditor/main/app/controller/Search.js
@@ -212,7 +212,7 @@ define([
this.view.disableNavButtons();
return false;
}
- if (update && this.view.$el.is(':visible')) {
+ if (update && this.view.$el.is(':visible') && this.view.$resultsContainer.find('.many-results').length === 0) {
this.api.asc_StartTextAroundSearch();
}
this.view.disableReplaceButtons(false);
@@ -277,8 +277,8 @@ define([
removeResultItems: function (type) {
this.resultItems = [];
- this.hideResults();
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
+ this.hideResults();
this.view.disableReplaceButtons(true);
this._state.currentResult = 0;
this._state.resultsNumber = 0;
@@ -332,13 +332,13 @@ define([
onEndTextAroundSearch: function () {
if (this.view) {
- this._state.isStartedAddingResults = false;
this.view.updateScrollers();
}
},
onApiGetTextAroundSearch: function (data) {
if (this.view && this._state.isStartedAddingResults) {
+ this._state.isStartedAddingResults = false;
if (data.length > 300 || !data.length) return;
var me = this,
selectedInd;
@@ -384,8 +384,10 @@ define([
hideResults: function () {
if (this.view) {
- this.view.$resultsContainer.hide();
- this.view.$resultsContainer.empty();
+ if (this.view.$resultsContainer.find('.many-results').length === 0) {
+ this.view.$resultsContainer.hide();
+ }
+ this.view.$resultsContainer.find('.item').remove();
}
},
@@ -413,7 +415,9 @@ define([
this.hideResults();
if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false);
- this.api.asc_StartTextAroundSearch();
+ if (this.view.$resultsContainer.find('.many-results').length === 0) {
+ this.api.asc_StartTextAroundSearch();
+ }
} else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text);
} else {
diff --git a/apps/presentationeditor/main/app/controller/Search.js b/apps/presentationeditor/main/app/controller/Search.js
index 5453d5e3ce..50356cb6d6 100644
--- a/apps/presentationeditor/main/app/controller/Search.js
+++ b/apps/presentationeditor/main/app/controller/Search.js
@@ -210,7 +210,7 @@ define([
return false;
}
- if (update && this.view.$el.is(':visible')) {
+ if (update && this.view.$el.is(':visible') && this.view.$resultsContainer.find('.many-results').length === 0) {
this.api.asc_StartTextAroundSearch();
}
this.view.disableReplaceButtons(false);
@@ -243,8 +243,8 @@ define([
removeResultItems: function (type) {
this.resultItems = [];
- this.hideResults();
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
+ this.hideResults();
this.view.disableReplaceButtons(true);
this._state.currentResult = 0;
this._state.resultsNumber = 0;
@@ -298,13 +298,13 @@ define([
onEndTextAroundSearch: function () {
if (this.view) {
- this._state.isStartedAddingResults = false;
this.view.updateScrollers();
}
},
onApiGetTextAroundSearch: function (data) {
if (this.view && this._state.isStartedAddingResults) {
+ this._state.isStartedAddingResults = false;
if (data.length > 300 || !data.length) return;
var me = this,
selectedInd;
@@ -350,8 +350,10 @@ define([
hideResults: function () {
if (this.view) {
- this.view.$resultsContainer.hide();
- this.view.$resultsContainer.empty();
+ if (this.view.$resultsContainer.find('.many-results').length === 0) {
+ this.view.$resultsContainer.hide();
+ }
+ this.view.$resultsContainer.find('.item').remove();
}
},
@@ -374,7 +376,9 @@ define([
this.hideResults();
if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false);
- this.api.asc_StartTextAroundSearch();
+ if (this.view.$resultsContainer.find('.many-results').length === 0) {
+ this.api.asc_StartTextAroundSearch();
+ }
} else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text);
} else {
diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js
index f300fc0d05..9b0465b4b4 100644
--- a/apps/spreadsheeteditor/main/app/controller/Search.js
+++ b/apps/spreadsheeteditor/main/app/controller/Search.js
@@ -358,8 +358,8 @@ define([
removeResultItems: function (type) {
this.resultItems = [];
- this.hideResults();
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
+ this.hideResults();
this._state.currentResult = 0;
this._state.resultsNumber = 0;
this.view.disableNavButtons();
@@ -367,7 +367,7 @@ define([
},
onApiRemoveTextAroundSearch: function (arr) {
- if (!this.resultItems) return;
+ if (!this.resultItems || this.resultItems && this.resultItems.length === 0) return;
var me = this;
arr.forEach(function (id) {
var ind = _.findIndex(me.resultItems, {id: id});
@@ -498,7 +498,9 @@ define([
hideResults: function () {
if (this.view) {
- this.view.$resultsContainer.hide();
+ if (this.view.$resultsContainer.find('.many-results').length === 0) {
+ this.view.$resultsContainer.hide();
+ }
this.view.$resultsContainer.find('.search-items').empty();
}
},
diff --git a/apps/spreadsheeteditor/main/resources/less/leftmenu.less b/apps/spreadsheeteditor/main/resources/less/leftmenu.less
index 2f599184d0..755f7e773b 100644
--- a/apps/spreadsheeteditor/main/resources/less/leftmenu.less
+++ b/apps/spreadsheeteditor/main/resources/less/leftmenu.less
@@ -1017,6 +1017,9 @@
}
#search-results {
padding: 0;
+ .many-results {
+ padding-top: 18px;
+ }
.search-table {
padding-top: 5px;
width:100%;