aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-13 23:15:20 -0400
committerbobzel <zzzman@gmail.com>2020-09-13 23:15:20 -0400
commite02715b188a8fbaf47b5aef9e1bc892bf57627a6 (patch)
tree094bba2edcfc8be2e5267cd0520aab544f674e73 /src/fields/Doc.ts
parentd6094e43606763ef9499f3e1fd42ac619e493135 (diff)
got rid of textTemplates which were superfluous. fixed problems with stored Marks on templates when creating one by typing and the template is the default layout.
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 9553c4c7b..ff45dda80 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -507,7 +507,9 @@ export namespace Doc {
Doc.SetLayout(alias, Doc.MakeAlias(layout));
}
alias.aliasOf = doc;
- alias.title = ComputedField.MakeFunction(`renameAlias(this, ${Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1})`);
+ if (doc !== Doc.GetProto(doc)) {
+ alias.title = ComputedField.MakeFunction(`renameAlias(this, ${Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1})`);
+ }
alias.author = Doc.CurrentUserEmail;
alias[AclSym] = doc[AclSym];
@@ -782,7 +784,6 @@ export namespace Doc {
if (doc) {
const delegate = new Doc(id, true);
delegate.proto = doc;
- delegate.isPrototype = true;
delegate.author = Doc.CurrentUserEmail;
title && (delegate.title = title);
return delegate;
@@ -841,14 +842,6 @@ export namespace Doc {
Cast(templateFieldValue, listSpec(Doc), [])?.map(d => d instanceof Doc && MakeMetadataFieldTemplate(d, templateDoc));
(Doc.GetProto(templateField)[metadataFieldKey] = ObjectField.MakeCopy(templateFieldValue));
}
- // copy the textTemplates from 'this' (not 'self') because the layout contains the template info, not the original doc
- if (templateCaptionValue instanceof RichTextField && !templateCaptionValue.Empty()) {
- templateField["caption-textTemplate"] = ComputedField.MakeFunction(`copyField(this.caption)`);
- }
- if (templateFieldValue instanceof RichTextField && !templateFieldValue.Empty()) {
- templateField[metadataFieldKey + "-textTemplate"] = ComputedField.MakeFunction(`copyField(this.${metadataFieldKey})`);
- }
-
// get the layout string that the template uses to specify its layout
const templateFieldLayoutString = StrCast(Doc.LayoutField(Doc.Layout(templateField)));
@@ -1137,6 +1130,7 @@ export namespace Doc {
}
export function delegateDragFactory(dragFactory: Doc) {
const ndoc = Doc.MakeDelegate(dragFactory);
+ ndoc.isPrototype = true;
if (ndoc && dragFactory["dragFactory-count"] !== undefined) {
dragFactory["dragFactory-count"] = NumCast(dragFactory["dragFactory-count"]) + 1;
Doc.GetProto(ndoc).title = ndoc.title + " " + NumCast(dragFactory["dragFactory-count"]).toString();