diff --git a/package-lock.json b/package-lock.json index 7f423c4a..9bd3685c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "react-markdown": "^9.0.1", "react-router-dom": "^6.16.0", "react-toastify": "^9.1.3", + "rehype-video": "^2.0.2", "tributejs": "^5.1.3", "tw-elements": "^1.0.0" }, @@ -28,7 +29,6 @@ "@types/leaflet": "^1.7.11", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.5", - "@types/react-helmet": "^6.1.6", "@types/react-leaflet": "^2.8.2", "@typescript-eslint/eslint-plugin": "^5.38.1", "@typescript-eslint/parser": "^5.38.1", @@ -382,15 +382,6 @@ "@types/react": "*" } }, - "node_modules/@types/react-helmet": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/@types/react-helmet/-/react-helmet-6.1.6.tgz", - "integrity": "sha512-ZKcoOdW/Tg+kiUbkFCBtvDw0k3nD4HJ/h/B9yWxN4uDO8OkRksWTO+EL+z/Qu3aHTeTll3Ro0Cc/8UhwBCMG5A==", - "dev": true, - "dependencies": { - "@types/react": "*" - } - }, "node_modules/@types/react-leaflet": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/@types/react-leaflet/-/react-leaflet-2.8.2.tgz", @@ -4870,6 +4861,21 @@ "url": "https://github.com/sponsors/mysticatea" } }, + "node_modules/rehype-video": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/rehype-video/-/rehype-video-2.0.2.tgz", + "integrity": "sha512-iT4kOiixMn+ytjpKRsBo/o+3ws9+q+eIyrzUlOhuL97buOO38ayEog2NhxR3R+g6J2lEOTK66XtHVfvzQ3H7Ug==", + "dependencies": { + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://jaywcjlove.github.io/#/sponsor" + } + }, "node_modules/remark-parse": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", diff --git a/package.json b/package.json index 521ee694..0f727cfb 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "@types/leaflet": "^1.7.11", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.5", - "@types/react-helmet": "^6.1.6", "@types/react-leaflet": "^2.8.2", "@typescript-eslint/eslint-plugin": "^5.38.1", "@typescript-eslint/parser": "^5.38.1", @@ -55,6 +54,7 @@ "react-markdown": "^9.0.1", "react-router-dom": "^6.16.0", "react-toastify": "^9.1.3", + "rehype-video": "^2.0.2", "tributejs": "^5.1.3", "tw-elements": "^1.0.0" } diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index 07471159..c8723382 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -5,18 +5,17 @@ import { useAddFilterTag } from '../../hooks/useFilter'; import { hashTagRegex } from '../../../../Utils/HashTagRegex'; import { fixUrls, mailRegex } from '../../../../Utils/ReplaceURLs'; import Markdown from 'react-markdown' +import rehypeVideo from 'rehype-video'; export const TextView = ({ item }: { item?: Item }) => { const tags = useTags(); const addFilterTag = useAddFilterTag(); - let replacedText; - console.log(item?.text); - + let replacedText; if (item && item.text) replacedText = fixUrls(item.text); - replacedText = replacedText.replace(/(? { + replacedText = replacedText.replace(/(? { let shortUrl = url; if (url.match('^https:\/\/')) { shortUrl = url.split('https://')[1]; @@ -25,24 +24,16 @@ export const TextView = ({ item }: { item?: Item }) => { shortUrl = url.split('http://')[1]; } return `[${shortUrl}](${url})` - }) - - console.log(replacedText); - + }) replacedText = replacedText.replace(mailRegex, (url) => { return `[${url}](mailto:${url})` }) -console.log(replacedText); - - replacedText = replacedText.replace(hashTagRegex, (match) => { return `[${match}](${match})` }) -console.log(replacedText); - const CustomH1 = ({ children }) => (