fix Ctrl+right/left handling in RTL fields
This commit is contained in:
parent
d079307536
commit
46573df890
@ -59,6 +59,29 @@ function onKey(evt: KeyboardEvent) {
|
||||
focusPrevious();
|
||||
return;
|
||||
}
|
||||
|
||||
// fix Ctrl+right/left handling in RTL fields
|
||||
if (currentField.dir === "rtl") {
|
||||
const selection = window.getSelection();
|
||||
let granularity = "character";
|
||||
let alter = "move";
|
||||
if (evt.ctrlKey) {
|
||||
granularity = "word";
|
||||
}
|
||||
if (evt.shiftKey) {
|
||||
alter = "extend";
|
||||
}
|
||||
if (evt.which === 39) {
|
||||
selection.modify(alter, "right", granularity);
|
||||
evt.preventDefault();
|
||||
return;
|
||||
} else if (evt.which === 37) {
|
||||
selection.modify(alter, "left", granularity);
|
||||
evt.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
triggerKeyTimer();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user