From 317ec72c7ea9a9dad6a2a03c19f2e7c45829d026 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Fri, 16 Jan 2026 09:33:25 +0100 Subject: [PATCH] fix(tiptap): fix truncation breaking mentions and hashtags in TextViewStatic Reorder processing steps: truncate raw markdown first, then preprocess. Previously, preprocessMarkdown converted mentions/hashtags to HTML tags before truncation, but truncateMarkdown only recognizes markdown syntax ([@Label](/item/id)), not HTML tags (), causing tags to be cut in half. Co-Authored-By: Claude Opus 4.5 --- .../ItemPopupComponents/TextViewStatic.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextViewStatic.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextViewStatic.tsx index 1dd473b9..32671ac3 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextViewStatic.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextViewStatic.tsx @@ -56,20 +56,21 @@ export const TextViewStatic = ({ innerText = text } - // Pre-process markdown first (converts naked URLs to links, etc.) - // Then truncate the processed markdown + // First truncate the raw markdown (before preprocessing) + // Then preprocess (converts naked URLs, mentions, hashtags to HTML tags) // Finally convert to HTML const html = useMemo(() => { if (!innerText) return '' - // First preprocess to normalize all URLs/mentions/hashtags - let processed = preprocessMarkdown(innerText) - - // Then truncate if needed (works on normalized markdown) + // First truncate if needed (works on raw markdown syntax) + let processed = innerText if (truncate) { processed = truncateMarkdown(processed, 100) } + // Then preprocess to normalize all URLs/mentions/hashtags to HTML tags + processed = preprocessMarkdown(processed) + return simpleMarkdownToHtml(processed, tags, { items, getItemColor }) }, [innerText, truncate, tags, items, getItemColor])