From f673344408927096314ac34ce01f20398093dd22 Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 19 Feb 2021 19:39:04 +0100 Subject: [PATCH] Bugfix: canExecute not a function Bugfix: _scopes.all is undefined --- dev/Knoin/Knoin.js | 2 +- dev/shortcuts.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js index 58dfb3572..266a0f2df 100644 --- a/dev/Knoin/Knoin.js +++ b/dev/Knoin/Knoin.js @@ -324,7 +324,7 @@ function decorateKoCommands(thisArg, commands) { Object.entries(commands).forEach(([key, canExecute]) => { let command = thisArg[key], fn = function(...args) { - if (fn.enabled() && canExecute.call(thisArg, thisArg)) { + if (fn.enabled() && fn.canExecute()) { command.apply(thisArg, args); } return false; diff --git a/dev/shortcuts.js b/dev/shortcuts.js index 9ac71a304..cc42f0f21 100644 --- a/dev/shortcuts.js +++ b/dev/shortcuts.js @@ -4,7 +4,9 @@ const doc = document, meta = /Mac OS X/.test(navigator.userAgent) ? 'meta' : 'ctrl', - _scopes = {}, + _scopes = { + all: {} + }, toArray = v => Array.isArray(v) ? v : v.split(/\s*,\s*/), keydown = event => {