mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
several fixes + custom keyboard action help getter...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4617fe512b
commit
f09fae92e1
@ -536,13 +536,18 @@ var KeyboardActions = actions.Actions({
|
|||||||
//
|
//
|
||||||
getKeysForAction: ['- Interface/',
|
getKeysForAction: ['- Interface/',
|
||||||
function(actions){
|
function(actions){
|
||||||
actions = arguments.length == null || actions == '*' ? this.actions
|
actions = arguments.length == 0 || actions == '*' ? this.actions
|
||||||
: arguments.length > 1 ? [].slice.call(arguments)
|
: arguments.length > 1 ? [].slice.call(arguments)
|
||||||
: actions
|
: actions
|
||||||
actions = actions instanceof Array ? actions : [actions]
|
actions = actions instanceof Array ? actions : [actions]
|
||||||
|
|
||||||
var paths = this.getPath(actions)
|
var paths = this.getPath(actions)
|
||||||
var help = keyboard.buildKeybindingsHelp(this.keyboard, null, this)
|
var help = keyboard.buildKeybindingsHelp(
|
||||||
|
this.keyboard,
|
||||||
|
null,
|
||||||
|
this,
|
||||||
|
function(action){
|
||||||
|
return Object.keys(this.getPath(action))[0] })
|
||||||
|
|
||||||
var res = {}
|
var res = {}
|
||||||
|
|
||||||
@ -572,7 +577,11 @@ var KeyboardActions = actions.Actions({
|
|||||||
showKeyboardBindings: ['Interface/Show keyboard bindings...',
|
showKeyboardBindings: ['Interface/Show keyboard bindings...',
|
||||||
widgets.makeUIDialog('Drawer',
|
widgets.makeUIDialog('Drawer',
|
||||||
function(){
|
function(){
|
||||||
return keyboard.buildKeybindingsHelpHTML(this.__keyboard_config, this)
|
return keyboard.buildKeybindingsHelpHTML(
|
||||||
|
this.__keyboard_config,
|
||||||
|
this,
|
||||||
|
function(action){
|
||||||
|
return Object.keys(this.getPath(action))[0] })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
background: 'white',
|
background: 'white',
|
||||||
|
|||||||
@ -810,7 +810,7 @@ function makeKeyboardHandler(keybindings, unhandled, actions){
|
|||||||
// XXX do we show overloaded keys???
|
// XXX do we show overloaded keys???
|
||||||
var buildKeybindingsHelp =
|
var buildKeybindingsHelp =
|
||||||
module.buildKeybindingsHelp =
|
module.buildKeybindingsHelp =
|
||||||
function buildKeybindingsHelp(keybindings, shifted_keys, actions){
|
function buildKeybindingsHelp(keybindings, shifted_keys, actions, doc_getter){
|
||||||
shifted_keys = shifted_keys == null ? _SHIFT_KEYS : shifted_keys
|
shifted_keys = shifted_keys == null ? _SHIFT_KEYS : shifted_keys
|
||||||
var res = {}
|
var res = {}
|
||||||
var mode, title
|
var mode, title
|
||||||
@ -861,6 +861,10 @@ function buildKeybindingsHelp(keybindings, shifted_keys, actions){
|
|||||||
var doc = 'Ignored'
|
var doc = 'Ignored'
|
||||||
//continue
|
//continue
|
||||||
|
|
||||||
|
// custom doc getter...
|
||||||
|
} else if(doc_getter && handler.action){
|
||||||
|
var doc = doc_getter.call(actions, handler.action)
|
||||||
|
|
||||||
// standard object doc...
|
// standard object doc...
|
||||||
} else if('doc' in handler){
|
} else if('doc' in handler){
|
||||||
var doc = handler.doc
|
var doc = handler.doc
|
||||||
@ -967,8 +971,8 @@ function getKeysByDoc(doc, help){
|
|||||||
//
|
//
|
||||||
var buildKeybindingsHelpHTML =
|
var buildKeybindingsHelpHTML =
|
||||||
module.buildKeybindingsHelpHTML =
|
module.buildKeybindingsHelpHTML =
|
||||||
function buildKeybindingsHelpHTML(keybindings, actions){
|
function buildKeybindingsHelpHTML(keybindings, actions, doc_getter){
|
||||||
var doc = buildKeybindingsHelp(keybindings, null, actions)
|
var doc = buildKeybindingsHelp(keybindings, null, actions, doc_getter)
|
||||||
|
|
||||||
var res = '<table class="keyboard-help">'
|
var res = '<table class="keyboard-help">'
|
||||||
for(var mode in doc){
|
for(var mode in doc){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user