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
+15
View File
@@ -313,6 +313,16 @@ function latestVersionText(versions) {
return '';
}
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 resolveNodeText(node) {
return firstNonEmptyText(
node?.text,
@@ -388,6 +398,8 @@ function openReplyModal({ onSubmit, navigate }) {
}
});
bindSubmitOnPlainEnter(textEl, () => root.querySelector('#thread-reply-submit')?.click());
if (textEl) textEl.focus();
}
@@ -477,6 +489,8 @@ function openRepostModal({ navigate, channels = [], onSubmit }) {
}
});
bindSubmitOnPlainEnter(textEl, () => submitEl?.click());
if (textEl) textEl.focus();
}
@@ -562,6 +576,7 @@ function openEditMessageModal({ initialText = '', onSave, onDelete }) {
errorEl.textContent = toUserMessage(error, 'Не удалось удалить сообщение.');
}
});
bindSubmitOnPlainEnter(textEl, () => root.querySelector('#thread-edit-save')?.click());
if (textEl) textEl.focus();
}