[DE PE SSE] Fix search panel after show
This commit is contained in:
parent
614a9fa1cc
commit
b68c5a7f0c
|
@ -303,7 +303,7 @@ define([
|
|||
|
||||
onApiGetTextAroundSearch: function (data) {
|
||||
if (this.view && this._state.isStartedAddingResults) {
|
||||
if (data.length > 300) return;
|
||||
if (data.length > 300 || !data.length) return;
|
||||
var me = this;
|
||||
me.resultItems = [];
|
||||
data.forEach(function (item, ind) {
|
||||
|
@ -352,7 +352,7 @@ define([
|
|||
viewport.searchBar.hide();
|
||||
}
|
||||
|
||||
var text = findText || this.api.asc_GetSelectedText() || this._state.searchText;
|
||||
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 === this.view.inputText.getValue())) { // show old results
|
||||
|
@ -360,8 +360,9 @@ define([
|
|||
}
|
||||
if (text) {
|
||||
this.view.setFindText(text);
|
||||
} else if (text !== undefined) {
|
||||
} else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search
|
||||
this.view.setFindText('');
|
||||
this._state.searchText = undefined;
|
||||
}
|
||||
|
||||
this.hideResults();
|
||||
|
|
|
@ -272,7 +272,7 @@ define([
|
|||
|
||||
onApiGetTextAroundSearch: function (data) {
|
||||
if (this.view && this._state.isStartedAddingResults) {
|
||||
if (data.length > 300) return;
|
||||
if (data.length > 300 || !data.length) return;
|
||||
var me = this;
|
||||
me.resultItems = [];
|
||||
data.forEach(function (item, ind) {
|
||||
|
@ -321,11 +321,12 @@ define([
|
|||
viewport.searchBar.hide();
|
||||
}
|
||||
|
||||
var text = findText || this.api.asc_GetSelectedText() || this._state.searchText;
|
||||
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
|
||||
if (text) {
|
||||
this.view.setFindText(text);
|
||||
} else if (text !== undefined) {
|
||||
} else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search
|
||||
this.view.setFindText('');
|
||||
this._state.searchText = undefined;
|
||||
}
|
||||
|
||||
this.hideResults();
|
||||
|
|
|
@ -683,7 +683,7 @@ define([
|
|||
if (this.isSearchPanelVisible()) {
|
||||
selectedText && this.leftMenu.panelSearch.setFindText(selectedText);
|
||||
this.leftMenu.panelSearch.focus(selectedText !== '' ? s : 'search');
|
||||
this.leftMenu.fireEvent('search:aftershow', this.leftMenu, selectedText);
|
||||
this.leftMenu.fireEvent('search:aftershow', [selectedText]);
|
||||
return false;
|
||||
} else if (this.getApplication().getController('Viewport').isSearchBarVisible()) {
|
||||
var viewport = this.getApplication().getController('Viewport');
|
||||
|
@ -840,7 +840,7 @@ define([
|
|||
if (state) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu('advancedsearch');
|
||||
this.leftMenu.fireEvent('search:aftershow', this.leftMenu, findText);
|
||||
this.leftMenu.fireEvent('search:aftershow', [findText]);
|
||||
} else {
|
||||
this.leftMenu.btnSearchBar.toggle(false, true);
|
||||
this.leftMenu.onBtnMenuClick(this.leftMenu.btnSearchBar);
|
||||
|
|
|
@ -413,7 +413,7 @@ define([
|
|||
|
||||
onApiGetTextAroundSearch: function (data) { // [id, sheet, name, cell, value, formula]
|
||||
if (this.view && this._state.isStartedAddingResults) {
|
||||
if (data.length > 300) return;
|
||||
if (data.length > 300 || !data.length) return;
|
||||
var me = this,
|
||||
$innerResults = me.view.$resultsContainer.find('.search-items');
|
||||
me.resultItems = [];
|
||||
|
@ -474,20 +474,21 @@ define([
|
|||
viewport.searchBar.hide();
|
||||
}
|
||||
|
||||
var text = findText || this.api.asc_GetSelectedText() || this._state.searchText;
|
||||
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 === this.view.inputText.getValue())) { // show old results
|
||||
return;
|
||||
}
|
||||
if (text && text !== this.view.inputText.getValue()) {
|
||||
if (text) {
|
||||
this.view.setFindText(text);
|
||||
} else if (text !== undefined) {
|
||||
} else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search
|
||||
this.view.setFindText('');
|
||||
this._state.searchText = undefined;
|
||||
}
|
||||
|
||||
this.hideResults();
|
||||
if (text !== '') { // search was made
|
||||
if (text !== '' && text === this._state.searchText) { // search was made
|
||||
this.view.disableReplaceButtons(false);
|
||||
this.api.asc_StartTextAroundSearch();
|
||||
} else if (text !== '') { // search wasn't made
|
||||
|
|
Loading…
Reference in a new issue