[DE PE SSE] Fix search

This commit is contained in:
JuliaSvinareva 2022-06-17 14:35:25 +03:00
parent 2db9b044c5
commit c31017def8
7 changed files with 13 additions and 12 deletions

View file

@ -52,7 +52,8 @@ define([
header: false,
cls: 'search-bar',
alias: 'SearchBar',
showOpenPanel: true
showOpenPanel: true,
toolclose: 'hide'
},
initialize : function(options) {

View file

@ -361,7 +361,7 @@ define([
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
if (this.resultItems && this.resultItems.length > 0 &&
(!this._state.matchCase && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
(!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
this._state.matchCase && text === this.view.inputText.getValue())) { // show old results
return;
}
@ -373,10 +373,10 @@ define([
}
this.hideResults();
if (text !== '' && text === this._state.searchText) { // search was made
if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false);
this.api.asc_StartTextAroundSearch();
} else if (text !== '') { // search wasn't made
} else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text);
} else {
this.resultItems = [];

View file

@ -209,7 +209,7 @@ define([
this.supressEvents = false;
this.onCoauthOptions();
(btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this);
btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this);
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
},

View file

@ -337,10 +337,10 @@ define([
}
this.hideResults();
if (text !== '' && text === this._state.searchText) { // search was made
if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false);
this.api.asc_StartTextAroundSearch();
} else if (text !== '') { // search wasn't made
} else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text);
} else {
this.resultItems = [];

View file

@ -202,7 +202,7 @@ define([
}
this.fireEvent('panel:show', [this, btn.options.action, btn.pressed]);
(btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this);
btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this);
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
},

View file

@ -482,7 +482,7 @@ define([
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
if (this.resultItems && this.resultItems.length > 0 &&
(!this._state.matchCase && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
(!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||
this._state.matchCase && text === this.view.inputText.getValue())) { // show old results
return;
}
@ -494,10 +494,10 @@ define([
}
this.hideResults();
if (text !== '' && text === this._state.searchText) { // search was made
if (text && text !== '' && text === this._state.searchText) { // search was made
this.view.disableReplaceButtons(false);
this.api.asc_StartTextAroundSearch();
} else if (text !== '') { // search wasn't made
} else if (text && text !== '') { // search wasn't made
this.onInputSearchChange(text);
} else {
this.resultItems = [];

View file

@ -183,7 +183,7 @@ define([
this.$el.width(SCALE_MIN);
}
this.onCoauthOptions();
(btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this);
btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this);
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
},