@@ -418,7 +418,7 @@ const DocumentViewer: React.FC<DocumentViewerProps> = ({
418418 pdfDocumentInstance . destroy ( ) ;
419419 }
420420 } ;
421- } , [ pdfDocument ?. originalFileUrl , pdfJsLoaded , zoomLevel , isBrowser , effectivePageNumber ] ) ;
421+ } , [ pdfDocument ?. originalFileUrl , pdfJsLoaded , isBrowser , effectivePageNumber ] ) ;
422422
423423 // Handle text highlighting when citationSnippet changes
424424 useEffect ( ( ) => {
@@ -440,12 +440,12 @@ const DocumentViewer: React.FC<DocumentViewerProps> = ({
440440 targetPage = effectivePageNumber ;
441441 }
442442 ( async ( ) => {
443- const newHighlight = await createRectangleHighlight (
444- citationSnippet ,
445- viewer ,
446- targetPage ,
447- currentHighlight
448- ) ;
443+ const newHighlight = await createRectangleHighlight ( {
444+ searchText : citationSnippet ,
445+ pdfViewerInstance : viewer ,
446+ targetPage : targetPage ,
447+ currentHighlight : currentHighlight ,
448+ } ) ;
449449 if ( newHighlight ) {
450450 removeCurrentHighlight ( ) ;
451451 setCurrentHighlight ( newHighlight ) ;
@@ -516,12 +516,13 @@ const DocumentViewer: React.FC<DocumentViewerProps> = ({
516516
517517 // Recreate highlight without changing page navigation
518518 const recreateHighlight = async ( ) => {
519- const newHighlight = await createRectangleHighlight (
520- citationSnippet ,
521- viewer ,
522- undefined , // Don't specify target page to avoid navigation
523- null
524- ) ;
519+ const newHighlight = await createRectangleHighlight ( {
520+ searchText : citationSnippet ,
521+ pdfViewerInstance : viewer ,
522+ targetPage : currentHighlight ?. page ,
523+ currentHighlight,
524+ shouldNavigateOnMatch : false ,
525+ } ) ;
525526 if ( newHighlight ) {
526527 removeCurrentHighlight ( ) ;
527528 setCurrentHighlight ( newHighlight ) ;
0 commit comments