fix: #11601, dont trigger edit if chat input has text

pressing escape will cancel edit
isekai-main
Barış Soner Uşaklı 2 years ago
parent 8eed5a8413
commit d55cd464a0

@ -235,15 +235,14 @@ define('forum/chats', [
}
});
mousetrap.bind('up', function (e) {
if (e.target === components.get('chat/input').get(0)) {
const inputEl = components.get('chat/input');
if (e.target === inputEl.get(0) && !inputEl.val()) {
// Retrieve message id from messages list
const message = components.get('chat/messages').find('.chat-message[data-self="1"]').last();
if (!message.length) {
return;
}
const lastMid = message.attr('data-mid');
const inputEl = components.get('chat/input');
messages.prepEdit(inputEl, lastMid, ajaxify.data.roomId);
}
});

@ -176,6 +176,11 @@ define('forum/chats/messages', [
autoCompleteEl.destroy();
}
}
textarea.on('keyup', (e) => {
if (e.key === 'Escape') {
finishEdit();
}
});
editEl.find('[data-action="cancel"]').on('click', finishEdit);
editEl.find('[data-action="save"]').on('click', function () {

Loading…
Cancel
Save