diff options
| author | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-10-19 14:41:16 -0400 |
|---|---|---|
| committer | Abdullah Ahmed <abdullah_ahmed@brown.edu> | 2019-10-19 14:41:16 -0400 |
| commit | 1a8292f7588880718a657a5fca5c32f1a5975205 (patch) | |
| tree | 216639d9d5387ba2563b37b169c678301d671b15 /src/client/views/GlobalKeyHandler.ts | |
| parent | 5e04d7f94d180dc984e48eca888ac2cedfd0c7a3 (diff) | |
| parent | 3d910bae8771e67cabc1500c49b77d425fdf62e9 (diff) | |
merged
Diffstat (limited to 'src/client/views/GlobalKeyHandler.ts')
| -rw-r--r-- | src/client/views/GlobalKeyHandler.ts | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts index fd8c958a4..189e2bbe0 100644 --- a/src/client/views/GlobalKeyHandler.ts +++ b/src/client/views/GlobalKeyHandler.ts @@ -8,6 +8,11 @@ import { Doc } from "../../new_fields/Doc"; import { DictationManager } from "../util/DictationManager"; import { RecommendationsBox } from "./Recommendations"; import SharingManager from "../util/SharingManager"; +import { CurrentUserUtils } from "../../server/authentication/models/current_user_utils"; +import { Cast, PromiseValue } from "../../new_fields/Types"; +import { ScriptField } from "../../new_fields/ScriptField"; +import { InkingControl } from "./InkingControl"; +import { InkTool } from "../../new_fields/InkField"; const modifiers = ["control", "meta", "shift", "alt"]; type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo | Promise<KeyControlInfo>; @@ -62,6 +67,7 @@ export default class KeyManager { switch (keyname) { case "escape": let main = MainView.Instance; + InkingControl.Instance.switchTool(InkTool.None); if (main.isPointerDown) { DragManager.AbortDrag(); } else { @@ -71,7 +77,6 @@ export default class KeyManager { SelectionManager.DeselectAll(); } } - main.toggleColorPicker(true); SelectionManager.DeselectAll(); DictationManager.Controls.stop(); // RecommendationsBox.Instance.closeMenu(); @@ -122,10 +127,10 @@ export default class KeyManager { let preventDefault = true; switch (keyname) { - case "n": - let toggle = MainView.Instance.addMenuToggle.current!; - toggle.checked = !toggle.checked; - break; + // case "n": + // let toggle = MainView.Instance.addMenuToggle.current!; + // toggle.checked = !toggle.checked; + // break; } return { @@ -162,8 +167,29 @@ export default class KeyManager { } } break; + case "c": + PromiseValue(Cast(CurrentUserUtils.UserDocument.Create, Doc)).then(pv => pv && (pv.onClick as ScriptField).script.run({ this: pv })); + if (MainView.Instance.flyoutWidth === 240) { + MainView.Instance.flyoutWidth = 0; + } else { + MainView.Instance.flyoutWidth = 240; + } + break; + case "l": + PromiseValue(Cast(CurrentUserUtils.UserDocument.Library, Doc)).then(pv => pv && (pv.onClick as ScriptField).script.run({ this: pv })); + if (MainView.Instance.flyoutWidth === 250) { + MainView.Instance.flyoutWidth = 0; + } else { + MainView.Instance.flyoutWidth = 250; + } + break; case "f": - MainView.Instance.isSearchVisible = !MainView.Instance.isSearchVisible; + PromiseValue(Cast(CurrentUserUtils.UserDocument.Search, Doc)).then(pv => pv && (pv.onClick as ScriptField).script.run({ this: pv })); + if (MainView.Instance.flyoutWidth === 400) { + MainView.Instance.flyoutWidth = 0; + } else { + MainView.Instance.flyoutWidth = 400; + } break; case "o": let target = SelectionManager.SelectedDocuments()[0]; |
