mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Allow defining keyboard shortcuts for missing actions
When users bind custom shortcuts to actions coming from extensions, the shortcuts can be loaded before the extensions, so we need to allow defining a shortcut for an action that doesn't exist yet. Closes gh-3549 Closes gh-2954
This commit is contained in:
parent
10b7240599
commit
20f1b74ce9
@ -454,7 +454,14 @@ define([
|
||||
**/
|
||||
var action_name = this.actions.get_name(data);
|
||||
if (! action_name){
|
||||
throw new Error('does not know how to deal with : ' + data);
|
||||
if (typeof data === 'string') {
|
||||
// If we have an action name, allow it to be bound anyway.
|
||||
console.log("Unknown action '" + data + "' for shortcut " + shortcut
|
||||
+ "; it may be defined by an extension which is not yet loaded.");
|
||||
action_name = data;
|
||||
} else {
|
||||
throw new Error('does not know how to deal with : ' + data);
|
||||
}
|
||||
}
|
||||
var _shortcut = normalize_shortcut(shortcut);
|
||||
this.set_shortcut(_shortcut, action_name);
|
||||
|
Loading…
Reference in New Issue
Block a user