Skip to content

Commit a22747c

Browse files
authored
Update chat-message-area.tsx new tab
1 parent 5a5a151 commit a22747c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/features/ui/chat/chat-message-area/chat-message-area.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)