From 03069417fb28049926bf814338425529b6ca0aff Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 20 Sep 2021 17:38:41 +0300 Subject: [PATCH] Add focus to menu with dataview items --- apps/common/main/lib/component/DataView.js | 12 ++++++++---- apps/documenteditor/main/app/controller/Toolbar.js | 5 ++++- apps/documenteditor/main/app/view/Toolbar.js | 10 ++++------ .../main/app/controller/DocumentHolder.js | 2 ++ .../main/app/view/FormatRulesEditDlg.js | 2 ++ 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index e09b8f9d3..86db1a9a7 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -701,7 +701,8 @@ define([ } else if (data.keyCode==Common.UI.Keys.UP) { if (topIdx==0 && this.outerMenu && this.outerMenu.menu) { this.deselectAll(true); - this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + return; } else while (idx===undefined) { topIdx--; @@ -711,7 +712,8 @@ define([ } else { if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) { this.deselectAll(true); - this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + return; } else while (idx===undefined) { topIdx++; @@ -1171,7 +1173,8 @@ define([ } else if (data.keyCode==Common.UI.Keys.UP) { if (topIdx==0 && this.outerMenu && this.outerMenu.menu) { this.deselectAll(true); - this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + return; } else while (idx===undefined) { topIdx--; @@ -1181,7 +1184,8 @@ define([ } else { if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) { this.deselectAll(true); - this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index); + return; } else while (idx===undefined) { topIdx++; diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 31705aa9e..3ca7e25b8 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2181,10 +2181,13 @@ define([ } }, - onInsertPageNumberClick: function(picker, item, record) { + onInsertPageNumberClick: function(picker, item, record, e) { if (this.api) this.api.put_PageNum(record.get('data').type, record.get('data').subtype); + if (e.type !== 'click') + this.toolbar.btnEditHeader.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Page Number'); }, diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index f5a7a2a32..99efa6dab 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2080,9 +2080,11 @@ define([ this.mnuPageNumberPosPicker = new Common.UI.DataView({ el: $('#id-toolbar-menu-pageposition'), allowScrollbar: false, + parentMenu: this.mnuInsertPageNum.menu, + outerMenu: {menu: this.mnuInsertPageNum.menu, index: 0}, + showLast: false, store: new Common.UI.DataViewStore([ { - allowSelected: false, iconname: 'page-number-top-left', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_TOP, @@ -2090,7 +2092,6 @@ define([ } }, { - allowSelected: false, iconname: 'page-number-top-center', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_TOP, @@ -2098,7 +2099,6 @@ define([ } }, { - allowSelected: false, iconname: 'page-number-top-right', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_TOP, @@ -2106,7 +2106,6 @@ define([ } }, { - allowSelected: false, iconname: 'page-number-bottom-left', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, @@ -2114,7 +2113,6 @@ define([ } }, { - allowSelected: false, iconname: 'page-number-bottom-center', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, @@ -2122,7 +2120,6 @@ define([ } }, { - allowSelected: false, iconname: 'page-number-bottom-right', data: { type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, @@ -2133,6 +2130,7 @@ define([ itemTemplate: _.template('
') }); _conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled); + this.mnuInsertPageNum.menu.setInnerMenu([{menu: this.mnuPageNumberPosPicker, index: 0}]); this.mnuTablePicker = new Common.UI.DimensionPicker({ el: $('#id-toolbar-menu-tablepicker'), diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ff1223e9e..f680e44fd 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -3567,6 +3567,7 @@ define([ view.paraBulletsPicker = new Common.UI.DataView({ el : $('#id-docholder-menu-bullets'), parentMenu : view.menuParagraphBullets.menu, + outerMenu: {menu: view.menuParagraphBullets.menu, index: 0}, groups : view.paraBulletsPicker.groups, store : view.paraBulletsPicker.store, itemTemplate: _.template('<% if (type==0) { %>' + @@ -3576,6 +3577,7 @@ define([ '<% } %>') }); view.paraBulletsPicker.on('item:click', _.bind(this.onSelectBullets, this)); + view.menuParagraphBullets.menu.setInnerMenu([{menu: view.paraBulletsPicker, index: 0}]); _conf && view.paraBulletsPicker.selectRecord(_conf.rec, true); }, diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 390a7504e..4172db974 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -664,11 +664,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', var picker = new Common.UI.DataView({ el: $('#format-rules-combo-menu-icon-' + (i+1)), parentMenu: menu, + outerMenu: {menu: menu, index: 1}, store: new Common.UI.DataViewStore(me.iconsList), itemTemplate: _.template(''), type : i }); picker.on('item:click', _.bind(this.onSelectIcon, this, combo, menu.items[0])); + menu.setInnerMenu([{menu: picker, index: 1}]); menu.items[0].on('toggle', _.bind(this.onSelectNoIcon, this, combo, picker)); this.iconsControls[i].cmbIcons = combo;