minor tweaks + added keyboard help (need to rethink)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-04-07 04:58:22 +03:00
parent b9dcfb4f84
commit 42298eee7b
2 changed files with 36 additions and 2 deletions

View File

@ -15,6 +15,11 @@ var keyboard = require('lib/keyboard')
var core = require('features/core')
var widget = require('lib/widget/widget')
var browse = require('lib/widget/browse')
var overlay = require('lib/widget/overlay')
var drawer = require('lib/widget/drawer')
/*********************************************************************/
@ -81,6 +86,10 @@ module.GLOBAL_KEYBOARD = {
'on this page.',
pattern: '*',
X: {
alt: 'close',
},
F4: {
alt: 'close',
},
@ -348,6 +357,24 @@ var KeyboardActions = actions.Actions({
},
['on', 'off'])],
// XXX need to pre-process the docs...
// - remove the path component...
// - insert the action name where not doc present...
// XXX cleanup CSS
showKeyboardBindings: ['Interface/Show keyboard bindings',
function(){
var widget = drawer.Drawer($('body'),
$('<div>')
.css({
background: 'white',
})
.append(
keyboard.buildKeybindingsHelpHTML(this.__keyboard_config, this)),
{
focusable: true,
})
}],
})
var Keyboard =

View File

@ -792,6 +792,13 @@ function buildKeybindingsHelp(keybindings, shifted_keys, actions){
var handler = getKeyHandlers(key, mod, keybindings, 'all', null, actions)[pattern]
// no handler...
// NOTE: handler is present in config but not present
// in actions...
if(handler == null){
continue
}
if(handler.constructor === Array && handler[1] == 'IGNORE NEXT'){
handler = handler[0]
}
@ -902,8 +909,8 @@ function getKeysByDoc(doc, help){
//
var buildKeybindingsHelpHTML =
module.buildKeybindingsHelpHTML =
function buildKeybindingsHelpHTML(keybindings){
var doc = buildKeybindingsHelp(keybindings)
function buildKeybindingsHelpHTML(keybindings, actions){
var doc = buildKeybindingsHelp(keybindings, null, actions)
var res = '<table class="keyboard-help">'
for(var mode in doc){