aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DropConverter.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-05-09 23:01:36 -0400
committerbobzel <zzzman@gmail.com>2025-05-09 23:01:36 -0400
commit299398cb7e21259de3bf7597995840b84e7e0590 (patch)
treebe9af99f42699470f2aaa5e991ad4e84603da629 /src/client/util/DropConverter.ts
parent4b8c4c9277cca69ea3341ca6ddf4c7f5befc78a0 (diff)
added user templates to template_user global field. fixed schemas to not erase field values when setting a new column name. fixed templates to render properly when switching by fixing contentsRef to be observable. fixed templates with fields in stacks to autoHeight update correctly by . fixed images in templates to set their nativeDim after rendering. fixed text views of descriptions to auto-updated by setting the modification date of the description field.
Diffstat (limited to 'src/client/util/DropConverter.ts')
-rw-r--r--src/client/util/DropConverter.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts
index b6b111930..1d4779d8a 100644
--- a/src/client/util/DropConverter.ts
+++ b/src/client/util/DropConverter.ts
@@ -41,7 +41,7 @@ function makeTemplate(doc: Doc, first: boolean = true): boolean {
if (first && !docs.length) {
// bcz: feels hacky : if the root level document has items, it's not a field template
isTemplate = Doc.MakeMetadataFieldTemplate(doc, layoutDoc[DocData], true) || isTemplate;
- } else if (docData instanceof RichTextField || docData instanceof ImageField) {
+ } else if (docData instanceof RichTextField || docData instanceof ImageField || (docData === undefined && doc.type === DocumentType.IMG)) {
if (!StrCast(layoutDoc.title).startsWith('-')) {
isTemplate = Doc.MakeMetadataFieldTemplate(layoutDoc, layoutDoc[DocData], true);
}
@@ -86,6 +86,8 @@ export function makeUserTemplateButtonOrImage(doc: Doc, image?: string) {
dbox.dragFactory = layoutDoc;
dbox.dropPropertiesToRemove = doc.dropPropertiesToRemove instanceof ObjectField ? ObjectField.MakeCopy(doc.dropPropertiesToRemove) : undefined;
dbox.onDragStart = ScriptField.MakeFunction('getCopy(this.dragFactory)');
+ const userTemplatesDoc = DocCast(Doc.UserDoc().template_user);
+ userTemplatesDoc && Doc.AddDocToList(userTemplatesDoc, 'data', layoutDoc);
return dbox;
}