mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-01 09:20:02 +00:00
Keyboard Widget: refresh keyInfoArray (#3541)
this makes a keyboard widget update its keyInfoArray if its key has the `((descriptor))` format and one of the platform-specific configuration tiddlers with that descriptor-suffix changes
This commit is contained in:
parent
4f7297645d
commit
43c8a0f485
@ -79,6 +79,13 @@ KeyboardWidget.prototype.execute = function() {
|
|||||||
this.tag = this.getAttribute("tag");
|
this.tag = this.getAttribute("tag");
|
||||||
this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);
|
this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);
|
||||||
this["class"] = this.getAttribute("class");
|
this["class"] = this.getAttribute("class");
|
||||||
|
if(this.key.substr(0,2) === "((" && this.key.substr(-2,2) === "))") {
|
||||||
|
this.shortcutTiddlers = [];
|
||||||
|
var name = this.key.substring(2,this.key.length -2);
|
||||||
|
$tw.utils.each($tw.keyboardManager.lookupNames,function(platformDescriptor) {
|
||||||
|
self.shortcutTiddlers.push("$:/config/" + platformDescriptor + "/" + name);
|
||||||
|
});
|
||||||
|
}
|
||||||
// Make child widgets
|
// Make child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
@ -92,6 +99,10 @@ KeyboardWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Update the keyInfoArray if one of its shortcut-config-tiddlers has changed
|
||||||
|
if(this.shortcutTiddlers && $tw.utils.hopArray(changedTiddlers,this.shortcutTiddlers)) {
|
||||||
|
this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);
|
||||||
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user