Merge pull request #20258 from calixteman/cleanup_before_editing_mode

[Editor] Cleanup the pages not being fully rendered before switching to editing mode
This commit is contained in:
calixteman 2025-09-11 23:03:08 +02:00 committed by GitHub
commit 0e28b5c3c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -1080,6 +1080,10 @@ class PDFPageView extends BasePDFPageView {
);
}
).then(async () => {
if (this.renderingState !== RenderingStates.FINISHED) {
// The rendering has been cancelled.
return;
}
this.structTreeLayer ||= new StructTreeLayerBuilder(
pdfPage,
viewport.rawDims

View File

@ -2525,6 +2525,8 @@ class PDFViewer {
if (!isEditing) {
this.pdfDocument.annotationStorage.resetModifiedIds();
}
// We need to cleanup whatever pages being rendered.
this.cleanup();
for (const pageView of this._pages) {
pageView.toggleEditingMode(isEditing);
}