mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
[Editor] Make editors movable in using the keyboard (bug 1845088)
Selected editors can be moved in using the arrows: - up/down/left/right will move the editors of 1 in page unit; - ctrl (or meta)+up/down/left/right will move them of 10 in page unit.
This commit is contained in:
parent
48cc67f17e
commit
bb6936c931
8 changed files with 311 additions and 50 deletions
|
@ -137,14 +137,20 @@ const mockClipboard = async pages => {
|
|||
};
|
||||
exports.mockClipboard = mockClipboard;
|
||||
|
||||
const getSerialized = page =>
|
||||
page.evaluate(() => {
|
||||
async function getSerialized(page, filter = undefined) {
|
||||
const values = await page.evaluate(() => {
|
||||
const { map } =
|
||||
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable;
|
||||
return map ? [...map.values()] : [];
|
||||
});
|
||||
return filter ? values.map(filter) : values;
|
||||
}
|
||||
exports.getSerialized = getSerialized;
|
||||
|
||||
const getFirstSerialized = async (page, filter = undefined) =>
|
||||
(await getSerialized(page, filter))[0];
|
||||
exports.getFirstSerialized = getFirstSerialized;
|
||||
|
||||
function getEditors(page, kind) {
|
||||
return page.evaluate(aKind => {
|
||||
const elements = document.querySelectorAll(`.${aKind}Editor`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue