Merge pull request #15274 from calixteman/missing_annotation
[Editor] A pasted FreeText editor was missing when printing/saving
This commit is contained in:
commit
e88c90e898
@ -426,7 +426,6 @@ class AnnotationEditorLayer {
|
|||||||
*/
|
*/
|
||||||
add(editor) {
|
add(editor) {
|
||||||
this.#changeParent(editor);
|
this.#changeParent(editor);
|
||||||
this.addToAnnotationStorage(editor);
|
|
||||||
this.#uiManager.addEditor(editor);
|
this.#uiManager.addEditor(editor);
|
||||||
this.attach(editor);
|
this.attach(editor);
|
||||||
|
|
||||||
@ -438,6 +437,7 @@ class AnnotationEditorLayer {
|
|||||||
|
|
||||||
this.moveDivInDOM(editor);
|
this.moveDivInDOM(editor);
|
||||||
editor.onceAdded();
|
editor.onceAdded();
|
||||||
|
this.addToAnnotationStorage(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,11 @@ describe("Editor", () => {
|
|||||||
await closePages(pages);
|
await closePages(pages);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const countStorageEntries = async page =>
|
||||||
|
page.evaluate(
|
||||||
|
() => window.PDFViewerApplication.pdfDocument.annotationStorage.size
|
||||||
|
);
|
||||||
|
|
||||||
it("must write a string in a FreeText editor", async () => {
|
it("must write a string in a FreeText editor", async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
pages.map(async ([browserName, page]) => {
|
pages.map(async ([browserName, page]) => {
|
||||||
@ -64,6 +69,10 @@ describe("Editor", () => {
|
|||||||
editorRect.y + 2 * editorRect.height
|
editorRect.y + 2 * editorRect.height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(await countStorageEntries(page))
|
||||||
|
.withContext(`In ${browserName}`)
|
||||||
|
.toEqual(1);
|
||||||
|
|
||||||
const content = await page.$eval(`${editorPrefix}0`, el =>
|
const content = await page.$eval(`${editorPrefix}0`, el =>
|
||||||
el.innerText.trimEnd()
|
el.innerText.trimEnd()
|
||||||
);
|
);
|
||||||
@ -94,6 +103,10 @@ describe("Editor", () => {
|
|||||||
await page.keyboard.press("v");
|
await page.keyboard.press("v");
|
||||||
await page.keyboard.up("Control");
|
await page.keyboard.up("Control");
|
||||||
|
|
||||||
|
expect(await countStorageEntries(page))
|
||||||
|
.withContext(`In ${browserName}`)
|
||||||
|
.toEqual(2);
|
||||||
|
|
||||||
const content = await page.$eval(`${editorPrefix}0`, el =>
|
const content = await page.$eval(`${editorPrefix}0`, el =>
|
||||||
el.innerText.trimEnd()
|
el.innerText.trimEnd()
|
||||||
);
|
);
|
||||||
@ -114,6 +127,10 @@ describe("Editor", () => {
|
|||||||
await page.keyboard.press("v");
|
await page.keyboard.press("v");
|
||||||
await page.keyboard.up("Control");
|
await page.keyboard.up("Control");
|
||||||
|
|
||||||
|
expect(await countStorageEntries(page))
|
||||||
|
.withContext(`In ${browserName}`)
|
||||||
|
.toEqual(3);
|
||||||
|
|
||||||
pastedContent = await page.$eval(`${editorPrefix}2`, el =>
|
pastedContent = await page.$eval(`${editorPrefix}2`, el =>
|
||||||
el.innerText.trimEnd()
|
el.innerText.trimEnd()
|
||||||
);
|
);
|
||||||
@ -142,6 +159,10 @@ describe("Editor", () => {
|
|||||||
|
|
||||||
expect(hasEditor).withContext(`In ${browserName}`).toEqual(false);
|
expect(hasEditor).withContext(`In ${browserName}`).toEqual(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(await countStorageEntries(page))
|
||||||
|
.withContext(`In ${browserName}`)
|
||||||
|
.toEqual(0);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user