Merge pull request #18697 from calixteman/issue18696
[Editor] Avoid to throw when an highlight annotation is resetted
This commit is contained in:
commit
4b906ad0a8
@ -1796,7 +1796,7 @@ class AnnotationEditor {
|
|||||||
resetAnnotationElement(annotation) {
|
resetAnnotationElement(annotation) {
|
||||||
const { firstChild } = annotation.container;
|
const { firstChild } = annotation.container;
|
||||||
if (
|
if (
|
||||||
firstChild.nodeName === "DIV" &&
|
firstChild?.nodeName === "DIV" &&
|
||||||
firstChild.classList.contains("annotationContent")
|
firstChild.classList.contains("annotationContent")
|
||||||
) {
|
) {
|
||||||
firstChild.remove();
|
firstChild.remove();
|
||||||
|
|||||||
@ -2020,4 +2020,37 @@ describe("Highlight Editor", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Highlight editor mustn't throw when disabled", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait(
|
||||||
|
"annotation-highlight.pdf",
|
||||||
|
".annotationEditorLayer"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must enable & disable highlight mode successfully", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
const modeChangedHandle = await waitForAnnotationModeChanged(page);
|
||||||
|
await switchToHighlight(page);
|
||||||
|
await awaitPromise(modeChangedHandle);
|
||||||
|
|
||||||
|
await page.waitForSelector("#highlightParamsToolbarContainer", {
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
await switchToHighlight(page, /* disable */ true);
|
||||||
|
await page.waitForSelector("#highlightParamsToolbarContainer", {
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user