{children}
@@ -132,7 +139,8 @@ export const TextView = ({
\s+(.*)/g, '$1') // Remove blockquotes
- .replace(/^\s*\n/gm, '\n') // Preserve empty lines
- .replace(/(\r\n|\n|\r)/gm, '\n') // Preserve line breaks
+function removeMarkdownKeepParagraphs(text: string): string {
+ return (
+ text
+ // 1) Bilder entfernen
+ .replace(/!\[.*?\]\(.*?\)/g, '')
+ // 2) Markdown-Links [Text](URL) → URL
+ .replace(/\[.*?\]\(\s*(https?:\/\/[^\s)]+)\s*\)/g, '$1')
+ // 3) Autolinks → http://…
+ .replace(/<\s*(https?:\/\/[^\s>]+)\s*>/g, '$1')
+ // 4) Code-Fences und Inline-Code entfernen
+ .replace(/```[\s\S]*?```/g, '')
+ .replace(/`([^`]+)`/g, '$1')
+ // 5) Fett/Italic löschen
+ .replace(/(\*\*|__)(.*?)\1/g, '$2')
+ .replace(/(\*|_)(.*?)\1/g, '$2')
+ // 6) Überschriften-Hashes entfernen
+ .replace(/^#{1,6}\s+(.*)$/gm, '$1')
+ // 7) Listen-Marker entfernen (-, *, +, 1., 2., …)
+ .replace(/^\s*([-+*]|\d+\.)\s+/gm, '')
+ // 8) Tabellen-Pipes entfernen
+ .replace(/^\|(.+)\|$/gm, '$1')
+ .replace(/^\s*\|[-\s|]+\|$/gm, '')
+ // 9) Blockquotes
+ .replace(/^>\s+(.*)$/gm, '$1')
+ // 10) Echte HTML-Tags (außer Absätze) entfernen
+ .replace(/<(?!\s*\/?\s*p\s*>)[^>]+>/g, '')
+ // 11) Zeilenumbrüche normalisieren
+ .replace(/\r\n|\r/g, '\n')
+ // 12) Mehrfache Leerzeilen auf max. 2 reduzieren
+ .replace(/\n{3,}/g, '\n\n')
+ // 13) Trim
+ .trim()
+ )
}
function truncateText(text, limit) {
@@ -178,3 +209,15 @@ function truncateText(text, limit) {
return truncated.trim()
}
+
+const sanitizeSchema = {
+ ...defaultSchema,
+ attributes: {
+ ...defaultSchema.attributes,
+ img: [
+ // alle bisherigen Attribute, plus 'style'
+ ...(defaultSchema.attributes?.img || []),
+ 'style',
+ ],
+ },
+}
diff --git a/lib/src/Utils/ReplaceURLs.ts b/lib/src/Utils/ReplaceURLs.ts
index 25981922..5e393e24 100644
--- a/lib/src/Utils/ReplaceURLs.ts
+++ b/lib/src/Utils/ReplaceURLs.ts
@@ -1,6 +1,4 @@
-export const urlRegex =
- // eslint-disable-next-line no-useless-escape, security/detect-unsafe-regex
- /(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm
+export const urlRegex = /(?)/g
export const mailRegex = /(? li {
+ list-style: none !important;
+ }
+
+ /* Für den Fall, dass ProseMirror ein ::before oder ::marker nutzt */
+ ul[data-type="taskList"] > li::before,
+ ul[data-type="taskList"] > li::marker {
+ content: "" !important;
+ display: none !important;
+ }
+ /* Ul ohne Marker, ohne Einrückung */
+ ul[data-type="taskList"] {
+ @apply tw:list-none tw:m-0 tw:p-0;
+ }
+
+ /* Li als Flex-Container, kein Marker */
+ ul[data-type="taskList"] > li {
+ @apply tw:flex tw:items-start tw:gap-2 tw:my-1 tw:list-none;
+ }
+ ul[data-type="taskList"] > li::marker {
+ content: "";
+ }
+
+ /* Label hält nur die Checkbox */
+ ul[data-type="taskList"] > li > label {
+ @apply tw:flex tw:items-center tw:m-0 tw:p-0;
+ }
+
+ /* Checkbox-Größe */
+ ul[data-type="taskList"] > li label input[type="checkbox"] {
+ @apply tw:w-4 tw:h-4 tw:shrink-0;
+ }
+
+ /* Der Text steht in einem div – mach’s inline und ohne Margin */
+ ul[data-type="taskList"] > li > div {
+ @apply tw:flex-1 tw:m-0;
+ }
+ ul[data-type="taskList"] > li > div > p {
+ @apply tw:inline-block tw:my-0 tw:leading-relaxed;
+ }
+
+ ul.contains-task-list {
+ @apply tw:list-none tw:m-0 tw:p-0;
+ }
+
+ /* Li ebenfalls ohne Marker */
+ ul.contains-task-list > li.task-list-item {
+ @apply tw:list-none;
+ }
+ /* Für alle Browser-Marker und ::before-Pseudo-Elemente */
+ ul.contains-task-list > li.task-list-item::marker,
+ ul.contains-task-list > li.task-list-item::before {
+ content: "" !important;
+ display: none !important;
+ }
+
+ /* P als Inline-Flex, damit kein Umbruch und guter Abstand */
+ ul.contains-task-list > li.task-list-item > p {
+ @apply tw:inline-flex tw:items-center tw:gap-2 tw:leading-relaxed;
+ }
+
+ /* Checkbox-Größe und Abstand */
+ ul.contains-task-list > li.task-list-item > p > input[type="checkbox"] {
+ @apply tw:w-4 tw:h-4 tw:shrink-0;
+ }
+
+ /* ========== Blockzitate ========== */
+ blockquote {
+ @apply tw:border-l-4 tw:border-gray-300 tw:pl-4 tw:italic tw:text-gray-600 tw:bg-gray-50 tw:my-4 tw:py-2;
}
}
}