diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextPreview.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextPreview.tsx
index 33bfd868..71acb997 100644
--- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextPreview.tsx
+++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextPreview.tsx
@@ -1,19 +1,98 @@
-import { RichTextEditor } from '#components/Input/RichTextEditor/RichTextEditor'
-import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+import truncate from 'markdown-truncate'
+import Markdown from 'react-markdown'
+import rehypeRaw from 'rehype-raw'
+import remarkBreaks from 'remark-breaks'
+import remarkGfm from 'remark-gfm'
+
+import { useAddFilterTag } from '#components/Map/hooks/useFilter'
+import { useGetItemTags, useTags } from '#components/Map/hooks/useTags'
+import { decodeTag } from '#utils/FormatTags'
import type { Item } from '#types/Item'
export const TextPreview = ({ item }: { item: Item }) => {
- let replacedText = ''
+ const getItemTags = useGetItemTags()
if (!item.text) return null
- else replacedText = fixUrls(item.text)
+ // Text auf ~100 Zeichen stutzen (inkl. Ellipse „…“)
+ const previewRaw = truncate(
+ removeGfmTables(convertImgTagsToMarkdown(removeMentionSpans(removeHashtags(item.text)))),
+ {
+ limit: 150,
+ ellipsis: true,
+ },
+ ) as string
- if (replacedText) {
- replacedText = replacedText.replace(mailRegex, (url) => {
- return `[${url}](mailto:${url})`
- })
- }
+ const withExtraHashes = previewRaw.replace(
+ /^(#{1,6})\s/gm,
+ (_match: string, hashes: string): string => `${hashes}## `,
+ )
- return