Merge pull request #15327 from Snuffleupagus/bug-1785218

Correctly mimic the proper event-format in `AnnotationElement._setDefaultPropertiesFromJS` (bug 1785218)
This commit is contained in:
Jonas Jenwald 2022-08-17 16:15:13 +02:00 committed by GitHub
commit 8f74fe6e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -401,7 +401,13 @@ class AnnotationElement {
for (const [actionName, detail] of Object.entries(storedData)) {
const action = commonActions[actionName];
if (action) {
action({ detail, target: element });
const eventProxy = {
detail: {
[actionName]: detail,
},
target: element,
};
action(eventProxy);
// The action has been consumed: no need to keep it.
delete storedData[actionName];
}

View File

@ -235,6 +235,7 @@ class PDFPageView {
try {
await this.annotationLayer.render(this.viewport, "display");
} catch (ex) {
console.error(`_renderAnnotationLayer: "${ex}".`);
error = ex;
} finally {
this.eventBus.dispatch("annotationlayerrendered", {
@ -253,6 +254,7 @@ class PDFPageView {
try {
await this.annotationEditorLayer.render(this.viewport, "display");
} catch (ex) {
console.error(`_renderAnnotationEditorLayer: "${ex}".`);
error = ex;
} finally {
this.eventBus.dispatch("annotationeditorlayerrendered", {
@ -274,6 +276,7 @@ class PDFPageView {
this._buildXfaTextContentItems(result.textDivs);
}
} catch (ex) {
console.error(`_renderXfaLayer: "${ex}".`);
error = ex;
} finally {
this.eventBus.dispatch("xfalayerrendered", {
@ -843,12 +846,10 @@ class PDFPageView {
);
if (this.xfaLayerFactory) {
if (!this.xfaLayer) {
this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder({
pageDiv: div,
pdfPage,
});
}
this.xfaLayer ||= this.xfaLayerFactory.createXfaLayerBuilder({
pageDiv: div,
pdfPage,
});
this._renderXfaLayer();
}