mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 11:10:56 +08:00
[DE PE SSE] Fix bug 58273
This commit is contained in:
@ -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, '<a class="search-again">','</a>')) :
|
||||
(!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, '<a class="search-again">','</a>')) :
|
||||
(!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('<div class="many-results">' + this.textTooManyResults + '</div>');
|
||||
if (!this.$resultsContainer.is(':visible')) {
|
||||
this.$resultsContainer.show();
|
||||
}
|
||||
},
|
||||
|
||||
onClickClosePanel: function() {
|
||||
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
|
||||
this.fireEvent('hide', this );
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
},
|
||||
|
||||
@ -1017,6 +1017,9 @@
|
||||
}
|
||||
#search-results {
|
||||
padding: 0;
|
||||
.many-results {
|
||||
padding-top: 18px;
|
||||
}
|
||||
.search-table {
|
||||
padding-top: 5px;
|
||||
width:100%;
|
||||
|
||||
Reference in New Issue
Block a user