SHA256
UI: обсуждения по ТЗ – открытие записи, общий редактор ответа, нижняя панель
Нижняя панель снова видна в канале, обсуждении и личном чате. Нажатие на запись в ленте открывает её вместе с обсуждением; «Обсуждение» и «Ответить» открывают обсуждение и сразу редактор ответа. Нажатие на ответ в обсуждении открывает его как отдельное обсуждение. Ответ пишется в том же редакторе, что и запись канала (с вложениями): над полем – цепочка от исходной записи до той, на которую отвечаем, с аватарами и линией, как в Threads. Строка внизу обсуждения «Ответить …» открывает этот редактор; простое поле ввода убрано.
This commit is contained in:
+1
-1
@@ -1455,7 +1455,7 @@ function renderApp() {
|
||||
try {
|
||||
const chrome = createChromeController(showAppChrome, page.pageMeta?.shellMode);
|
||||
currentChromeCleanup = () => chrome.dispose();
|
||||
// В переписке нижняя панель прячется (pageMeta.hideToolbar), чтобы не отнимать место у сообщений.
|
||||
// Нижняя панель видна везде, кроме экранов с pageMeta.hideToolbar (например, смена ключей).
|
||||
if (showAppChrome && !page.pageMeta?.hideToolbar) {
|
||||
mountSlot(toolbarEl, '--toolbar-height', renderToolbar(page.pageMeta.id, navigate));
|
||||
toolbarHeightObserver?.sync?.();
|
||||
|
||||
@@ -92,7 +92,38 @@ export function openChannelEditor({
|
||||
const body = document.createElement('div');
|
||||
body.className = 'channel-editor__body';
|
||||
|
||||
if (context && (context.author || context.text || context.attachmentLabel)) {
|
||||
// Цепочка как в Threads: исходная запись и ответы до той, на которую отвечаем, сверху вниз, соединены линией.
|
||||
// Поле ввода – последним звеном; к началу цепочки – прокруткой вверх.
|
||||
const chain = Array.isArray(context?.chain) ? context.chain.filter(Boolean) : [];
|
||||
if (chain.length) {
|
||||
const chainBox = document.createElement('ol');
|
||||
chainBox.className = 'channel-editor__chain';
|
||||
chainBox.setAttribute('aria-label', 'На что вы отвечаете');
|
||||
chain.forEach((item) => {
|
||||
const row = document.createElement('li');
|
||||
row.className = 'channel-editor__chain-item';
|
||||
const avatar = item.avatar instanceof Node ? item.avatar : renderUserAvatar({ login: item.author || 'unknown', className: 'avatar-plain', size: 'sm' });
|
||||
avatar.classList.add('channel-editor__chain-avatar');
|
||||
const main = document.createElement('div');
|
||||
main.className = 'channel-editor__chain-main';
|
||||
const head = document.createElement('div');
|
||||
head.className = 'channel-editor__chain-head';
|
||||
const name = document.createElement('strong');
|
||||
name.textContent = String(item.title || item.author || '');
|
||||
head.append(name);
|
||||
if (item.time) {
|
||||
const time = document.createElement('span');
|
||||
time.textContent = item.time;
|
||||
head.append(time);
|
||||
}
|
||||
const text = document.createElement('p');
|
||||
text.textContent = String(item.text || item.attachmentLabel || 'Запись без текста');
|
||||
main.append(head, text);
|
||||
row.append(avatar, main);
|
||||
chainBox.append(row);
|
||||
});
|
||||
body.append(chainBox);
|
||||
} else if (context && (context.author || context.text || context.attachmentLabel)) {
|
||||
const contextBox = document.createElement('div');
|
||||
contextBox.className = 'channel-editor__context';
|
||||
const contextTitle = document.createElement('strong');
|
||||
@@ -147,6 +178,7 @@ export function openChannelEditor({
|
||||
authorText.append(where);
|
||||
}
|
||||
author.append(authorText);
|
||||
if (chain.length) author.classList.add('is-chained');
|
||||
body.append(author);
|
||||
body.append(textarea, attachmentsBox, error, clearButton);
|
||||
|
||||
@@ -375,7 +407,8 @@ export function openChannelEditor({
|
||||
const expand = overlay.querySelector('.channel-editor__context-toggle');
|
||||
if (quote && expand && quote.clientHeight > 0) expand.hidden = quote.scrollHeight <= quote.clientHeight;
|
||||
sync();
|
||||
textarea.focus();
|
||||
if (chain.length) body.scrollTop = author.offsetTop - body.offsetTop - 120;
|
||||
textarea.focus({ preventScroll: chain.length > 0 });
|
||||
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
||||
});
|
||||
return { close };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { appendShineMessageLinks } from '../services/shine-message-links.js';
|
||||
import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { consumeReplyEditorOnOpen, rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { attachMessageMenu } from '../components/message-menu.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { authService, getMessageReactionState, setMessageReactionState, state } from '../state.js';
|
||||
@@ -22,7 +22,6 @@ import { getPreviousTrackedPath, parseRouteFromPath } from '../router.js';
|
||||
import { renderAvatar, renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { openChannelEditor } from '../components/channel-editor.js';
|
||||
import { createDropdownMenu } from '../components/dropdown-menu.js';
|
||||
import { createEmojiPicker } from '../components/emoji-picker.js';
|
||||
import { openShareSheet } from '../components/share-sheet.js';
|
||||
import {
|
||||
composeMessageWithAttachments,
|
||||
@@ -34,7 +33,7 @@ import { loadProfileSnapshot } from '../services/user-profile-params.js';
|
||||
import { extractLoginFromBlockchainName, makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
|
||||
import { parsePublicationOrdinal, publicationAtOrdinal, ordinalForPublication } from '../services/channel-message-ordinals.js';
|
||||
|
||||
export const pageMeta = { id: 'channel-thread-view', title: 'Обсуждение', hideToolbar: true, shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
export const pageMeta = { id: 'channel-thread-view', title: 'Обсуждение', shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
const MSG_SUBTYPE_TEXT_POST = 10;
|
||||
const MSG_SUBTYPE_TEXT_RATING = 30;
|
||||
const MSG_SUBTYPE_TEXT_ENTRYPOINT = 100;
|
||||
@@ -883,6 +882,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
|
||||
handlers.navigate('login-view');
|
||||
return;
|
||||
}
|
||||
if (focusPost && handlers.openReplyEditor) { handlers.openReplyEditor(node); return; }
|
||||
openReplyModal({
|
||||
onSubmit: async (textValue) => handlers.onReply(target, textValue),
|
||||
isActive: handlers.isActive,
|
||||
@@ -925,7 +925,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
|
||||
discussionButton.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
animatePress(event.currentTarget);
|
||||
if (focusPost) card.closest('.channels-screen')?.querySelector('.thread-block--replies')?.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
||||
if (focusPost) handlers.openReplyEditor?.(node);
|
||||
else handlers.onOpenThread(target);
|
||||
});
|
||||
// Тот же вид и порядок кнопок, что в ленте канала.
|
||||
@@ -1219,6 +1219,12 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
|
||||
actions.append(like, reply);
|
||||
main.append(actions);
|
||||
item.append(who, main);
|
||||
// Как в Threads: нажатие на ответ открывает его обсуждение (кнопки, ссылки и вложения работают сами по себе).
|
||||
item.addEventListener('click', (event) => {
|
||||
if (event.target.closest('button, a, .message-attachment-carousel')) return;
|
||||
if (String(window.getSelection?.() || '').trim()) return;
|
||||
handlers.onOpenThread(target);
|
||||
});
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -1365,114 +1371,6 @@ function setThreadMuted(key, muted) {
|
||||
// Глубина дерева ответов за один запрос; что глубже – открывается обсуждением конкретного ответа.
|
||||
const THREAD_LOAD_DEPTH = 8;
|
||||
|
||||
// Черновик и адресат ответа принадлежат конкретному обсуждению
|
||||
const threadDrafts = new Map();
|
||||
|
||||
function createThreadComposer({ draftKey, isAuthorized, onLogin, onSend }) {
|
||||
const root = document.createElement('div');
|
||||
root.className = 'channel-composer thread-composer';
|
||||
if (!isAuthorized) {
|
||||
const login = document.createElement('button');
|
||||
login.type = 'button';
|
||||
login.className = 'primary-btn channel-main-action';
|
||||
login.textContent = 'Войти / зарегистрироваться';
|
||||
login.addEventListener('click', onLogin);
|
||||
root.append(login);
|
||||
return { root, setReplyTo() {} };
|
||||
}
|
||||
const draft = threadDrafts.get(draftKey) || { text: '', replyTo: null };
|
||||
threadDrafts.set(draftKey, draft);
|
||||
|
||||
const replying = document.createElement('div');
|
||||
replying.className = 'thread-replying';
|
||||
const row = document.createElement('div');
|
||||
row.className = 'compose-row';
|
||||
const field = document.createElement('div');
|
||||
field.className = 'compose-field';
|
||||
const input = document.createElement('textarea');
|
||||
input.rows = 1;
|
||||
input.className = 'compose-field__input';
|
||||
input.value = draft.text;
|
||||
const emojiBtn = document.createElement('button');
|
||||
emojiBtn.type = 'button';
|
||||
emojiBtn.className = 'compose-field__emoji';
|
||||
emojiBtn.setAttribute('aria-label', 'Эмодзи');
|
||||
emojiBtn.innerHTML = iconHtml('emoji');
|
||||
field.append(input, emojiBtn);
|
||||
const send = document.createElement('button');
|
||||
send.type = 'button';
|
||||
send.className = 'compose-send';
|
||||
send.setAttribute('aria-label', 'Отправить');
|
||||
send.innerHTML = iconHtml('send');
|
||||
row.append(field, send);
|
||||
const emojiSlot = document.createElement('div');
|
||||
emojiSlot.className = 'thread-composer__emoji';
|
||||
emojiSlot.hidden = true;
|
||||
root.append(replying, row, emojiSlot);
|
||||
|
||||
const sync = () => {
|
||||
draft.text = input.value;
|
||||
send.disabled = !input.value.trim();
|
||||
input.placeholder = draft.replyTo ? `Ответить ${draft.replyTo.authorLogin || ''}…` : 'Написать комментарий…';
|
||||
replying.replaceChildren();
|
||||
replying.hidden = !draft.replyTo;
|
||||
if (draft.replyTo) {
|
||||
const quote = document.createElement('div');
|
||||
quote.className = 'thread-quote';
|
||||
const a = document.createElement('strong');
|
||||
a.textContent = String(draft.replyTo.authorLogin || '');
|
||||
const t = document.createElement('span');
|
||||
t.textContent = parseMessageAttachments(resolveNodeText(draft.replyTo)).text;
|
||||
quote.append(a, t);
|
||||
const cancel = document.createElement('button');
|
||||
cancel.type = 'button';
|
||||
cancel.className = 'thread-replying__cancel';
|
||||
cancel.setAttribute('aria-label', 'Не отвечать на комментарий');
|
||||
cancel.innerHTML = iconHtml('close');
|
||||
cancel.addEventListener('click', () => { draft.replyTo = null; sync(); });
|
||||
replying.append(quote, cancel);
|
||||
}
|
||||
};
|
||||
input.addEventListener('input', sync);
|
||||
emojiBtn.addEventListener('click', () => {
|
||||
if (!emojiSlot.childElementCount) {
|
||||
emojiSlot.append(createEmojiPicker({ onSelect: (emoji) => {
|
||||
const at = input.selectionStart ?? input.value.length;
|
||||
input.value = `${input.value.slice(0, at)}${emoji}${input.value.slice(at)}`;
|
||||
sync();
|
||||
} }));
|
||||
}
|
||||
emojiSlot.hidden = !emojiSlot.hidden;
|
||||
});
|
||||
const submit = async () => {
|
||||
const text = input.value.trim();
|
||||
if (!text) return;
|
||||
send.disabled = true;
|
||||
try {
|
||||
await onSend(text, draft.replyTo);
|
||||
draft.text = '';
|
||||
draft.replyTo = null;
|
||||
input.value = '';
|
||||
emojiSlot.hidden = true;
|
||||
} catch (error) {
|
||||
showToast(toUserMessage(error, 'Комментарий не отправлен. Текст сохранён.'), { kind: 'error' });
|
||||
} finally {
|
||||
sync();
|
||||
}
|
||||
};
|
||||
send.addEventListener('click', submit);
|
||||
bindSubmitOnPlainEnter(input, submit);
|
||||
sync();
|
||||
return {
|
||||
root,
|
||||
setReplyTo(node) {
|
||||
draft.replyTo = node;
|
||||
sync();
|
||||
input.focus();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function render({ navigate, route, chrome }) {
|
||||
let selector = parseThreadSelector(route);
|
||||
const channelDisplayName = resolveChannelDisplayName(selector?.channel);
|
||||
@@ -1552,9 +1450,13 @@ export function render({ navigate, route, chrome }) {
|
||||
return { login, storagePwd };
|
||||
};
|
||||
|
||||
let replyEditorOpener = null;
|
||||
// Пришли по «Обсуждение» из ленты – после первой загрузки сразу открыть редактор ответа.
|
||||
let openEditorOnLoad = consumeReplyEditorOnOpen(window.location.pathname);
|
||||
const handlers = {
|
||||
navigate,
|
||||
isActive: () => !disposed,
|
||||
openReplyEditor: (node) => replyEditorOpener?.(node),
|
||||
onToggleLike: async (target, action) => {
|
||||
if (!state.session.isAuthorized) {
|
||||
state.authReturnHash = window.location.pathname || '/channels';
|
||||
@@ -2025,7 +1927,6 @@ export function render({ navigate, route, chrome }) {
|
||||
returnKey = fromKey;
|
||||
returnBtn.hidden = false;
|
||||
},
|
||||
setReplyTo: (node) => composerApi?.setReplyTo(node),
|
||||
shareComment: (node) => openShareSheet({
|
||||
title: 'Поделиться комментарием',
|
||||
kicker: `${node.authorLogin} · комментарий`,
|
||||
@@ -2048,15 +1949,82 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
screen.append(listWrap, returnBtn);
|
||||
|
||||
let composerApi = null;
|
||||
if (focus) {
|
||||
composerApi = createThreadComposer({
|
||||
draftKey: routeKey,
|
||||
isAuthorized: state.session.isAuthorized,
|
||||
onLogin: () => { state.authReturnHash = window.location.pathname || '/channels'; navigate('login-view'); },
|
||||
onSend: async (text, replyTo) => handlers.onReply(replyTo ? buildTargetFromNode(replyTo) : focusTarget, text),
|
||||
// Ответ пишется в том же редакторе, что и запись канала; над полем – цепочка до исходной записи.
|
||||
const parentByKey = new Map();
|
||||
const indexParents = (items, parent) => (Array.isArray(items) ? items : []).forEach((branch) => {
|
||||
if (!branch?.node) return;
|
||||
parentByKey.set(nodeKey(branch.node), parent);
|
||||
indexParents(branch.children, branch.node);
|
||||
});
|
||||
indexParents(descendants, focus);
|
||||
const chainItem = (node) => {
|
||||
const parsedNode = parseMessageAttachments(resolveNodeText(node));
|
||||
// Начало цепочки – запись канала: показываем её от имени канала, как в ленте.
|
||||
const isRoot = ancestors.length ? node === ancestors[0] : node === focus;
|
||||
const isChannelPost = isRoot && Boolean(selector?.channel?.ownerBlockchainName)
|
||||
&& String(node?.authorBlockchainName || '').toLowerCase() === String(selector.channel.ownerBlockchainName).toLowerCase();
|
||||
const item = {
|
||||
author: String(node?.authorLogin || ''),
|
||||
time: formatShortAge(node?.createdAtMs),
|
||||
text: parsedNode.text,
|
||||
attachmentLabel: parsedNode.attachments.length ? 'Вложение' : '',
|
||||
};
|
||||
if (isChannelPost) {
|
||||
item.title = title;
|
||||
item.avatar = renderAvatar({
|
||||
initials: (title[0] || 'К').toUpperCase(),
|
||||
avatar: (avatarAr || avatarSha256) ? { ar: avatarAr, sha256Hex: avatarSha256 } : null,
|
||||
authorLogin: item.author,
|
||||
size: 'xl',
|
||||
className: 'channel-profile-avatar',
|
||||
title,
|
||||
alt: 'Аватар канала',
|
||||
});
|
||||
item.avatar.style.setProperty('--channel-avatar-size', '40px');
|
||||
}
|
||||
return item;
|
||||
};
|
||||
replyEditorOpener = (node) => {
|
||||
if (!node || disposed) return;
|
||||
const path = [];
|
||||
for (let cur = node; cur && cur !== focus; cur = parentByKey.get(nodeKey(cur))) path.unshift(cur);
|
||||
const chain = [...ancestors, focus, ...path].filter(Boolean).map(chainItem);
|
||||
openChannelEditor({
|
||||
id: 'thread-reply-modal',
|
||||
title: 'Ответ',
|
||||
submitLabel: 'Ответить',
|
||||
placeholder: `Ответить ${node.authorLogin || ''}…`,
|
||||
context: { chain },
|
||||
key: `thread-reply:${nodeKey(node)}`,
|
||||
isActive: () => !disposed,
|
||||
onSubmit: ({ text }) => handlers.onReply(buildTargetFromNode(node), text),
|
||||
});
|
||||
chrome?.setComposer(composerApi.root);
|
||||
};
|
||||
commentHandlers.setReplyTo = (node) => {
|
||||
if (!state.session.isAuthorized) { state.authReturnHash = window.location.pathname || '/channels'; navigate('login-view'); return; }
|
||||
replyEditorOpener(node);
|
||||
};
|
||||
if (focus) {
|
||||
const bar = document.createElement('div');
|
||||
bar.className = 'channel-composer thread-composer';
|
||||
const open = document.createElement('button');
|
||||
open.type = 'button';
|
||||
if (state.session.isAuthorized) {
|
||||
open.className = 'channel-compose-bar';
|
||||
open.innerHTML = `<span class="channel-compose-bar__text"></span><span class="channel-compose-bar__icon" aria-hidden="true">${iconHtml('send')}</span>`;
|
||||
open.querySelector('.channel-compose-bar__text').textContent = `Ответить ${focus.authorLogin || ''}…`;
|
||||
open.addEventListener('click', () => replyEditorOpener(focus));
|
||||
} else {
|
||||
open.className = 'primary-btn channel-main-action';
|
||||
open.textContent = 'Войти, чтобы ответить';
|
||||
open.addEventListener('click', () => { state.authReturnHash = window.location.pathname || '/channels'; navigate('login-view'); });
|
||||
}
|
||||
bar.append(open);
|
||||
chrome?.setComposer(bar);
|
||||
if (openEditorOnLoad && state.session.isAuthorized) {
|
||||
openEditorOnLoad = false;
|
||||
trackTimer(window.setTimeout(() => { if (!disposed) replyEditorOpener?.(focus); }, 60));
|
||||
}
|
||||
}
|
||||
const focusWrap = screen.querySelector('.thread-block--focus');
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { appendShineMessageLinks } from '../services/shine-message-links.js';
|
||||
import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { rememberChannelPosition, readChannelPosition, requestReplyEditorOnOpen, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { getPreviousTrackedPath } from '../router.js';
|
||||
import { attachMessageMenu } from '../components/message-menu.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
@@ -50,7 +50,7 @@ import {
|
||||
import { parseDmTechBlocks } from '../services/dm-tech-blocks.js';
|
||||
import { sortedChannelPublications } from '../services/channel-message-ordinals.js';
|
||||
|
||||
export const pageMeta = { id: 'channel-view', title: 'Канал', hideToolbar: true, shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
export const pageMeta = { id: 'channel-view', title: 'Канал', shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
const CHANNEL_TYPE_STORIES = 0;
|
||||
const CHANNEL_TYPE_PERSONAL = 100;
|
||||
const MSG_SUBTYPE_TEXT_RATING = 30;
|
||||
@@ -2102,11 +2102,24 @@ function renderPostCard(post, {
|
||||
discussionButton.append(faces);
|
||||
}
|
||||
setActionTitle(discussionButton, `Открыть обсуждение, ответов: ${post.repliesCount || 0}`);
|
||||
// По ТЗ: «Обсуждение» открывает запись с обсуждением и сразу редактор ответа (гостю – только обсуждение).
|
||||
const openDiscussion = ({ withEditor = false } = {}) => {
|
||||
const route = buildThreadRoute(post, selector);
|
||||
if (!route) return;
|
||||
if (withEditor && state.session.isAuthorized) requestReplyEditorOnOpen(route);
|
||||
navigate(route);
|
||||
};
|
||||
discussionButton.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
const route = buildThreadRoute(post, selector);
|
||||
if (route) navigate(route);
|
||||
openDiscussion({ withEditor: true });
|
||||
});
|
||||
// Нажатие на саму запись открывает её вместе с обсуждением.
|
||||
card.addEventListener('click', (event) => {
|
||||
if (event.target.closest('button, a, input, textarea, .message-attachment-carousel')) return;
|
||||
if (String(window.getSelection?.() || '').trim()) return;
|
||||
openDiscussion();
|
||||
});
|
||||
card.classList.add('is-openable');
|
||||
|
||||
const replyButton = document.createElement('button');
|
||||
replyButton.type = 'button';
|
||||
@@ -2120,6 +2133,7 @@ function renderPostCard(post, {
|
||||
replyButton.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
animatePress(event.currentTarget);
|
||||
if (state.session.isAuthorized) { openDiscussion({ withEditor: true }); return; }
|
||||
openReplyModal({
|
||||
onSubmit: async (text) => onReply(post.messageRef, text),
|
||||
isActive,
|
||||
|
||||
@@ -46,7 +46,6 @@ import { makeProfileLinksRoute, makeProfileRoute } from '../services/shine-route
|
||||
export const pageMeta = {
|
||||
id: 'chat-view',
|
||||
title: 'Чат',
|
||||
hideToolbar: true,
|
||||
shellMode: {
|
||||
topFade: true,
|
||||
bottomFade: true,
|
||||
|
||||
@@ -8,3 +8,18 @@ export function restoreChannelPosition(value) {
|
||||
const root = document.getElementById('app-screen');
|
||||
if (root && Number.isFinite(value)) root.scrollTop = value;
|
||||
}
|
||||
|
||||
// «Открыть обсуждение» из ленты ведёт сразу в редактор ответа: лента отмечает путь, обсуждение забирает отметку один раз.
|
||||
let replyOnOpenPath = '';
|
||||
const normalizePath = (path) => {
|
||||
const raw = String(path || '').split(/[?#]/)[0];
|
||||
let decoded = raw;
|
||||
try { decoded = decodeURIComponent(raw); } catch { /* оставляем как есть */ }
|
||||
return decoded.replace(/^\/+|\/+$/g, '').toLowerCase();
|
||||
};
|
||||
export function requestReplyEditorOnOpen(path) { replyOnOpenPath = normalizePath(path); }
|
||||
export function consumeReplyEditorOnOpen(path) {
|
||||
const match = Boolean(replyOnOpenPath) && replyOnOpenPath === normalizePath(path);
|
||||
replyOnOpenPath = '';
|
||||
return match;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user