diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js
index ca8a763f7..764175cec 100644
--- a/apps/common/main/lib/view/SearchPanel.js
+++ b/apps/common/main/lib/view/SearchPanel.js
@@ -51,8 +51,7 @@ define([
_.extend(this, options);
Common.UI.BaseView.prototype.initialize.call(this, arguments);
- this.isEdit = options.mode.isEdit;
-
+ this.mode = false;
window.SSE && (this.extendedOptions = Common.localStorage.getBool('sse-search-options-extended', true));
},
@@ -61,8 +60,7 @@ define([
if (!this.rendered) {
el = el || this.el;
$(el).html(this.template({
- scope: this,
- headerText: this.isEdit ? this.textFindAndReplace : this.textFind
+ scope: this
}));
this.$el = $(el);
@@ -129,15 +127,6 @@ define([
dataHintOffset: 'small'
});
- this.chMatchWord = new Common.UI.CheckBox({
- el: $('#search-adv-match-word'),
- labelText: this.options.matchwordstr || this.textWholeWords,
- value: false,
- dataHint: '1',
- dataHintDirection: 'left',
- dataHintOffset: 'small'
- });
-
this.buttonClose = new Common.UI.Button({
parentEl: $('#search-btn-close', this.$el),
cls: 'btn-toolbar',
@@ -147,6 +136,14 @@ define([
this.buttonClose.on('click', _.bind(this.onClickClosePanel, this));
if (window.SSE) {
+ this.chMatchWord = new Common.UI.CheckBox({
+ el: $('#search-adv-match-word'),
+ labelText: this.options.matchwordstr || this.textWholeWords,
+ value: false,
+ dataHint: '1',
+ dataHintDirection: 'left',
+ dataHintOffset: 'small'
+ });
this.cmbWithin = new Common.UI.ComboBox({
el: $('#search-adv-cmb-within'),
@@ -221,6 +218,14 @@ define([
}, 10);
},
+ setSearchMode: function (mode) {
+ if (this.mode !== mode) {
+ this.$el.find('.edit-setting')[mode !== 'no-replace' ? 'show' : 'hide']();
+ this.$el.find('#search-adv-title').text(mode !== 'no-replace' ? this.textFindAndReplace : this.textFind);
+ this.mode = mode;
+ }
+ },
+
ChangeSettings: function(props) {
},
diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js
index 67ac025c4..1cd72977c 100644
--- a/apps/documenteditor/main/app/controller/LeftMenu.js
+++ b/apps/documenteditor/main/app/controller/LeftMenu.js
@@ -127,6 +127,7 @@ define([
onLaunch: function() {
this.leftMenu = this.createView('LeftMenu').render();
this.leftMenu.btnSearch.on('toggle', _.bind(this.onMenuSearch, this));
+ this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
@@ -666,6 +667,8 @@ define([
this.viewmode = mode;
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
+
+ this.leftMenu.panelSearch && this.leftMenu.panelSearch.setSearchMode(this.viewmode ? 'no-replace' : 'search');
},
SetDisabled: function(disable, options) {
@@ -918,9 +921,11 @@ define([
}
},
- onShowHideSearch: function (state) {
+ onShowHideSearch: function (state, action) {
if (state) {
Common.UI.Menu.Manager.hideAll();
+ var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
this.leftMenu.showMenu('advancedsearch');
} else {
this.leftMenu.btnSearchBar.toggle(false, true);
@@ -928,6 +933,13 @@ define([
}
},
+ onMenuSearchBar: function(obj, show) {
+ if (show) {
+ var mode = this.mode.isEdit && !this.viewmode ? undefined : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
+ }
+ },
+
isCommentsVisible: function() {
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
},
diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js
index 95d73dc93..3932f5c48 100644
--- a/apps/presentationeditor/main/app/controller/LeftMenu.js
+++ b/apps/presentationeditor/main/app/controller/LeftMenu.js
@@ -124,6 +124,7 @@ define([
this.leftMenu.btnSearch.on('toggle', _.bind(this.onMenuSearch, this));
this.leftMenu.btnThumbs.on('toggle', _.bind(this.onShowTumbnails, this));
this.isThumbsShown = true;
+ this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
@@ -537,6 +538,8 @@ define([
this.viewmode = mode;
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
+
+ this.leftMenu.panelSearch && this.leftMenu.panelSearch.setSearchMode(this.viewmode ? 'no-replace' : 'search');
},
onApiServerDisconnect: function(enableDownload) {
@@ -771,9 +774,11 @@ define([
}
},
- onShowHideSearch: function (state) {
+ onShowHideSearch: function (state, action) {
if (state) {
Common.UI.Menu.Manager.hideAll();
+ var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
this.leftMenu.showMenu('advancedsearch');
} else {
this.leftMenu.btnSearchBar.toggle(false, true);
@@ -781,6 +786,13 @@ define([
}
},
+ onMenuSearchBar: function(obj, show) {
+ if (show) {
+ var mode = this.mode.isEdit && !this.viewmode ? undefined : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
+ }
+ },
+
showHistory: function() {
if (!this.mode.wopi) {
var maincontroller = PE.getController('Main');
diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
index 911cc0f2a..76d56330a 100644
--- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
+++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js
@@ -116,6 +116,7 @@ define([
onLaunch: function() {
this.leftMenu = this.createView('LeftMenu').render();
this.leftMenu.btnSearch.on('toggle', _.bind(this.onMenuSearch, this));
+ this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
@@ -722,6 +723,8 @@ define([
this.viewmode = mode;
this.dlgSearch && this.dlgSearch.setMode(this.viewmode ? 'no-replace' : 'search');
+
+ this.leftMenu.panelSearch && this.leftMenu.panelSearch.setSearchMode(this.viewmode ? 'no-replace' : 'search');
},
onApiServerDisconnect: function(enableDownload) {
@@ -980,9 +983,11 @@ define([
}
},
- onShowHideSearch: function (state) {
+ onShowHideSearch: function (state, action) {
if (state) {
Common.UI.Menu.Manager.hideAll();
+ var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
this.leftMenu.showMenu('advancedsearch');
} else {
this.leftMenu.btnSearchBar.toggle(false, true);
@@ -990,6 +995,13 @@ define([
}
},
+ onMenuSearchBar: function(obj, show) {
+ if (show) {
+ var mode = this.mode.isEdit && !this.viewmode ? undefined : 'no-replace';
+ this.leftMenu.panelSearch.setSearchMode(mode);
+ }
+ },
+
onMenuChange: function (value) {
if ('hide' === value) {
if (this.leftMenu.btnComments.isActive() && this.api) {
|