SHA256
Finalize DM docs and queue routing
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user