We use cookies to make our website more effective. By using our website you agree to our privacy policy.

Namespace: keys

keys

keys.js is part of Aloha Editor project http://www.alohaeditor.org

Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html

Members

ARROWSObject.<number, string>

Arrow keys

CODESObject.<string, number>

A map of key names to their keycode.

Methods

middleware(event){AlohaEvent}

Provides meta, keycode
Name Type Description
event AlohaEvent

parseKeys(event){Object.<string, *>}

Parses keys for a browser event. Will return an object as follows:


{
meta : 'cmd+shift', // active meta keys
keycode : 32, // currently active keycode
key : 'space', // associated key
char : '' // corresponding lowercase character key
}
Name Type Description
event Event

shortcutHandler(meta, keycode, shortcutHandlers){*}

Goes through the shortcutHandlers object to find a shortcutHandler that
matches the pressed meta keys along with the provided keycode. The
shortcutHandler array must be structured as follows:


// add a shortcut handler for meta+esc on keydown
shortcutHandlers = {
'meta+escape' : function () {},
'meta+shift+b' : function () {}
}


The order of meta keys in the shortcutHandlers array MUST be in
alphabetical order, as provided by
Name Type Description
meta string
keycode integer
shortcutHandlers Object
See:
  • Keys.parseKeys
Returns:
if no handler could be found
comments powered by Disqus