1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Introduce a generic selectEditors helper function

This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
This commit is contained in:
Tim van der Meij 2025-02-23 18:49:14 +01:00
parent 060ef0e15e
commit f155b69c07
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
5 changed files with 16 additions and 28 deletions

View file

@ -32,13 +32,13 @@ import {
isVisible,
kbBigMoveDown,
kbBigMoveRight,
kbSelectAll,
kbUndo,
loadAndWait,
paste,
pasteFromClipboard,
scrollIntoView,
selectEditor,
selectEditors,
serializeBitmapDimensions,
switchToEditor,
unselectEditor,
@ -57,12 +57,7 @@ import { PNG } from "pngjs";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const selectAll = async page => {
await kbSelectAll(page);
await page.waitForFunction(
() => !document.querySelector(".stampEditor:not(.selectedEditor)")
);
};
const selectAll = selectEditors.bind(null, "stamp");
const clearAll = async page => {
await selectAll(page);