mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-15 23:07:18 +00:00
Add support for global keyboard shortcuts (#3493)
* changes for global keyboardshortcuts * add keyboard.js startup module * remove not existing "th-opening-window" hook * correct title * use utils.addEventListeners * define platform lookup-names on startup * use the startup-lookup-names array * use the platform-specific lookupNames only * Update keyboard.js * move initializations to the constructor * move initializations to the constructor * rename hasAnyTiddlerChanged * don't explicitely create new RegExp * use $tw.utils.hopArray * match strings, no regex * remove hopArray, move to boot.js * add $tw.utils.hopArray to boot.js * style update * style updates * move more to keyboardManager module this could probably be moved to rootwidget.js * move more to keyboardManager module * add event listener for shortcuts in new windows * prevent error when opening window is blocked * add keydown listener on document in startup.js * delete startup/keyboard.js * add missing this.shortcutTiddlers * Update keyboard.js * Update boot.js * add exports.hopArray to utils.js * minor codingstyle tweak * change how lookupnames get pushed to array * Update windows.js * re-add shortcuts-listener for new windows I removed this before which I think was because I misunderstood what exactly should go to a separate PR
This commit is contained in:
committed by
Jeremy Ruston
parent
b584295831
commit
3592333cb8
@@ -87,6 +87,14 @@ exports.startup = function() {
|
||||
});
|
||||
// Kick off the keyboard manager
|
||||
$tw.keyboardManager = new $tw.KeyboardManager();
|
||||
// Listen for shortcuts
|
||||
if($tw.browser) {
|
||||
$tw.utils.addEventListeners(document,[{
|
||||
name: "keydown",
|
||||
handlerObject: $tw.keyboardManager,
|
||||
handlerMethod: "handleKeydownEvent"
|
||||
}]);
|
||||
}
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
|
||||
Reference in New Issue
Block a user