diff --git a/package-lock.json b/package-lock.json index fe59b2d8..c167ed82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "react-leaflet-cluster": "^2.1.0", "react-markdown": "^9.0.1", "react-router-dom": "^6.16.0", + "react-string-replace": "^1.1.1", "react-toastify": "^9.1.3", "rehype-video": "^2.0.2", "tributejs": "^5.1.3", @@ -4890,6 +4891,14 @@ "react-dom": ">=16.8" } }, + "node_modules/react-string-replace": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/react-string-replace/-/react-string-replace-1.1.1.tgz", + "integrity": "sha512-26TUbLzLfHQ5jO5N7y3Mx88eeKo0Ml0UjCQuX4BMfOd/JX+enQqlKpL1CZnmjeBRvQE8TR+ds9j1rqx9CxhKHQ==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/react-toastify": { "version": "9.1.3", "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.3.tgz", diff --git a/package.json b/package.json index a88aa5d0..4ba7c666 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "react-leaflet-cluster": "^2.1.0", "react-markdown": "^9.0.1", "react-router-dom": "^6.16.0", + "react-string-replace": "^1.1.1", "react-toastify": "^9.1.3", "rehype-video": "^2.0.2", "tributejs": "^5.1.3", diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index c8723382..24efd282 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -11,85 +11,90 @@ export const TextView = ({ item }: { item?: Item }) => { const tags = useTags(); const addFilterTag = useAddFilterTag(); - let replacedText; + let replacedText; if (item && item.text) replacedText = fixUrls(item.text); replacedText = replacedText.replace(/(? { - let shortUrl = url; + let shortUrl = url; if (url.match('^https:\/\/')) { shortUrl = url.split('https://')[1]; } if (url.match('^http:\/\/')) { shortUrl = url.split('http://')[1]; - } + } return `[${shortUrl}](${url})` - }) + }) -replacedText = replacedText.replace(mailRegex, (url) => { - return `[${url}](mailto:${url})` -}) + replacedText = replacedText.replace(mailRegex, (url) => { + return `[${url}](mailto:${url})` + }) -replacedText = replacedText.replace(hashTagRegex, (match) => { - return `[${match}](${match})` -}) + replacedText = replacedText.replace(hashTagRegex, (match) => { + return `[${match}](${match})` + }) -const CustomH1 = ({ children }) => ( -
{children}
-); -const CustomUnorderdList = ({ children }) => ( -{children}
+ ); + const CustomUnorderdList = ({ children }) => ( +