From 3b1162f58fd854091fca515dfe9af942d2220108 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 25 Oct 2022 14:34:53 -0400
Subject: fixed up dragging fields from key value pane to support numbers

---
 src/client/views/nodes/KeyValueBox.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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

diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx
index d9f46509e..7d04c4b64 100644
--- a/src/client/views/nodes/KeyValueBox.tsx
+++ b/src/client/views/nodes/KeyValueBox.tsx
@@ -209,13 +209,18 @@ export class KeyValueBox extends React.Component<FieldViewProps> {
             }
             return parent;
         }
-        return this.createFieldView(DocCast(this.props.Document.data), rows.lastElement());
+        return rows.length ? this.createFieldView(DocCast(this.props.Document.data), rows.lastElement()) : undefined;
     };
 
     createFieldView = (templateDoc: Doc, row: KeyValuePair) => {
         const metaKey = row.props.keyName;
-        const fieldTemplate = Doc.MakeAlias(templateDoc);
+        const fieldTemplate = Doc.IsDelegateField(templateDoc, metaKey) ? Doc.MakeDelegate(templateDoc) : Doc.MakeAlias(templateDoc);
         fieldTemplate.title = metaKey;
+        fieldTemplate.fitWidth = true;
+        fieldTemplate._xMargin = 10;
+        fieldTemplate._yMargin = 10;
+        fieldTemplate._width = 100;
+        fieldTemplate._height = 40;
         fieldTemplate.layout = this.inferType(templateDoc[metaKey], metaKey);
         return fieldTemplate;
     };
-- 
cgit v1.2.3-70-g09d2

