aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/Doc.ts11
-rw-r--r--src/fields/documentSchemas.ts6
2 files changed, 9 insertions, 8 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 56d50846a..b1bdd50a7 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -391,7 +391,10 @@ export class Doc extends RefField {
export namespace Doc {
export function SetContainer(doc: Doc, container: Doc) {
- container !== Doc.MyRecentlyClosed && (doc.embedContainer = container);
+ if (container !== Doc.MyRecentlyClosed) {
+ doc.embedContainer = container;
+ Doc.AddEmbedding(doc, doc);
+ }
}
export function RunCachedUpdate(doc: Doc, field: string) {
const update = doc[CachedUpdates][field];
@@ -604,7 +607,7 @@ export namespace Doc {
const dataDoc = doc[DocData];
const availableEmbeddings = Doc.GetEmbeddings(dataDoc);
const bestEmbedding = [...(dataDoc !== doc ? [doc] : []), ...availableEmbeddings].find(doc => !doc.embedContainer && doc.author === Doc.CurrentUserEmail);
- bestEmbedding && Doc.AddDocToList(dataDoc, 'protoEmbeddings', doc, undefined, undefined, undefined, undefined, undefined, true);
+ bestEmbedding && Doc.AddDocToList(dataDoc, 'proto_embeddings', doc, undefined, undefined, undefined, undefined, undefined, true);
return bestEmbedding ?? Doc.MakeEmbedding(doc);
}
@@ -984,10 +987,9 @@ export namespace Doc {
Object.keys(doc)
.filter(key => key.startsWith('acl'))
.forEach(key => (delegate[key] = doc[key]));
- if (!Doc.IsSystem(doc)) Doc.AddEmbedding(doc, delegate);
title && (delegate.title = title);
delegate[Initializing] = false;
- Doc.AddEmbedding(doc, delegate);
+ if (!Doc.IsSystem(doc)) Doc.AddEmbedding(doc, delegate);
return delegate;
}
return undefined;
@@ -1008,7 +1010,6 @@ export namespace Doc {
delegate[Initializing] = true;
delegate.proto = delegateProto;
delegate.author = Doc.CurrentUserEmail;
- Doc.AddEmbedding(delegateProto, delegate);
delegate[Initializing] = false;
delegateProto[Initializing] = false;
return delegate;
diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts
index 8eeb52709..1cacfe30c 100644
--- a/src/fields/documentSchemas.ts
+++ b/src/fields/documentSchemas.ts
@@ -96,9 +96,9 @@ export const documentSchema = createSchema({
// drag drop properties
_dragOnlyWithinContainer: 'boolean', // whether document can be dropped into a different collection
dragFactory: Doc, // the document that serves as the "template" for the onDragStart script. ie, to drag out copies of the dragFactory document.
- dropAction: 'string', // override specifying what should happen when something is dropped on this document (can be "embed", "copy", "move")
- dragAction: 'string', // override specifying what should happen when this document s dragged (can be "embed", "copy", "move")
- childDragAction: 'string', // specify the override for what should happen when the child of a collection is dragged from it and dropped (can be "embed" or "copy")
+ dropAction: 'string', // override specifying what should happen when something is dropped on this document (dropActionType)
+ dragAction: 'string', // override specifying what should happen when this document s dragged (dropActionType)
+ childDragAction: 'string', // specify the override for what should happen when the child of a collection is dragged from it and dropped (dropActionType)
dropPropertiesToRemove: listSpec('string'), // properties that should be removed from the embed/copy/etc of this document when it is dropped
});