From cf91c46cfec6e3e36b9184764016f9c1b5c997d4 Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Tue, 11 Mar 2025 17:31:16 +0100
Subject: c

---
 .../nodes/DataVizBox/DocCreatorMenu/Template.tsx     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

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

diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
index 43f622512..0f911421a 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx
@@ -32,22 +32,22 @@ export class Template {
         //dispose each subfields disposers, etc.
     }
 
-    cloneBase = (): Template => {
-        const makeCloneFieldTree = (field: Field): Field => {
-            const root: Field = field.makeClone();
-            field.getSubfields.forEach(field => {
-                const clone: Field = makeCloneFieldTree(field);
+    cloneBase = async (): Promise<Template> => {
+        const makeCloneFieldTree = async (field: Field): Promise<Field> => {
+            const root: Field = await field.makeClone();
+            field.getSubfields.forEach(async field => {
+                const clone: Field = await makeCloneFieldTree(field);
                 root.addField(clone);
             });
             return root;
         }
 
         const clone: Template = new Template(TemplateLayouts.BasicSettings);
-        console.log('made clone')
-        clone.mainField = makeCloneFieldTree(this.mainField) as DynamicField;
-        console.log('reinit')
-        clone.mainField.initializeDocument(clone.mainField.documentOptions);
-        console.log('cloned, fieldinfo: ', this.mainField, ' width: ', this.mainField.renderedDoc._width, ' options width: ', clone.mainField.documentOptions._width);
+        clone.mainField = await makeCloneFieldTree(this.mainField) as DynamicField;
+        console.log('last init')
+        clone.mainField.initializeDocument();
+        clone.mainField.renderedDoc._width = this.mainField.renderedDoc._width;
+        clone.mainField.renderedDoc._height = this.mainField.renderedDoc._height;
         return clone;
     }
 
-- 
cgit v1.2.3-70-g09d2

