mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 22:51:43 +01:00
Implemented executing the default action with the return key
This commit is contained in:
parent
8e7c73dd84
commit
28e6ff6920
@ -108,6 +108,34 @@ function egwPopupActionImplementation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ai._getDefaultLink = function(_links) {
|
||||||
|
var defaultAction = null;
|
||||||
|
for (var k in _links)
|
||||||
|
{
|
||||||
|
if (_links[k].actionObj["default"] && _links[k].enabled)
|
||||||
|
{
|
||||||
|
defaultAction = _links[k].actionObj;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles a key press
|
||||||
|
*/
|
||||||
|
ai._handleKeyPress = function(_key, _selected, _links, _target) {
|
||||||
|
if (_key.keyCode == EGW_KEY_ENTER && !_key.ctrl && !_key.shift && !_key.alt) {
|
||||||
|
var defaultAction = this._getDefaultLink(_links);
|
||||||
|
if (defaultAction)
|
||||||
|
{
|
||||||
|
defaultAction.execute(_selected);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the handler for the context menu
|
* Registers the handler for the context menu
|
||||||
*/
|
*/
|
||||||
@ -162,7 +190,6 @@ function egwPopupActionImplementation()
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the context menu and shows it at the given position/DOM-Node.
|
* Builds the context menu and shows it at the given position/DOM-Node.
|
||||||
*/
|
*/
|
||||||
@ -173,7 +200,11 @@ function egwPopupActionImplementation()
|
|||||||
_target = null;
|
_target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_context != "default")
|
if (typeof _context == "object" && typeof _context.keyEvent == "object")
|
||||||
|
{
|
||||||
|
return ai._handleKeyPress(_context.keyEvent, _selected, _links, _target);
|
||||||
|
}
|
||||||
|
else if (_context != "default")
|
||||||
{
|
{
|
||||||
//Check whether the context has the posx and posy parameters
|
//Check whether the context has the posx and posy parameters
|
||||||
if ((typeof _context.posx != "number" || typeof _context.posy != "number") &&
|
if ((typeof _context.posx != "number" || typeof _context.posy != "number") &&
|
||||||
@ -195,16 +226,7 @@ function egwPopupActionImplementation()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var defaultAction = null;
|
var defaultAction = ai._getDefaultLink(_links);
|
||||||
for (var k in _links)
|
|
||||||
{
|
|
||||||
if (_links[k].actionObj["default"] && _links[k].enabled)
|
|
||||||
{
|
|
||||||
defaultAction = _links[k].actionObj;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultAction)
|
if (defaultAction)
|
||||||
{
|
{
|
||||||
defaultAction.execute(_selected);
|
defaultAction.execute(_selected);
|
||||||
|
@ -281,11 +281,27 @@ function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
|
|||||||
|
|
||||||
if (focusedObject)
|
if (focusedObject)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Handle the default keys (arrow_up, down etc.)
|
||||||
var cntr = focusedObject.getContainerRoot();
|
var cntr = focusedObject.getContainerRoot();
|
||||||
|
var handled = false;
|
||||||
|
|
||||||
if (cntr)
|
if (cntr)
|
||||||
{
|
{
|
||||||
return cntr.handleKeyPress(_keyCode, _shift, _ctrl, _alt);
|
handled = cntr.handleKeyPress(_keyCode, _shift, _ctrl, _alt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Execute the egw_popup key handler of the focused object
|
||||||
|
if (!handled) {
|
||||||
|
!focusedObject.executeActionImplementation({"keyEvent": {
|
||||||
|
"keyCode": _keyCode,
|
||||||
|
"shift": _shift,
|
||||||
|
"ctrl": _ctrl,
|
||||||
|
"alt": _alt
|
||||||
|
}}, "popup", EGW_AO_EXEC_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user