From 4bea6686eca22a66126cf16fd3f3ed4d597d64bd Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 20 Oct 2014 07:18:35 +0400 Subject: [PATCH] added doc generator compatibility for action keyboard wrappers... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/keyboard.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/lib/keyboard.js b/ui (gen4)/lib/keyboard.js index edac68ca..23931d6f 100755 --- a/ui (gen4)/lib/keyboard.js +++ b/ui (gen4)/lib/keyboard.js @@ -376,19 +376,29 @@ function getKeyHandlers(key, modifiers, keybindings, modes, shifted_keys, action // and letting the caller decide how to make the call // seems more logical... handler = function(n){ - return function(){ - return actions[n]() }}(handler) + var f = function(){ return actions[n]() } + // make this doc-generator compatible -- inherit all + // the docs from the actual action... + f.__proto__ = actions[n] + return f + }(handler) // action name with '!' -- prevent default... } else if(handler.slice(-1) == '!' && handler.slice(0, -1) in actions){ // build a handler... - // ...see notes for the previous section... + // ...for the reasons why this is like it is see notes + // for the previous if... handler = function(n){ - return function(){ + var f = function(){ event.preventDefault() return actions[n]() - }}(handler.slice(0, -1)) + } + // make this doc-generator compatible -- inherit all + // the docs from the actual action... + f.__proto__ = actions[n] + return f + }(handler.slice(0, -1)) // key code... } else if(typeof(handler) == typeof(1)) {