aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PreviewCursor.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-09-26 16:49:43 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-09-26 16:49:43 -0400
commitf2958fd4d7dab5369c9e68c5d8f3b50332391aac (patch)
tree633e77c196ad4c8c51fb7244e4af22c88168e10d /src/client/views/PreviewCursor.tsx
parentaa3dc83bdd723db2597dc36fe09ae288ce3641da (diff)
parent78edc744c77e378728d033001331737df0b2f393 (diff)
Merge branch 'master' into sophie-ai-images
Diffstat (limited to 'src/client/views/PreviewCursor.tsx')
-rw-r--r--src/client/views/PreviewCursor.tsx13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index 82d2bff56..e3a43d45f 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -1,9 +1,8 @@
import { action, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
-import { Doc } from '../../fields/Doc';
-import { StrCast } from '../../fields/Types';
-import { returnFalse } from '../../Utils';
+import { Doc, Opt } from '../../fields/Doc';
+import { lightOrDark, returnFalse } from '../../Utils';
import { Docs, DocumentOptions, DocUtils } from '../documents/Documents';
import { ImageUtils } from '../util/Import & Export/ImageUtils';
import { Transform } from '../util/Transform';
@@ -21,6 +20,7 @@ export class PreviewCursor extends React.Component<{}> {
static _slowLoadDocuments?: (files: File[] | string, options: DocumentOptions, generatedDocuments: Doc[], text: string, completed: ((doc: Doc[]) => void) | undefined, addDocument: (doc: Doc | Doc[]) => boolean) => Promise<void>;
@observable static _clickPoint = [0, 0];
@observable public static Visible = false;
+ public static Doc: Opt<Doc>;
constructor(props: any) {
super(props);
document.addEventListener('keydown', this.onKeyPress);
@@ -178,7 +178,12 @@ export class PreviewCursor extends React.Component<{}> {
}
render() {
return !PreviewCursor._clickPoint || !PreviewCursor.Visible ? null : (
- <div className={`previewCursor${StrCast(Doc.ActiveDashboard?.colorScheme)}`} onBlur={this.onBlur} tabIndex={0} ref={e => e?.focus()} style={{ transform: `translate(${PreviewCursor._clickPoint[0]}px, ${PreviewCursor._clickPoint[1]}px)` }}>
+ <div
+ className="previewCursor"
+ onBlur={this.onBlur}
+ tabIndex={0}
+ ref={e => e?.focus()}
+ style={{ color: lightOrDark(PreviewCursor.Doc?.backgroundColor ?? 'white'), transform: `translate(${PreviewCursor._clickPoint[0]}px, ${PreviewCursor._clickPoint[1]}px)` }}>
I
</div>
);