diff options
author | bob <bcz@cs.brown.edu> | 2020-01-28 18:32:51 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2020-01-28 18:32:51 -0500 |
commit | 7f27720aa9b3dd691b95635ea8b345a5a14a417f (patch) | |
tree | 9f500f9db5e4d5777240340910b7f1f813e52daf /src | |
parent | 0361c04360362c31e4bdd5d27b52707b4e288662 (diff) |
fixes for texttemplates that get updated.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/DropConverter.ts | 1 | ||||
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 1 | ||||
-rw-r--r-- | src/client/views/collections/CollectionStackingViewFieldColumn.tsx | 2 | ||||
-rw-r--r-- | src/new_fields/Doc.ts | 2 |
4 files changed, 2 insertions, 4 deletions
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<CSVFieldC const docItems: ContextMenuProps[] = []; const dataDoc = this.props.parent.props.DataDoc || this.props.parent.Document; - Array.from(Object.keys(Doc.GetProto(dataDoc))).filter(fieldKey => 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 |