From fba9b8e68e19e65e9823c5538b7b8b25baeb4670 Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Wed, 22 Feb 2023 19:24:41 -0500
Subject: fixes

---
 src/client/views/nodes/formattedText/FormattedTextBox.tsx | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

(limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')

diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 652971298..683ccb9c4 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -848,12 +848,6 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
 
     generateImage = async () => {
         console.log("Generate image from text: ", (this.dataDoc.text as RichTextField)?.Text);
-        const newDoc = Docs.Create.ImageDocument("https://media.tenor.com/ffyK3EANQyYAAAAd/loading-chemical.gif", {
-            x: NumCast(this.rootDoc.x) + NumCast(this.layoutDoc._width) + 10, 
-            y: NumCast(this.rootDoc.y),
-            _height: 200,
-            _width: 200
-        })
         try {
             const configuration = new Configuration({
                 apiKey: process.env.OPENAI_KEY,
@@ -867,7 +861,12 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
             let image_url = response.data.data[0].url;
             console.log(image_url);
             if (image_url) {
-                // const newDoc = Docs.Create.ImageDocument();
+                const newDoc = Docs.Create.ImageDocument(image_url, {
+                    x: NumCast(this.rootDoc.x) + NumCast(this.layoutDoc._width) + 10, 
+                    y: NumCast(this.rootDoc.y),
+                    _height: 200,
+                    _width: 200
+                })
                 if (DocListCast(Doc.MyOverlayDocs?.data).includes(this.rootDoc)) {
                     newDoc.overlayX = this.rootDoc.x;
                     newDoc.overlayY = NumCast(this.rootDoc.y) + NumCast(this.rootDoc._height);
-- 
cgit v1.2.3-70-g09d2

