I detect ctrl+v
in keydown event in such a way:
.keydown(function(e){
if ( e.ctrlKey && e.keyCode == 86 ) {
console.log ('ctrl+v!');
}
});
it works fine, when my layout is latin (English). But when I switch my layout to Russian (cyrillic) - ctrl+v
is executed (text is inserted) but jQuery detection doesn't work. (e.keyCode = 0
of cyrillic symbols).
P.S. I need it in good order (for preformatting inserted text )
P.P.S. My task was accomplished without detection of pasting. (just listening on keyup event was enough for me), but the problem exist on my PC (Ubuntu, Fx6). keyCode of Cyrillic symbols is recognized as 0, and you can't detect shortcuts with latin letters (ctrl+c
,ctrl+v
, etc).
This works fo me on ubuntu too(FF 5):
.keypress(function(e){
if ( e.ctrlKey && (e.which == 86 || e.which==118) ) {
console.log ('ctrl+v!');
}
});
for ctrl+n use
if ( e.ctrlKey && (e.which == 110 || e.which==78) )
and for ctrl+t:
if ( e.ctrlKey && (e.which == 84 || e.which==116) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With