aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/MainView.tsx2
-rw-r--r--src/client/views/nodes/ImageBox.tsx17
2 files changed, 9 insertions, 10 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index fad53523c..58b8d255a 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -1042,7 +1042,7 @@ export class MainView extends ObservableReactComponent<{}> {
<OverlayView />
<GPTPopup key="gptpopup" />
<SchemaCSVPopUp key="schemacsvpopup" />
- <GenerativeFill imageEditorOpen={ImageEditor.Open} imageEditorSource={ImageEditor.Source} imageRootDoc={ImageEditor.RootDoc} addDoc={ImageBox.addDoc} />
+ <GenerativeFill imageEditorOpen={ImageEditor.Open} imageEditorSource={ImageEditor.Source} imageRootDoc={ImageEditor.RootDoc} addDoc={ImageEditor.AddDoc} />
{/* <NewLightboxView key="newLightbox" PanelWidth={this._windowWidth} PanelHeight={this._windowHeight} maxBorder={[200, 50]} /> */}
</div>
);
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index cb799abd9..bb1f70f97 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -37,8 +37,8 @@ import { PinProps, PresBox } from './trails';
export class ImageEditorData {
private static _instance: ImageEditorData;
private static get imageData() { return (ImageEditorData._instance ?? new ImageEditorData()).imageData; } // prettier-ignore
- @observable imageData: { rootDoc: Doc | undefined; open: boolean; source: string } = observable({ rootDoc: undefined, open: false, source: '' });
- @action private static set = (open: boolean, rootDoc: Doc | undefined, source: string) => (this._instance.imageData = { open, rootDoc, source });
+ @observable imageData: { rootDoc: Doc | undefined; open: boolean; source: string; addDoc: Opt<(doc: Doc | Doc[], annotationKey?: string) => boolean> } = observable({ rootDoc: undefined, open: false, source: '', addDoc: undefined });
+ @action private static set = (open: boolean, rootDoc: Doc | undefined, source: string, addDoc: Opt<(doc: Doc | Doc[], annotationKey?: string) => boolean>) => (this._instance.imageData = { open, rootDoc, source, addDoc });
constructor() {
makeObservable(this);
@@ -48,18 +48,17 @@ export class ImageEditorData {
public static get Open() { return ImageEditorData.imageData.open; } // prettier-ignore
public static get Source() { return ImageEditorData.imageData.source; } // prettier-ignore
public static get RootDoc() { return ImageEditorData.imageData.rootDoc; } // prettier-ignore
- public static set Open(open: boolean) { ImageEditorData.set(open, this.imageData.rootDoc, this.imageData.source); } // prettier-ignore
- public static set Source(source: string) { ImageEditorData.set(this.imageData.open, this.imageData.rootDoc, source); } // prettier-ignore
- public static set RootDoc(rootDoc: Opt<Doc>) { ImageEditorData.set(this.imageData.open, rootDoc, this.imageData.source); } // prettier-ignore
+ public static get AddDoc() { return ImageEditorData.imageData.addDoc; } // prettier-ignore
+ public static set Open(open: boolean) { ImageEditorData.set(open, this.imageData.rootDoc, this.imageData.source, this.imageData.addDoc); } // prettier-ignore
+ public static set Source(source: string) { ImageEditorData.set(this.imageData.open, this.imageData.rootDoc, source, this.imageData.addDoc); } // prettier-ignore
+ public static set RootDoc(rootDoc: Opt<Doc>) { ImageEditorData.set(this.imageData.open, rootDoc, this.imageData.source, this.imageData.addDoc); } // prettier-ignore
+ public static set AddDoc(addDoc: Opt<(doc: Doc | Doc[], annotationKey?: string) => boolean>) { ImageEditorData.set(this.imageData.open, this.imageData.rootDoc, this.imageData.source, addDoc); } // prettier-ignore
}
@observer
export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() implements ViewBoxInterface {
public static LayoutString(fieldKey: string) {
return FieldView.LayoutString(ImageBox, fieldKey);
}
-
- @observable public static addDoc: ((doc: Doc | Doc[], annotationKey?: string) => boolean) | undefined = undefined;
-
private _ignoreScroll = false;
private _forcedScroll = false;
private _dropDisposer?: DragManager.DragDropDisposer;
@@ -258,7 +257,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() impl
event: action(() => {
ImageEditorData.Open = true;
ImageEditorData.Source = this.choosePath(field.url);
- ImageBox.addDoc = this._props.addDocument;
+ ImageEditorData.AddDoc = this._props.addDocument;
ImageEditorData.RootDoc = this.Document;
}),
icon: 'pencil-alt',