From 14cf16f2016047cd7a328b6584cfaff0e5d3ee13 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 8 Feb 2022 19:03:44 +0300 Subject: [PATCH 01/52] [DE] Make new search bar --- apps/common/main/lib/view/Header.js | 10 ++ apps/common/main/lib/view/SearchBar.js | 100 ++++++++++++++++++ .../main/app/controller/Viewport.js | 14 +++ 3 files changed, 124 insertions(+) create mode 100644 apps/common/main/lib/view/SearchBar.js diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 61d10d6fa..5dbf268b8 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -100,6 +100,7 @@ define([ '
' + '
' + '
' + + '' + '
' + '' + '
' + @@ -457,6 +458,14 @@ define([ reset : onResetUsers }); + me.btnSearch = new Common.UI.Button({ + cls: 'btn-header no-caret', + iconCls: 'toolbar__icon icon--inverse btn-menu-search', + dataHint: '0', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + me.btnOptions = new Common.UI.Button({ cls: 'btn-header no-caret', iconCls: 'toolbar__icon icon--inverse btn-ic-options', @@ -563,6 +572,7 @@ define([ if ( config.canEdit && config.canRequestEditRights ) this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big'); } + me.btnSearch.render($html.find('#slot-btn-search')); me.btnOptions.render($html.find('#slot-btn-options')); if (!config.isEdit || config.customization && !!config.customization.compactHeader) { diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js new file mode 100644 index 000000000..5d963f0c6 --- /dev/null +++ b/apps/common/main/lib/view/SearchBar.js @@ -0,0 +1,100 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * +*/ +/** + * SearchBar.js + * + * Created by Julia Svinareva on 03.02.2022 + * Copyright (c) 2022 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/component/Window' +], function () { + 'use strict'; + + Common.UI.SearchBar = Common.UI.Window.extend(_.extend({ + options: { + modal: false, + width: 328, + height: 54, + header: false, + cls: 'search-bar' + }, + + initialize : function(options) { + _.extend(this.options, options || {}); + + this.template = [ + '
', + 'jghjgj', + '
' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + + Common.UI.Window.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + + + this.on('animate:before', _.bind(this.focus, this)); + + return this; + }, + + show: function(x, y) { + Common.UI.Window.prototype.show.call(this, x, y); + + + this.focus(); + }, + + focus: function() { + var me = this; + setTimeout(function(){ + + }, 10); + }, + + getSettings: function() { + return { + + }; + }, + + }, Common.UI.SearchBar || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index d8258c6e8..ec93ef631 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -44,6 +44,7 @@ define([ 'core', 'common/main/lib/view/Header', + 'common/main/lib/view/SearchBar', 'documenteditor/main/app/view/Viewport', 'documenteditor/main/app/view/LeftMenu' ], function (Viewport) { @@ -332,6 +333,7 @@ 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(); @@ -460,6 +462,18 @@ define([ this.header && this.header.lockHeaderBtns( 'rename-user', disable); }, + onSearchClick: function () { + if ( !this.searchBar ) { + this.searchBar = (new Common.UI.SearchBar({ + })); + } + + var top = $('#app-title').height() + $('#toolbar').height() + 2, + left = Common.Utils.innerWidth() - $('#right-menu').width() - this.searchBar.options.width - 32; + + this.searchBar.show(left, top); + }, + textFitPage: 'Fit to Page', textFitWidth: 'Fit to Width', txtDarkMode: 'Dark mode' From d00d8c428dacbfdef6bcfa22210e1de40e6dc0ab Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 9 Feb 2022 21:15:36 +0300 Subject: [PATCH 02/52] [DE] Make new search, add controller --- apps/common/main/lib/view/Header.js | 1 + apps/common/main/lib/view/SearchBar.js | 61 +++++++++++-- .../main/resources/less/searchdialog.less | 18 ++++ apps/documenteditor/main/app.js | 2 + .../main/app/controller/Main.js | 6 +- .../main/app/controller/Search.js | 87 +++++++++++++++++++ .../main/app/controller/Viewport.js | 22 +++-- apps/documenteditor/main/app_dev.js | 2 + 8 files changed, 184 insertions(+), 15 deletions(-) create mode 100644 apps/documenteditor/main/app/controller/Search.js diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 5dbf268b8..6622a1fa8 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -461,6 +461,7 @@ define([ me.btnSearch = new Common.UI.Button({ cls: 'btn-header no-caret', iconCls: 'toolbar__icon icon--inverse btn-menu-search', + enableToggle: true, dataHint: '0', dataHintDirection: 'bottom', dataHintOffset: 'big' diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js index 5d963f0c6..b2605d287 100644 --- a/apps/common/main/lib/view/SearchBar.js +++ b/apps/common/main/lib/view/SearchBar.js @@ -49,7 +49,8 @@ define([ width: 328, height: 54, header: false, - cls: 'search-bar' + cls: 'search-bar', + alias: 'SearchBar' }, initialize : function(options) { @@ -57,28 +58,59 @@ define([ this.template = [ '
', - 'jghjgj', + '', + '
', + '
', + '
', + '
', + '
', '
' ].join(''); this.options.tpl = _.template(this.template)(this.options); Common.UI.Window.prototype.initialize.call(this, this.options); + + Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); }, render: function() { Common.UI.Window.prototype.render.call(this); + this.inputSearch = this.$window.find('#search-bar-text'); + this.btnBack = new Common.UI.Button({ + parentEl: $('#search-bar-back'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-up' + }); + this.btnBack.on('click', _.bind(this.onBtnClick, this, 'back')); + + this.btnNext = new Common.UI.Button({ + parentEl: $('#search-bar-next'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-arrow-down' + }); + this.btnNext.on('click', _.bind(this.onBtnClick, this, 'next')); + + this.btnClose = new Common.UI.Button({ + parentEl: $('#search-bar-close'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-close' + }); + this.btnClose.on('click', _.bind(function () { + this.hide(); + }, this)) this.on('animate:before', _.bind(this.focus, this)); return this; }, - show: function(x, y) { - Common.UI.Window.prototype.show.call(this, x, y); - + show: function() { + var top = $('#app-title').height() + $('#toolbar').height() + 2, + left = Common.Utils.innerWidth() - $('#right-menu').width() - this.options.width - 32; + Common.UI.Window.prototype.show.call(this, left, top); this.focus(); }, @@ -86,7 +118,8 @@ define([ focus: function() { var me = this; setTimeout(function(){ - + me.inputSearch.focus(); + me.inputSearch.select(); }, 10); }, @@ -96,5 +129,21 @@ define([ }; }, + onLayoutChanged: function () { + var top = $('#app-title').height() + $('#toolbar').height() + 2, + left = Common.Utils.innerWidth() - $('#right-menu').width() - this.options.width - 32; + this.$window.css({left: left, top: top}); + }, + + onBtnClick: function(action, event) { + if ( $('.asc-loadmask').length ) return; + var opts = { + textsearch : this.inputSearch.val() + }; + this.fireEvent('search:'+action, [this, opts]); + }, + + textFind: 'Find' + }, Common.UI.SearchBar || {})); }); \ No newline at end of file diff --git a/apps/common/main/resources/less/searchdialog.less b/apps/common/main/resources/less/searchdialog.less index 322fb7845..5f64dfa18 100644 --- a/apps/common/main/resources/less/searchdialog.less +++ b/apps/common/main/resources/less/searchdialog.less @@ -80,4 +80,22 @@ } } } +} + +.search-bar { + z-index: 950; + .box { + padding: 16px; + display: flex; + input[type=text] { + width: 192px; + } + .tools { + display: flex; + align-items: center; + div { + margin-left: 5px; + } + } + } } \ No newline at end of file diff --git a/apps/documenteditor/main/app.js b/apps/documenteditor/main/app.js index 3e2a27386..ebe926b5c 100644 --- a/apps/documenteditor/main/app.js +++ b/apps/documenteditor/main/app.js @@ -158,6 +158,7 @@ require([ 'LeftMenu', 'Main', 'ViewTab', + 'Search', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -187,6 +188,7 @@ require([ 'documenteditor/main/app/controller/LeftMenu', 'documenteditor/main/app/controller/Main', 'documenteditor/main/app/controller/ViewTab', + 'documenteditor/main/app/controller/Search', 'documenteditor/main/app/view/FileMenuPanels', 'documenteditor/main/app/view/ParagraphSettings', 'documenteditor/main/app/view/HeaderFooterSettings', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index b46515549..633cdf77e 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1195,7 +1195,9 @@ define([ leftmenuController = application.getController('LeftMenu'), chatController = application.getController('Common.Controllers.Chat'), pluginsController = application.getController('Common.Controllers.Plugins'), - navigationController = application.getController('Navigation'); + navigationController = application.getController('Navigation'), + searchController = application.getController('Search'); + leftmenuController.getView('LeftMenu').getMenu('file').loadDocument({doc:me.document}); leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api); @@ -1219,6 +1221,8 @@ define([ documentHolderController.getView().setApi(me.api).on('editcomplete', _.bind(me.onEditComplete, me)); + searchController.setApi(me.api); + if (me.appOptions.isEdit) { if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", me.appOptions.canForcesave); diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js new file mode 100644 index 000000000..6026abd34 --- /dev/null +++ b/apps/documenteditor/main/app/controller/Search.js @@ -0,0 +1,87 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * ViewTab.js + * + * Created by Julia Svinareva on 09.02.2022 + * Copyright (c) 2022 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core' +], function () { + 'use strict'; + + DE.Controllers.Search = Backbone.Controller.extend(_.extend({ + sdkViewName : '#id_main', + + initialize: function () { + console.log('init'); + this.addListeners({ + 'SearchBar': { + 'search:back': _.bind(this.onQuerySearch, this, 'back'), + 'search:next': _.bind(this.onQuerySearch, this, 'next'), + } + }); + }, + onLaunch: function () { + this._state = {}; + }, + + setApi: function (api) { + if (api) { + this.api = api; + } + return this; + }, + + onQuerySearch: function (d, w, opts) { + if (opts.textsearch && opts.textsearch.length) { + if (!this.api.asc_findText(opts.textsearch, d != 'back')) { + var me = this; + Common.UI.info({ + msg: this.textNoTextFound, + callback: function() { + //me.dlgSearch.focus(); + } + }); + } + } + }, + + textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.', + + }, DE.Controllers.Search || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index ec93ef631..b261e8b6b 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -463,15 +463,21 @@ define([ }, onSearchClick: function () { - if ( !this.searchBar ) { - this.searchBar = (new Common.UI.SearchBar({ - })); + if (!this.searchBar) { + this.searchBar = new Common.UI.SearchBar({}); } - - var top = $('#app-title').height() + $('#toolbar').height() + 2, - left = Common.Utils.innerWidth() - $('#right-menu').width() - this.searchBar.options.width - 32; - - this.searchBar.show(left, top); + if (this.header.btnSearch.pressed) { + if (this.searchBar.isVisible()) { + this.searchBar.focus(); + } else { + this.searchBar.show(); + } + } else { + this.searchBar.hide(); + } + this.searchBar.on('hide', _.bind(function () { + this.header.btnSearch.toggle(false); + }, this)); }, textFitPage: 'Fit to Page', diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js index cb8cdd5a4..1463eec8b 100644 --- a/apps/documenteditor/main/app_dev.js +++ b/apps/documenteditor/main/app_dev.js @@ -148,6 +148,7 @@ require([ 'LeftMenu', 'Main', 'ViewTab', + 'Search', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -177,6 +178,7 @@ require([ 'documenteditor/main/app/controller/LeftMenu', 'documenteditor/main/app/controller/Main', 'documenteditor/main/app/controller/ViewTab', + 'documenteditor/main/app/controller/Search', 'documenteditor/main/app/view/FileMenuPanels', 'documenteditor/main/app/view/ParagraphSettings', 'documenteditor/main/app/view/HeaderFooterSettings', From 9336d891d7ebe96e732aba1d7c3512c228c48eca Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sat, 12 Feb 2022 15:35:16 +0300 Subject: [PATCH 03/52] [DE] Make new search, add left panel --- .../main/lib/template/SearchPanel.template | 8 ++ apps/common/main/lib/view/SearchBar.js | 12 +++ apps/common/main/lib/view/SearchPanel.js | 96 +++++++++++++++++++ .../main/resources/less/searchdialog.less | 27 ++++++ .../main/app/controller/LeftMenu.js | 5 + .../main/app/controller/Search.js | 14 ++- .../main/app/template/LeftMenu.template | 2 + apps/documenteditor/main/app/view/LeftMenu.js | 28 +++++- 8 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 apps/common/main/lib/template/SearchPanel.template create mode 100644 apps/common/main/lib/view/SearchPanel.js diff --git a/apps/common/main/lib/template/SearchPanel.template b/apps/common/main/lib/template/SearchPanel.template new file mode 100644 index 000000000..808667fbe --- /dev/null +++ b/apps/common/main/lib/template/SearchPanel.template @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js index b2605d287..acb2e9252 100644 --- a/apps/common/main/lib/view/SearchBar.js +++ b/apps/common/main/lib/view/SearchBar.js @@ -62,6 +62,7 @@ define([ '
', '
', '
', + '
', '
', '
', '
' @@ -93,6 +94,13 @@ define([ }); this.btnNext.on('click', _.bind(this.onBtnClick, this, 'next')); + this.btnOpenPanel = new Common.UI.Button({ + parentEl: $('#search-bar-open-panel'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon more-vertical' + }); + this.btnOpenPanel.on('click', _.bind(this.onOpenPanel, this)); + this.btnClose = new Common.UI.Button({ parentEl: $('#search-bar-close'), cls: 'btn-toolbar', @@ -143,6 +151,10 @@ define([ this.fireEvent('search:'+action, [this, opts]); }, + onOpenPanel: function () { + + }, + textFind: 'Find' }, Common.UI.SearchBar || {})); diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js new file mode 100644 index 000000000..7d23f33f6 --- /dev/null +++ b/apps/common/main/lib/view/SearchPanel.js @@ -0,0 +1,96 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * +*/ +/** + * User: Julia.Svinareva + * Date: 11.02.2022 + */ + +define([ + 'text!common/main/lib/template/SearchPanel.template', + 'common/main/lib/util/utils', + 'common/main/lib/component/BaseView', + 'common/main/lib/component/Layout' +], function (template) { + 'use strict'; + + Common.Views.SearchPanel = Common.UI.BaseView.extend(_.extend({ + el: '#left-panel-search', + template: _.template(template), + + initialize: function(options) { + _.extend(this, options); + Common.UI.BaseView.prototype.initialize.call(this, arguments); + }, + + render: function(el) { + if (!this.rendered) { + el = el || this.el; + $(el).html(this.template({scope: this})); + this.$el = $(el); + + this.buttonClose = new Common.UI.Button({ + parentEl: $('#search-btn-close', this.$el), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-close', + hint: this.textCloseSearch + }); + this.buttonClose.on('click', _.bind(this.onClickClosePanel, this)); + } + + this.rendered = true; + this.trigger('render:after', this); + return this; + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this,arguments); + this.fireEvent('show', this ); + }, + + hide: function () { + Common.UI.BaseView.prototype.hide.call(this,arguments); + this.fireEvent('hide', this ); + }, + + ChangeSettings: function(props) { + }, + + onClickClosePanel: function() { + Common.NotificationCenter.trigger('leftmenu:change', 'hide'); + }, + + textFind: 'Find', + textCloseSearch: 'Close search' + + }, Common.Views.SearchPanel || {})); +}); \ No newline at end of file diff --git a/apps/common/main/resources/less/searchdialog.less b/apps/common/main/resources/less/searchdialog.less index 5f64dfa18..1430a4aee 100644 --- a/apps/common/main/resources/less/searchdialog.less +++ b/apps/common/main/resources/less/searchdialog.less @@ -95,7 +95,34 @@ align-items: center; div { margin-left: 5px; + &:first-of-type { + margin-left: 7px; + } } } } +} + +#search-box { + position: relative; + border-collapse: collapse; + + #search-header { + position: relative; + height: 45px; + padding: 12px; + overflow: hidden; + border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie; + border-bottom: @scaled-one-px-value solid @border-toolbar; + + label { + font-size: 12px; + .font-weight-bold(); + margin-top: 2px; + } + + #search-btn-close { + float: right; + } + } } \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 270215f25..53c704c04 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -192,6 +192,8 @@ define([ }, createDelayedElements: function() { + this.leftMenu.setOptionsPanel('searchbar', this.getApplication().getController('Search').getView('Common.Views.SearchPanel')); + /** coauthoring begin **/ if ( this.mode.canCoAuthoring ) { this.leftMenu.btnComments[(this.mode.canViewComments && !this.mode.isLightVersion) ? 'show' : 'hide'](); @@ -776,6 +778,9 @@ define([ } else if (this.leftMenu.btnThumbnails.isActive()) { this.leftMenu.btnThumbnails.toggle(false); this.leftMenu.onBtnMenuClick(this.leftMenu.btnThumbnails); + } else if (this.leftMenu.btnSearchBar.isActive()) { + this.leftMenu.btnSearchBar.toggle(false); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnSearchBar); } } } diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index 6026abd34..0fe0ac009 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -40,13 +40,18 @@ */ define([ - 'core' + 'core', + 'common/main/lib/view/SearchPanel' ], function () { 'use strict'; DE.Controllers.Search = Backbone.Controller.extend(_.extend({ sdkViewName : '#id_main', + views: [ + 'Common.Views.SearchPanel' + ], + initialize: function () { console.log('init'); this.addListeners({ @@ -58,6 +63,8 @@ define([ }, onLaunch: function () { this._state = {}; + + this.view = this.createView('Common.Views.SearchPanel'); }, setApi: function (api) { @@ -67,6 +74,11 @@ define([ return this; }, + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); + }, + onQuerySearch: function (d, w, opts) { if (opts.textsearch && opts.textsearch.length) { if (!this.api.asc_findText(opts.textsearch, d != 'back')) { diff --git a/apps/documenteditor/main/app/template/LeftMenu.template b/apps/documenteditor/main/app/template/LeftMenu.template index 27eef5966..f1b280f03 100644 --- a/apps/documenteditor/main/app/template/LeftMenu.template +++ b/apps/documenteditor/main/app/template/LeftMenu.template @@ -1,6 +1,7 @@
+ @@ -12,6 +13,7 @@
+ diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 69ef3d49f..7673a3f4b 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -76,6 +76,7 @@ define([ 'click #left-btn-plugins': _.bind(this.onCoauthOptions, this), 'click #left-btn-navigation': _.bind(this.onCoauthOptions, this), 'click #left-btn-thumbnails': _.bind(this.onCoauthOptions, this), + 'click #left-btn-searchbar': _.bind(this.onCoauthOptions, this), 'click #left-btn-support': function() { var config = this.mode.customization; config && !!config.feedback && !!config.feedback.url ? @@ -101,6 +102,15 @@ define([ enableToggle: true }); + this.btnSearchBar = new Common.UI.Button({ + action: 'searchbar', + el: $markup.elementById('#left-btn-searchbar'), + hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'), + disabled: true, + enableToggle: true, + toggleGroup: 'leftMenuGroup' + }); + this.btnAbout = new Common.UI.Button({ action: 'about', el: $markup.elementById('#left-btn-about'), @@ -162,6 +172,7 @@ define([ this.btnNavigation.on('click', this.onBtnMenuClick.bind(this)); this.btnSearch.on('click', this.onBtnMenuClick.bind(this)); + this.btnSearchBar.on('click', this.onBtnMenuClick.bind(this)); this.btnAbout.on('toggle', this.onBtnMenuToggle.bind(this)); this.menuFile = new DE.Views.FileMenu(); @@ -257,6 +268,13 @@ define([ this.panelThumbnails.hide(); } } + if (this.panelSearch) { + if (this.btnSearchBar.pressed) { + this.panelSearch.show(); + } else { + this.panelSearch.hide(); + } + } /** coauthoring end **/ // if (this.mode.canPlugins && this.panelPlugins) { // if (this.btnPlugins.pressed) { @@ -285,6 +303,9 @@ define([ if (name == 'thumbnails') { this.panelThumbnails = panel.render('#left-panel-thumbnails'); } + if (name == 'searchbar') { + this.panelSearch = panel.render('#left-panel-search'); + } }, /** coauthoring begin **/ @@ -329,11 +350,15 @@ define([ this.panelNavigation['hide'](); this.btnNavigation.toggle(false, true); } + if (this.panelSearch) { + this.panelSearch['hide'](); + this.btnSearchBar.toggle(false, true); + } } }, isOpened: function() { - var isopened = this.btnSearch.pressed; + var isopened = this.btnSearchBar.pressed; /** coauthoring begin **/ !isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed); /** coauthoring end **/ @@ -342,6 +367,7 @@ define([ disableMenu: function(menu, disable) { this.btnSearch.setDisabled(false); + this.btnSearchBar.setDisabled(false); this.btnAbout.setDisabled(false); this.btnSupport.setDisabled(false); /** coauthoring begin **/ From c44fdfc61eee80cba1338572d5c43c0cc53e9168 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sat, 12 Feb 2022 15:36:32 +0300 Subject: [PATCH 04/52] Add icons for new search --- .../resources/img/toolbar/1.25x/more-vertical.png | Bin 0 -> 107 bytes .../resources/img/toolbar/1.5x/more-vertical.png | Bin 0 -> 134 bytes .../resources/img/toolbar/1.75x/more-vertical.png | Bin 0 -> 140 bytes .../resources/img/toolbar/1x/more-vertical.png | Bin 0 -> 104 bytes .../resources/img/toolbar/2x/more-vertical.png | Bin 0 -> 172 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/common/main/resources/img/toolbar/1.25x/more-vertical.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/more-vertical.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/more-vertical.png create mode 100644 apps/common/main/resources/img/toolbar/1x/more-vertical.png create mode 100644 apps/common/main/resources/img/toolbar/2x/more-vertical.png diff --git a/apps/common/main/resources/img/toolbar/1.25x/more-vertical.png b/apps/common/main/resources/img/toolbar/1.25x/more-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..2abea9e3f3382c17fa86882f54a837df1cf8670a GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^MnEjd!3HFYLuy?>0-i38Ar-gYUOvdlV8Fw?@y-4e zw?dARCMSDWCjJMF!Z?70~9WdZwar}Sh z*H2Y}#7|73CwVxohgV!@YVg1Ded&Ee&oa5{s)9Ik%O5l3Vr;jyv4_9cozD{zwKP-; gL_{rRe88{geWI%E+5GBLK!X`PUHx3vIVCg!0HLrhLI3~& literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.75x/more-vertical.png b/apps/common/main/resources/img/toolbar/1.75x/more-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..a9158bfc49390363307eae4d2fa135a1327896df GIT binary patch literal 140 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!3HEX#cOhbRIsOuV@SoVw^tpx8Vq<`58kuc zSt-Kf8pC}yiOuP|{HbVe1_rxF`(Axtv8t=;NK4|Y(&g^AOFu(u+ literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1x/more-vertical.png b/apps/common/main/resources/img/toolbar/1x/more-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..07d127a2548e900cb9e8b624464234c653599902 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<}Qjv*Dd-d@_s$>6}lyz$Nc z6t}{PAA*-$nZE0-*|63egawTvkP%DF{tDnm{r-UW| D^Y9|W literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/2x/more-vertical.png b/apps/common/main/resources/img/toolbar/2x/more-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..b2338321dbe00ef6d37ed04eaf427aa68c808efc GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^0YI$5!3HEV6KWZORI#UvV@SoVx7QAGGAQ!6I$B>n zr>m&CLvYgu)s#dwrg`#m|0ICQ>dihY Date: Mon, 14 Feb 2022 19:16:04 +0300 Subject: [PATCH 05/52] [DE] New search: make show search panel from search window --- .../main/lib/template/SearchPanel.template | 2 +- apps/common/main/lib/view/SearchBar.js | 3 ++- apps/common/main/lib/view/SearchPanel.js | 8 +++++++- .../main/app/controller/LeftMenu.js | 17 +++++++++++++++-- .../main/app/controller/Search.js | 4 +++- apps/documenteditor/main/app/view/LeftMenu.js | 11 +++++++++-- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/apps/common/main/lib/template/SearchPanel.template b/apps/common/main/lib/template/SearchPanel.template index 808667fbe..079887f33 100644 --- a/apps/common/main/lib/template/SearchPanel.template +++ b/apps/common/main/lib/template/SearchPanel.template @@ -1,6 +1,6 @@