From 3a8477f863b1e6d3f0b0aeec7fa14160ec787c84 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Wed, 14 Jan 2026 17:34:11 +0100 Subject: [PATCH] fix: use preprocessMarkdown for parsing hashtags and item mentions The @tiptap/markdown extension doesn't automatically parse custom markdown syntax like [@Label](/item/id). We need to preprocess the markdown before loading it into the editor to convert these patterns to HTML spans that the extensions' parseHTML handlers can recognize. - RichTextEditor: preprocess defaultValue before loading - TextView: preprocess innerText before loading Co-Authored-By: Claude Opus 4.5 --- .../Map/Subcomponents/ItemPopupComponents/TextView.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index d93ee3ff..a548ecce 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -10,6 +10,7 @@ import { useItems } from '#components/Map/hooks/useItems' import { useTags } from '#components/Map/hooks/useTags' import { Hashtag, ItemMention, VideoEmbed } from '#components/TipTap/extensions' import { + preprocessMarkdown, removeMarkdownSyntax, truncateMarkdown, } from '#components/TipTap/utils/preprocessMarkdown' @@ -79,8 +80,8 @@ export const TextView = ({ }), VideoEmbed, ], - content: innerText, - contentType: 'markdown', + // Preprocess markdown to convert hashtags and item mentions to HTML + content: preprocessMarkdown(innerText), editable: false, editorProps: { attributes: { @@ -93,7 +94,7 @@ export const TextView = ({ // Update content when text changes useEffect(() => { - editor.commands.setContent(innerText, { contentType: 'markdown' }) + editor.commands.setContent(preprocessMarkdown(innerText)) }, [editor, innerText]) // Handle link clicks for internal navigation