mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-30 11:26:41 +00:00
Extend keyboard handling
To cope with the Mac’s “meta” key (ie command/⌘) preparatory to trapping command-S
This commit is contained in:
@@ -48,6 +48,8 @@ exports.parseKeyDescriptor = function(keyDescriptor) {
|
||||
info.shiftKey = true;
|
||||
} else if(s === "alt") {
|
||||
info.altKey = true;
|
||||
} else if(s === "meta") {
|
||||
info.metaKey = true;
|
||||
}
|
||||
// Replace named keys with their code
|
||||
if(namedKeys[s]) {
|
||||
@@ -57,4 +59,12 @@ exports.parseKeyDescriptor = function(keyDescriptor) {
|
||||
return info;
|
||||
};
|
||||
|
||||
exports.checkKeyDescriptor = function(event,keyInfo) {
|
||||
return event.keyCode === keyInfo.keyCode &&
|
||||
event.shiftKey === keyInfo.shiftKey &&
|
||||
event.altKey === keyInfo.altKey &&
|
||||
event.ctrlKey === keyInfo.ctrlKey &&
|
||||
event.metaKey === keyInfo.metaKey;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user