mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Enable editor when double-clicking on stamp annotation
In Firefox, double-clicking on a stamp annotation triggers text selection (selecting the last text element in the dom before the annotation): this triggers the logic to make annotations not interfere with text selection, which in turns prevents the double click from triggering the annotation editor. This commit fixes the problem by making annotations non-selectable, so that clicking on them does not trigger text selection. Freetext annotations were already non-selectable, so this commit doesn't change that. However, we need to explicitly mark text in popups as selectable.
This commit is contained in:
parent
e1b972aac3
commit
60dd8147c6
2 changed files with 33 additions and 1 deletions
|
@ -1814,4 +1814,35 @@ describe("Stamp Editor", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Switch to edit mode by double clicking on an existing stamp annotation", () => {
|
||||
const annotationSelector = getAnnotationSelector("999R");
|
||||
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("issue19239.pdf", annotationSelector);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must switch to edit mode", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([, page]) => {
|
||||
await page.waitForSelector(annotationSelector);
|
||||
await scrollIntoView(page, annotationSelector);
|
||||
|
||||
await page.click(annotationSelector, { count: 2 });
|
||||
|
||||
await page.waitForFunction(() =>
|
||||
document
|
||||
.querySelector(".annotationEditorLayer")
|
||||
.classList.contains("stampEditing")
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue