aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index b9c6e5478..b2a320517 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -631,16 +631,16 @@ export namespace DocUtils {
LinkManager.Instance.deleteLink(link);
LinkManager.Instance.addLink(link);
}
- })
- })
+ });
+ });
}
}
});
}
export function MakeLink(source: Doc, target: Doc, targetContext?: Doc, title: string = "", description: string = "", sourceContext?: Doc, id?: string, anchored1?: boolean) {
- if (LinkManager.Instance.doesLinkExist(source, target)) return undefined;
+ // if (LinkManager.Instance.doesLinkExist(source, target)) return undefined;
let sv = DocumentManager.Instance.getDocumentView(source);
- if (sv && sv.props.ContainingCollectionView && sv.props.ContainingCollectionView.props.Document === target) return;
+ if (sv && sv.props.ContainingCollectionDoc === target) return;
if (target === CurrentUserUtils.UserDocument) return undefined;
let linkDocProto = new Doc(id, true);
@@ -662,10 +662,8 @@ export namespace DocUtils {
LinkManager.Instance.addLink(linkDocProto);
- let script = `return links(this);`;
- let computed = CompileScript(script, { params: { this: "Doc" }, typecheck: false });
- computed.compiled && (Doc.GetProto(source).links = new ComputedField(computed));
- computed.compiled && (Doc.GetProto(target).links = new ComputedField(computed));
+ Doc.GetProto(source).links = ComputedField.MakeFunction("links(this)");
+ Doc.GetProto(target).links = ComputedField.MakeFunction("links(this)");
}, "make link");
return linkDocProto;
}