Merge pull request #4216 from matrix-org/jryans/jump-shifted-char
Move to composer when typing letters with Shift held
This commit is contained in:
commit
0f0671dd84
1 changed files with 7 additions and 4 deletions
|
@ -337,13 +337,13 @@ const LoggedInView = createReactClass({
|
||||||
|
|
||||||
let handled = false;
|
let handled = false;
|
||||||
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
||||||
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey ||
|
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
||||||
ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
||||||
|
|
||||||
switch (ev.key) {
|
switch (ev.key) {
|
||||||
case Key.PAGE_UP:
|
case Key.PAGE_UP:
|
||||||
case Key.PAGE_DOWN:
|
case Key.PAGE_DOWN:
|
||||||
if (!hasModifier) {
|
if (!hasModifier && !isModifier) {
|
||||||
this._onScrollKeyPressed(ev);
|
this._onScrollKeyPressed(ev);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,10 @@ const LoggedInView = createReactClass({
|
||||||
if (handled) {
|
if (handled) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
} else if (!hasModifier) {
|
} else if (!isModifier && !ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
||||||
|
// The above condition is crafted to _allow_ characters with Shift
|
||||||
|
// already pressed (but not the Shift key down itself).
|
||||||
|
|
||||||
const isClickShortcut = ev.target !== document.body &&
|
const isClickShortcut = ev.target !== document.body &&
|
||||||
(ev.key === Key.SPACE || ev.key === Key.ENTER);
|
(ev.key === Key.SPACE || ev.key === Key.ENTER);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue