diff options
author | Joanne <zehan_ding@brown.edu> | 2025-06-17 13:02:50 -0400 |
---|---|---|
committer | Joanne <zehan_ding@brown.edu> | 2025-06-17 13:02:50 -0400 |
commit | 2aa2c26b95a539d220e46b20cdfbef6ae39d6c43 (patch) | |
tree | 344a6f798f692fdd4921ab5a6762e907f5ad7b06 /src/client/views/nodes/PDFBox.tsx | |
parent | 430db63077868fa54829721d6530a810aa4d4588 (diff) | |
parent | ccfdf905400cd4b81d8cde0f16bb0e15cd65621b (diff) |
Merge branch 'agent-paper-main' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/nodes/PDFBox.tsx')
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 55e6d5596..4ecbd65b6 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -53,6 +53,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { private _sidebarRef = React.createRef<SidebarAnnos>(); @observable private _searching: boolean = false; + @observable private _fuzzySearchEnabled: boolean = true; @observable private _pdf: Opt<Pdfjs.PDFDocumentProxy> = undefined; @observable private _pageControls = false; @@ -272,6 +273,14 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { !this.Document._layout_fitWidth && (this.Document._height = NumCast(this.Document._width) * (p.height / p.width)); }; + @action + toggleFuzzySearch = () => { + this._fuzzySearchEnabled = !this._fuzzySearchEnabled; + this._pdfViewer?.toggleFuzzySearch(); + // Clear existing search results when switching modes + this.search('', false, true); + }; + override search = action((searchString: string, bwd?: boolean, clear: boolean = false) => { if (!this._searching && !clear) { this._searching = true; @@ -412,6 +421,9 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { <button type="button" className="pdfBox-search" title="Search" onClick={e => this.search(this._searchString, e.shiftKey)}> <FontAwesomeIcon icon="search" size="sm" /> </button> + <button type="button" className={`pdfBox-fuzzy ${this._fuzzySearchEnabled ? 'active' : ''}`} title={`${this._fuzzySearchEnabled ? 'Disable' : 'Enable'} Fuzzy Search`} onClick={this.toggleFuzzySearch}> + <FontAwesomeIcon icon="magic" size="sm" /> + </button> <button type="button" className="pdfBox-prevIcon" title="Previous Annotation" onClick={this.prevAnnotation}> <FontAwesomeIcon icon="arrow-up" size="lg" /> </button> |