Commit 6232f19d authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Fixed bugs with focus and keydown events in function menu.

parent 765f3c67
...@@ -441,7 +441,7 @@ define([ ...@@ -441,7 +441,7 @@ define([
onAfterHideMenu: function(e) { onAfterHideMenu: function(e) {
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e);
Common.NotificationCenter.trigger('menu:hide'); Common.NotificationCenter.trigger('menu:hide', this);
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {
......
...@@ -47,7 +47,7 @@ function onDropDownKeyDown(e) { ...@@ -47,7 +47,7 @@ function onDropDownKeyDown(e) {
$parent.trigger(beforeEvent); $parent.trigger(beforeEvent);
if ($parent.hasClass('no-stop-propagate')) { if ($parent.hasClass('no-stop-propagate')) {
if (arguments.length>1 && arguments[1] instanceof jQuery.Event) if (arguments.length>1 && arguments[1] instanceof KeyboardEvent)
e = arguments[1]; e = arguments[1];
if ( /^(38|40|27|13|9)$/.test(e.keyCode) && !e.ctrlKey && !e.altKey) { if ( /^(38|40|27|13|9)$/.test(e.keyCode) && !e.ctrlKey && !e.altKey) {
patchDropDownKeyDownAdditional.call(this, e); patchDropDownKeyDownAdditional.call(this, e);
......
...@@ -81,6 +81,7 @@ define([ ...@@ -81,6 +81,7 @@ define([
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, this));
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this)); Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onInputKeyDown', _.bind(this.onInputKeyDown, this));
return this; return this;
}, },
...@@ -92,6 +93,15 @@ define([ ...@@ -92,6 +93,15 @@ define([
this.editor.btnNamedRanges.setVisible(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge); this.editor.btnNamedRanges.setVisible(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
}, },
onInputKeyDown: function(e) {
if (Common.UI.Keys.UP === e.keyCode || Common.UI.Keys.DOWN === e.keyCode ||
Common.UI.Keys.TAB === e.keyCode || Common.UI.Keys.RETURN === e.keyCode) {
var menu = $('#menu-formula-selection'); // for formula menu
if (menu.hasClass('open'))
menu.find('.dropdown-menu').trigger('keydown', e);
}
},
onLaunch: function() { onLaunch: function() {
this.editor = this.createView('CellEditor',{ this.editor = this.createView('CellEditor',{
el: '#cell-editing-box' el: '#cell-editing-box'
...@@ -100,21 +110,6 @@ define([ ...@@ -100,21 +110,6 @@ define([
this.bindViewEvents(this.editor, this.events); this.bindViewEvents(this.editor, this.events);
this.editor.$el.parent().find('.after').css({zIndex: '4'}); // for spreadsheets - bug 23127 this.editor.$el.parent().find('.after').css({zIndex: '4'}); // for spreadsheets - bug 23127
var me = this;
$('#ce-cell-content').keydown(function (e) {
if (Common.UI.Keys.ESC === e.keyCode) {
// me.api.asc_enableKeyEvents(true);
} else if (Common.UI.Keys.UP === e.keyCode || Common.UI.Keys.DOWN === e.keyCode ||
Common.UI.Keys.TAB === e.keyCode || Common.UI.Keys.RETURN === e.keyCode) {
var menu = $('#menu-formula-selection'); // for formula menu
if (menu.hasClass('open'))
menu.find('.dropdown-menu').trigger('keydown', e);
// if (Common.UI.Keys.RETURN === e.keyCode)
// me.api.asc_enableKeyEvents(true);
}
});
this.editor.btnNamedRanges.menu.on('item:click', _.bind(this.onNamedRangesMenu, this)) this.editor.btnNamedRanges.menu.on('item:click', _.bind(this.onNamedRangesMenu, this))
.on('show:before', _.bind(this.onNameBeforeShow, this)); .on('show:before', _.bind(this.onNameBeforeShow, this));
this.namedrange_locked = false; this.namedrange_locked = false;
......
...@@ -1451,7 +1451,7 @@ define([ ...@@ -1451,7 +1451,7 @@ define([
// Common.UI.Menu.prototype.onAfterKeydownMenu.call(menu, e); // Common.UI.Menu.prototype.onAfterKeydownMenu.call(menu, e);
var li; var li;
if (arguments.length>1 && arguments[1] instanceof jQuery.Event) // when typing in cell editor if (arguments.length>1 && arguments[1] instanceof KeyboardEvent) // when typing in cell editor
e = arguments[1]; e = arguments[1];
if (menuContainer.hasClass('open')) { if (menuContainer.hasClass('open')) {
if (e.keyCode == Common.UI.Keys.TAB || e.keyCode == Common.UI.Keys.RETURN && !e.ctrlKey && !e.altKey) if (e.keyCode == Common.UI.Keys.TAB || e.keyCode == Common.UI.Keys.RETURN && !e.ctrlKey && !e.altKey)
...@@ -1505,6 +1505,7 @@ define([ ...@@ -1505,6 +1505,7 @@ define([
} }
if (infocus) if (infocus)
me.cellEditor.focus(); me.cellEditor.focus();
menu.cmpEl.toggleClass('from-cell-edit', infocus);
_.delay(function() { _.delay(function() {
menu.cmpEl.find('li:first a').addClass('focus'); menu.cmpEl.find('li:first a').addClass('focus');
}, 10); }, 10);
......
...@@ -199,9 +199,11 @@ define([ ...@@ -199,9 +199,11 @@ define([
}, },
'menu:show': function(e){ 'menu:show': function(e){
}, },
'menu:hide': function(e){ 'menu:hide': function(menu){
if (!me.isModalShowed) if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit'))) {
me.api.asc_InputClearKeyboardElement();
me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
}
}, },
'edit:complete': _.bind(this.onEditComplete, this), 'edit:complete': _.bind(this.onEditComplete, this),
'settings:unitschanged':_.bind(this.unitsChanged, this) 'settings:unitschanged':_.bind(this.unitsChanged, this)
......
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