From 9aa0e5e812dfbc67b0542c6740d43209313a37d6 Mon Sep 17 00:00:00 2001 From: geireann Date: Tue, 17 Aug 2021 23:50:00 -0400 Subject: more updates --- src/client/views/search/SearchBox.tsx | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 680982685..67c7fc845 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -12,21 +12,26 @@ import { ViewBoxBaseComponent } from "../DocComponent"; import { FieldView, FieldViewProps } from '../nodes/FieldView'; import "./SearchBox.scss"; import { DocumentManager } from '../../util/DocumentManager'; +import { DocUtils } from '../../documents/Documents'; export const searchSchema = createSchema({ - Document: Doc, - linkSearch: Boolean + Document: Doc }); type SearchBoxDocument = makeInterface<[typeof documentSchema, typeof searchSchema]>; const SearchBoxDocument = makeInterface(documentSchema, searchSchema); +export interface SearchBoxProps extends FieldViewProps { + linkSearch: boolean; + // linkFrom: Doc; +} + /** * This is the SearchBox component. It represents the search box input and results in * the search panel on the left side of the screen. */ @observer -export class SearchBox extends ViewBoxBaseComponent(SearchBoxDocument) { +export class SearchBox extends ViewBoxBaseComponent(SearchBoxDocument) { public static LayoutString(fieldKey: string) { return FieldView.LayoutString(SearchBox, fieldKey); } public static Instance: SearchBox; @@ -103,6 +108,10 @@ export class SearchBox extends ViewBoxBaseComponent { + DocUtils.MakeLink({doc: doc}, {doc:doc}); + }); + /** * @param {Doc[]} docs - docs to be searched through recursively * @param {number, Doc => void} func - function to be called on each doc @@ -278,6 +287,9 @@ export class SearchBox extends ViewBoxBaseComponent { var className = "searchBox-results-scroll-view-result"; @@ -288,7 +300,7 @@ export class SearchBox extends ViewBoxBaseComponent this.onResultClick(result[0])} className={className}> +
this.makeLink(result[0]) : () => this.onResultClick(result[0])} className={className}>
{result[0].title}
@@ -309,11 +321,11 @@ export class SearchBox extends ViewBoxBaseComponent -
- {this.selectOptions} - - + } +
-- cgit v1.2.3-70-g09d2