aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-19 14:40:24 -0400
committerbobzel <zzzman@gmail.com>2025-03-19 14:40:24 -0400
commit5ddd41905823fb77ca987517b63e46a63fe4d4ca (patch)
treec7c3da3e7a6155f6c645dcbc7ab0b6f550cc18cf /src/client/views/search
parent5e73c471b14d5007306fd1bedfdf349769bd5f82 (diff)
fixed focus() on text boxes to scroll into view by hacking around a breaking prosemirror patch.
Diffstat (limited to 'src/client/views/search')
-rw-r--r--src/client/views/search/SearchBox.tsx12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index ae0838dd5..af98355d1 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -1,5 +1,3 @@
-/* eslint-disable jsx-a11y/no-static-element-interactions */
-/* eslint-disable jsx-a11y/click-events-have-key-events */
import { Tooltip } from '@mui/material';
import { action, computed, makeObservable, observable } from 'mobx';
import { observer } from 'mobx-react';
@@ -52,9 +50,7 @@ export class SearchBoxItem extends ObservableReactComponent<SearchBoxItemProps>
* 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, finishFunc: () => void) => {
- await DocumentView.showDocument(doc, { willZoomCentered: true }, finishFunc);
- };
+ selectElement = (doc: Doc, finishFunc: () => void) => DocumentView.showDocument(doc, { willPan: true }, finishFunc);
/**
* @param {Doc} doc - doc of the search result that has been clicked on
@@ -183,7 +179,7 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() {
* (Note: There is no longer a need to press enter to submit a search. Any update to the input
* causes a search to be submitted automatically.)
*/
- _timeout: any = undefined;
+ _timeout: NodeJS.Timeout | undefined = undefined;
onInputChange = action((e: React.ChangeEvent<HTMLInputElement>) => {
this._searchString = e.target.value;
this._timeout && clearTimeout(this._timeout);
@@ -242,7 +238,7 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() {
* which the first letter is capitalized. This is used when displaying the type on the
* right side of each search result.
*/
- static formatType(type: string, colType: string): String {
+ static formatType(type: string, colType: string): string {
switch (type) {
case DocumentType.PDF : return 'PDF';
case DocumentType.IMG : return 'Img';
@@ -437,7 +433,7 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() {
render() {
const isLinkSearch: boolean = this._props.linkSearch;
const sortedResults = Array.from(this._results.entries()).sort((a, b) => (this._pageRanks.get(b[0]) ?? 0) - (this._pageRanks.get(a[0]) ?? 0)); // sorted by page rank
- const resultsJSX = [] as any[];
+ const resultsJSX = [] as JSX.Element[];
const linkFrom = this._props.linkFrom?.();
let validResults = 0;