diff options
author | madelinegr <monika_hedman@brown.edu> | 2019-06-07 16:14:05 -0400 |
---|---|---|
committer | madelinegr <monika_hedman@brown.edu> | 2019-06-07 16:14:05 -0400 |
commit | 30034bbcfac77466ff74bca97d40771ccd6a4b1c (patch) | |
tree | aed9d49e39c20245fd88da531e153cdc16e89ce4 /src | |
parent | 8dc4d7a7b11188e939563beb1253c766414cc015 (diff) |
setting up keyhandler in progress
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/MainView.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 42d5929bf..c0f6e01e2 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -305,6 +305,34 @@ export class MainView extends React.Component { this.isSearchVisible = !this.isSearchVisible; } + @action + globalKeyHandler = (e: KeyboardEvent) => { + if (e.key === "Control" || !e.ctrlKey) return; + + e.preventDefault(); + e.stopPropagation(); + + switch (e.key) { + case "ArrowRight": + if (this.mainFreeform) { + CollectionDockingView.Instance.AddRightSplit(this.mainFreeform!); + } + break; + case "ArrowLeft": + if (this.mainFreeform) { + CollectionDockingView.Instance.CloseRightSplit(this.mainFreeform!); + } + break; + case "o": + this.globalDisplayFlags.jumpToVisible = true; + break; + case "escape": + _.mapValues(this.globalDisplayFlags, () => false) + break; + } + } + + render() { return ( <div id="main-div"> |