[Editor] Dispatch an event when some global states are changing

- this way the context menu in Firefox can take into account what we
  have in the clipboard, if an editor is selected, ...
- when the user will click on a context menu item, an action will be
  triggered, hence this patch adds what is required to handle it;
- some tests will be added in the Firefox' patch.
This commit is contained in:
Calixte Denizet 2022-07-04 18:04:32 +02:00
parent a1ac1a61b7
commit ec0f9f6dcf
8 changed files with 278 additions and 28 deletions

View file

@ -640,6 +640,10 @@ class BaseViewer {
if (this._scriptingManager) {
this._scriptingManager.setDocument(null);
}
if (this.#annotationEditorUIManager) {
this.#annotationEditorUIManager.destroy();
this.#annotationEditorUIManager = null;
}
}
this.pdfDocument = pdfDocument;
@ -899,7 +903,6 @@ class BaseViewer {
}
_resetView() {
this.#annotationEditorUIManager = null;
this._pages = [];
this._currentPageNumber = 1;
this._currentScale = UNKNOWN_SCALE;