react-pdf-highlighter
Advanced tools
Comparing version
@@ -55,4 +55,7 @@ import "pdfjs-dist/web/pdf_viewer.css"; | ||
containerNodeRef: RefObject<HTMLDivElement>; | ||
highlightReactRoots: { | ||
[page: number]: Root; | ||
highlightRoots: { | ||
[page: number]: { | ||
reactRoot: Root; | ||
container: Element; | ||
}; | ||
}; | ||
@@ -59,0 +62,0 @@ unsubscribe: () => void; |
@@ -66,3 +66,3 @@ "use strict"; | ||
this.containerNode = null; | ||
this.highlightReactRoots = {}; | ||
this.highlightRoots = {}; | ||
this.unsubscribe = () => { }; | ||
@@ -398,5 +398,6 @@ this.attachRef = () => { | ||
for (let pageNumber = 1; pageNumber <= pdfDocument.numPages; pageNumber++) { | ||
const root = this.highlightReactRoots[pageNumber]; | ||
if (root != null) { | ||
this.renderHighlightLayer(root, pageNumber); | ||
const highlightRoot = this.highlightRoots[pageNumber]; | ||
/** Need to check if container is still attached to the DOM as PDF.js can unload pages. */ | ||
if (highlightRoot && highlightRoot.container.isConnected) { | ||
this.renderHighlightLayer(highlightRoot.reactRoot, pageNumber); | ||
} | ||
@@ -406,5 +407,8 @@ else { | ||
if (highlightLayer) { | ||
const root = (0, client_1.createRoot)(highlightLayer); | ||
this.highlightReactRoots[pageNumber] = root; | ||
this.renderHighlightLayer(root, pageNumber); | ||
const reactRoot = (0, client_1.createRoot)(highlightLayer); | ||
this.highlightRoots[pageNumber] = { | ||
reactRoot, | ||
container: highlightLayer, | ||
}; | ||
this.renderHighlightLayer(reactRoot, pageNumber); | ||
} | ||
@@ -411,0 +415,0 @@ } |
@@ -55,4 +55,7 @@ import "pdfjs-dist/web/pdf_viewer.css"; | ||
containerNodeRef: RefObject<HTMLDivElement>; | ||
highlightReactRoots: { | ||
[page: number]: Root; | ||
highlightRoots: { | ||
[page: number]: { | ||
reactRoot: Root; | ||
container: Element; | ||
}; | ||
}; | ||
@@ -59,0 +62,0 @@ unsubscribe: () => void; |
@@ -37,3 +37,3 @@ import "pdfjs-dist/web/pdf_viewer.css"; | ||
this.containerNode = null; | ||
this.highlightReactRoots = {}; | ||
this.highlightRoots = {}; | ||
this.unsubscribe = () => { }; | ||
@@ -369,5 +369,6 @@ this.attachRef = () => { | ||
for (let pageNumber = 1; pageNumber <= pdfDocument.numPages; pageNumber++) { | ||
const root = this.highlightReactRoots[pageNumber]; | ||
if (root != null) { | ||
this.renderHighlightLayer(root, pageNumber); | ||
const highlightRoot = this.highlightRoots[pageNumber]; | ||
/** Need to check if container is still attached to the DOM as PDF.js can unload pages. */ | ||
if (highlightRoot && highlightRoot.container.isConnected) { | ||
this.renderHighlightLayer(highlightRoot.reactRoot, pageNumber); | ||
} | ||
@@ -377,5 +378,8 @@ else { | ||
if (highlightLayer) { | ||
const root = createRoot(highlightLayer); | ||
this.highlightReactRoots[pageNumber] = root; | ||
this.renderHighlightLayer(root, pageNumber); | ||
const reactRoot = createRoot(highlightLayer); | ||
this.highlightRoots[pageNumber] = { | ||
reactRoot, | ||
container: highlightLayer, | ||
}; | ||
this.renderHighlightLayer(reactRoot, pageNumber); | ||
} | ||
@@ -382,0 +386,0 @@ } |
{ | ||
"name": "react-pdf-highlighter", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Set of React components for PDF annotation", | ||
@@ -5,0 +5,0 @@ "author": "Artem Tyurin <artem.tyurin@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
237036
0.34%3629
0.39%