Skip to content

Commit 8f74fe6

Browse files
Merge pull request #15327 from Snuffleupagus/bug-1785218
Correctly mimic the proper event-format in `AnnotationElement._setDefaultPropertiesFromJS` (bug 1785218)
2 parents b05010c + 5e12603 commit 8f74fe6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/display/annotation_layer.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,13 @@ class AnnotationElement {
401401
for (const [actionName, detail] of Object.entries(storedData)) {
402402
const action = commonActions[actionName];
403403
if (action) {
404-
action({ detail, target: element });
404+
const eventProxy = {
405+
detail: {
406+
[actionName]: detail,
407+
},
408+
target: element,
409+
};
410+
action(eventProxy);
405411
// The action has been consumed: no need to keep it.
406412
delete storedData[actionName];
407413
}

web/pdf_page_view.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ class PDFPageView {
235235
try {
236236
await this.annotationLayer.render(this.viewport, "display");
237237
} catch (ex) {
238+
console.error(`_renderAnnotationLayer: "${ex}".`);
238239
error = ex;
239240
} finally {
240241
this.eventBus.dispatch("annotationlayerrendered", {
@@ -253,6 +254,7 @@ class PDFPageView {
253254
try {
254255
await this.annotationEditorLayer.render(this.viewport, "display");
255256
} catch (ex) {
257+
console.error(`_renderAnnotationEditorLayer: "${ex}".`);
256258
error = ex;
257259
} finally {
258260
this.eventBus.dispatch("annotationeditorlayerrendered", {
@@ -274,6 +276,7 @@ class PDFPageView {
274276
this._buildXfaTextContentItems(result.textDivs);
275277
}
276278
} catch (ex) {
279+
console.error(`_renderXfaLayer: "${ex}".`);
277280
error = ex;
278281
} finally {
279282
this.eventBus.dispatch("xfalayerrendered", {
@@ -843,12 +846,10 @@ class PDFPageView {
843846
);
844847

845848
if (this.xfaLayerFactory) {
846-
if (!this.xfaLayer) {
847-
this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder({
848-
pageDiv: div,
849-
pdfPage,
850-
});
851-
}
849+
this.xfaLayer ||= this.xfaLayerFactory.createXfaLayerBuilder({
850+
pageDiv: div,
851+
pdfPage,
852+
});
852853
this._renderXfaLayer();
853854
}
854855

0 commit comments

Comments
 (0)