From 2bfe6b2d2ccd43d7c49e6053d081e7603d8959fc Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 2 Mar 2022 21:48:37 +0300 Subject: [PATCH] [DE PE SSE] New search: add filling find input, fix view mode --- apps/common/main/lib/view/SearchBar.js | 5 +++-- apps/common/main/lib/view/SearchPanel.js | 4 ++++ apps/documenteditor/main/app/controller/LeftMenu.js | 3 ++- apps/documenteditor/main/app/controller/Viewport.js | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 3 ++- apps/presentationeditor/main/app/controller/Viewport.js | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 3 ++- apps/spreadsheeteditor/main/app/controller/Viewport.js | 2 +- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js index 716f52ed9..4231d1f82 100644 --- a/apps/common/main/lib/view/SearchBar.js +++ b/apps/common/main/lib/view/SearchBar.js @@ -118,9 +118,10 @@ define([ show: function() { var top = $('#app-title').height() + $('#toolbar').height() + 2, - left = Common.Utils.innerWidth() - $('#right-menu').width() - this.options.width - 32; + left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32; Common.UI.Window.prototype.show.call(this, left, top); + this.inputSearch.val(''); this.focus(); }, @@ -154,7 +155,7 @@ define([ onOpenPanel: function () { this.hide(); - this.fireEvent('search:show', [true]); + this.fireEvent('search:show', [true, this.inputSearch.val()]); }, textFind: 'Find' diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js index 764175cec..798fe92f8 100644 --- a/apps/common/main/lib/view/SearchPanel.js +++ b/apps/common/main/lib/view/SearchPanel.js @@ -271,6 +271,10 @@ define([ Common.localStorage.setBool('sse-search-options-extended', this.extendedOptions); }, + setFindText: function (val) { + this.inputText.setValue(val); + }, + textFind: 'Find', textFindAndReplace: 'Find and replace', textCloseSearch: 'Close search', diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 1cd72977c..944fbcaa7 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -921,10 +921,11 @@ define([ } }, - onShowHideSearch: function (state, action) { + onShowHideSearch: function (state, findText, action) { if (state) { Common.UI.Menu.Manager.hideAll(); var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace'; + findText && this.leftMenu.panelSearch.setFindText(findText); this.leftMenu.panelSearch.setSearchMode(mode); this.leftMenu.showMenu('advancedsearch'); } else { diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index b261e8b6b..75bffea04 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -333,13 +333,13 @@ define([ cls : 'btn-toolbar' })).on('click', _on_btn_zoom.bind(me, 'up')); - me.header.btnSearch.on('click', me.onSearchClick.bind(this)); me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this)); if ( !Common.UI.Themes.isDarkTheme() ) { me.header.menuItemsDarkMode.hide(); me.header.menuItemsDarkMode.$el.prev('.divider').hide(); } } + me.header.btnSearch.on('click', me.onSearchClick.bind(this)); }, onLayoutChanged: function(area) { diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 3932f5c48..5f941717c 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -774,10 +774,11 @@ define([ } }, - onShowHideSearch: function (state, action) { + onShowHideSearch: function (state, findText, action) { if (state) { Common.UI.Menu.Manager.hideAll(); var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace'; + findText && this.leftMenu.panelSearch.setFindText(findText); this.leftMenu.panelSearch.setSearchMode(mode); this.leftMenu.showMenu('advancedsearch'); } else { diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 93d072182..7eb4a417a 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -342,8 +342,8 @@ define([ })).on('click', _on_btn_zoom.bind(me, 'up')); me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this)); - me.header.btnSearch.on('click', me.onSearchClick.bind(this)); } + me.header.btnSearch.on('click', me.onSearchClick.bind(this)); }, onLayoutChanged: function(area) { diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 76d56330a..58974f57f 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -983,10 +983,11 @@ define([ } }, - onShowHideSearch: function (state, action) { + onShowHideSearch: function (state, findText, action) { if (state) { Common.UI.Menu.Manager.hideAll(); var mode = this.mode.isEdit && !this.viewmode ? (action || undefined) : 'no-replace'; + findText && this.leftMenu.panelSearch.setFindText(findText); this.leftMenu.panelSearch.setSearchMode(mode); this.leftMenu.showMenu('advancedsearch'); } else { diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index fc15ad3ad..817b8cc82 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -348,8 +348,8 @@ define([ })).on('click', _on_btn_zoom.bind(me, 'up')); me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this)); - me.header.btnSearch.on('click', me.onSearchClick.bind(this)); } + me.header.btnSearch.on('click', me.onSearchClick.bind(this)); }, // When our application is ready, lets get started