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 1d5fc57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 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,12 @@ class AnnotationEditorLayer {
}

addInkEditorIfNeeded(isCommitting) {
if (
!isCommitting &&
this.#uiManager.getMode() !== AnnotationEditorType.INK
) {
const mode = this.#uiManager.getMode();
if (mode === AnnotationEditorType.NONE) {
return;
}

if (!isCommitting && mode !== AnnotationEditorType.INK) {
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 1d5fc57

Please sign in to comment.