1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

[Editor] Don't try to use an non-existing canvas when rendering an invisible existing stamp editor

It fixes #19239.

When the canvas isn't existing the editor has no image: it's fine because the editor is invisible.
Once it's made visible, the canvas is set when the annotation layer has been rendered.
This commit is contained in:
Calixte Denizet 2025-01-09 18:10:47 +01:00
parent f1166f480f
commit 06f72d5662
7 changed files with 160 additions and 15 deletions

View file

@ -588,10 +588,14 @@ class PDFPageView {
}
toggleEditingMode(isEditing) {
// The page can be invisible, consequently there's no annotation layer and
// we can't know if there are editable annotations.
// So to avoid any issue when the page is rendered the #isEditing flag must
// be set.
this.#isEditing = isEditing;
if (!this.hasEditableAnnotations()) {
return;
}
this.#isEditing = isEditing;
this.reset({
keepAnnotationLayer: true,
keepAnnotationEditorLayer: true,