Commit 17142e48 authored by Julia Radzhabova's avatar Julia Radzhabova

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.
parent e85a8a6e
......@@ -331,7 +331,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]);
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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)
......
......@@ -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;
});
......
......@@ -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) {
......
......@@ -213,8 +213,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)
......
......@@ -1683,13 +1683,13 @@ define([
{caption: '--'},
mnuPreview
]
}).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;
}).on('render:after', function(cmp) {
me.slideLayoutMenu = new Common.UI.DataView({
......@@ -2425,13 +2425,13 @@ define([
menuAddHyperlinkPara,
menuHyperlinkPara
]
}).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;
});
......@@ -2591,13 +2591,13 @@ define([
menuAddHyperlinkTable,
menuHyperlinkTable
]
}).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;
});
......@@ -2654,13 +2654,13 @@ define([
menuAddCommentImg
/** coauthoring end **/
]
}).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;
});
......
......@@ -355,8 +355,8 @@ define([
}
},
onHideMenus: function(e){
this.fireEvent('editcomplete', this);
onHideMenus: function(menu, e, isFromInputControl){
if (!isFromInputControl) this.fireEvent('editcomplete', this);
},
setLocked: function (locked) {
......
......@@ -222,8 +222,8 @@ define([
},
'menu:show': function(e){
},
'menu:hide': function(menu){
if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit'))) {
'menu:hide': function(menu, isFromInputControl){
if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit')) && !isFromInputControl) {
me.api.asc_InputClearKeyboardElement();
me.api.asc_enableKeyEvents(true);
}
......
......@@ -364,8 +364,8 @@ define([
}
},
onHideMenus: function(e){
Common.NotificationCenter.trigger('edit:complete', this);
onHideMenus: function(menu, e, isFromInputControl){
if (!isFromInputControl) Common.NotificationCenter.trigger('edit:complete', this);
},
setLocked: function (locked) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment