react-pdf
Advanced tools
Comparing version
@@ -135,2 +135,3 @@ "use strict"; | ||
page, | ||
structTreeLayer: null, // TODO: Implement this | ||
viewport: clonedViewport, | ||
@@ -137,0 +138,0 @@ }; |
@@ -52,3 +52,2 @@ "use strict"; | ||
const layerElement = (0, react_1.useRef)(null); | ||
const endElement = (0, react_1.useRef)(undefined); | ||
(0, warning_1.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-text-layer'), 10) === 1, 'TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer'); | ||
@@ -128,14 +127,14 @@ /** | ||
function onMouseDown() { | ||
const end = endElement.current; | ||
if (!end) { | ||
const layer = layerElement.current; | ||
if (!layer) { | ||
return; | ||
} | ||
end.classList.add('active'); | ||
layer.classList.add('selecting'); | ||
} | ||
function onMouseUp() { | ||
const end = endElement.current; | ||
if (!end) { | ||
const layer = layerElement.current; | ||
if (!layer) { | ||
return; | ||
} | ||
end.classList.remove('active'); | ||
layer.classList.remove('selecting'); | ||
} | ||
@@ -166,3 +165,2 @@ const viewport = (0, react_1.useMemo)(() => page.getViewport({ scale, rotation: rotate }), [page, rotate, scale]); | ||
layer.append(end); | ||
endElement.current = end; | ||
const layerChildren = layer.querySelectorAll('[role="presentation"]'); | ||
@@ -169,0 +167,0 @@ if (customTextRenderer) { |
@@ -106,2 +106,3 @@ 'use client'; | ||
page, | ||
structTreeLayer: null, // TODO: Implement this | ||
viewport: clonedViewport, | ||
@@ -108,0 +109,0 @@ }; |
@@ -23,3 +23,2 @@ 'use client'; | ||
const layerElement = useRef(null); | ||
const endElement = useRef(undefined); | ||
warning(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue('--react-pdf-text-layer'), 10) === 1, 'TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer'); | ||
@@ -99,14 +98,14 @@ /** | ||
function onMouseDown() { | ||
const end = endElement.current; | ||
if (!end) { | ||
const layer = layerElement.current; | ||
if (!layer) { | ||
return; | ||
} | ||
end.classList.add('active'); | ||
layer.classList.add('selecting'); | ||
} | ||
function onMouseUp() { | ||
const end = endElement.current; | ||
if (!end) { | ||
const layer = layerElement.current; | ||
if (!layer) { | ||
return; | ||
} | ||
end.classList.remove('active'); | ||
layer.classList.remove('selecting'); | ||
} | ||
@@ -137,3 +136,2 @@ const viewport = useMemo(() => page.getViewport({ scale, rotation: rotate }), [page, rotate, scale]); | ||
layer.append(end); | ||
endElement.current = end; | ||
const layerChildren = layer.querySelectorAll('[role="presentation"]'); | ||
@@ -140,0 +138,0 @@ if (customTextRenderer) { |
@@ -10,3 +10,2 @@ /** | ||
await import('pdfjs-dist/build/pdf.worker.mjs'); | ||
// biome-ignore lint/style/useExportType: This export is necessary for the file to be a module | ||
export {}; |
{ | ||
"name": "react-pdf", | ||
"version": "9.1.1", | ||
"version": "9.2.0", | ||
"description": "Display PDFs in your React app as easily as if they were images.", | ||
@@ -60,3 +60,3 @@ "type": "module", | ||
"merge-refs": "^1.3.0", | ||
"pdfjs-dist": "4.4.168", | ||
"pdfjs-dist": "4.8.69", | ||
"tiny-invariant": "^1.0.0", | ||
@@ -74,3 +74,3 @@ "warning": "^4.0.0" | ||
"@types/warning": "^3.0.0", | ||
"canvas": "^2.11.2", | ||
"canvas": "^3.0.0-rc2", | ||
"core-js": "^3.37.0", | ||
@@ -83,3 +83,3 @@ "cpy-cli": "^5.0.0", | ||
"typescript": "^5.5.2", | ||
"vitest": "^2.0.5" | ||
"vitest": "^2.1.1" | ||
}, | ||
@@ -110,2 +110,2 @@ "peerDependencies": { | ||
"funding": "https://github.com/wojtekmaj/react-pdf?sponsor=1" | ||
} | ||
} |
@@ -15,3 +15,2 @@ /** | ||
// biome-ignore lint/style/useExportType: This export is necessary for the file to be a module | ||
export {}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
552217
0.05%12380
0.06%643
1.26%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated