Finalize DM docs and queue routing

This commit is contained in:
AidarKC
2026-07-22 15:13:13 +04:00
parent 38141ea5c7
commit a56252c361
8 changed files with 74 additions and 21 deletions
+16
View File
@@ -297,6 +297,16 @@ function openAboutChannelModal(channel) {
});
}
function bindSubmitOnPlainEnter(textarea, submit) {
if (!(textarea instanceof HTMLTextAreaElement) || typeof submit !== 'function') return;
textarea.addEventListener('keydown', (event) => {
if (event.key !== 'Enter') return;
if (event.shiftKey || event.ctrlKey) return;
event.preventDefault();
submit();
});
}
function openReplyModal({ onSubmit, navigate }) {
const root = document.getElementById('modal-root');
root.innerHTML = `
@@ -363,6 +373,8 @@ function openReplyModal({ onSubmit, navigate }) {
}
});
bindSubmitOnPlainEnter(textEl, () => submitEl?.click());
if (textEl) textEl.focus();
}
@@ -448,6 +460,7 @@ function openRepostModal({ navigate, channels = [], onSubmit }) {
errorEl.textContent = toUserMessage(error, 'Не удалось сделать репост.');
}
});
bindSubmitOnPlainEnter(textEl, () => submitEl?.click());
if (textEl) textEl.focus();
}
@@ -506,6 +519,8 @@ function openAddMessageModal({ channelName, onSubmit, navigate }) {
}
});
bindSubmitOnPlainEnter(textEl, () => submitEl?.click());
if (textEl) textEl.focus();
}
@@ -592,6 +607,7 @@ function openEditMessageModal({ initialText = '', onSave, onDelete }) {
errorEl.textContent = toUserMessage(error, 'Не удалось удалить сообщение.');
}
});
bindSubmitOnPlainEnter(textEl, () => root.querySelector('#edit-message-save')?.click());
if (textEl) textEl.focus();
}