aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorAubrey Li <Aubrey-Li>2021-10-26 17:16:16 -0400
committerAubrey Li <Aubrey-Li>2021-10-26 17:16:16 -0400
commit34ce1ba0275406aff180a49f99d333ffa0d86e3b (patch)
tree25e8ae29b145e5e1e33c59e285f3b29f5a481dc5 /src/client/views/search
parent3c1b393732ef9dc704a2f40b103c37b3f8370ba7 (diff)
parent48d5e650ddc8caa8252561bbc91961f2f4677d6e (diff)
Merge branch 'master' into trails-aubrey
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>