From 0edd55e5f233929afb80c2c4c49f5d7560293e52 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sun, 27 Sep 2020 13:48:53 +0300 Subject: [PATCH] [DE] Add focus manager --- .../main/app/view/NoteSettingsDialog.js | 20 ++++++++++++++++++- .../main/app/view/PageMarginsDialog.js | 12 ++++++++++- .../main/app/view/PageSizeDialog.js | 10 +++++++++- .../main/app/view/TableFormulaDialog.js | 14 +++++++++---- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/apps/documenteditor/main/app/view/NoteSettingsDialog.js b/apps/documenteditor/main/app/view/NoteSettingsDialog.js index 3f13ac7ef..7b4f48182 100644 --- a/apps/documenteditor/main/app/view/NoteSettingsDialog.js +++ b/apps/documenteditor/main/app/view/NoteSettingsDialog.js @@ -50,7 +50,8 @@ define([ options: { contentWidth: 300, height: 380, - buttons: null + buttons: null, + focusManager: true }, initialize : function(options) { @@ -159,6 +160,9 @@ define([ this.radioFootnote.on('change', function(field, newValue, eOpts) { if (newValue) { me.changeNoteType(false); + setTimeout(function(){ + me.cmbFootnote.focus(); + }, 1); } }); @@ -170,6 +174,9 @@ define([ this.radioEndnote.on('change', function(field, newValue, eOpts) { if (newValue) { me.changeNoteType(true); + setTimeout(function(){ + me.cmbEndnote.focus(); + }, 1); } }); @@ -178,6 +185,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 150px;', editable: false, + takeFocusOnClose: true, data: [ { displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom }, { displayValue: this.textTextBottom, value: Asc.c_oAscFootnotePos.BeneathText } @@ -190,6 +198,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 150px;', editable: false, + takeFocusOnClose: true, data: [ { displayValue: this.textSectEnd, value: Asc.c_oAscFootnotePos.SectEnd }, { displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom } @@ -202,6 +211,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 150px;', editable: false, + takeFocusOnClose: true, data: [ { displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal, maskExp: /[0-9]/, defValue: 1 }, { displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter, maskExp: /[a-z]/, defValue: 'a' }, @@ -235,6 +245,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 150px;', editable: false, + takeFocusOnClose: true, data: this._arrNumbering }); this.cmbNumbering.setValue(Asc.c_oAscFootnoteRestart.Continuous); @@ -257,6 +268,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 150px;', editable: false, + takeFocusOnClose: true, data: [ { displayValue: this.textDocument, value: 1 }, { displayValue: this.textSection, value: 0 } @@ -273,6 +285,12 @@ define([ afterRender: function() { this._setDefaults(this.props); + + this.focusManager.add([this.cmbFootnote, this.cmbEndnote, this.cmbFormat, this.spnStart, this.cmbNumbering, this.txtCustom, this.cmbApply], '.form-control'); + var me = this; + setTimeout(function(){ + me.cmbFormat.focus(); + }, 100); }, show: function() { diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index b63c61d18..5a07f94e0 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -50,7 +50,8 @@ define([ style: 'min-width: 404px;', cls: 'modal-dlg', id: 'window-page-margins', - buttons: ['ok', 'cancel'] + buttons: ['ok', 'cancel'], + focusManager: true }, initialize : function(options) { @@ -213,6 +214,7 @@ define([ menuStyle : 'min-width: 86px;', style : 'width: 86px;', editable : false, + takeFocusOnClose: true, cls : 'input-group-nr', data : [ { value: 0, displayValue: this.textLeft }, @@ -232,6 +234,7 @@ define([ menuStyle : 'min-width: 180px;', style : 'width: 180px;', editable : false, + takeFocusOnClose: true, cls : 'input-group-nr', data : [ { value: 0, displayValue: this.textPortrait }, @@ -275,6 +278,7 @@ define([ menuStyle : 'min-width: 180px;', style : 'width: 180px;', editable : false, + takeFocusOnClose: true, cls : 'input-group-nr', data : [ { value: 0, displayValue: this.textNormal }, @@ -303,6 +307,12 @@ define([ this.window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.updateMetricUnit(); + + this.focusManager.add([this.spnTop, this.spnBottom, this.spnLeft, this.spnRight, this.spnGutter, this.cmbGutterPosition, this.cmbOrientation, this.cmbMultiplePages], '.form-control'); + var me = this; + setTimeout(function(){ + me.spnTop.focus(); + }, 100); }, _handleInput: function(state) { diff --git a/apps/documenteditor/main/app/view/PageSizeDialog.js b/apps/documenteditor/main/app/view/PageSizeDialog.js index 50a32ce27..f1dd0f770 100644 --- a/apps/documenteditor/main/app/view/PageSizeDialog.js +++ b/apps/documenteditor/main/app/view/PageSizeDialog.js @@ -50,7 +50,8 @@ define([ style: 'min-width: 216px;', cls: 'modal-dlg', id: 'window-page-size', - buttons: ['ok', 'cancel'] + buttons: ['ok', 'cancel'], + focusManager: true }, initialize : function(options) { @@ -129,6 +130,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 183px;max-height: 208px;', editable: false, + takeFocusOnClose: true, scrollAlwaysVisible: true, data: [ { value: 0, displayValue: 'US Letter', size: [215.9, 279.4]}, @@ -166,6 +168,12 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.updateMetricUnit(); + + this.focusManager.add([this.cmbPreset, this.spnWidth, this.spnHeight], '.form-control'); + var me = this; + setTimeout(function(){ + me.cmbPreset.focus(); + }, 100); }, _handleInput: function(state) { diff --git a/apps/documenteditor/main/app/view/TableFormulaDialog.js b/apps/documenteditor/main/app/view/TableFormulaDialog.js index 44ad3eba0..51500d6a2 100644 --- a/apps/documenteditor/main/app/view/TableFormulaDialog.js +++ b/apps/documenteditor/main/app/view/TableFormulaDialog.js @@ -48,7 +48,8 @@ define([ width: 300, style: 'min-width: 230px;', cls: 'modal-dlg', - buttons: ['ok', 'cancel'] + buttons: ['ok', 'cancel'], + focusManager: true }, initialize : function(options) { @@ -96,7 +97,8 @@ define([ this.cmbFormat = new Common.UI.ComboBox({ el : $('#id-dlg-formula-format'), cls : 'input-group-nr', - menuStyle : 'min-width: 100%; max-height: 200px;' + menuStyle : 'min-width: 100%; max-height: 200px;', + takeFocusOnClose: true }); this.cmbFunction = new Common.UI.ComboBox({ @@ -104,6 +106,7 @@ define([ cls : 'input-group-nr', menuStyle : 'min-width: 100%; max-height: 150px;', editable : false, + takeFocusOnClose: true, scrollAlwaysVisible: true, data: [ {displayValue: 'ABS', value: 1}, @@ -141,7 +144,8 @@ define([ el : $('#id-dlg-formula-bookmark'), cls : 'input-group-nr', menuStyle : 'min-width: 100%; max-height: 150px;', - editable : false + editable : false, + takeFocusOnClose: true }); this.cmbBookmark.on('selected', _.bind(function(combo, record) { combo.setValue(this.textBookmark); @@ -160,6 +164,8 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.afterRender(); + + this.focusManager.add([this.inputFormula, this.cmbFormat, this.cmbFunction, this.cmbBookmark], '.form-control'); }, onSelectItem: function(picker, item, record, e){ @@ -171,7 +177,7 @@ define([ var me = this; _.delay(function(){ - me.inputFormula.cmpEl.find('input').focus(); + me.inputFormula.focus(); },500); },