Merge pull request #12265 from Snuffleupagus/issue-12262

Don't warn when navigating away from a modified form, if printing has occurred (issue 12262)
This commit is contained in:
Tim van der Meij 2020-08-22 20:59:52 +02:00 committed by GitHub
commit 364b9cc802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -58,7 +58,7 @@ class AnnotationStorage {
*/ */
setValue(key, value) { setValue(key, value) {
if (this._storage.get(key) !== value) { if (this._storage.get(key) !== value) {
this.setModified(); this._setModified();
} }
this._storage.set(key, value); this._storage.set(key, value);
} }
@ -74,7 +74,10 @@ class AnnotationStorage {
return this._storage.size; return this._storage.size;
} }
setModified() { /**
* @private
*/
_setModified() {
if (!this._modified) { if (!this._modified) {
this._modified = true; this._modified = true;
if (typeof this.onSetModified === "function") { if (typeof this.onSetModified === "function") {

View File

@ -2544,7 +2544,9 @@ class WorkerTransport {
filename: this._fullReader ? this._fullReader.filename : null, filename: this._fullReader ? this._fullReader.filename : null,
}) })
.finally(() => { .finally(() => {
annotationStorage.resetModified(); if (annotationStorage) {
annotationStorage.resetModified();
}
}); });
} }

View File

@ -1687,6 +1687,10 @@ const PDFViewerApplication = {
if (this.printService) { if (this.printService) {
this.printService.destroy(); this.printService.destroy();
this.printService = null; this.printService = null;
if (this.pdfDocument) {
this.pdfDocument.annotationStorage.resetModified();
}
} }
this.forceRendering(); this.forceRendering();
}, },