diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 8c48f09e0..20048c4c3 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -391,7 +391,7 @@ define([ $(document).off('mouseup', onMouseUp); }; - var onAfterHideMenu = function(e) { + var onAfterHideMenu = function(e, isFromInputControl) { me.cmpEl.find('.dropdown-toggle').blur(); if (me.cmpEl.hasClass('active') !== me.pressed) me.cmpEl.trigger('button.internal.active', [me.pressed]); diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index f86049013..d45a3054c 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -294,10 +294,10 @@ define([ e.preventDefault(); }, - onAfterHideMenu: function(e) { + onAfterHideMenu: function(e, isFromInputControl) { this.cmpEl.find('.dropdown-toggle').blur(); - this.trigger('hide:after', this, e); - Common.NotificationCenter.trigger('menu:hide'); + this.trigger('hide:after', this, e, isFromInputControl); + Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl); }, onAfterKeydownMenu: function(e) { diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index 1a6ac86cf..d1d56c232 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -304,10 +304,10 @@ define([ } }, - onAfterHideMenu: function(e) { + onAfterHideMenu: function(e, isFromInputControl) { this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec()[0]; // for DataView - onKeyDown - Return key (this.showLast) ? this.menuPicker.showLastSelected() : this.menuPicker.deselectAll(); - this.trigger('hide:after', this, e); + this.trigger('hide:after', this, e, isFromInputControl); }, onFieldPickerSelect: function(picker, item, record) { diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index 26238e205..5cbd8a087 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -439,9 +439,9 @@ define([ e.preventDefault(); }, - onAfterHideMenu: function(e) { - this.trigger('hide:after', this, e); - Common.NotificationCenter.trigger('menu:hide', this); + onAfterHideMenu: function(e, isFromInputControl) { + this.trigger('hide:after', this, e, isFromInputControl); + Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl); }, onAfterKeydownMenu: function(e) { diff --git a/apps/common/main/lib/extend/Bootstrap.js b/apps/common/main/lib/extend/Bootstrap.js index aaa79c965..62ce6b868 100755 --- a/apps/common/main/lib/extend/Bootstrap.js +++ b/apps/common/main/lib/extend/Bootstrap.js @@ -186,13 +186,13 @@ function getParent($this) { return $parent && $parent.length ? $parent : $this.parent(); } -function clearMenus() { +function clearMenus(isFromInputControl) { $('.dropdown-toggle').each(function (e) { var $parent = ($(this)).parent(); if (!$parent.hasClass('open')) return; $parent.trigger(e = $.Event('hide.bs.dropdown')); if (e.isDefaultPrevented()) return; - $parent.removeClass('open').trigger('hidden.bs.dropdown'); + $parent.removeClass('open').trigger('hidden.bs.dropdown', isFromInputControl); }) } @@ -217,7 +217,7 @@ $(document) function onDropDownClick(e) { if (e.which == 1 || e.which == undefined) - clearMenus(); + clearMenus(/form-control/.test(e.target.className)); } if (!!clickDefHandler) { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 804829391..c8d247933 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -223,8 +223,8 @@ define([ }, 'menu:show': function(e){ }, - 'menu:hide': function(e){ - if (!me.isModalShowed) + 'menu:hide': function(e, isFromInputControl){ + if (!me.isModalShowed && !isFromInputControl) me.api.asc_enableKeyEvents(true); }, 'edit:complete': _.bind(me.onEditComplete, me) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index b447e747c..57dc75acd 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -2117,8 +2117,8 @@ define([ { caption: '--' }, menuImageAdvanced ] - }).on('hide:after', function(menu) { - me.fireEvent('editcomplete', me); + }).on('hide:after', function(menu, e, isFromInputControl) { + if (!isFromInputControl) me.fireEvent('editcomplete', me); me.currentMenu = null; }); @@ -2685,13 +2685,13 @@ define([ menuHyperlinkSeparator, menuParagraphAdvancedInTable ] - }).on('hide:after', function(menu) { + }).on('hide:after', function(menu, e, isFromInputControl) { if (me.suppressEditComplete) { me.suppressEditComplete = false; return; } - me.fireEvent('editcomplete', me); + if (!isFromInputControl) me.fireEvent('editcomplete', me); me.currentMenu = null; }); @@ -3064,13 +3064,13 @@ define([ menuStyleSeparator, menuStyle ] - }).on('hide:after', function(menu, e) { + }).on('hide:after', function(menu, e, isFromInputControl) { if (me.suppressEditComplete) { me.suppressEditComplete = false; return; } - me.fireEvent('editcomplete', me); + if (!isFromInputControl) me.fireEvent('editcomplete', me); me.currentMenu = null; }); @@ -3096,8 +3096,8 @@ define([ items: [ menuEditHeaderFooter ] - }).on('hide:after', function(menu) { - me.fireEvent('editcomplete', me); + }).on('hide:after', function(menu, e, isFromInputControl) { + if (!isFromInputControl) me.fireEvent('editcomplete', me); me.currentMenu = null; }); diff --git a/apps/documenteditor/main/app/view/ParagraphSettings.js b/apps/documenteditor/main/app/view/ParagraphSettings.js index 57563b833..b6ad0e8d5 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettings.js +++ b/apps/documenteditor/main/app/view/ParagraphSettings.js @@ -457,8 +457,8 @@ define([ this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, - onHideMenus: function(e){ - this.fireEvent('editcomplete', this); + onHideMenus: function(menu, e, isFromInputControl){ + if (!isFromInputControl) this.fireEvent('editcomplete', this); }, setLocked: function (locked) {