Merge pull request #14984 from Snuffleupagus/dialog-polyfill-CSS
Bundle the `<dialog>` polyfill-CSS in the GENERIC `legacy/`-viewer (PR 14710 follow-up)
This commit is contained in:
commit
37f7995dde
10
gulpfile.js
10
gulpfile.js
@ -190,6 +190,8 @@ function createWebpackConfig(
|
|||||||
DEFAULT_PREFERENCES: defaultPreferencesDir
|
DEFAULT_PREFERENCES: defaultPreferencesDir
|
||||||
? getDefaultPreferences(defaultPreferencesDir)
|
? getDefaultPreferences(defaultPreferencesDir)
|
||||||
: {},
|
: {},
|
||||||
|
DIALOG_POLYFILL_CSS:
|
||||||
|
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
|
||||||
});
|
});
|
||||||
const licenseHeaderLibre = fs
|
const licenseHeaderLibre = fs
|
||||||
.readFileSync("./src/license_header_libre.js")
|
.readFileSync("./src/license_header_libre.js")
|
||||||
@ -736,6 +738,12 @@ function getDefaultPreferences(dir) {
|
|||||||
return AppOptions.getAll(OptionKind.PREFERENCE);
|
return AppOptions.getAll(OptionKind.PREFERENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDialogPolyfillCSS() {
|
||||||
|
return fs
|
||||||
|
.readFileSync("node_modules/dialog-polyfill/dist/dialog-polyfill.css")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task("locale", function () {
|
gulp.task("locale", function () {
|
||||||
const VIEWER_LOCALE_OUTPUT = "web/locale/";
|
const VIEWER_LOCALE_OUTPUT = "web/locale/";
|
||||||
|
|
||||||
@ -1519,6 +1527,8 @@ function buildLib(defines, dir) {
|
|||||||
DEFAULT_PREFERENCES: getDefaultPreferences(
|
DEFAULT_PREFERENCES: getDefaultPreferences(
|
||||||
defines.SKIP_BABEL ? "lib/" : "lib-legacy/"
|
defines.SKIP_BABEL ? "lib/" : "lib-legacy/"
|
||||||
),
|
),
|
||||||
|
DIALOG_POLYFILL_CSS:
|
||||||
|
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const inputStream = merge([
|
const inputStream = merge([
|
||||||
|
@ -44,6 +44,15 @@ class OverlayManager {
|
|||||||
) {
|
) {
|
||||||
const dialogPolyfill = require("dialog-polyfill/dist/dialog-polyfill.js");
|
const dialogPolyfill = require("dialog-polyfill/dist/dialog-polyfill.js");
|
||||||
dialogPolyfill.registerDialog(dialog);
|
dialogPolyfill.registerDialog(dialog);
|
||||||
|
|
||||||
|
if (!this._dialogPolyfillCSS) {
|
||||||
|
this._dialogPolyfillCSS = true;
|
||||||
|
|
||||||
|
const style = document.createElement("style");
|
||||||
|
style.textContent = PDFJSDev.eval("DIALOG_POLYFILL_CSS");
|
||||||
|
|
||||||
|
document.head.insertBefore(style, document.head.firstElementChild);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.addEventListener("cancel", evt => {
|
dialog.addEventListener("cancel", evt => {
|
||||||
|
Loading…
Reference in New Issue
Block a user