From 4af498433a887c70dc7043a5a34eef7fff5bbbe0 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sun, 11 May 2025 07:51:59 -0400 Subject: a million and one things --- .../nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 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 7beb93636..8a98399b6 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx @@ -374,6 +374,7 @@ export class DocCreatorMenu extends ObservableReactComponent } @action updateRenderedPreviewCollection = async (template: Template) => { + this._docsRendering = true; this._fullyRenderedDocs = this._dataViz ? ((await this.templateManager.createDocsFromTemplate(this._dataViz, template, this.fieldsInfos, this.DEBUG_MODE)).filter(doc => doc).map(doc => doc!) ?? []) as unknown as Doc[] : []; this.updateRenderedDocCollection(); }; @@ -384,7 +385,6 @@ export class DocCreatorMenu extends ObservableReactComponent return; } else { this._selectedTemplate = template; - //template.renderUpdates(); this.updateRenderedPreviewCollection(template); } }; @@ -434,7 +434,7 @@ export class DocCreatorMenu extends ObservableReactComponent }; @action addField = () => { - const newFields: Col[] = this._userCreatedFields.concat([{ title: '', type: TemplateFieldType.UNSET, desc: '', sizes: [] }]); + const newFields: Col[] = this._userCreatedFields.concat([{ title: '', type: TemplateFieldType.UNSET, desc: '', sizes: [], AIGenerated: true }]); this._userCreatedFields = newFields; }; @@ -544,10 +544,10 @@ export class DocCreatorMenu extends ObservableReactComponent const toObj = Object.entries(assignment).reduce( (a, [fieldID, colTitle]) => { 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 field - const field = template.getFieldByID(Number(fieldID)); + if (!col.AIGenerated) { + var field = template.getFieldByID(Number(fieldID)); field.setContent(col.defaultContent ?? '', col.type === TemplateFieldType.VISUAL ? ViewType.IMG : ViewType.TEXT); + field = template.getFieldByID(Number(fieldID)); field.setTitle(col.title); } else { a[Number(fieldID)] = this.getColByTitle(colTitle); @@ -602,7 +602,7 @@ export class DocCreatorMenu extends ObservableReactComponent clone.x = 10000; clone.y = 10000; - await DrawingFillHandler.drawingToImage(clone, 100, prompt, undefined, this) + await DrawingFillHandler.drawingToImage(clone, 100, prompt, clone, this) return this.variations; } @@ -762,10 +762,9 @@ export class DocCreatorMenu extends ObservableReactComponent this._renderedDocCollection = collection; - // const mainCollection = this._dataViz?.DocumentView?.().containerViewPath?.().lastElement()?.ComponentView as CollectionFreeFormView; - // mainCollection.addDocument(collection); + this._docsRendering = false; - console.log('changed to: ', collection); + this.forceUpdate(); }; layoutPreviewContents = action(() => { -- cgit v1.2.3-70-g09d2