|
@@ -200,7 +200,9 @@ class ComPDFKitViewer {
|
|
|
}
|
|
|
|
|
|
async handleAnnotations(annotation, init = false) {
|
|
|
- this.annotations = this.annotations || {}
|
|
|
+ if (!this.annotations) {
|
|
|
+ this.annotations = {}
|
|
|
+ }
|
|
|
if (init) {
|
|
|
this.initAddAnnotations(annotation)
|
|
|
} else {
|
|
@@ -451,6 +453,7 @@ class ComPDFKitViewer {
|
|
|
|
|
|
const pageView = this.pdfViewer._pages[activeResult.pageNum - 1]
|
|
|
this.pdfViewer.currentPageNumber = activeResult.pageNum
|
|
|
+
|
|
|
scrollIntoView(pageView.div, {
|
|
|
left,
|
|
|
top
|
|
@@ -570,7 +573,15 @@ class ComPDFKitViewer {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.initAnnotations(annotations, true)
|
|
|
+ for (let index = 0; index < annotations.length; index++) {
|
|
|
+ if (!this.annotations) {
|
|
|
+ this.annotations = {}
|
|
|
+ }
|
|
|
+ this.pushAnnotations(annotations[index])
|
|
|
+
|
|
|
+ this.pdfViewer.renderAnnotation(annotations[index])
|
|
|
+ }
|
|
|
+ this.eventBus.dispatch('annotationChanged', { annotations: this.annotations })
|
|
|
}
|
|
|
|
|
|
get supportsFullscreen() {
|
|
@@ -781,15 +792,13 @@ class ComPDFKitViewer {
|
|
|
const outlines = await messageHandler.sendWithPromise('GetOutlines', {
|
|
|
doc
|
|
|
})
|
|
|
-
|
|
|
- function generateOutline(outline, index, parent) {
|
|
|
+ const generateOutline = (outline, index, parent) => {
|
|
|
const outlineItem = new Outline({
|
|
|
outline,
|
|
|
index,
|
|
|
doc,
|
|
|
messageHandler,
|
|
|
- parent,
|
|
|
- document: this
|
|
|
+ parent
|
|
|
})
|
|
|
outline.children.forEach(function (outline, index) {
|
|
|
outlineItem.children.push(generateOutline(outline, index, outlineItem))
|