#1696 Don't cancel generation on first Escape press if editing a message

This commit is contained in:
Cohee 2024-01-15 03:45:31 +02:00
parent 0540af2bfe
commit ed77f4763a
1 changed files with 5 additions and 2 deletions

View File

@ -9292,13 +9292,16 @@ jQuery(async function () {
$(document).keyup(function (e) {
if (e.key === 'Escape') {
if (power_user.auto_save_msg_edits === false) {
const isEditVisible = $('#curEditTextarea').is(':visible');
if (isEditVisible && power_user.auto_save_msg_edits === false) {
closeMessageEditor();
$('#send_textarea').focus();
return;
}
if (power_user.auto_save_msg_edits === true) {
if (isEditVisible && power_user.auto_save_msg_edits === true) {
$(`#chat .mes[mesid="${this_edit_mes_id}"] .mes_edit_done`).click();
$('#send_textarea').focus();
return;
}
if (!this_edit_mes_id && $('#mes_stop').is(':visible')) {
$('#mes_stop').trigger('click');