Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export const SelectionHandler = (
*/
if (store.getAnnotation(currentTarget.annotation)) {
store.updateTarget(currentTarget, Origin.LOCAL);
} else {
// Proper lifecycle management: clear the previous selection first...
selection.clear();
}
});

Expand Down Expand Up @@ -206,7 +209,7 @@ export const SelectionHandler = (
if (selected.length !== 1 || selected[0].id !== hovered.id) {
selection.userSelect(hovered.id, evt);
}
} else if (!selection.isEmpty()) {
} else {
selection.clear();
}
Comment on lines -209 to 214
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isEmpty check is redundant because such a case is already handled on the a9s side. The operation will be no-op if the selection is already clear. Source

};
Expand Down