diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..2b9b3f4c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+lib/node_modules/
+lib/dist/
+frontend/node_modules/
+frontend/dist/
+
diff --git a/lib/src/Components/Input/RichTextEditor.tsx b/lib/src/Components/Input/RichTextEditor.tsx
index 4016a823..293e0009 100644
--- a/lib/src/Components/Input/RichTextEditor.tsx
+++ b/lib/src/Components/Input/RichTextEditor.tsx
@@ -1,8 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
-import { log } from 'node:console'
-
import { Color } from '@tiptap/extension-color'
import { Image } from '@tiptap/extension-image'
import { Link } from '@tiptap/extension-link'
@@ -209,12 +207,14 @@ export function getStyledMarkdown(editor: Editor): string {
/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,
)
const videoId = match?.[1]
- const nocookieUrl = `https://www.youtube-nocookie.com/embed/${videoId}`
+ if (videoId) {
+ const nocookieUrl = `https://www.youtube-nocookie.com/embed/${videoId}`
- let tag = '
'
- tag += ``
- tag += '
'
- state.write(tag)
+ let tag = ''
+ tag += ``
+ tag += '
'
+ state.write(tag)
+ }
}
const customSerializer = new MarkdownSerializer(
@@ -258,16 +258,12 @@ const CustomYoutube = Youtube.extend({
tag: 'iframe[src*="/embed/"]',
priority: 1000,
getAttrs: (dom) => {
- const src = (dom as HTMLIFrameElement).getAttribute('src') || ''
- console.log(src)
+ const src = (dom as HTMLIFrameElement).getAttribute('src') ?? ''
const match = src.match(/\/embed\/([A-Za-z0-9_-]{11})/)
- console.log(match)
if (!match) {
return false
}
const videoId = match[1]
- console.log(videoId)
- // immer auf nocookie normieren
return {
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
}
diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
index 5add5edf..0027ef82 100644
--- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
+++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
@@ -20,6 +20,7 @@ import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
import type { Item } from '#types/Item'
import type { Tag } from '#types/Tag'
+import type { Root, Element } from 'hast'
/**
* @category Map
@@ -246,20 +247,25 @@ export const sanitizeSchema = {
}
export function rehypeFilterYouTubeIframes() {
- return (tree: any) => {
+ return (tree: Root) => {
visit(tree, 'element', (node) => {
- if (node.tagName === 'iframe') {
- const src = String(node.properties?.src || '')
+ // node ist hier typischerweise ein HAST-Element
+ const el = node
+
+ if (el.tagName === 'iframe') {
+ const src = String(el.properties?.src ?? '')
+
// Nur echte YouTube-Embed-URLs zulassen
if (
+ // eslint-disable-next-line security/detect-unsafe-regex
!/^https:\/\/(?:www\.)?(?:youtube\.com|youtube-nocookie\.com)\/embed\/[A-Za-z0-9_-]+(?:\?.*)?$/.test(
src,
)
) {
// ersetze es durch einen leeren div
- node.tagName = 'div'
- node.properties = {}
- node.children = []
+ el.tagName = 'div'
+ el.properties = {}
+ el.children = []
}
}
})
diff --git a/node_modules/.vite/deps/_metadata.json b/node_modules/.vite/deps/_metadata.json
deleted file mode 100644
index 9fd5219b..00000000
--- a/node_modules/.vite/deps/_metadata.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "hash": "af787104",
- "configHash": "61d63c0d",
- "lockfileHash": "fc7082fc",
- "browserHash": "ef8d4f33",
- "optimized": {},
- "chunks": {}
-}
\ No newline at end of file
diff --git a/node_modules/.vite/deps/package.json b/node_modules/.vite/deps/package.json
deleted file mode 100644
index 3dbc1ca5..00000000
--- a/node_modules/.vite/deps/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "type": "module"
-}