/// import { PDFViewer } from "pdfjs-dist/types/web/pdf_viewer"; import { GhostHighlight, Highlight, PdfSelection, Tip } from "../types"; /** * A set of utilities for to control the behaviour of {@link PdfHighlighter}. * * @category Context */ export type PdfHighlighterUtils = { /** * Checks whether a selection is progress, a ghost highlight, or an edit. * * @returns - `true` if editing, ghost highlighting, or selecting. */ isEditingOrHighlighting(): boolean; /** * Get currently selected area or text selection. * * @returns - current selection or `null` if no selection is being made. */ getCurrentSelection(): PdfSelection | null; /** * Get the currently present ghost highlight. * * @return - currently present ghost highlight or `null` if non-existent. */ getGhostHighlight(): GhostHighlight | null; /** * Cancel any ghost highlight. * The selected area will stay selected until the user clicks away. */ removeGhostHighlight(): void; /** * If enabled, automatic tips/popups inside of a PdfHighlighter will be disabled. * Additional niceties will also be provided to prevent new highlights being made. */ toggleEditInProgress(flag?: boolean): void; /** * Whether an AreaHighlight is being moved/resized, or a manual highlight edit has * been toggled. * * @returns - `true` if AreaHighlight is being edited or edit mode was set. */ isEditInProgress(): boolean; /** * Whether a mouse selection or text selection is currently being performed. * * @returns - `true` if mouse selection or text selection is being performed. */ isSelectionInProgress(): boolean; /** * Scroll to a highlight in this viewer. * * @param highlight - A highlight provided to the {@link PdfHighlighter} to * scroll to. * @param paddingTop - Optional padding to add when scrolling to the highlight. */ scrollToHighlight(highlight: Highlight, paddingTop?: number): void; /** * Get a reference to the currently used instance of a PDF Viewer. * * @returns - The currently active PDF Viewer. */ getViewer(): PDFViewer | null; /** * Get the currently active tip, if any. * * @returns - the currently active tip or `null` if inactive. */ getTip(): Tip | null; /** * Set a tip to be displayed in the current PDF Viewer. * * @param tip - tip to be displayed, or `null` to hide any tip. */ setTip(tip: Tip | null): void; /** * Callback to update any currently active tip's position. This will make sure * the tip is visible above/below its highlight. */ updateTipPosition(): void; /** * Get the current page number being viewed. * * @returns - The current 1-indexed page number. */ getCurrentPage(): number; /** * Navigate to a specific page in the PDF viewer. * * @param pageNumber - The 1-indexed page number to navigate to. */ goToPage(pageNumber: number): void; /** * Search for text in the PDF document. * * @param query - The text string to search for. * @param options - Optional search parameters. * @param options.caseSensitive - Whether search should be case sensitive. * @param options.entireWord - Whether to match entire words only. * @param options.highlightAll - Whether to highlight all matches. * @param options.findPrevious - Whether to find previous match instead of next. */ searchText(query: string, options?: { caseSensitive?: boolean; entireWord?: boolean; highlightAll?: boolean; findPrevious?: boolean; }): void; /** * Navigate to the next search result. */ findNext(): void; /** * Navigate to the previous search result. */ findPrevious(): void; /** * Clear the current search and remove all search highlights. */ clearSearch(): void; }; export declare const PdfHighlighterContext: import("react").Context; /** * Custom hook for providing {@link PdfHighlighterUtils}. Must be used * within a child of {@link PdfHighlighter}. * * @category Context */ export declare const usePdfHighlighterContext: () => PdfHighlighterUtils;