diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js
index 55b91e303..ec1fe6c6d 100644
--- a/apps/common/main/lib/view/SearchBar.js
+++ b/apps/common/main/lib/view/SearchBar.js
@@ -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([
'
',
''
@@ -103,13 +104,15 @@ define([
});
this.btnNext.on('click', _.bind(this.onBtnNextClick, this, 'next'));
- this.btnOpenPanel = new Common.UI.Button({
- parentEl: $('#search-bar-open-panel'),
- cls: 'btn-toolbar',
- iconCls: 'toolbar__icon more-vertical',
- hint: this.tipOpenAdvancedSettings
- });
- this.btnOpenPanel.on('click', _.bind(this.onOpenPanel, this));
+ if (this.options.showOpenPanel) {
+ this.btnOpenPanel = new Common.UI.Button({
+ parentEl: $('#search-bar-open-panel'),
+ cls: 'btn-toolbar',
+ iconCls: 'toolbar__icon more-vertical',
+ hint: this.tipOpenAdvancedSettings
+ });
+ this.btnOpenPanel.on('click', _.bind(this.onOpenPanel, this));
+ }
this.btnClose = new Common.UI.Button({
parentEl: $('#search-bar-close'),
diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
index 4554ae76a..4b4099757 100644
--- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
+++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
@@ -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();
diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
index 5bd64d2cd..4de188390 100644
--- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
@@ -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) {
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js
index 26cc63ec1..4161b2721 100644
--- a/apps/spreadsheeteditor/main/app/view/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js
@@ -349,6 +349,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-menu-search',
lock : [_set.lostConnect],
+ enableToggle: true,
dataHint : '1',
dataHintDirection: 'bottom'
});