I removed the excessive selection.clean() calls that can cause losing the same selected annotation reference. Previously upon releasing the Shift or a finger, the selection was cleared out and immediately updated. That cleanup would make the consumer think that a brand-new annotation was selected while the user just kept selecting the text after a pause.
Additionally, that cleanup is processed inconsistency in React 18 vs React <18 consumers.
Now, the selection is cleared only on:
selectionchange event is emitted but there's no currentTarget present (already in place)
Issue
See - https://github.com/recogito/text-annotator-js/issues/179
Changes Made
I removed the excessive
selection.clean()
calls that can cause losing the same selected annotation reference. Previously upon releasing theShift
or a finger, the selection was cleared out and immediately updated. That cleanup would make the consumer think that a brand-new annotation was selected while the user just kept selecting the text after a pause. Additionally, that cleanup is processed inconsistency in React 18 vs React <18 consumers.Now, the selection is cleared only on:
selectionchange
event is emitted but there's nocurrentTarget
present (already in place)