From 9e3f045c81c0238775798b5aabf420ee8c5d8eb2 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Mon, 30 Sep 2024 11:13:29 +0200 Subject: [PATCH] Addresses #139 in the revised selection model --- packages/text-annotator/src/SelectionHandler.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/text-annotator/src/SelectionHandler.ts b/packages/text-annotator/src/SelectionHandler.ts index b03caadb..dbe05df8 100644 --- a/packages/text-annotator/src/SelectionHandler.ts +++ b/packages/text-annotator/src/SelectionHandler.ts @@ -117,6 +117,8 @@ export const SelectionHandler = ( store.deleteAnnotation(currentTarget.annotation); } + currentTarget = undefined; + return; } @@ -144,21 +146,7 @@ export const SelectionHandler = ( // being edited. But it will typcially be the case on mobile! if (store.getAnnotation(currentTarget.annotation)) { store.updateTarget(currentTarget, Origin.LOCAL); - } /* else { - // Proper lifecycle management: clear selection first... - selection.clear(); - - // ...then add annotation to store... - store.addAnnotation({ - id: currentTarget.annotation, - bodies: [], - target: currentTarget - }); - - // ...then make the new annotation the current selection - selection.userSelect(currentTarget.annotation, lastDownEvent); } - */ }); /**