Merge pull request #16567 from calixteman/issue16566
[Editor] Show hidden annotations once editing is finished
This commit is contained in:
commit
d01efc6767
@ -215,14 +215,32 @@ class AnnotationEditorLayer {
|
|||||||
disable() {
|
disable() {
|
||||||
this.#isDisabling = true;
|
this.#isDisabling = true;
|
||||||
this.div.style.pointerEvents = "none";
|
this.div.style.pointerEvents = "none";
|
||||||
|
const hiddenAnnotationIds = new Set();
|
||||||
for (const editor of this.#editors.values()) {
|
for (const editor of this.#editors.values()) {
|
||||||
editor.disableEditing();
|
editor.disableEditing();
|
||||||
if (!editor.annotationElementId || editor.serialize() !== null) {
|
if (!editor.annotationElementId || editor.serialize() !== null) {
|
||||||
|
hiddenAnnotationIds.add(editor.annotationElementId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.getEditableAnnotation(editor.annotationElementId)?.show();
|
this.getEditableAnnotation(editor.annotationElementId)?.show();
|
||||||
editor.remove();
|
editor.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.#annotationLayer) {
|
||||||
|
// Show the annotations that were hidden in enable().
|
||||||
|
const editables = this.#annotationLayer.getEditableAnnotations();
|
||||||
|
for (const editable of editables) {
|
||||||
|
const { id } = editable.data;
|
||||||
|
if (
|
||||||
|
hiddenAnnotationIds.has(id) ||
|
||||||
|
this.#uiManager.isDeletedAnnotationElement(id)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
editable.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.#cleanup();
|
this.#cleanup();
|
||||||
if (this.isEmpty) {
|
if (this.isEmpty) {
|
||||||
this.div.hidden = true;
|
this.div.hidden = true;
|
||||||
|
@ -471,4 +471,41 @@ describe("ResetForm action", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Ink widget and its popup after editing", () => {
|
||||||
|
describe("annotation-caret-ink.pdf", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait(
|
||||||
|
"annotation-caret-ink.pdf",
|
||||||
|
"[data-annotation-id='25R']"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the annotation has a popup", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
await page.waitForFunction(
|
||||||
|
`document.querySelector("[data-annotation-id='25R']").hidden === false`
|
||||||
|
);
|
||||||
|
await page.click("#editorFreeText");
|
||||||
|
await page.waitForTimeout(10);
|
||||||
|
await page.waitForFunction(
|
||||||
|
`document.querySelector("[data-annotation-id='25R']").hidden === true`
|
||||||
|
);
|
||||||
|
await page.click("#editorFreeText");
|
||||||
|
await page.waitForTimeout(10);
|
||||||
|
await page.waitForFunction(
|
||||||
|
`document.querySelector("[data-annotation-id='25R']").hidden === false`
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user