aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-16 21:04:57 -0400
committerbobzel <zzzman@gmail.com>2021-09-16 21:04:57 -0400
commit64119b5d8766725025b8b2bfda72f2401bba0f00 (patch)
treec35230d13e954e7541d5e433f190454dd700c5cd /src/client/views/search
parent68b20c7cf3b3472a7c7adbdcffa2318ad3549d8d (diff)
added search() component method. changed search menu to call search on documents that match search string. added seach bar for web pages.
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/SearchBox.tsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 9c353e9d0..3612bd7c4 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -104,9 +104,9 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps, SearchBoxDoc
* This method is called when the user clicks on a search result. The _selectedResult is
* updated accordingly and the doc is highlighted with the selectElement method.
*/
- onResultClick = action((doc: Doc) => {
- this.selectElement(doc);
+ onResultClick = action(async (doc: Doc) => {
this._selectedResult = doc;
+ this.selectElement(doc, () => DocumentManager.Instance.getFirstDocumentView(doc)?.ComponentView?.search?.(this._searchString, undefined, false));
});
makeLink = action((linkTo: Doc) => {
@@ -269,8 +269,8 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps, SearchBoxDoc
* This method selects a doc by either jumping to it (centering/zooming in on it)
* or opening it in a new tab.
*/
- selectElement = async (doc: Doc) => {
- await DocumentManager.Instance.jumpToDocument(doc, true);
+ selectElement = async (doc: Doc, finishFunc: () => void) => {
+ await DocumentManager.Instance.jumpToDocument(doc, true, undefined, undefined, undefined, undefined, undefined, finishFunc);
}
/**
@@ -307,7 +307,12 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps, SearchBoxDoc
validResults++;
return (
<Tooltip key={result[0][Id]} placement={"right"} title={<><div className="dash-tooltip">{title}</div></>}>
- <div onClick={isLinkSearch ? () => this.makeLink(result[0]) : () => this.onResultClick(result[0])} className={className}>
+ <div onClick={isLinkSearch ?
+ () => this.makeLink(result[0]) :
+ e => {
+ this.onResultClick(result[0]);
+ e.stopPropagation();
+ }} className={className}>
<div className="searchBox-result-title">
{title}
</div>