1
1
import React , { ComponentType } from 'react' ;
2
- import ReactMarkdown , { defaultUrlTransform , Options } from 'react-markdown' ;
2
+ import ReactMarkdown , { Options , uriTransformer } from 'react-markdown' ;
3
3
import { find } from 'linkifyjs' ;
4
4
import uniqBy from 'lodash.uniqby' ;
5
5
import remarkGfm from 'remark-gfm' ;
@@ -9,7 +9,7 @@ import { detectHttp, escapeRegExp, matchMarkdownLinks, messageCodeBlocks } from
9
9
import { emojiMarkdownPlugin , mentionsMarkdownPlugin } from './rehypePlugins' ;
10
10
import { htmlToTextPlugin , keepLineBreaksPlugin } from './remarkPlugins' ;
11
11
12
- import type { PluggableList } from 'react-markdown/lib' ;
12
+ import type { PluggableList } from 'react-markdown/lib/react-markdown ' ;
13
13
import type { UserResponse } from 'stream-chat' ;
14
14
import type { DefaultStreamChatGenerics } from '../../../types/types' ;
15
15
@@ -51,7 +51,7 @@ function encodeDecode(url: string) {
51
51
}
52
52
}
53
53
54
- const urlTransform = ( uri : string ) => ( uri . startsWith ( 'app://' ) ? uri : defaultUrlTransform ( uri ) ) ;
54
+ const urlTransform = ( uri : string ) => ( uri . startsWith ( 'app://' ) ? uri : uriTransformer ( uri ) ) ;
55
55
56
56
const getPluginsForward : RenderTextPluginConfigurator = ( plugins : PluggableList ) => plugins ;
57
57
@@ -167,8 +167,8 @@ export const renderText = <
167
167
rehypePlugins = { getRehypePlugins ( rehypePlugins ) }
168
168
remarkPlugins = { getRemarkPlugins ( remarkPlugins ) }
169
169
skipHtml
170
+ transformLinkUri = { urlTransform }
170
171
unwrapDisallowed
171
- urlTransform = { urlTransform }
172
172
>
173
173
{ newText }
174
174
</ ReactMarkdown >
0 commit comments