Skip to content

Commit

Permalink
Merge branch 'recogito#136-fix-not-dismisssed-annotation-on-native-ra…
Browse files Browse the repository at this point in the history
…nge-click' into keyboard-event-selection

# Conflicts:
#	packages/text-annotator/src/SelectionHandler.ts
  • Loading branch information
oleksandr-danylchenko committed Aug 30, 2024
2 parents fcbfc8f + cecc655 commit 247ef33
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const SelectionHandler = (
return;

// Logic for selecting an existing annotation
const userSelect = () => {
const clickSelect = () => {
const { x, y } = container.getBoundingClientRect();

const hovered =
Expand Down Expand Up @@ -189,16 +189,17 @@ export const SelectionHandler = (
* @see https://github.com/recogito/text-annotator-js/issues/136
*/
setTimeout(() => {
const sel = document.getSelection();
const sel = document.getSelection()

// Just a click, not a selection
if (sel?.isCollapsed && timeDifference < 300) {
userSelect();
clickSelect();
} else if (currentTarget) {
selection.userSelect(currentTarget.annotation, evt);
}
});
};
}

document.addEventListener('pointerup', onPointerUp);


Expand Down

0 comments on commit 247ef33

Please sign in to comment.