1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

[Editor] Init the default highlight color before creating the first editor instance

We want to be able to draw an highlight with the default color but without having an
instance of the HighlightEditor.
This commit is contained in:
Calixte Denizet 2024-01-05 10:10:01 +01:00
parent 130a0fef3d
commit 17e1519410
10 changed files with 89 additions and 15 deletions

View file

@ -16,7 +16,7 @@
import os from "os";
const isMac = os.platform() === "darwin";
function loadAndWait(filename, selector, zoom, pageSetup) {
function loadAndWait(filename, selector, zoom, pageSetup, options) {
return Promise.all(
global.integrationSessions.map(async session => {
const page = await session.browser.newPage();
@ -36,9 +36,16 @@ function loadAndWait(filename, selector, zoom, pageSetup) {
});
});
let app_options = "";
if (options) {
// Options must be handled in app.js::_parseHashParams.
for (const [key, value] of Object.entries(options)) {
app_options += `&${key}=${encodeURIComponent(value)}`;
}
}
const url = `${
global.integrationBaseUrl
}?file=/test/pdfs/${filename}#zoom=${zoom ?? "page-fit"}`;
}?file=/test/pdfs/${filename}#zoom=${zoom ?? "page-fit"}${app_options}`;
await page.goto(url);
if (pageSetup) {