Merge pull request #1840 from ONLYOFFICE/fix/fix-bugs

Fix/fix bugs
This commit is contained in:
Julia Radzhabova 2022-07-01 23:04:36 +03:00 committed by GitHub
commit 8ca7d5ca94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 9 deletions

View file

@ -301,6 +301,7 @@ define([
}, },
onItemMouseDown: function(e) { onItemMouseDown: function(e) {
Common.UI.HintManager.clearHints();
if (e.which != 1) { if (e.which != 1) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();

View file

@ -139,6 +139,7 @@ define([
left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32; left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32;
Common.UI.Window.prototype.show.call(this, left, top); Common.UI.Window.prototype.show.call(this, left, top);
this.disableNavButtons();
if (text) { if (text) {
this.inputSearch.val(text); this.inputSearch.val(text);
this.fireEvent('search:input', [text]); this.fireEvent('search:input', [text]);
@ -146,7 +147,6 @@ define([
this.inputSearch.val(''); this.inputSearch.val('');
} }
this.disableNavButtons();
this.focus(); this.focus();
}, },
@ -185,9 +185,9 @@ define([
}, },
disableNavButtons: function (resultNumber, allResults) { disableNavButtons: function (resultNumber, allResults) {
var disable = this.inputSearch.val() === ''; var disable = this.inputSearch.val() === '' || !allResults;
this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); this.btnBack.setDisabled(disable);
this.btnNext.setDisabled(disable || resultNumber + 1 === allResults); this.btnNext.setDisabled(disable);
}, },
textFind: 'Find', textFind: 'Find',

View file

@ -373,9 +373,9 @@ define([
}, },
disableNavButtons: function (resultNumber, allResults) { disableNavButtons: function (resultNumber, allResults) {
var disable = this.inputText._input.val() === ''; var disable = this.inputText._input.val() === '' || !allResults;
this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); this.btnBack.setDisabled(disable);
this.btnNext.setDisabled(disable || !allResults || resultNumber + 1 === allResults); this.btnNext.setDisabled(disable);
}, },
disableReplaceButtons: function (disable) { disableReplaceButtons: function (disable) {

View file

@ -57,7 +57,13 @@ define([
'SearchBar': { 'SearchBar': {
'search:back': _.bind(this.onSearchNext, this, 'back'), 'search:back': _.bind(this.onSearchNext, this, 'back'),
'search:next': _.bind(this.onSearchNext, this, 'next'), 'search:next': _.bind(this.onSearchNext, this, 'next'),
'search:input': _.bind(this.onInputSearchChange, this), 'search:input': _.bind(function (text) {
if (this._state.searchText === text) {
Common.NotificationCenter.trigger('search:updateresults', this._state.currentResult, this._state.resultsNumber);
return;
}
this.onInputSearchChange(text);
}, this),
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'), 'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
'show': _.bind(this.onSelectSearchingResults, this, true), 'show': _.bind(this.onSelectSearchingResults, this, true),
'hide': _.bind(this.onSelectSearchingResults, this, false) 'hide': _.bind(this.onSelectSearchingResults, this, false)
@ -169,6 +175,7 @@ define([
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.disableNavButtons();
me.view.disableReplaceButtons(true); me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);

View file

@ -57,7 +57,13 @@ define([
'SearchBar': { 'SearchBar': {
'search:back': _.bind(this.onSearchNext, this, 'back'), 'search:back': _.bind(this.onSearchNext, this, 'back'),
'search:next': _.bind(this.onSearchNext, this, 'next'), 'search:next': _.bind(this.onSearchNext, this, 'next'),
'search:input': _.bind(this.onInputSearchChange, this), 'search:input': _.bind(function (text) {
if (this._state.searchText === text) {
Common.NotificationCenter.trigger('search:updateresults', this._state.currentResult, this._state.resultsNumber);
return;
}
this.onInputSearchChange(text);
}, this),
'search:keydown': _.bind(this.onSearchNext, this, 'keydown') 'search:keydown': _.bind(this.onSearchNext, this, 'keydown')
}, },
'Common.Views.SearchPanel': { 'Common.Views.SearchPanel': {
@ -166,6 +172,7 @@ define([
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.disableNavButtons();
me.view.disableReplaceButtons(true); me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);

View file

@ -556,6 +556,7 @@
"Common.Views.SearchPanel.textWholeWords": "Whole words only", "Common.Views.SearchPanel.textWholeWords": "Whole words only",
"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.textSearchHasStopped": "Search has stopped",
"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",

View file

@ -229,6 +229,7 @@ define([
//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.disableNavButtons();
//me.view.disableReplaceButtons(true); //me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);

View file

@ -421,6 +421,7 @@
"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.textSearchHasStopped": "Search has stopped",
"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",