diff --git a/lib/src/Components/Input/RichTextEditor.tsx b/lib/src/Components/Input/RichTextEditor.tsx index 293e0009..4fb3e1a5 100644 --- a/lib/src/Components/Input/RichTextEditor.tsx +++ b/lib/src/Components/Input/RichTextEditor.tsx @@ -68,15 +68,8 @@ export function RichTextEditor({ }: RichTextEditorProps) { const handleChange = () => { if (!editor) return - - let newValue = getStyledMarkdown(editor) - // matcht entweder Markdown-Images *oder* HTML-–Tags - const regex = /(!\[.*?\]\(.*?\)|]*?\/?>)/gi - - newValue = newValue.replace(regex, (match) => match + '\n\n') - - if (updateFormValue && newValue) { - updateFormValue(newValue) + if (updateFormValue) { + updateFormValue(getStyledMarkdown(editor)) } } @@ -197,6 +190,7 @@ export function getStyledMarkdown(editor: Editor): string { if (title) tag += ' title="' + title + '"' if (style) tag += ' style="' + style + '"' tag += ' />' + tag += '\n\n' state.write(tag) } @@ -204,7 +198,7 @@ export function getStyledMarkdown(editor: Editor): string { const { src } = node.attrs as { src: string } const match = src.match( - /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, + /(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/|youtube-nocookie\.com\/embed\/)([A-Za-z0-9_-]{11})/, ) const videoId = match?.[1] if (videoId) { @@ -213,6 +207,7 @@ export function getStyledMarkdown(editor: Editor): string { let tag = '
' tag += `` tag += '
' + tag += '\n\n' state.write(tag) } } @@ -236,7 +231,7 @@ const CustomYoutube = Youtube.extend({ find: youtubePasteRegex, type: this.type, getAttributes: (match) => { - return { src: match[1] } + return { src: `https://www.youtube-nocookie.com/embed/${match[2]}` } }, }), ] @@ -247,7 +242,7 @@ const CustomYoutube = Youtube.extend({ find: youtubeInputRegex, type: this.type, getAttributes: (match) => { - return { src: match[1] } + return { src: `https://www.youtube-nocookie.com/embed/${match[2]}` } }, }), ] @@ -291,7 +286,6 @@ const CustomYoutube = Youtube.extend({ }) const youtubePasteRegex = - /(https?:\/\/(?:www\.)?youtube\.com\/watch\?v=[\w-]+|https?:\/\/youtu\.be\/[\w-]+)/g - +/(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/))([A-Za-z0-9_-]{11})(?:\?.*)?/g const youtubeInputRegex = - /(https?:\/\/(?:www\.)?youtube\.com\/watch\?v=[\w-]+|https?:\/\/youtu\.be\/[\w-]+)$/ + /(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/))([A-Za-z0-9_-]{11})(?:\?.*)?$/ \ No newline at end of file diff --git a/lib/src/Components/Profile/ProfileForm.tsx b/lib/src/Components/Profile/ProfileForm.tsx index b4d82862..cc8e63a1 100644 --- a/lib/src/Components/Profile/ProfileForm.tsx +++ b/lib/src/Components/Profile/ProfileForm.tsx @@ -157,6 +157,9 @@ export function ProfileForm() { <> {item ? ( diff --git a/lib/src/Components/Profile/itemFunctions.ts b/lib/src/Components/Profile/itemFunctions.ts index 51045c04..be72d112 100644 --- a/lib/src/Components/Profile/itemFunctions.ts +++ b/lib/src/Components/Profile/itemFunctions.ts @@ -292,7 +292,7 @@ export const onUpdateItem = async ( ) .then(() => { setLoading(false) - navigate(`/${params && '?' + params}`) + navigate(`/item/${item.id}${params && '?' + params}`) return null })) } diff --git a/lib/src/Components/Templates/LoadingMapOverlay.tsx b/lib/src/Components/Templates/LoadingMapOverlay.tsx index 9d3eb69f..f5f55445 100644 --- a/lib/src/Components/Templates/LoadingMapOverlay.tsx +++ b/lib/src/Components/Templates/LoadingMapOverlay.tsx @@ -2,7 +2,12 @@ import { MapOverlayPage } from '#components/Templates/MapOverlayPage' export const LoadingMapOverlay = () => { return ( - +
diff --git a/lib/src/Components/Templates/MapOverlayPage.tsx b/lib/src/Components/Templates/MapOverlayPage.tsx index 0e994b28..3b8d05d9 100644 --- a/lib/src/Components/Templates/MapOverlayPage.tsx +++ b/lib/src/Components/Templates/MapOverlayPage.tsx @@ -10,14 +10,18 @@ export function MapOverlayPage({ className, backdrop, card = true, + showCloseButton = true, + closeButtonUrl, }: { children: React.ReactNode className?: string backdrop?: boolean card?: boolean + showCloseButton?: boolean + closeButtonUrl?: string }) { const closeScreen = () => { - navigate(`/${window.location.search ? window.location.search : ''}`) + navigate(closeButtonUrl ?? `/${window.location.search ? window.location.search : ''}`) } const navigate = useNavigate() @@ -48,12 +52,14 @@ export function MapOverlayPage({ className={`${card ? 'tw:card tw:card-body tw:shadow-xl' : ''} tw:bg-base-100 tw:p-6 ${className ?? ''} ${backdrop ? '' : 'tw:z-2000'} tw:absolute tw:top-0 tw:bottom-0 tw:right-0 tw:left-0 tw:m-auto`} > {children} - + {showCloseButton && ( + + )}