From 4ac766e89ca89c244156bbf3ea5817b48efda9f2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 17 Jan 2017 16:40:18 +0300 Subject: [PATCH] [SSE] Use Ctrl+1 for opening FormatSettingsDialog. --- .../main/app/controller/Toolbar.js | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index ea4fc6506..c13d254a8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -890,25 +890,31 @@ define([ if (this.api) this.api.asc_setCellFormat(record.format); } else { - var me = this, - value = Common.localStorage.getItem("sse-settings-reg-settings"); - value = (value!==null) ? parseInt(value) : ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409); - - (new SSE.Views.FormatSettingsDialog({ - api: me.api, - handler: function(result, settings) { - if (settings) { - me.api.asc_setCellFormat(settings.format); - } - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - }, - props : {formatType: me._state.numformattype, langId: value} - })).show(); + this.onCustomNumberFormat(); } Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Number Format'); }, + onCustomNumberFormat: function() { + var me = this, + value = Common.localStorage.getItem("sse-settings-reg-settings"); + value = (value!==null) ? parseInt(value) : ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409); + + (new SSE.Views.FormatSettingsDialog({ + api: me.api, + handler: function(result, settings) { + if (settings) { + me.api.asc_setCellFormat(settings.format); + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + }, + props : {formatType: me._state.numformattype, langId: value} + })).show(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Number Format'); + }, + onNumberFormatOpenBefore: function(combo) { if (this.api) { var me = this; @@ -1289,6 +1295,13 @@ define([ if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.toolbar.mode.isEditDiagram && !me.api.isCellEdited && !me._state.multiselect) me.onHyperlink(); e.preventDefault(); + }, + 'command+1,ctrl+1': function(e) { + if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.api.isCellEdited && !me.toolbar.cmbNumberFormat.isDisabled()) { + me.onCustomNumberFormat(); + } + + return false; } } }); @@ -1528,8 +1541,8 @@ define([ }); var is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart); - (is_cell_edited) ? Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h') : - Common.util.Shortcuts.resumeEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h'); + (is_cell_edited) ? Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1') : + Common.util.Shortcuts.resumeEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1'); if (is_cell_edited) { toolbar.listStyles.suspendEvents(); @@ -2582,10 +2595,10 @@ define([ var left = toolbar.isCompactView ? 75 : (toolbar.mode.nativeApp ? 80 : 48 ); mask.css('left', left + 'px'); mask.css('right', (toolbar.isCompactView ? 0 : 45) + 'px'); - Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h'); + Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1'); } else { mask.remove(); - Common.util.Shortcuts.resumeEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h'); + Common.util.Shortcuts.resumeEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1'); } },