File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/features/ui/chat/chat-message-area Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,15 @@ export const ChatMessageArea = (props: {
103103 </ div >
104104 < div className = "flex flex-col gap-2 flex-1 px-10" >
105105 < div className = "prose prose-slate dark:prose-invert whitespace-break-spaces prose-p:leading-relaxed prose-pre:p-0 max-w-none" >
106- { props . children }
106+ { props . children ;
107+ const parser = new DOMParser ( ) ;
108+ const htmlText = `<div><a href="#some-url">Url link</a></div>` ;
109+ let content = parser . parseFromString ( htmlText , "text/html" ) ;
110+ const anchors = content . getElementsByTagName ( 'a' ) ;
111+ Array . from ( anchors ) . forEach ( a => {
112+ a . setAttribute ( "target" , "_blank" ) ;
113+ } )
114+ console . log ( content . body . innerHTML ) ; // Here it is your new string }
107115 </div >
108116 < / div >
109117 </ div >
You can’t perform that action at this time.
0 commit comments