Skip to content

Commit ee82fe1

Browse files
committed
don't eat inputs
1 parent 4ae5b4c commit ee82fe1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/webpage/editor/editor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,9 @@ class Editor extends EventTarget {
656656
this.renderToCanvas(ctx);
657657
return;
658658
}
659-
e.preventDefault();
659+
660660
if (e.key.startsWith("Arrow")) {
661+
e.preventDefault();
661662
if (!e.shiftKey) {
662663
this.castToCursorsPassive();
663664
if (!("possitions" in this.cursor))
@@ -715,6 +716,7 @@ class Editor extends EventTarget {
715716
!e.altKey &&
716717
!e.ctrlKey
717718
) {
719+
e.preventDefault();
718720
if ("highlights" in this.cursor) {
719721
this.pushPast();
720722
this.castToCursorsDestructive();
@@ -784,12 +786,14 @@ class Editor extends EventTarget {
784786
!e.altKey &&
785787
!e.metaKey
786788
) {
789+
e.preventDefault();
787790
navigator.clipboard.writeText(this.copy().join("\n"));
788791
if (e.key === "x") {
789792
this.pushPast();
790793
this.castToCursorsDestructive();
791794
}
792795
} else if (e.key.toLowerCase() === "a" && e.ctrlKey && !e.altKey && !e.metaKey) {
796+
e.preventDefault();
793797
if (e.shiftKey) {
794798
console.log("not here?");
795799
this.castToCursorsPassive();
@@ -807,8 +811,10 @@ class Editor extends EventTarget {
807811
};
808812
}
809813
} else if (e.key === "a" && !e.ctrlKey && e.altKey && !e.metaKey) {
814+
e.preventDefault();
810815
this.assemble();
811816
} else if (e.key === "Backspace" && e.ctrlKey) {
817+
e.preventDefault();
812818
this.pushPast();
813819
this.castToCursorsDestructive();
814820
if ("highlight" in this.cursor) throw Error("oops, idk how I got here!");
@@ -829,6 +835,7 @@ class Editor extends EventTarget {
829835
this.renderToCanvas(ctx);
830836
return;
831837
} else if (e.key === "s" && e.ctrlKey && !e.altKey && !e.metaKey) {
838+
e.preventDefault();
832839
this.save();
833840
}
834841
this.focusCursors();

0 commit comments

Comments
 (0)