aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GlobalKeyHandler.ts
diff options
context:
space:
mode:
authoreleanor-park <eleanor_park@brown.edu>2024-04-14 14:27:43 -0400
committereleanor-park <eleanor_park@brown.edu>2024-04-14 14:27:43 -0400
commit15e40cd865474f524c8e35f9352fc40d4b515ab3 (patch)
tree4ba71fafec248b22226157908b9fb578e4529df6 /src/client/views/GlobalKeyHandler.ts
parentd938cd08650279f5c7894793d5fd78ec4068694c (diff)
parent36d18da80e5e5e1c6cae0dc21c1677a7ab9c1d77 (diff)
Merge branch 'eleanor-starter' of https://github.com/brown-dash/Dash-Web into eleanor-starter
Diffstat (limited to 'src/client/views/GlobalKeyHandler.ts')
-rw-r--r--src/client/views/GlobalKeyHandler.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts
index 733383002..e800798ca 100644
--- a/src/client/views/GlobalKeyHandler.ts
+++ b/src/client/views/GlobalKeyHandler.ts
@@ -24,6 +24,7 @@ import { MainView } from './MainView';
import { DocumentLinksButton } from './nodes/DocumentLinksButton';
import { OpenWhereMod } from './nodes/DocumentView';
import { AnchorMenu } from './pdf/AnchorMenu';
+import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox';
const modifiers = ['control', 'meta', 'shift', 'alt'];
type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo;
@@ -61,6 +62,8 @@ export class KeyManager {
});
public handle = action((e: KeyboardEvent) => {
+ // accumulate buffer of characters to insert in a new text note. once the note is created, it will stop keyboard events from reaching this function.
+ if (FormattedTextBox.SelectOnLoadChar) FormattedTextBox.SelectOnLoadChar = FormattedTextBox.SelectOnLoadChar + (e.key === 'Enter' ? '\n' : e.key);
e.key === 'Control' && (CtrlKey = true);
//if (!Doc.noviceMode && e.key.toLocaleLowerCase() === "shift") DocServer.UPDATE_SERVER_CACHE(true);
const keyname = e.key && e.key.toLowerCase();