From fe1536918dbbca08c9900497bb466fd7aa36ffdf Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Sat, 22 Feb 2025 15:02:26 -0500
Subject: Splitting staticfield into different content types (as subclasses)

---
 .../views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx')

diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index e8b80b7b5..b576aee82 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -32,7 +32,7 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
 import { TemplateFieldSize, TemplateFieldType, TemplateLayouts } from './TemplateBackend';
 import { TemplateManager } from './TemplateManager';
 import { Template } from './Template';
-import { Field, FieldContentType } from './FieldTypes/Field';
+import { Field, ViewType } from './FieldTypes/Field';
 import { TabDocView } from '../../../collections/TabDocView';
 
 export enum LayoutType {
@@ -585,7 +585,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                             const col = this.getColByTitle(colTitle);
                             if (!this._userCreatedFields.includes(col)){ // do the following for any fields not added by the user; will change in the future, for now only GPT content works with user-added fields
                                 const field = template.getFieldByID(Number(fieldID));
-                                field.setContent(col.defaultContent ?? '', col.type === TemplateFieldType.VISUAL ? FieldContentType.IMAGE : FieldContentType.STRING);
+                                field.setContent(col.defaultContent ?? '', col.type === TemplateFieldType.VISUAL ? ViewType.IMG : ViewType.TEXT);
                                 field.setTitle(col.title);
                             } else {
                                 a[Number(fieldID)] = this.getColByTitle(colTitle);
@@ -618,6 +618,8 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
 
         const renderedTemplates: (Template | undefined)[] = await Promise.all(renderedTemplatePromises);
 
+        templates.forEach(template => template.mainField.updateRenderedDoc())
+
         setTimeout(() => {
             this.setSuggestedTemplates(templates);
             this._GPTLoading = false;
@@ -630,7 +632,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
             console.log('url: ', url)
             const field: Field = template.getFieldByID(Number(fieldNum));
 
-            field.setContent(url ?? '', FieldContentType.IMAGE);
+            field.setContent(url ?? '', ViewType.IMG);
             field.setTitle(col.title);
         };
 
@@ -687,7 +689,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                     const field: Field = template.getFieldByID(Number(info.number));
                     const col = this.getColByTitle(title);
 
-                    field.setContent(info.content ?? '', FieldContentType.STRING);
+                    field.setContent(info.content ?? '', ViewType.TEXT);
                     field.setTitle(col.title);
                 });
             }
-- 
cgit v1.2.3-70-g09d2

