UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

19 lines (18 loc) 760 B
import { jsx as n } from "react/jsx-runtime"; import { createContext as s, useContext as c } from "react"; import { useDocumentContext as l } from "./RPDocumentContext.js"; import { useHighlight as u } from "../utils/hooks/useHighlight.js"; const o = s(void 0), p = ({ children: t }) => { const { pdf: i } = l(), { highlight: e, highlightMatches: r, highlightKeywords: h, clear: g } = u(i); return /* @__PURE__ */ n(o.Provider, { value: { highlight: e, highlightMatches: r, highlightKeywords: h, clear: g }, children: t }); }, C = () => { const t = c(o); if (!t) throw new Error("useHighlightContext must be used within a HighlightProvider"); return t; }; export { o as HighlightContext, p as HighlightProvider, C as useHighlightContext };