SHA256
Finalize DM docs and queue routing
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1392,22 +1392,10 @@ export function render({ navigate, route }) {
|
||||
if (!emojiPickerOpen || form.contains(event.target)) return;
|
||||
closeEmojiPicker();
|
||||
});
|
||||
// Enter — отправить; Ctrl+Enter — перенос строки.
|
||||
// Enter — отправить; Shift+Enter и Ctrl+Enter — перенос строки.
|
||||
input?.addEventListener('keydown', async (event) => {
|
||||
if (event.key !== 'Enter') return;
|
||||
if (event.ctrlKey) {
|
||||
event.preventDefault();
|
||||
const start = Number(input.selectionStart ?? input.value.length);
|
||||
const end = Number(input.selectionEnd ?? input.value.length);
|
||||
const value = String(input.value || '');
|
||||
input.value = `${value.slice(0, start)}\n${value.slice(end)}`;
|
||||
const nextPos = start + 1;
|
||||
try {
|
||||
input.setSelectionRange(nextPos, nextPos);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
autoResizeComposer(input);
|
||||
if (event.shiftKey || event.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
|
||||
@@ -489,7 +489,7 @@ export function render({ navigate }) {
|
||||
void renderSupportBuyIntro();
|
||||
});
|
||||
actions.querySelector('#support-queue')?.addEventListener('click', () => {
|
||||
void renderSupportQueue();
|
||||
navigate('quene');
|
||||
});
|
||||
actions.querySelector('#support-keygen')?.addEventListener('click', () => {
|
||||
void renderSupportKeygen();
|
||||
|
||||
@@ -39,6 +39,7 @@ const PRETTY_PATHS = new Map([
|
||||
['solana-users-init-view', 'settings/solana-users-init'],
|
||||
['solana-rpc-check-view', 'settings/solana-rpc-check'],
|
||||
['wallet-view', 'wallet'],
|
||||
['queue', 'quene'],
|
||||
['device-view', 'devices'],
|
||||
['device-session-view', 'devices'],
|
||||
['connect-device-view', 'devices/connect'],
|
||||
@@ -274,6 +275,10 @@ export function getRoute() {
|
||||
return { pageId: 'wallet-view', params: {} };
|
||||
}
|
||||
|
||||
if (pageId === 'quene' || pageId === 'queue') {
|
||||
return { pageId: 'queue', params: {} };
|
||||
}
|
||||
|
||||
if (pageId === 'devices') {
|
||||
const sub = decodePart(segments[1] || '').toLowerCase();
|
||||
if (sub === 'connect') return { pageId: 'connect-device-view', params: {} };
|
||||
@@ -332,10 +337,6 @@ export function getRoute() {
|
||||
return { pageId, params: { mode: segments[1] ? decodePart(segments[1]) : '' } };
|
||||
}
|
||||
|
||||
if (pageId === 'queue') {
|
||||
return { pageId, params: {} };
|
||||
}
|
||||
|
||||
return { pageId, params: {} };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user