1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-18 08:15:15 +00:00

Keyboard widget: provide variable for shortcut descriptor to actions. (#5782)

This commit is contained in:
Saq Imtiaz
2021-06-14 13:03:59 +02:00
committed by GitHub
parent 3cd80de5bb
commit 8f9e8c1dee
3 changed files with 19 additions and 6 deletions

View File

@@ -53,7 +53,8 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) {
};
KeyboardWidget.prototype.handleChangeEvent = function(event) {
if($tw.keyboardManager.checkKeyDescriptors(event,this.keyInfoArray)) {
var keyInfo = $tw.keyboardManager.getMatchingKeyDescriptor(event,this.keyInfoArray);
if(keyInfo) {
var handled = this.invokeActions(this,event);
if(this.actions) {
var variables = {
@@ -61,6 +62,9 @@ KeyboardWidget.prototype.handleChangeEvent = function(event) {
"event-code": event.code,
"modifier": $tw.keyboardManager.getEventModifierKeyDescriptor(event)
};
if(keyInfo.keyDescriptor) {
variables["event-key-descriptor"] = keyInfo.keyDescriptor;
}
this.invokeActionString(this.actions,this,event,variables);
}
this.dispatchMessage(event);