[Editor] Avoid error when an editor is unselected during the pdf.js closing

It aims to fix an error I noticed in the logs:
JavaScript error: http://127.0.0.1:65159/build/generic/build/pdf.mjs, line 15847:
TypeError: can't access property "div", currentLayer is undefined
This commit is contained in:
Calixte Denizet 2024-07-11 18:48:52 +02:00
parent 9b1b5ff7e7
commit 68076af0e4

View File

@ -1581,7 +1581,7 @@ class AnnotationEditor {
if (this.div?.contains(document.activeElement)) {
// Don't use this.div.blur() because we don't know where the focus will
// go.
this._uiManager.currentLayer.div.focus({
this.currentLayer?.div.focus({
preventScroll: true,
});
}