File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
packages/text-annotator/src Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -230,12 +230,18 @@ export const SelectionHandler = (
230230 // Proper lifecycle management: clear selection first...
231231 selection . clear ( ) ;
232232
233- // ...then add annotation to store...
234- store . addAnnotation ( {
235- id : currentTarget . annotation ,
236- bodies : [ ] ,
237- target : currentTarget
238- } ) ;
233+ const exists = store . getAnnotation ( currentTarget . annotation ) ;
234+ if ( exists ) {
235+ // ...then add annotation to store...
236+ store . updateTarget ( currentTarget ) ;
237+ } else {
238+ // ...then add annotation to store...
239+ store . addAnnotation ( {
240+ id : currentTarget . annotation ,
241+ bodies : [ ] ,
242+ target : currentTarget
243+ } ) ;
244+ }
239245
240246 // ...then make the new annotation the current selection
241247 selection . userSelect ( currentTarget . annotation , cloneKeyboardEvent ( evt ) ) ;
You can’t perform that action at this time.
0 commit comments