I'm struggling to understand why text selection (using mouse) got deleted automatically on HostListener click.
I built a very basic directive to detect if user click on a link in a paragraph and add some logic to it. However, it stops user from selecting a text (copy/paste) as it automatically deselect the text.
Any thoughts?
@HostListener('click', ['$event'])
public onClick(event: any) {
if (event.view.getSelection().type !== 'Range') {
alert('you clicked');
} else {
alert('U selected text');
return;
}
}
}