diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-07-16 17:48:11 -0400 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-07-16 17:48:11 -0400 |
commit | 7a4310f95da38cf5de55e487030284157acc58d8 (patch) | |
tree | 2a4b8fe4783a3cb501b944a51400d0b18101a67d /src/client/documents/Documents.ts | |
parent | aa32601952f9387d85d6f109aef9ad39396d3f98 (diff) |
link ctrl makes link show in context
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 177810444..85fc721da 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -483,18 +483,20 @@ export namespace Docs { export namespace DocUtils { - export function MakeLink(source: Doc, target: Doc, targetContext?: Doc, title: string = "", description: string = "", tags: string = "Default") { + export function MakeLink(source: Doc, target: Doc, targetContext?: Doc, title: string = "", description: string = "", tags: string = "Default", sourceContext?: Doc) { if (LinkManager.Instance.doesLinkExist(source, target)) return; let sv = DocumentManager.Instance.getDocumentView(source); if (sv && sv.props.ContainingCollectionView && sv.props.ContainingCollectionView.props.Document === target) return; if (target === CurrentUserUtils.UserDocument) return; + let linkDoc; UndoManager.RunInBatch(() => { - let linkDoc = Docs.Create.TextDocument({ width: 100, height: 30, borderRounding: "100%" }); + linkDoc = Docs.Create.TextDocument({ width: 100, height: 30, borderRounding: "100%" }); linkDoc.type = DocumentType.LINK; let linkDocProto = Doc.GetProto(linkDoc); - linkDocProto.context = targetContext; + linkDocProto.targetContext = targetContext; + linkDocProto.sourceContext = sourceContext; linkDocProto.title = title === "" ? source.title + " to " + target.title : title; linkDocProto.linkDescription = description; linkDocProto.linkTags = tags; @@ -509,8 +511,8 @@ export namespace DocUtils { LinkManager.Instance.addLink(linkDoc); - return linkDoc; }, "make link"); + return linkDoc; } } |