angular-mentions icon indicating copy to clipboard operation
angular-mentions copied to clipboard

Doesn't work for different keyboard combinations

Open CheckMater opened this issue 6 years ago • 1 comments

Looks like it doesn't work if I for example use the Alt + 64 combination for the "@" character but it works if I add it using other combination or a key to insert it directly.

CheckMater avatar Mar 05 '20 00:03 CheckMater

Hi, this worked to me, detecting with keypress and triggering a KeyboardEventInit:

onKeypress(event:any) { var element = document.getElementById("commentMentions"); if(element&&event&&event["key"]=='@'&&event["code"]!="Digit2"){ let eventInit:KeyboardEventInit = {}; eventInit.composed = true; eventInit.bubbles = true; eventInit.cancelable = true; eventInit.code = "Digit2"; eventInit.ctrlKey = true; eventInit.key = '@'; eventInit.location = 0; element.dispatchEvent(new KeyboardEvent('keydown',eventInit)); } }

erickvalderrama avatar Mar 14 '22 14:03 erickvalderrama