From bd03aebc435d07983d7100787b41028a3673fd98 Mon Sep 17 00:00:00 2001 From: ab Date: Tue, 2 Jul 2019 14:32:10 -0400 Subject: idk --- src/client/views/search/SearchBox.tsx | 2 +- src/client/views/search/SearchItem.tsx | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index dc21e4a3c..2582c0d94 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -192,7 +192,7 @@ export class SearchBox extends React.Component {
{(this._results.length !== 0) ? ( - this._results.map(result => ) + this._results.map(result => ) ) : this._openNoResults ? (
No Search Results
) : null}
diff --git a/src/client/views/search/SearchItem.tsx b/src/client/views/search/SearchItem.tsx index f4ea3ee09..d2e57c5ca 100644 --- a/src/client/views/search/SearchItem.tsx +++ b/src/client/views/search/SearchItem.tsx @@ -21,9 +21,14 @@ import { DocumentView } from "../nodes/DocumentView"; import { SearchBox } from "./SearchBox"; import "./SearchItem.scss"; import "./SelectorContextMenu.scss"; +import { RichTextField } from "../../../new_fields/RichTextField"; +import { FormattedTextBox } from "../nodes/FormattedTextBox"; +import { MarqueeView } from "../collections/collectionFreeForm/MarqueeView"; +import { SelectionManager } from "../../util/SelectionManager"; export interface SearchItemProps { doc: Doc; + query?: string; } library.add(faCaretUp); @@ -120,8 +125,8 @@ export class LinkContextMenu extends React.Component { return (

Anchors:

-
Doc 1: {this.props.doc2.title}
-
Doc 2: {this.props.doc1.title}
+
Doc 1: {this.props.doc2.title}
+
Doc 2: {this.props.doc1.title}
) } @@ -135,10 +140,25 @@ export class SearchItem extends React.Component { onClick = () => { DocumentManager.Instance.jumpToDocument(this.props.doc, false); + if (this.props.doc.data instanceof RichTextField) { + this.highlightTextBox(this.props.doc); + } } @observable _useIcons = true; @observable _displayDim = 50; + highlightTextBox = (doc: Doc) => { + if (this.props.query) { + doc.search_string = this.props.query; + // FormattedTextBox.Instance.highlightSearchTerms([this.props.query]); + } + else { + // FormattedTextBox.Instance.highlightSearchTerms(["hello"]); + doc.search_string = "hello"; + } + } + + @computed public get DocumentIcon() { let layoutresult = StrCast(this.props.doc.type); @@ -282,8 +302,8 @@ export class SearchItem extends React.Component {
- {this.props.doc.type === DocTypes.LINK ? : - } + {this.props.doc.type === DocTypes.LINK ? : + }
); -- cgit v1.2.3-70-g09d2