From e87f8f5113756b188feb3de1fc6f9697a4c91b51 Mon Sep 17 00:00:00 2001 From: Andy Rickert Date: Mon, 3 Aug 2020 19:46:09 -0400 Subject: pdf search --- src/client/views/collections/SchemaTable.tsx | 28 +++++++++++++++++++++++++++- src/client/views/search/SearchBox.tsx | 6 ++++++ 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx index 5c199096e..9d02807fd 100644 --- a/src/client/views/collections/SchemaTable.tsx +++ b/src/client/views/collections/SchemaTable.tsx @@ -283,13 +283,39 @@ export class SchemaTable extends React.Component { Header: , accessor: (doc: Doc) => 0, id: "add", - Cell: (rowProps: CellInfo) => <>, + Cell: (rowProps: CellInfo) =>
+
, width: 28, resizable: false }); return columns; } + + + @action + nextHighlight = (e: React.MouseEvent, doc: Doc) => { + e.preventDefault(); + e.stopPropagation(); + + doc.searchMatch = false; + setTimeout(() => doc.searchMatch = true, 0); + doc.searchIndex = NumCast(doc.searchIndex); + } + + @action + nextHighlight2 = (e: React.MouseEvent, doc: Doc) => { + e.preventDefault(); + e.stopPropagation(); + doc.searchMatch2 = false; + setTimeout(() => doc.searchMatch2 = true, 0); + doc.searchIndex = NumCast(doc.searchIndex); + } + constructor(props: SchemaTableProps) { super(props); // convert old schema columns (list of strings) into new schema columns (list of schema header fields) diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 09fbe383c..de6fff5d2 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -195,6 +195,7 @@ export class SearchBox extends ViewBoxBaseComponent { Doc.UnBrushDoc(result[0]); + result[0].searchMatch = undefined; }); this.props.Document._schemaHeaders = new List([]); @@ -493,15 +494,18 @@ export class SearchBox extends ViewBoxBaseComponent([]); this.headercount = 0; this.children = 0; this.buckets = []; this.new_buckets = {}; const query = StrCast(this.layoutDoc._searchString); + Doc.SetSearchQuery(query); this.getFinalQuery(query); this._results.forEach(result => { Doc.UnBrushDoc(result[0]); + result[0].searchMatch = undefined; }); this._results = []; this._resultsSet.clear(); @@ -758,6 +762,7 @@ export class SearchBox extends ViewBoxBaseComponent