The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(email threads): linkify Email body so that URL links are properly formatted (#16415)
Abhishek Kumar61addf8b62f5
diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.jsonindex 4166e8d7502..5f275c9aa9c 100644--- a/packages/twenty-front/package.json+++ b/packages/twenty-front/package.json@@ -88,6 +88,8 @@"json-2-csv": "^5.4.0","json-logic-js": "^2.0.5","jwt-decode": "^4.0.0",+ "linkify-react": "^4.1.3",+ "linkifyjs": "^4.1.3","qs": "^6.11.2","react-data-grid": "7.0.0-beta.13","react-datepicker": "^6.7.1",diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsxindex 4a0a9660546..438504018f0 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx@@ -1,5 +1,6 @@import styled from '@emotion/styled';import { motion } from 'framer-motion';+import Linkify from 'linkify-react';import { AnimatedEaseInOut } from 'twenty-ui/utilities';const StyledThreadMessageBody = styled(motion.div)`@@ -9,6 +10,18 @@ const StyledThreadMessageBody = styled(motion.div)`margin-top: ${({ theme }) => theme.spacing(4)};white-space: pre-line;overflow-wrap: break-word;++ a {+ color: ${({ theme }) => theme.font.color.primary};++ text-decoration: underline;+ text-decoration-color: ${({ theme }) => theme.font.color.primary};++ &:hover {+ color: ${({ theme }) => theme.font.color.tertiary};+ text-decoration-color: ${({ theme }) => theme.border.color.strong};+ }+ }`;type EmailThreadMessageBodyProps = {@@ -22,7 +35,16 @@ export const EmailThreadMessageBody = ({}: EmailThreadMessageBodyProps) => {return (<AnimatedEaseInOut isOpen={isDisplayed} duration="fast">- <StyledThreadMessageBody>{body}</StyledThreadMessageBody>+ <StyledThreadMessageBody>+ <Linkify+ options={{+ target: '_blank',+ rel: 'noopener noreferrer',+ }}+ >+ {body}+ </Linkify>+ </StyledThreadMessageBody></AnimatedEaseInOut>);};diff --git a/yarn.lock b/yarn.lockindex 92a2d08fa86..07ed02a9166 100644--- a/yarn.lock+++ b/yarn.lock@@ -42669,7 +42669,17 @@ __metadata:languageName: nodelinkType: hard-"linkifyjs@npm:^4.2.0, linkifyjs@npm:^4.3.2":+"linkify-react@npm:^4.1.3":+ version: 4.3.2+ resolution: "linkify-react@npm:4.3.2"+ peerDependencies:+ linkifyjs: ^4.0.0+ react: ">= 15.0.0"+ checksum: 10c0/6f1e5fa28129bfa2c9fe7568a63c4cc8453cfa7de9f401a33b9bf6826b8d7ecccbb054cfe54c0b3f7c39d36b410189a9adcf438667c3e6443afda8bd2e4b36df+ languageName: node+ linkType: hard++"linkifyjs@npm:^4.1.3, linkifyjs@npm:^4.2.0, linkifyjs@npm:^4.3.2":version: 4.3.2resolution: "linkifyjs@npm:4.3.2"checksum: 10c0/1a85e6b368304a4417567fe5e38651681e3e82465590836942d1b4f3c834cc35532898eb1e2479f6337d9144b297d418eb708b6be8ed0b3dc3954a3588e07971@@ -56708,6 +56718,8 @@ __metadata:json-2-csv: "npm:^5.4.0"json-logic-js: "npm:^2.0.5"jwt-decode: "npm:^4.0.0"+ linkify-react: "npm:^4.1.3"+ linkifyjs: "npm:^4.1.3"monaco-editor: "npm:^0.51.0"monaco-editor-auto-typings: "npm:^0.4.5"optionator: "npm:^0.9.1"