aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-06-27 12:30:12 -0400
committeryipstanley <stanley_yip@brown.edu>2019-06-27 12:30:12 -0400
commit775885384e6032dbb8f0d37b569854a0692a4b45 (patch)
tree8612d98fa6f15d730ec0da3c8684df6d3066c3fb /src/client/views/search
parent088eec96750fcbdfc30b42f24e8b57926441f4e5 (diff)
parentc0bbdabe7d2e1eb422a12697848ada7127c6e2dc (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/SearchItem.tsx41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx
index 5082f9623..b495975cb 100644
--- a/src/client/views/search/SearchItem.tsx
+++ b/src/client/views/search/SearchItem.tsx
@@ -19,6 +19,7 @@ import { FilterBox } from "./FilterBox";
import { DocumentView } from "../nodes/DocumentView";
import "./SelectorContextMenu.scss";
import { SearchBox } from "./SearchBox";
+import { LinkManager } from "../../util/LinkManager";
export interface SearchItemProps {
doc: Doc;
@@ -87,7 +88,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
@observable _selected: boolean = false;
onClick = () => {
- CollectionDockingView.Instance.AddRightSplit(this.props.doc, undefined);
+ DocumentManager.Instance.jumpToDocument(this.props.doc, false);
}
@computed
@@ -119,7 +120,7 @@ export class SearchItem extends React.Component<SearchItemProps> {
}
@computed
- get linkCount() { return Cast(this.props.doc.linkedToDocs, listSpec(Doc), []).length + Cast(this.props.doc.linkedFromDocs, listSpec(Doc), []).length; }
+ get linkCount() { return LinkManager.Instance.getAllRelatedLinks(this.props.doc).length; }
@computed
get linkString(): string {
@@ -133,17 +134,37 @@ export class SearchItem extends React.Component<SearchItemProps> {
pointerDown = (e: React.PointerEvent) => { SearchBox.Instance.openSearch(e); };
highlightDoc = (e: React.PointerEvent) => {
- let docViews: DocumentView[] = DocumentManager.Instance.getAllDocumentViews(this.props.doc);
- docViews.forEach(element => {
- element.props.Document.libraryBrush = true;
- });
+ if (this.props.doc.type === DocTypes.LINK) {
+ if (this.props.doc.anchor1 && this.props.doc.anchor2) {
+
+ let doc1 = Cast(this.props.doc.anchor1, Doc, new Doc());
+ let doc2 = Cast(this.props.doc.anchor2, Doc, new Doc());
+ doc1.libraryBrush = true;
+ doc2.libraryBrush = true;
+ }
+ } else {
+ let docViews: DocumentView[] = DocumentManager.Instance.getAllDocumentViews(this.props.doc);
+ docViews.forEach(element => {
+ element.props.Document.libraryBrush = true;
+ });
+ }
}
unHighlightDoc = (e: React.PointerEvent) => {
- let docViews: DocumentView[] = DocumentManager.Instance.getAllDocumentViews(this.props.doc);
- docViews.forEach(element => {
- element.props.Document.libraryBrush = false;
- });
+ if (this.props.doc.type === DocTypes.LINK) {
+ if (this.props.doc.anchor1 && this.props.doc.anchor2) {
+
+ let doc1 = Cast(this.props.doc.anchor1, Doc, new Doc());
+ let doc2 = Cast(this.props.doc.anchor2, Doc, new Doc());
+ doc1.libraryBrush = false;
+ doc2.libraryBrush = false;
+ }
+ } else {
+ let docViews: DocumentView[] = DocumentManager.Instance.getAllDocumentViews(this.props.doc);
+ docViews.forEach(element => {
+ element.props.Document.libraryBrush = false;
+ });
+ }
}
render() {