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

Add the possibility to copy all the pdf text whatever the rendered pages are (bug 1788035)

This commit is contained in:
Calixte Denizet 2023-04-13 16:57:23 +02:00
parent 342dc760da
commit ca54ea12b3
10 changed files with 253 additions and 3 deletions

View file

@ -118,3 +118,19 @@ const waitForSelectedEditor = async (page, selector) => {
);
};
exports.waitForSelectedEditor = waitForSelectedEditor;
const mockClipboard = async pages => {
await Promise.all(
pages.map(async ([_, page]) => {
await page.evaluate(() => {
let data = null;
const clipboard = {
writeText: async text => (data = text),
readText: async () => data,
};
Object.defineProperty(navigator, "clipboard", { value: clipboard });
});
})
);
};
exports.mockClipboard = mockClipboard;