diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-10 15:51:08 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-10 15:51:08 -0400 |
commit | f056fb9e6af0f8a90137acd485c3c6622c0708f5 (patch) | |
tree | d10bede56ed8aa371850000eab7e8df6c6b6659d /src | |
parent | db6eb4b24014a517a3c62a47056335e8c063b063 (diff) |
fixed parameterized templates after refactor
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/DropConverter.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts index 8cea120cd..60a6bbb3c 100644 --- a/src/client/util/DropConverter.ts +++ b/src/client/util/DropConverter.ts @@ -36,7 +36,13 @@ export function makeTemplate(doc: Doc, first: boolean = true, rename: Opt<string } }); if (first) { - any = Doc.MakeMetadataFieldTemplate(doc, Doc.GetProto(layoutDoc)) || any; + if (docs.length) { // bcz: feels hacky : if the root level document has items, it's not a field template, but we still want its caption to be a textTemplate + if (doc.caption instanceof RichTextField && !doc.caption.Empty()) { + doc["caption-textTemplate"] = ComputedField.MakeFunction(`copyField(this.caption)`); + } + } else { + any = Doc.MakeMetadataFieldTemplate(doc, Doc.GetProto(layoutDoc)) || any; + } } if (layoutDoc[fieldKey] instanceof RichTextField || layoutDoc[fieldKey] instanceof ImageField) { if (!StrCast(layoutDoc.title).startsWith("-")) { |