aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/LinkManager.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-10-10 01:17:04 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-10-10 01:17:04 +0530
commitd387ffe9756165c6e201da70e7a77744b280c4be (patch)
tree5983ab8e8abec6da69b204998ff682bd939dd0da /src/client/util/LinkManager.ts
parent7ae3e17011725b380b9010e7579c7084139b61e5 (diff)
parent3fe20d8730cf0d18fa18956105ee92cf434b6350 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/client/util/LinkManager.ts')
-rw-r--r--src/client/util/LinkManager.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts
index a2bb16dfc..56b6cb8a9 100644
--- a/src/client/util/LinkManager.ts
+++ b/src/client/util/LinkManager.ts
@@ -3,6 +3,7 @@ import { List } from "../../fields/List";
import { listSpec } from "../../fields/Schema";
import { Cast, StrCast } from "../../fields/Types";
import { SharingManager } from "./SharingManager";
+import { computedFn } from "mobx-utils";
/*
* link doc:
@@ -59,13 +60,18 @@ export class LinkManager {
});
return related;
}
- // finds all links that contain the given anchor
- public getAllRelatedLinks(anchor: Doc): Doc[] {
+
+ relatedLinker = computedFn(function realtedLinker(this: any, anchor: Doc) {
const related = LinkManager.Instance.getAllDirectLinks(anchor);
DocListCast(anchor[Doc.LayoutFieldKey(anchor) + "-annotations"]).map(anno => {
related.push(...LinkManager.Instance.getAllRelatedLinks(anno));
});
return related;
+ }.bind(this));
+
+ // finds all links that contain the given anchor
+ public getAllRelatedLinks(anchor: Doc): Doc[] {
+ return this.relatedLinker(anchor);
}
public deleteAllLinksOnAnchor(anchor: Doc) {