From 2ca24a234817495c3330b93b504b13c0c6db91f3 Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Thu, 27 Jun 2019 14:22:45 -0400 Subject: fixed template stuff --- src/client/views/nodes/KeyValueBox.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 af22f0a48..0e798d291 100644 --- a/src/client/views/nodes/KeyValueBox.tsx +++ b/src/client/views/nodes/KeyValueBox.tsx @@ -99,8 +99,16 @@ export class KeyValueBox extends React.Component { let rows: JSX.Element[] = []; let i = 0; + const self = this; for (let key of Object.keys(ids).sort()) { - rows.push( { if (el) this.rows.push(el); }} keyWidth={100 - this.splitPercentage} rowStyle={"keyValueBox-" + (i++ % 2 ? "oddRow" : "evenRow")} key={key} keyName={key} />); + rows.push( { + if (oldEl) self.rows.splice(self.rows.indexOf(oldEl), 1); + oldEl = el; + if (el) self.rows.push(el); + }; + })()} keyWidth={100 - this.splitPercentage} rowStyle={"keyValueBox-" + (i++ % 2 ? "oddRow" : "evenRow")} key={key} keyName={key} />); } return rows; } @@ -189,9 +197,9 @@ export class KeyValueBox extends React.Component { inferType = (field: FieldResult, metaKey: string) => { let options = { width: 300, height: 300, title: metaKey }; if (field instanceof RichTextField || typeof field === "string" || typeof field === "number") { - return Docs.StackingDocument(options); + return Docs.TextDocument(options); } else if (field instanceof List) { - return Docs.FreeformDocument([], options); + return Docs.StackingDocument([], options); } else if (field instanceof ImageField) { return Docs.ImageDocument("https://www.freepik.com/free-icon/picture-frame-with-mountain-image_748687.htm", options); } -- cgit v1.2.3-70-g09d2