From 7f27720aa9b3dd691b95635ea8b345a5a14a417f Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 28 Jan 2020 18:32:51 -0500 Subject: fixes for texttemplates that get updated. --- src/client/util/DropConverter.ts | 1 - src/client/util/RichTextSchema.tsx | 1 - src/client/views/collections/CollectionStackingViewFieldColumn.tsx | 2 +- src/new_fields/Doc.ts | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts index 8d92de28f..6faa21125 100644 --- a/src/client/util/DropConverter.ts +++ b/src/client/util/DropConverter.ts @@ -6,7 +6,6 @@ import { StrCast } from "../../new_fields/Types"; import { Docs } from "../documents/Documents"; import { ScriptField, ComputedField } from "../../new_fields/ScriptField"; import { RichTextField } from "../../new_fields/RichTextField"; -import { Compute } from "google-auth-library"; export function makeTemplate(doc: Doc): boolean { const layoutDoc = doc.layout instanceof Doc && doc.layout.isTemplateForField ? doc.layout : doc; diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index f667b86af..c0400bd6c 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -791,7 +791,6 @@ export class DashDocView { if (finalLayout !== dashDoc && finalKey) { const finalLayoutField = finalLayout[finalKey]; if (finalLayoutField instanceof ObjectField) { - //finalLayout._textTemplate = ObjectField.MakeCopy(finalLayoutField); finalLayout._textTemplate = ComputedField.MakeFunction(`copyField(this.${finalKey})`, { this: Doc.name }); } } diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx index 9cd9c1465..801cab896 100644 --- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx +++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx @@ -270,7 +270,7 @@ export class CollectionStackingViewFieldColumn extends React.Component dataDoc[fieldKey] instanceof RichTextField || dataDoc[fieldKey] instanceof ImageField).map(fieldKey => + Array.from(Object.keys(Doc.GetProto(dataDoc))).filter(fieldKey => dataDoc[fieldKey] instanceof RichTextField || dataDoc[fieldKey] instanceof ImageField || typeof (dataDoc[fieldKey]) === "string").map(fieldKey => docItems.push({ description: ":" + fieldKey, event: () => { const created = Docs.Get.DocumentFromField(dataDoc, fieldKey, Doc.GetProto(this.props.parent.props.Document)); diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index ca3aa0167..16678981d 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -612,7 +612,7 @@ export namespace Doc { (Doc.GetProto(templateField)[metadataFieldKey] = ObjectField.MakeCopy(templateField.data)); } if (templateField.data instanceof RichTextField && templateField.data.Data) { - templateField._textTemplate = ObjectField.MakeCopy(templateField.data); + templateField._textTemplate = ComputedField.MakeFunction(`copyField(this.${metadataFieldKey})`, { this: Doc.name }); } // get the layout string that the template uses to specify its layout -- cgit v1.2.3-70-g09d2