diff options
author | Sam Wilkins <samuel_wilkins@brown.edu> | 2019-06-04 20:04:19 -0400 |
---|---|---|
committer | Sam Wilkins <samuel_wilkins@brown.edu> | 2019-06-04 20:04:19 -0400 |
commit | d0f130d21c3e029592f376ff205b6f82b76b4e6e (patch) | |
tree | 65e97436bc0e8abfc3cead57c3adc8d8c43c769e | |
parent | 7d3ef1c914cc1cc0b6c05b14773a8b83e1b95c96 (diff) |
initial commit
-rw-r--r-- | src/client/views/MainView.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index a093ffdec..408d454f4 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -52,6 +52,15 @@ export class MainView extends React.Component { } } + componentWillMount() { + document.removeEventListener("keydown", this.globalKeyHandler); + document.addEventListener("keydown", this.globalKeyHandler); + } + + componentWillUnMount() { + document.removeEventListener("keydown", this.globalKeyHandler); + } + constructor(props: Readonly<{}>) { super(props); MainView.Instance = this; @@ -299,6 +308,19 @@ export class MainView extends React.Component { this.isSearchVisible = !this.isSearchVisible; } + globalKeyHandler = (e: KeyboardEvent) => { + if (e.key === "Control" || !e.ctrlKey) return; + + e.preventDefault(); + e.stopPropagation(); + + switch (e.key) { + case "ArrowRight": + CollectionDockingView.Instance.AddRightSplit(this.mainContainer!); + console.log("split screen right"); + } + } + render() { return ( <div id="main-div"> |