diff options
author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2021-08-25 06:55:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 06:55:32 -0400 |
commit | d88db8300f400e89d50fb42ee8d9186e147c61e7 (patch) | |
tree | a819ace5d1844fed81e5bf3f73b6f77479fe119d /src/client/util/LinkManager.ts | |
parent | e221001a24e8615aa6113dd3f25b8c6e10c74999 (diff) | |
parent | 9b0a043eeb272c69c1aac07c5a4df409f09400b7 (diff) |
Merge pull request #33 from brown-dash/linking-anh
Linking anh - fixed and expanded link relationships
Diffstat (limited to 'src/client/util/LinkManager.ts')
-rw-r--r-- | src/client/util/LinkManager.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index 3579083e4..84ff3a3ff 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -3,6 +3,7 @@ import { computedFn } from "mobx-utils"; import { DirectLinksSym, Doc, DocListCast, Field, Opt } from "../../fields/Doc"; import { List } from "../../fields/List"; import { ProxyField } from "../../fields/Proxy"; +import { listSpec } from "../../fields/Schema"; import { BoolCast, Cast, PromiseValue, StrCast } from "../../fields/Types"; import { LightboxView } from "../views/LightboxView"; import { DocumentViewSharedProps, ViewAdjustment } from "../views/nodes/DocumentView"; @@ -33,6 +34,7 @@ export class LinkManager { static links: Doc[] = []; constructor() { LinkManager._instance = this; + this.createLinkrelationshipLists(); setTimeout(() => { LinkManager.userLinkDBs = []; const addLinkToDoc = (link: Doc) => { @@ -97,6 +99,17 @@ export class LinkManager { }); } + + public createLinkrelationshipLists = () => { + //create new lists for link relations and their associated colors if the lists don't already exist + if (!Doc.UserDoc().linkRelationshipList && !Doc.UserDoc().linkColorList) { + const linkRelationshipList = new List<string>(); + const linkColorList = new List<string>(); + Doc.UserDoc().linkRelationshipList = linkRelationshipList; + Doc.UserDoc().linkColorList = linkColorList; + } + } + public addLink(linkDoc: Doc, checkExists = false) { if (!checkExists || !DocListCast(Doc.LinkDBDoc().data).includes(linkDoc)) { Doc.AddDocToList(Doc.LinkDBDoc(), "data", linkDoc); |