1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

[Editor] Allow to edit FreeText annotations

This commit is contained in:
Calixte Denizet 2023-06-06 17:18:02 +02:00
parent a37f7d2477
commit 0116a8f484
8 changed files with 459 additions and 39 deletions

View file

@ -134,3 +134,21 @@ const mockClipboard = async pages => {
);
};
exports.mockClipboard = mockClipboard;
const getSerialized = page =>
page.evaluate(() => [
...window.PDFViewerApplication.pdfDocument.annotationStorage.serializable.values(),
]);
exports.getSerialized = getSerialized;
function getEditors(page, kind) {
return page.evaluate(aKind => {
const elements = document.querySelectorAll(`.${aKind}Editor`);
const results = [];
for (const { id } of elements) {
results.push(id);
}
return results;
}, kind);
}
exports.getEditors = getEditors;