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:
commit
c5b9e9aef8
3 changed files with 33 additions and 26 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue