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);
};
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]);

View file

@ -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) {

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.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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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)

View file

@ -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;
});

View file

@ -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) {