diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index e451e0d7c..490c83490 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -232,6 +232,7 @@ define([ }, onBeforeShowMenu: function(e) { + Common.NotificationCenter.trigger('menu:show'); this.trigger('show:before', this, e); if (this.options.hint) { var tip = this.cmpEl.data('bs.tooltip'); @@ -273,6 +274,7 @@ define([ onAfterHideMenu: function(e) { this.cmpEl.find('.dropdown-toggle').blur(); this.trigger('hide:after', this, e); + Common.NotificationCenter.trigger('menu:hide'); }, onAfterKeydownMenu: function(e) { diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index a68db2469..5cac51db6 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -410,6 +410,8 @@ define([ }, onBeforeShowMenu: function(e) { + Common.NotificationCenter.trigger('menu:show'); + if (this.mustLayout) { delete this.mustLayout; this.doLayout.call(this); @@ -439,6 +441,7 @@ define([ onAfterHideMenu: function(e) { this.trigger('hide:after', this, e); + Common.NotificationCenter.trigger('menu:hide'); }, onAfterKeydownMenu: function(e) { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a8c1e8e24..cc1fe52b8 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -172,7 +172,8 @@ define([ /* * TODO: Workaround bug #25004. Clipboard feature processing in sdk. */ - if (!(Common.Utils.isSafari && Common.Utils.isMac) && !/area_id/.test(e.target.id)) { + if (!(Common.Utils.isSafari && Common.Utils.isMac) && !/area_id/.test(e.target.id) && + $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */) { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; @@ -214,6 +215,15 @@ define([ me.onEditComplete(); } }, + 'menu:show': function(e){ + me.api.asc_enableKeyEvents(false); + }, + 'menu:hide': function(e){ + if (!me.isModalShowed) { + me.api.asc_enableKeyEvents(true); + me.onEditComplete(); + } + }, 'edit:complete': _.bind(me.onEditComplete, me) }); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index f7a799eeb..cf5ddf146 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -154,7 +154,8 @@ define([ /* * TODO: Workaround bug #25004. Clipboard feature processing in sdk. */ - if (!(Common.Utils.isSafari && Common.Utils.isMac) && !/area_id/.test(e.target.id)) { + if (!(Common.Utils.isSafari && Common.Utils.isMac) && !/area_id/.test(e.target.id) && + $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */) { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; @@ -196,6 +197,15 @@ define([ me.onEditComplete(); } }, + 'menu:show': function(e){ + me.api.asc_enableKeyEvents(false); + }, + 'menu:hide': function(e){ + if (!me.isModalShowed) { + me.api.asc_enableKeyEvents(true); + me.onEditComplete(); + } + }, 'edit:complete': _.bind(me.onEditComplete, me) }); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index ab8840d6a..25545b4ab 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -172,7 +172,8 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (this.isAppDisabled === true) return; - if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && !/area_id/.test(e.target.id)) { + if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && !/area_id/.test(e.target.id) && + $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */) { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; @@ -212,6 +213,15 @@ define([ me.onEditComplete(); } }, + 'menu:show': function(e){ + me.api.asc_enableKeyEvents(false); + }, + 'menu:hide': function(e){ + if (!me.isModalShowed) { + me.api.asc_enableKeyEvents(true); + me.onEditComplete(); + } + }, 'edit:complete': _.bind(this.onEditComplete, this), 'settings:unitschanged':_.bind(this.unitsChanged, this) });