Skip to content

Commit

Permalink
[Editor] Avoid to add a new ink editor when we aren't editing anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Nov 27, 2023
1 parent b7e943b commit 2be136a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/display/editor/annotation_editor_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion src/display/editor/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2be136a

Please sign in to comment.