[DE] Fix search in edit mail merge mode

This commit is contained in:
JuliaSvinareva 2022-05-30 20:46:20 +03:00
parent e9a0798327
commit 57443701d6
4 changed files with 48 additions and 12 deletions

View file

@ -50,7 +50,8 @@ define([
height: 54,
header: false,
cls: 'search-bar',
alias: 'SearchBar'
alias: 'SearchBar',
showOpenPanel: true
},
initialize : function(options) {
@ -62,7 +63,7 @@ define([
'<div class="tools">',
'<div id="search-bar-back"></div>',
'<div id="search-bar-next"></div>',
'<div id="search-bar-open-panel"></div>',
this.options.showOpenPanel ? '<div id="search-bar-open-panel"></div>' : '',
'<div id="search-bar-close"></div>',
'</div>',
'</div>'
@ -103,6 +104,7 @@ define([
});
this.btnNext.on('click', _.bind(this.onBtnNextClick, this, 'next'));
if (this.options.showOpenPanel) {
this.btnOpenPanel = new Common.UI.Button({
parentEl: $('#search-bar-open-panel'),
cls: 'btn-toolbar',
@ -110,6 +112,7 @@ define([
hint: this.tipOpenAdvancedSettings
});
this.btnOpenPanel.on('click', _.bind(this.onOpenPanel, this));
}
this.btnClose = new Common.UI.Button({
parentEl: $('#search-bar-close'),

View file

@ -678,6 +678,10 @@ define([
switch (s) {
case 'replace':
case 'search':
if (this.mode.isEditMailMerge || this.mode.isEditOle) {
this.leftMenu.fireEvent('search:show');
return false;
}
if (!this.leftMenu.btnSearchBar.isDisabled()) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.btnAbout.toggle(false);
@ -738,6 +742,11 @@ define([
btnSearch.pressed && btnSearch.toggle(false);
this.leftMenu._state.isSearchOpen && (this.leftMenu._state.isSearchOpen = false);
if (this.mode.isEditMailMerge || this.mode.isEditOle) {
btnSearch = this.getApplication().getController('Toolbar').toolbar.btnSearch;
btnSearch.pressed && btnSearch.toggle(false);
}
if ( this.leftMenu.menuFile.isVisible() ) {
if (Common.UI.HintManager.needCloseFileMenu())
this.leftMenu.menuFile.hide();

View file

@ -47,6 +47,7 @@ define([
'common/main/lib/view/SymbolTableDialog',
'common/main/lib/view/OptionsDialog',
'common/main/lib/util/define',
'common/main/lib/view/SearchBar',
'spreadsheeteditor/main/app/view/Toolbar',
'spreadsheeteditor/main/app/collection/TableTemplates',
'spreadsheeteditor/main/app/controller/PivotTable',
@ -147,6 +148,9 @@ define([
},
'ViewTab': {
'viewtab:showtoolbar': this.onChangeViewMode.bind(this)
},
'LeftMenu': {
'search:show': this.searchShow.bind(this)
}
});
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
@ -296,7 +300,7 @@ define([
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnSearch.on('click', _.bind(this.onSearch, this));
toolbar.btnSearch.on('toggle', _.bind(this.onSearch, this));
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
@ -307,7 +311,7 @@ define([
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnSearch.on('click', _.bind(this.onSearch, this));
toolbar.btnSearch.on('toggle', _.bind(this.onSearch, this));
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
@ -1282,8 +1286,27 @@ define([
}
},
searchShow: function () {
if (this.toolbar.btnSearch && this.searchBar && !this.searchBar.isVisible()) {
this.toolbar.btnSearch.toggle(true);
}
},
onSearch: function(type, btn) {
this.getApplication().getController('LeftMenu').showSearchDlg(true);
if (!this.searchBar) {
this.searchBar = new Common.UI.SearchBar({
showOpenPanel: false,
width: 303
});
this.searchBar.on('hide', _.bind(function () {
this.toolbar.btnSearch.toggle(false, true);
}, this));
}
if (this.toolbar.btnSearch.pressed) {
this.searchBar.show(this.api.asc_GetSelectedText());
} else {
this.searchBar.hide();
}
},
onAutoFilter: function(btn) {

View file

@ -349,6 +349,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-menu-search',
lock : [_set.lostConnect],
enableToggle: true,
dataHint : '1',
dataHintDirection: 'bottom'
});