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([ ...@@ -331,7 +331,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]);
......
...@@ -294,10 +294,10 @@ define([ ...@@ -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) {
......
...@@ -304,10 +304,10 @@ define([ ...@@ -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) {
......
...@@ -439,9 +439,9 @@ define([ ...@@ -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) {
......
...@@ -186,13 +186,13 @@ function getParent($this) { ...@@ -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) ...@@ -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) {
......
...@@ -223,8 +223,8 @@ define([ ...@@ -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)
......
...@@ -2117,8 +2117,8 @@ define([ ...@@ -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([ ...@@ -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([ ...@@ -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([ ...@@ -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;
}); });
......
...@@ -457,8 +457,8 @@ define([ ...@@ -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) {
......
...@@ -213,8 +213,8 @@ define([ ...@@ -213,8 +213,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)
......
...@@ -1683,13 +1683,13 @@ define([ ...@@ -1683,13 +1683,13 @@ define([
{caption: '--'}, {caption: '--'},
mnuPreview mnuPreview
] ]
}).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;
}).on('render:after', function(cmp) { }).on('render:after', function(cmp) {
me.slideLayoutMenu = new Common.UI.DataView({ me.slideLayoutMenu = new Common.UI.DataView({
...@@ -2425,13 +2425,13 @@ define([ ...@@ -2425,13 +2425,13 @@ define([
menuAddHyperlinkPara, menuAddHyperlinkPara,
menuHyperlinkPara menuHyperlinkPara
] ]
}).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;
}); });
...@@ -2591,13 +2591,13 @@ define([ ...@@ -2591,13 +2591,13 @@ define([
menuAddHyperlinkTable, menuAddHyperlinkTable,
menuHyperlinkTable menuHyperlinkTable
] ]
}).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;
}); });
...@@ -2654,13 +2654,13 @@ define([ ...@@ -2654,13 +2654,13 @@ define([
menuAddCommentImg menuAddCommentImg
/** coauthoring end **/ /** coauthoring end **/
] ]
}).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;
}); });
......
...@@ -355,8 +355,8 @@ define([ ...@@ -355,8 +355,8 @@ define([
} }
}, },
onHideMenus: function(e){ onHideMenus: function(menu, e, isFromInputControl){
this.fireEvent('editcomplete', this); if (!isFromInputControl) this.fireEvent('editcomplete', this);
}, },
setLocked: function (locked) { setLocked: function (locked) {
......
...@@ -222,8 +222,8 @@ define([ ...@@ -222,8 +222,8 @@ define([
}, },
'menu:show': function(e){ 'menu:show': function(e){
}, },
'menu:hide': function(menu){ 'menu:hide': function(menu, isFromInputControl){
if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit'))) { if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit')) && !isFromInputControl) {
me.api.asc_InputClearKeyboardElement(); me.api.asc_InputClearKeyboardElement();
me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
} }
......
...@@ -364,8 +364,8 @@ define([ ...@@ -364,8 +364,8 @@ define([
} }
}, },
onHideMenus: function(e){ onHideMenus: function(menu, e, isFromInputControl){
Common.NotificationCenter.trigger('edit:complete', this); if (!isFromInputControl) Common.NotificationCenter.trigger('edit:complete', this);
}, },
setLocked: function (locked) { 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