From 2be136ab700a06b7e6c4f83a1ac6b91e8989406c Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 27 Nov 2023 15:06:23 +0100 Subject: [PATCH] [Editor] Avoid to add a new ink editor when we aren't editing anymore --- src/display/editor/annotation_editor_layer.js | 6 ++---- src/display/editor/tools.js | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/display/editor/annotation_editor_layer.js b/src/display/editor/annotation_editor_layer.js index f45e6ef92..ccb10cbdc 100644 --- a/src/display/editor/annotation_editor_layer.js +++ b/src/display/editor/annotation_editor_layer.js @@ -152,10 +152,8 @@ class AnnotationEditorLayer { } addInkEditorIfNeeded(isCommitting) { - if ( - !isCommitting && - this.#uiManager.getMode() !== AnnotationEditorType.INK - ) { + if (this.#uiManager.getMode() !== AnnotationEditorType.INK) { + // We don't want to add an ink editor if we're not in ink mode! return; } diff --git a/src/display/editor/tools.js b/src/display/editor/tools.js index 89e898c8f..a3db74a0d 100644 --- a/src/display/editor/tools.js +++ b/src/display/editor/tools.js @@ -1604,7 +1604,11 @@ class AnnotationEditorUIManager { if (this.#activeEditor) { // An editor is being edited so just commit it. this.#activeEditor.commitOrRemove(); - return; + if (this.#mode !== AnnotationEditorType.NONE) { + // If the mode is NONE, we want to really unselect the editor, hence we + // mustn't return here. + return; + } } if (!this.hasSelection) {