Last active
August 18, 2020 22:27
-
-
Save escapewindow/d21c467044dffa63b2c52623ba6e9a20 to your computer and use it in GitHub Desktop.
try to clear modified later
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/worker.js b/src/core/worker.js | |
index d2c680c53..482c216ac 100644 | |
--- a/src/core/worker.js | |
+++ b/src/core/worker.js | |
@@ -521,6 +521,9 @@ class WorkerMessageHandler { | |
annotationStorage, | |
filename, | |
}) { | |
+ const storageValues = annotationStorage | |
+ ? annotationStorage.getAll() | |
+ : null; | |
pdfManager.requestLoadedStream(); | |
const promises = [pdfManager.onLoadedStream()]; | |
const document = pdfManager.pdfDocument; | |
@@ -528,7 +531,7 @@ class WorkerMessageHandler { | |
promises.push( | |
pdfManager.getPage(pageIndex).then(function (page) { | |
const task = new WorkerTask(`Save: page ${pageIndex}`); | |
- return page.save(handler, task, annotationStorage); | |
+ return page.save(handler, task, storageValues); | |
}) | |
); | |
} | |
@@ -572,6 +575,7 @@ class WorkerMessageHandler { | |
}; | |
} | |
xref.resetNewRef(); | |
+ annotationStorage.setUnmodified(); | |
return incrementalUpdate(stream.bytes, newXrefInfo, newRefs); | |
}); | |
diff --git a/src/display/api.js b/src/display/api.js | |
index 17f4eca93..c581b9296 100644 | |
--- a/src/display/api.js | |
+++ b/src/display/api.js | |
@@ -2536,11 +2536,9 @@ class WorkerTransport { | |
} | |
saveDocument(annotationStorage) { | |
- annotationStorage.setUnmodified(); | |
return this.messageHandler.sendWithPromise("SaveDocument", { | |
numPages: this._numPages, | |
- annotationStorage: | |
- (annotationStorage && annotationStorage.getAll()) || null, | |
+ annotationStorage, | |
filename: this._fullReader.filename, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment