1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Add a <dialog> polyfill for the generic-legacy build

Please note that this patch is purposely quite basic, e.g. it doesn't add the polyfill-CSS in order to simplify the build process, and things such as `::backdrop` thus isn't working.
However, this patch does ensure that older browsers can at least still *access* all of the previous overlays and that things like e.g. opening of password-protected documents respectively printing still works.
This commit is contained in:
Jonas Jenwald 2022-03-25 14:10:33 +01:00
parent b3d58e1000
commit c9f262c480
3 changed files with 23 additions and 0 deletions

View file

@ -37,6 +37,15 @@ class OverlayManager {
}
this.#overlays.set(dialog, { canForceClose });
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("GENERIC && !SKIP_BABEL") &&
!dialog.showModal
) {
const dialogPolyfill = require("dialog-polyfill/dist/dialog-polyfill.js");
dialogPolyfill.registerDialog(dialog);
}
dialog.addEventListener("cancel", evt => {
this.#active = null;
});