diff --git a/apps/common/main/lib/core/keymaster.js b/apps/common/main/lib/core/keymaster.js index 29a5b1502..9cf5a0ee6 100644 --- a/apps/common/main/lib/core/keymaster.js +++ b/apps/common/main/lib/core/keymaster.js @@ -36,7 +36,8 @@ return _MAP[x] || x.toUpperCase().charCodeAt(0); }, _downKeys = []; - var locked; + var locked, + propagate; for(k=1;k<20;k++) _MAP['f'+k] = 111+k; @@ -116,6 +117,8 @@ // call the handler and stop the event if neccessary if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){ if(locked===true || handler.locked || handler.method(event, handler)===false){ + if (locked===true && propagate || handler.locked && handler.propagate) + continue; if(event.preventDefault) event.preventDefault(); else event.returnValue = false; if(event.stopPropagation) event.stopPropagation(); @@ -188,8 +191,8 @@ if (keys.length > 1) { mods = getMods(keys); - key = keys[keys.length - 1]; } + (keys.length > 0) && (key = keys[keys.length - 1]); key = code(key); @@ -301,8 +304,8 @@ if (keys.length > 1) { mods = getMods(keys); - key = keys[keys.length - 1]; } + (keys.length > 0) && (key = keys[keys.length - 1]); key = code(key); @@ -320,12 +323,23 @@ } } - function suspend(key, scope) { - key ? setKeyOptions(key, scope, 'locked', true) : (locked = true); + function suspend(key, scope, pass) { + if (key) { + setKeyOptions(key, scope, 'locked', true) + pass && setKeyOptions(key, scope, 'propagate', true) + } else { + locked = true; + pass && (propagate = true); + } } - function resume(key, scope) { - key ? setKeyOptions(key, scope, 'locked', false) : (locked = false); + function resume(key, scope) { + if (key) { + setKeyOptions(key, scope, 'locked', false) + setKeyOptions(key, scope, 'propagate', false) + } else { + locked = propagate = false; + } } // set window.key and window.key.set/get/deleteScope, and the default filter diff --git a/apps/common/main/lib/util/Shortcuts.js b/apps/common/main/lib/util/Shortcuts.js index f34ae1ce5..de36581ce 100644 --- a/apps/common/main/lib/util/Shortcuts.js +++ b/apps/common/main/lib/util/Shortcuts.js @@ -148,8 +148,8 @@ Common.util = Common.util||{}; } }, - suspendEvents: function(key,scope) { - window.key.suspend(key,scope); + suspendEvents: function(key,scope,propagate) { + window.key.suspend(key,scope,propagate); }, resumeEvents: function(key,scope) { diff --git a/apps/documenteditor/main/app/controller/DocumentHolder.js b/apps/documenteditor/main/app/controller/DocumentHolder.js index 0d5219db4..616d2fa71 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolder.js +++ b/apps/documenteditor/main/app/controller/DocumentHolder.js @@ -143,7 +143,8 @@ define([ me.userTooltip = true; me.wrapEvents = { userTipMousover: _.bind(me.userTipMousover, me), - userTipMousout: _.bind(me.userTipMousout, me) + userTipMousout: _.bind(me.userTipMousout, me), + onKeyUp: _.bind(me.onKeyUp, me) }; var keymap = {}; @@ -643,6 +644,9 @@ define([ var me = this; if (me.api){ var key = event.keyCode; + if (me.hkSpecPaste) { + me._needShowSpecPasteMenu = !event.shiftKey && !event.altKey && event.keyCode == Common.UI.Keys.CTRL; + } if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey){ if (key === Common.UI.Keys.NUM_PLUS || key === Common.UI.Keys.EQUALITY || (Common.Utils.isGecko && key === Common.UI.Keys.EQUALITY_FF) || (Common.Utils.isOpera && key == 43)){ me.api.zoomIn(); @@ -1087,8 +1091,10 @@ define([ parentEl: $('#id-document-holder-btn-special-paste'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paste', + caption : Common.Utils.String.platformKey('Ctrl', '({0})'), menu : new Common.UI.Menu({items: []}) }); + me.initSpecialPasteEvents(); } if (pasteItems.length>0) { @@ -1101,20 +1107,18 @@ define([ var group_prev = -1; _.each(pasteItems, function(menuItem, index) { var mnu = new Common.UI.MenuItem({ - caption: me._arrSpecialPaste[menuItem], + caption: me._arrSpecialPaste[menuItem] + ' (' + me.hkSpecPaste[menuItem] + ')', value: menuItem, checkable: true, toggleGroup : 'specialPasteGroup' - }).on('click', function(item, e) { - me.api.asc_SpecialPaste(item.value); - setTimeout(function(){menu.hide();}, 100); - }); + }).on('click', _.bind(me.onSpecialPasteItemClick, me)); menu.addItem(mnu); }); (menu.items.length>0) && menu.items[0].setChecked(true, true); } if (coord.asc_getX()<0 || coord.asc_getY()<0) { if (pasteContainer.is(':visible')) pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); } else { var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3]; if (!Common.Utils.InternalSettings.get("de-hidden-rulers")) { @@ -1122,13 +1126,54 @@ define([ } pasteContainer.css({left: showPoint[0], top : showPoint[1]}); pasteContainer.show(); + setTimeout(function() { + $(document).on('keyup', me.wrapEvents.onKeyUp); + }, 10); } }, onHideSpecialPasteOptions: function() { var pasteContainer = this.documentHolder.cmpEl.find('#special-paste-container'); - if (pasteContainer.is(':visible')) + if (pasteContainer.is(':visible')) { pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); + } + }, + + onKeyUp: function (e) { + if (e.keyCode == Common.UI.Keys.CTRL && this._needShowSpecPasteMenu && !this.btnSpecialPaste.menu.isVisible() && /area_id/.test(e.target.id)) { + $('button', this.btnSpecialPaste.cmpEl).click(); + e.preventDefault(); + } + this._needShowSpecPasteMenu = false; + }, + + initSpecialPasteEvents: function() { + var me = this; + me.hkSpecPaste = []; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.insertAsNestedTable] = 'N'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.overwriteCells] = 'O'; + for(var key in me.hkSpecPaste){ + if(me.hkSpecPaste.hasOwnProperty(key)){ + var keymap = {}; + keymap[me.hkSpecPaste[key]] = _.bind(me.onSpecialPasteItemClick, me, {value: parseInt(key)}); + Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap}); + Common.util.Shortcuts.suspendEvents(me.hkSpecPaste[key], undefined, true); + } + } + + me.btnSpecialPaste.menu.on('show:after', function(menu) { + for (var i = 0; i < menu.items.length; i++) { + me.hkSpecPaste[menu.items[i].value] && Common.util.Shortcuts.resumeEvents(me.hkSpecPaste[menu.items[i].value]); + } + }).on('hide:after', function(menu) { + for (var i = 0; i < menu.items.length; i++) { + me.hkSpecPaste[menu.items[i].value] && Common.util.Shortcuts.suspendEvents(me.hkSpecPaste[menu.items[i].value], undefined, true); + } + }); }, onDoubleClickOnChart: function(chart) { @@ -2233,6 +2278,22 @@ define([ this.documentHolder.fireEvent('links:contents', [item.value, true]); }, + onSpecialPasteItemClick: function(item, e) { + if (this.api) { + this.api.asc_SpecialPaste(item.value); + var menu = this.btnSpecialPaste.menu; + if (!item.cmpEl) { + for (var i = 0; i < menu.items.length; i++) { + menu.items[i].setChecked(menu.items[i].value===item.value, true); + } + } + setTimeout(function(){ + menu.hide(); + }, 100); + } + return false; + }, + editComplete: function() { this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder); } diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 6a8b5fef6..7fe92b685 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -715,6 +715,7 @@ define([ case 'replace': case 'search': this.leftMenu.btnAbout.toggle(false); + Common.UI.Menu.Manager.hideAll(); var selectedText = this.api.asc_GetSelectedText(); if (this.isSearchPanelVisible()) { selectedText && this.leftMenu.panelSearch.setFindText(selectedText); diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index 71141128d..c8fdd94b8 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -122,7 +122,8 @@ define([ me.userTooltip = true; me.wrapEvents = { userTipMousover: _.bind(me.userTipMousover, me), - userTipMousout: _.bind(me.userTipMousout, me) + userTipMousout: _.bind(me.userTipMousout, me), + onKeyUp: _.bind(me.onKeyUp, me) }; // Hotkeys @@ -641,6 +642,9 @@ define([ var me = this; if (me.api){ var key = event.keyCode; + if (me.hkSpecPaste) { + me._needShowSpecPasteMenu = !event.shiftKey && !event.altKey && event.keyCode == Common.UI.Keys.CTRL; + } if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey){ if (key === Common.UI.Keys.NUM_PLUS || key === Common.UI.Keys.EQUALITY || (Common.Utils.isGecko && key === Common.UI.Keys.EQUALITY_FF) || (Common.Utils.isOpera && key == 43)){ me.api.zoomIn(); @@ -1171,8 +1175,10 @@ define([ parentEl: $('#id-document-holder-btn-special-paste'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paste', + caption : Common.Utils.String.platformKey('Ctrl', '({0})'), menu : new Common.UI.Menu({items: []}) }); + me.initSpecialPasteEvents(); } if (pasteItems.length>0) { @@ -1185,31 +1191,70 @@ define([ var group_prev = -1; _.each(pasteItems, function(menuItem, index) { var mnu = new Common.UI.MenuItem({ - caption: me._arrSpecialPaste[menuItem], + caption: me._arrSpecialPaste[menuItem] + ' (' + me.hkSpecPaste[menuItem] + ')', value: menuItem, checkable: true, toggleGroup : 'specialPasteGroup' - }).on('click', function(item, e) { - me.api.asc_SpecialPaste(item.value); - setTimeout(function(){menu.hide();}, 100); - }); + }).on('click', _.bind(me.onSpecialPasteItemClick, me)); menu.addItem(mnu); }); (menu.items.length>0) && menu.items[0].setChecked(true, true); } if (coord.asc_getX()<0 || coord.asc_getY()<0) { if (pasteContainer.is(':visible')) pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); } else { var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3]; pasteContainer.css({left: showPoint[0], top : showPoint[1]}); pasteContainer.show(); + setTimeout(function() { + $(document).on('keyup', me.wrapEvents.onKeyUp); + }, 10); } }, onHideSpecialPasteOptions: function() { var pasteContainer = this.documentHolder.cmpEl.find('#special-paste-container'); - if (pasteContainer.is(':visible')) + if (pasteContainer.is(':visible')) { pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); + } + }, + + onKeyUp: function (e) { + if (e.keyCode == Common.UI.Keys.CTRL && this._needShowSpecPasteMenu && !this.btnSpecialPaste.menu.isVisible() && /area_id/.test(e.target.id)) { + $('button', this.btnSpecialPaste.cmpEl).click(); + e.preventDefault(); + } + this._needShowSpecPasteMenu = false; + }, + + initSpecialPasteEvents: function() { + var me = this; + me.hkSpecPaste = []; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.picture] = 'U'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = 'H'; + for(var key in me.hkSpecPaste){ + if(me.hkSpecPaste.hasOwnProperty(key)){ + var keymap = {}; + keymap[me.hkSpecPaste[key]] = _.bind(me.onSpecialPasteItemClick, me, {value: parseInt(key)}); + Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap}); + Common.util.Shortcuts.suspendEvents(me.hkSpecPaste[key], undefined, true); + } + } + + me.btnSpecialPaste.menu.on('show:after', function(menu) { + for (var i = 0; i < menu.items.length; i++) { + me.hkSpecPaste[menu.items[i].value] && Common.util.Shortcuts.resumeEvents(me.hkSpecPaste[menu.items[i].value]); + } + }).on('hide:after', function(menu) { + for (var i = 0; i < menu.items.length; i++) { + me.hkSpecPaste[menu.items[i].value] && Common.util.Shortcuts.suspendEvents(me.hkSpecPaste[menu.items[i].value], undefined, true); + } + }); }, onChangeCropState: function(state) { @@ -2018,6 +2063,21 @@ define([ } }, + onSpecialPasteItemClick: function(item, e) { + if (this.api) { + this.api.asc_SpecialPaste(item.value); + var menu = this.btnSpecialPaste.menu; + if (!item.cmpEl) { + for (var i = 0; i < menu.items.length; i++) { + menu.items[i].setChecked(menu.items[i].value===item.value, true); + } + } + setTimeout(function(){ + menu.hide(); + }, 100); + } + return false; + }, SetDisabled: function(state) { this._isDisabled = state; diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index e02a0297d..672e45836 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -121,7 +121,8 @@ define([ me._TtHeight = 20; /** coauthoring begin **/ this.wrapEvents = { - apiHideComment: _.bind(this.onApiHideComment, this) + apiHideComment: _.bind(this.onApiHideComment, this), + onKeyUp: _.bind(this.onKeyUp, this) }; /** coauthoring end **/ @@ -1846,6 +1847,9 @@ define([ onDocumentKeyDown: function(event){ if (this.api){ var key = event.keyCode; + if (this.hkSpecPaste) { + this._needShowSpecPasteMenu = !event.shiftKey && !event.altKey && event.keyCode == Common.UI.Keys.CTRL; + } if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey){ if (key === Common.UI.Keys.NUM_PLUS || key === Common.UI.Keys.EQUALITY || (Common.Utils.isGecko && key === Common.UI.Keys.EQUALITY_FF) || (Common.Utils.isOpera && key == 43)){ if (!this.api.isCellEdited) { @@ -2944,8 +2948,10 @@ define([ parentEl: $('#id-document-holder-btn-special-paste'), cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paste', + caption : Common.Utils.String.platformKey('Ctrl', '({0})'), menu : new Common.UI.Menu({items: []}) }); + me.initSpecialPasteEvents(); } if (pasteItems.length>0) { @@ -2963,49 +2969,19 @@ define([ _.each(pasteItems, function(menuItem, index) { if (menuItem == Asc.c_oSpecialPasteProps.useTextImport) { importText = new Common.UI.MenuItem({ - caption: me._arrSpecialPaste[menuItem][0], + caption: me._arrSpecialPaste[menuItem][0] + (me.hkSpecPaste[menuItem] ? ' (' + me.hkSpecPaste[menuItem] + ')' : ''), value: menuItem, checkable: true, toggleGroup : 'specialPasteGroup' - }).on('click', function(item, e) { - (new Common.Views.OpenDialog({ - title: me.txtImportWizard, - closable: true, - type: Common.Utils.importTextType.Paste, - preview: true, - api: me.api, - handler: function (result, settings) { - if (result == 'ok') { - if (me && me.api) { - var props = new Asc.SpecialPasteProps(); - props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport); - props.asc_setAdvancedOptions(settings.textOptions); - me.api.asc_SpecialPaste(props); - } - me._state.lastSpecPasteChecked = item; - } else { - item.setChecked(false, true); - me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); - } - } - })).show(); - setTimeout(function(){menu.hide();}, 100); - }); + }).on('click', _.bind(me.onSpecialPasteItemClick, me)); me._arrSpecialPaste[menuItem][2] = importText; } else if (me._arrSpecialPaste[menuItem]) { var mnu = new Common.UI.MenuItem({ - caption: me._arrSpecialPaste[menuItem][0], + caption: me._arrSpecialPaste[menuItem][0] + (me.hkSpecPaste[menuItem] ? ' (' + me.hkSpecPaste[menuItem] + ')' : ''), value: menuItem, checkable: true, toggleGroup : 'specialPasteGroup' - }).on('click', function(item, e) { - me._state.lastSpecPasteChecked = item; - - var props = new Asc.SpecialPasteProps(); - props.asc_setProps(item.value); - me.api.asc_SpecialPaste(props); - setTimeout(function(){menu.hide();}, 100); - }); + }).on('click', _.bind(me.onSpecialPasteItemClick, me)); groups[me._arrSpecialPaste[menuItem][1]].push(mnu); me._arrSpecialPaste[menuItem][2] = mnu; } @@ -3056,6 +3032,7 @@ define([ if ( coord[0].asc_getX()<0 || coord[0].asc_getY()<0) { if (pasteContainer.is(':visible')) pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); return; } @@ -3081,12 +3058,117 @@ define([ pasteContainer.css({left: showPoint[0], top : showPoint[1]}); pasteContainer.show(); + setTimeout(function() { + $(document).on('keyup', me.wrapEvents.onKeyUp); + }, 10); }, onHideSpecialPasteOptions: function() { var pasteContainer = this.documentHolder.cmpEl.find('#special-paste-container'); - if (pasteContainer.is(':visible')) + if (pasteContainer.is(':visible')) { pasteContainer.hide(); + $(document).off('keyup', this.wrapEvents.onKeyUp); + } + }, + + onSpecialPasteItemClick: function(item, e) { + var me = this, + menu = this.btnSpecialPaste.menu; + if (item.value == Asc.c_oSpecialPasteProps.useTextImport) { + (new Common.Views.OpenDialog({ + title: me.txtImportWizard, + closable: true, + type: Common.Utils.importTextType.Paste, + preview: true, + api: me.api, + handler: function (result, settings) { + if (result == 'ok') { + if (me && me.api) { + var props = new Asc.SpecialPasteProps(); + props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport); + props.asc_setAdvancedOptions(settings.textOptions); + me.api.asc_SpecialPaste(props); + } + me._state.lastSpecPasteChecked = item; + } else if (item.cmpEl) { + item.setChecked(false, true); + me._state.lastSpecPasteChecked && me._state.lastSpecPasteChecked.setChecked(true, true); + } + } + })).show(); + setTimeout(function(){menu.hide();}, 100); + } else { + me._state.lastSpecPasteChecked = item; + var props = new Asc.SpecialPasteProps(); + props.asc_setProps(item.value); + me.api.asc_SpecialPaste(props); + setTimeout(function(){menu.hide();}, 100); + } + if (!item.cmpEl && me._state.lastSpecPasteChecked) { + for (var i = 0; i < menu.items.length; i++) { + menu.items[i].setChecked(menu.items[i].value===me._state.lastSpecPasteChecked.value, true); + } + } + return false; + }, + + onKeyUp: function (e) { + if (e.keyCode == Common.UI.Keys.CTRL && this._needShowSpecPasteMenu && !this.btnSpecialPaste.menu.isVisible() && /area_id/.test(e.target.id)) { + $('button', this.btnSpecialPaste.cmpEl).click(); + e.preventDefault(); + } + this._needShowSpecPasteMenu = false; + }, + + initSpecialPasteEvents: function() { + var me = this; + me.hkSpecPaste = []; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.paste] = 'P'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula] = 'F'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat] = 'O'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting] = 'K'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders] = 'B'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth] = 'W'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating] = 'G'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.transpose] = 'T'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues] = 'V'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueNumberFormat] = 'A'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.valueAllFormating] = 'E'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating] = 'R'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.link] = 'N'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.picture] = 'U'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.linkedPicture] = 'I'; + + me.hkSpecPaste[Asc.c_oSpecialPasteProps.sourceformatting] = 'K'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = 'M'; + me.hkSpecPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = 'T'; + // me.hkSpecPaste[Asc.c_oSpecialPasteProps.useTextImport] = ''; + + var str = ''; + for(var key in me.hkSpecPaste){ + if(me.hkSpecPaste.hasOwnProperty(key)){ + if (str.indexOf(me.hkSpecPaste[key])<0) + str += me.hkSpecPaste[key] + ','; + } + } + str = str.substring(0, str.length-1) + var keymap = {}; + keymap[str] = _.bind(function(e) { + var menu = this.btnSpecialPaste.menu; + for (var i = 0; i < menu.items.length; i++) { + if (this.hkSpecPaste[menu.items[i].value] === String.fromCharCode(e.keyCode)) { + return me.onSpecialPasteItemClick({value: menu.items[i].value}); + } + } + }, me); + Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap}); + Common.util.Shortcuts.suspendEvents(str, undefined, true); + + me.btnSpecialPaste.menu.on('show:after', function(menu) { + Common.util.Shortcuts.resumeEvents(str); + }).on('hide:after', function(menu) { + Common.util.Shortcuts.suspendEvents(str, undefined, true); + }); }, onToggleAutoCorrectOptions: function(autoCorrectOptions) {