aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkTranscription.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-09-02 12:16:43 -0400
committerbobzel <zzzman@gmail.com>2024-09-02 12:16:43 -0400
commitb453414dc2bb11d56c5dcb2a73d389eefabff7d5 (patch)
tree439ba13733a35bda2afae95cafce22c55b6ead6a /src/client/views/InkTranscription.tsx
parentcbb74abac69e6f4e6f7f813e57a5cc3280647d39 (diff)
cleaned up updateIcon to use promises to avoid a bunch of setTimeouts
Diffstat (limited to 'src/client/views/InkTranscription.tsx')
-rw-r--r--src/client/views/InkTranscription.tsx14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/client/views/InkTranscription.tsx b/src/client/views/InkTranscription.tsx
index 485a0e7c4..26e0aa372 100644
--- a/src/client/views/InkTranscription.tsx
+++ b/src/client/views/InkTranscription.tsx
@@ -3,7 +3,7 @@ import { action, observable } from 'mobx';
import * as React from 'react';
import { Doc, DocListCast } from '../../fields/Doc';
import { InkData, InkField, InkTool } from '../../fields/InkField';
-import { Cast, DateCast, ImageCast, NumCast, StrCast } from '../../fields/Types';
+import { Cast, DateCast, DocCast, ImageCast, NumCast, StrCast } from '../../fields/Types';
import { aggregateBounds } from '../../Utils';
import { DocumentType } from '../documents/DocumentTypes';
import { CollectionFreeFormView, MarqueeView } from './collections/collectionFreeForm';
@@ -273,7 +273,7 @@ export class InkTranscription extends React.Component {
DocumentView.getDocumentView(this.currGroup)?.ComponentView?.updateIcon?.();
this.currGroup.transcription = text;
this.currGroup.title = text;
- let image = await this.getIcon();
+ let image = await DocumentView.GetDocImage(this.currGroup);
const pathname = image?.url.href as string;
console.log(image?.url);
console.log(image);
@@ -300,16 +300,6 @@ export class InkTranscription extends React.Component {
}
}
};
- async getIcon() {
- const docView = DocumentView.getDocumentView(this.currGroup);
- console.log(this.currGroup);
- if (docView) {
- console.log(docView);
- docView.ComponentView?.updateIcon?.();
- return new Promise<ImageField | undefined>(res => setTimeout(() => res(ImageCast(docView.Document.icon)), 1000));
- }
- return undefined;
- }
imageUrlToBase64 = async (imageUrl: string): Promise<string> => {
try {
const response = await fetch(imageUrl);