Regression: Cursor position set to beginning when editing a message (#14245)

* Regression: Cursor position set to begining when editing a message

* Prevent keydown event on switch editing message
pull/11346/head^2
Rodrigo Nascimento 7 years ago committed by GitHub
parent 5ada58ffdf
commit a11939e50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/ui/client/lib/chatMessages.js

@ -226,8 +226,8 @@ export class ChatMessages {
}
const cursorPosition = editingNext ? 0 : -1;
this.$input.setCursorPosition(cursorPosition);
this.input.focus();
this.$input.setCursorPosition(cursorPosition);
}
clearEditing() {
@ -521,12 +521,12 @@ export class ChatMessages {
event.preventDefault();
event.stopPropagation();
return true;
return;
}
if (keyCode === keyCodes.ARROW_UP || keyCode === keyCodes.ARROW_DOWN) {
if (event.shiftKey) {
return true;
return;
}
const cursorPosition = input.selectionEnd;
@ -535,7 +535,7 @@ export class ChatMessages {
if (cursorPosition === 0) {
this.toPrevMessage();
} else if (!event.altKey) {
return true;
return;
}
if (event.altKey) {
@ -545,7 +545,7 @@ export class ChatMessages {
if (cursorPosition === input.value.length) {
this.toNextMessage();
} else if (!event.altKey) {
return true;
return;
}
if (event.altKey) {
@ -553,7 +553,9 @@ export class ChatMessages {
}
}
return false;
event.preventDefault();
event.stopPropagation();
return;
}
}

Loading…
Cancel
Save