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:
parent
342dc760da
commit
ca54ea12b3
10 changed files with 253 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue