[SSE] Fixed bugs with focus and keydown events in function menu.
This commit is contained in:
parent
765f3c67c9
commit
6232f19dcc
|
@ -441,7 +441,7 @@ define([
|
|||
|
||||
onAfterHideMenu: function(e) {
|
||||
this.trigger('hide:after', this, e);
|
||||
Common.NotificationCenter.trigger('menu:hide');
|
||||
Common.NotificationCenter.trigger('menu:hide', this);
|
||||
},
|
||||
|
||||
onAfterKeydownMenu: function(e) {
|
||||
|
|
|
@ -47,7 +47,7 @@ function onDropDownKeyDown(e) {
|
|||
$parent.trigger(beforeEvent);
|
||||
|
||||
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];
|
||||
if ( /^(38|40|27|13|9)$/.test(e.keyCode) && !e.ctrlKey && !e.altKey) {
|
||||
patchDropDownKeyDownAdditional.call(this, e);
|
||||
|
|
|
@ -81,6 +81,7 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiDisconnect, 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_onInputKeyDown', _.bind(this.onInputKeyDown, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -92,6 +93,15 @@ define([
|
|||
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() {
|
||||
this.editor = this.createView('CellEditor',{
|
||||
el: '#cell-editing-box'
|
||||
|
@ -100,21 +110,6 @@ define([
|
|||
this.bindViewEvents(this.editor, this.events);
|
||||
|
||||
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))
|
||||
.on('show:before', _.bind(this.onNameBeforeShow, this));
|
||||
this.namedrange_locked = false;
|
||||
|
|
|
@ -1451,7 +1451,7 @@ define([
|
|||
// Common.UI.Menu.prototype.onAfterKeydownMenu.call(menu, e);
|
||||
|
||||
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];
|
||||
if (menuContainer.hasClass('open')) {
|
||||
if (e.keyCode == Common.UI.Keys.TAB || e.keyCode == Common.UI.Keys.RETURN && !e.ctrlKey && !e.altKey)
|
||||
|
@ -1505,6 +1505,7 @@ define([
|
|||
}
|
||||
if (infocus)
|
||||
me.cellEditor.focus();
|
||||
menu.cmpEl.toggleClass('from-cell-edit', infocus);
|
||||
_.delay(function() {
|
||||
menu.cmpEl.find('li:first a').addClass('focus');
|
||||
}, 10);
|
||||
|
|
|
@ -199,9 +199,11 @@ define([
|
|||
},
|
||||
'menu:show': function(e){
|
||||
},
|
||||
'menu:hide': function(e){
|
||||
if (!me.isModalShowed)
|
||||
'menu:hide': function(menu){
|
||||
if (!me.isModalShowed && (!menu || !menu.cmpEl.hasClass('from-cell-edit'))) {
|
||||
me.api.asc_InputClearKeyboardElement();
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
}
|
||||
},
|
||||
'edit:complete': _.bind(this.onEditComplete, this),
|
||||
'settings:unitschanged':_.bind(this.unitsChanged, this)
|
||||
|
|
Loading…
Reference in a new issue