Fix Bug 34570. + Bug with closing menus by clicking to the input fields: open context menu or combobox, click at any of metric spinners or editable comboboxes -> menu closed, focus goes from spinner/combobox to canvas.

This commit is contained in:
Julia Radzhabova 2017-04-12 12:45:16 +03:00
parent 135e83506a
commit aa03115dd2
8 changed files with 24 additions and 24 deletions

View file

@ -391,7 +391,7 @@ define([
$(document).off('mouseup', onMouseUp); $(document).off('mouseup', onMouseUp);
}; };
var onAfterHideMenu = function(e) { var onAfterHideMenu = function(e, isFromInputControl) {
me.cmpEl.find('.dropdown-toggle').blur(); me.cmpEl.find('.dropdown-toggle').blur();
if (me.cmpEl.hasClass('active') !== me.pressed) if (me.cmpEl.hasClass('active') !== me.pressed)
me.cmpEl.trigger('button.internal.active', [me.pressed]); me.cmpEl.trigger('button.internal.active', [me.pressed]);

View file

@ -294,10 +294,10 @@ define([
e.preventDefault(); e.preventDefault();
}, },
onAfterHideMenu: function(e) { onAfterHideMenu: function(e, isFromInputControl) {
this.cmpEl.find('.dropdown-toggle').blur(); this.cmpEl.find('.dropdown-toggle').blur();
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide'); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {

View file

@ -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.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec()[0]; // for DataView - onKeyDown - Return key
(this.showLast) ? this.menuPicker.showLastSelected() : this.menuPicker.deselectAll(); (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) { onFieldPickerSelect: function(picker, item, record) {

View file

@ -439,9 +439,9 @@ define([
e.preventDefault(); e.preventDefault();
}, },
onAfterHideMenu: function(e) { onAfterHideMenu: function(e, isFromInputControl) {
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {

View file

@ -186,13 +186,13 @@ function getParent($this) {
return $parent && $parent.length ? $parent : $this.parent(); return $parent && $parent.length ? $parent : $this.parent();
} }
function clearMenus() { function clearMenus(isFromInputControl) {
$('.dropdown-toggle').each(function (e) { $('.dropdown-toggle').each(function (e) {
var $parent = ($(this)).parent(); var $parent = ($(this)).parent();
if (!$parent.hasClass('open')) return; if (!$parent.hasClass('open')) return;
$parent.trigger(e = $.Event('hide.bs.dropdown')); $parent.trigger(e = $.Event('hide.bs.dropdown'));
if (e.isDefaultPrevented()) return; 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) { function onDropDownClick(e) {
if (e.which == 1 || e.which == undefined) if (e.which == 1 || e.which == undefined)
clearMenus(); clearMenus(/form-control/.test(e.target.className));
} }
if (!!clickDefHandler) { if (!!clickDefHandler) {

View file

@ -223,8 +223,8 @@ define([
}, },
'menu:show': function(e){ 'menu:show': function(e){
}, },
'menu:hide': function(e){ 'menu:hide': function(e, isFromInputControl){
if (!me.isModalShowed) if (!me.isModalShowed && !isFromInputControl)
me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
}, },
'edit:complete': _.bind(me.onEditComplete, me) 'edit:complete': _.bind(me.onEditComplete, me)

View file

@ -2117,8 +2117,8 @@ define([
{ caption: '--' }, { caption: '--' },
menuImageAdvanced menuImageAdvanced
] ]
}).on('hide:after', function(menu) { }).on('hide:after', function(menu, e, isFromInputControl) {
me.fireEvent('editcomplete', me); if (!isFromInputControl) me.fireEvent('editcomplete', me);
me.currentMenu = null; me.currentMenu = null;
}); });
@ -2685,13 +2685,13 @@ define([
menuHyperlinkSeparator, menuHyperlinkSeparator,
menuParagraphAdvancedInTable menuParagraphAdvancedInTable
] ]
}).on('hide:after', function(menu) { }).on('hide:after', function(menu, e, isFromInputControl) {
if (me.suppressEditComplete) { if (me.suppressEditComplete) {
me.suppressEditComplete = false; me.suppressEditComplete = false;
return; return;
} }
me.fireEvent('editcomplete', me); if (!isFromInputControl) me.fireEvent('editcomplete', me);
me.currentMenu = null; me.currentMenu = null;
}); });
@ -3064,13 +3064,13 @@ define([
menuStyleSeparator, menuStyleSeparator,
menuStyle menuStyle
] ]
}).on('hide:after', function(menu, e) { }).on('hide:after', function(menu, e, isFromInputControl) {
if (me.suppressEditComplete) { if (me.suppressEditComplete) {
me.suppressEditComplete = false; me.suppressEditComplete = false;
return; return;
} }
me.fireEvent('editcomplete', me); if (!isFromInputControl) me.fireEvent('editcomplete', me);
me.currentMenu = null; me.currentMenu = null;
}); });
@ -3096,8 +3096,8 @@ define([
items: [ items: [
menuEditHeaderFooter menuEditHeaderFooter
] ]
}).on('hide:after', function(menu) { }).on('hide:after', function(menu, e, isFromInputControl) {
me.fireEvent('editcomplete', me); if (!isFromInputControl) me.fireEvent('editcomplete', me);
me.currentMenu = null; me.currentMenu = null;
}); });

View file

@ -457,8 +457,8 @@ define([
this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
}, },
onHideMenus: function(e){ onHideMenus: function(menu, e, isFromInputControl){
this.fireEvent('editcomplete', this); if (!isFromInputControl) this.fireEvent('editcomplete', this);
}, },
setLocked: function (locked) { setLocked: function (locked) {