1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #15351 from Snuffleupagus/bug-1785854

[api-minor][editor] Indicate, in the title, if the document has been edited (bug 1785854)
This commit is contained in:
Tim van der Meij 2022-08-27 13:52:07 +02:00 committed by GitHub
commit c5b9e9aef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 26 deletions

View file

@ -68,12 +68,21 @@ class AnnotationStorage {
* Remove a value from the storage.
* @param {string} key
*/
removeKey(key) {
remove(key) {
this._storage.delete(key);
if (this._storage.size === 0) {
this.resetModified();
}
if (typeof this.onAnnotationEditor === "function") {
for (const value of this._storage.values()) {
if (value instanceof AnnotationEditor) {
return;
}
}
this.onAnnotationEditor(null);
}
}
/**
@ -172,15 +181,6 @@ class AnnotationStorage {
return clone;
}
get hasAnnotationEditors() {
for (const value of this._storage.values()) {
if (value instanceof AnnotationEditor) {
return true;
}
}
return false;
}
/**
* PLEASE NOTE: Only intended for usage within the API itself.
* @ignore

View file

@ -207,7 +207,7 @@ class AnnotationEditorLayer {
this.#uiManager.removeEditor(editor);
this.detach(editor);
this.annotationStorage.removeKey(editor.id);
this.annotationStorage.remove(editor.id);
editor.div.style.display = "none";
setTimeout(() => {
// When the div is removed from DOM the focus can move on the