aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PreviewCursor.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-05 18:26:50 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-05 18:26:50 -0400
commit2a9db784a6e3492a8f7d8ce9a745b4f1a0494241 (patch)
treec3a6c50857c3349462e525eec10fb26088292071 /src/client/views/PreviewCursor.tsx
parentf706f70451525d4d0716c631cece9d78d76b3bfd (diff)
parent2caf7b7bb80b663b6ba585f88cdbd2d725f8505e (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into nathan-starter
Diffstat (limited to 'src/client/views/PreviewCursor.tsx')
-rw-r--r--src/client/views/PreviewCursor.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index a94c18295..4b7771f27 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -18,7 +18,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
return PreviewCursor._instance;
}
- _onKeyPress?: (e: KeyboardEvent) => void;
+ _onKeyDown?: (e: KeyboardEvent) => void;
_getTransform?: () => Transform;
_addDocument?: (doc: Doc | Doc[]) => boolean;
_addLiveTextDoc?: (doc: Doc) => void;
@@ -32,7 +32,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
makeObservable(this);
PreviewCursor._instance = this;
this._clickPoint = observable([0, 0]);
- document.addEventListener('keydown', this.onKeyPress);
+ document.addEventListener('keydown', this.onKeyDown);
document.addEventListener('paste', this.paste, true);
}
@@ -120,7 +120,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
};
@action
- onKeyPress = (e: KeyboardEvent) => {
+ onKeyDown = (e: KeyboardEvent) => {
// Mixing events between React and Native is finicky.
//if not these keys, make a textbox if preview cursor is active!
if (
@@ -146,7 +146,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
) {
if ((!e.metaKey && !e.ctrlKey) || (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 65 && e.keyCode <= 90)) {
// /^[a-zA-Z0-9$*^%#@+-=_|}{[]"':;?/><.,}]$/.test(e.key)) {
- this.Visible && this._onKeyPress?.(e);
+ this.Visible && this._onKeyDown?.(e);
((!e.ctrlKey && !e.metaKey) || e.key !== 'v') && (this.Visible = false);
}
} else if (this.Visible) {
@@ -171,7 +171,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
public static Show(
x: number,
y: number,
- onKeyPress: (e: KeyboardEvent) => void,
+ onKeyDown: (e: KeyboardEvent) => void,
addLiveText: (doc: Doc) => void,
getTransform: () => Transform,
addDocument: undefined | ((doc: Doc | Doc[]) => boolean),
@@ -181,7 +181,7 @@ export class PreviewCursor extends ObservableReactComponent<{}> {
const self = PreviewCursor.Instance;
if (self) {
self._clickPoint = [x, y];
- self._onKeyPress = onKeyPress;
+ self._onKeyDown = onKeyDown;
self._addLiveTextDoc = addLiveText;
self._getTransform = getTransform;
self._addDocument = addDocument || returnFalse;