1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-05 00:08:06 +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:
BurningTreeC
2018-11-06 14:34:51 +01:00
committed by Jeremy Ruston
parent b584295831
commit 3592333cb8
4 changed files with 104 additions and 4 deletions

View File

@@ -149,6 +149,18 @@ exports.isArrayEqual = function(array1,array2) {
});
};
/*
Determine whether an array-item is an object-property
*/
exports.hopArray = function(object,array) {
for(var i=0; i<array.length; i++) {
if($tw.utils.hop(object,array[i])) {
return true;
}
}
return false;
};
/*
Push entries onto an array, removing them first if they already exist in the array
array: array to modify (assumed to be free of duplicates)