Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Edit message with arrow up key if not last message #15021

Merged
merged 1 commit into from
Jul 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions app/ui/client/lib/chatMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,22 @@ export class ChatMessages {

toPrevMessage() {
const { element } = this.editing;
if (element) {
let previous;
for (previous = element.previousElementSibling; previous; previous = previous.previousElementSibling) {
if (previous.matches('.own:not(.system)')) {
break;
}
if (!element) {
const messages = Array.from(this.wrapper.querySelectorAll('.own:not(.system)'));
const message = messages.pop();
return message && this.edit(message, false);
}

for (
let previous = element.previousElementSibling;
previous;
previous = previous.previousElementSibling
) {
if (previous.matches('.own:not(.system)')) {
return this.edit(previous, false);
}

previous ? this.edit(previous, false) : this.clearEditing();
} else {
this.edit(this.wrapper.querySelector('.own:not(.system):last-child'), false);
}
this.clearEditing();
}

toNextMessage() {
Expand Down