aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-07-12 19:23:35 -0400
committeryipstanley <stanley_yip@brown.edu>2019-07-12 19:23:35 -0400
commit1e79bbb18e54a4408099470c9677b67826db52bb (patch)
treeb1a52c527f466860a714ab26e7a2d2b7872df88d /src
parent1dceb81a4b0a5c0e5b0c620b9cce2cebaa8430bd (diff)
backspace no longer deletes things
Diffstat (limited to 'src')
-rw-r--r--src/client/views/GlobalKeyHandler.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts
index 280b13599..037eee55f 100644
--- a/src/client/views/GlobalKeyHandler.ts
+++ b/src/client/views/GlobalKeyHandler.ts
@@ -6,7 +6,7 @@ import { DragManager } from "../util/DragManager";
import { action } from "mobx";
const modifiers = ["control", "meta", "shift", "alt"];
-type KeyHandler = (keycode: string) => KeyControlInfo;
+type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo;
type KeyControlInfo = {
preventDefault: boolean,
stopPropagation: boolean
@@ -42,7 +42,7 @@ export default class KeyManager {
return;
}
- let control = handleConstrained(keyname);
+ let control = handleConstrained(keyname, e);
control.stopPropagation && e.stopPropagation();
control.preventDefault && e.preventDefault();
@@ -53,7 +53,7 @@ export default class KeyManager {
}
});
- private unmodified = action((keyname: string) => {
+ private unmodified = action((keyname: string, e: KeyboardEvent) => {
switch (keyname) {
case "escape":
if (MainView.Instance.isPointerDown) {
@@ -69,6 +69,11 @@ export default class KeyManager {
break;
case "delete":
case "backspace":
+ if (document.activeElement) {
+ if (document.activeElement.tagName === "INPUT" || document.activeElement.tagName === "TEXTAREA") {
+ return;
+ }
+ }
UndoManager.RunInBatch(() => {
SelectionManager.SelectedDocuments().map(docView => {
let doc = docView.props.Document;