File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ const DEFAULT_LINK_STATE: OnLinkDetected = {
3838const LINK_REGEX =
3939 / ^ (?: e n r i c h e d : \/ \/ \S + | (?: h t t p s ? : \/ \/ ) ? (?: w w w \. ) ? s w m a n s i o n \. c o m (?: \/ \S * ) ? ) $ / i;
4040
41+ const SANITIZATION_CONFIG = {
42+ linkRegex : LINK_REGEX ,
43+ } ;
44+
4145function App ( ) {
4246 const ref = useRef < EnrichedTextInputInstance > ( null ) ;
4347 const [ currentHtml , setCurrentHtml ] = useState ( '' ) ;
@@ -278,9 +282,7 @@ function App() {
278282 mentionIndicators = { [ '@' , '#' ] }
279283 htmlStyle = { WEB_DEFAULT_HTML_STYLE }
280284 linkRegex = { LINK_REGEX }
281- sanitizationConfig = { {
282- linkRegex : LINK_REGEX ,
283- } }
285+ sanitizationConfig = { SANITIZATION_CONFIG }
284286 />
285287 < MentionPopup
286288 variant = "user"
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ import { WEB_DEFAULT_HTML_STYLE } from '../defaultHtmlStyle';
1313const LINK_REGEX =
1414 / ^ (?: e n r i c h e d : \/ \/ \S + | (?: h t t p s ? : \/ \/ ) ? (?: w w w \. ) ? s w m a n s i o n \. c o m (?: \/ \S * ) ? ) $ / i;
1515
16+ const SANITIZATION_CONFIG = {
17+ linkRegex : LINK_REGEX ,
18+ } ;
19+
1620interface TextRendererProps {
1721 htmlValue : string ;
1822}
@@ -47,9 +51,7 @@ export function TextRenderer({ htmlValue }: TextRendererProps) {
4751 onBlur = { handleTextBlur }
4852 onLinkPress = { handleLinkPress }
4953 onMentionPress = { handleMentionPress }
50- sanitizationConfig = { {
51- linkRegex : LINK_REGEX ,
52- } }
54+ sanitizationConfig = { SANITIZATION_CONFIG }
5355 >
5456 { htmlValue }
5557 </ EnrichedText >
You can’t perform that action at this time.
0 commit comments