diff options
author | bobzel <zzzman@gmail.com> | 2024-01-04 10:18:57 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-01-04 10:18:57 -0500 |
commit | ebf32ac65d35053f847fb2cf60f915eb29d6fdd5 (patch) | |
tree | aca380ddebb208b8114f75ba7cc07d24ab4158f6 /src/fields/Doc.ts | |
parent | d1b3d3d852e6b8eed7949b17f566a59d97a2dcf4 (diff) |
fixed text references to docs or fields to create docs that don't exist. fixed IsLinkFollowing observable by not making static (to fix docDecorations not appearing after link following)
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 9dc3c173d..d726f7064 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -574,8 +574,10 @@ export namespace Doc { } export function BestEmbedding(doc: Doc) { - const bestEmbedding = Doc.GetProto(doc) ? [doc, ...DocListCast(doc.proto_embeddings)].find(doc => !doc.embedContainer && doc.author === Doc.CurrentUserEmail) : doc; - bestEmbedding && Doc.AddDocToList(Doc.GetProto(doc), 'protoEmbeddings', doc); + const dataDoc = doc[DocData]; + const availableEmbeddings = DocListCast(dataDoc.proto_embeddings); + const bestEmbedding = [...(dataDoc !== doc ? [doc] : []), ...availableEmbeddings].find(doc => !doc.embedContainer && doc.author === Doc.CurrentUserEmail); + bestEmbedding && Doc.AddDocToList(dataDoc, 'protoEmbeddings', doc); return bestEmbedding ?? Doc.MakeEmbedding(doc); } |