Skip to content

Commit 4484dfe

Browse files
authored
Update chat-message-content.tsx links in new tab v2
1 parent cba60c0 commit 4484dfe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ const ChatMessageContentArea: ForwardRefRenderFunction<
99
ChatMessageContentAreaProps
1010
> = (props, ref) => {
1111
useEffect(() => {
12-
const links = ref.current?.querySelectorAll('a'); // Select all anchor tags in the current ref
13-
if (links) {
12+
// Check if ref.current is not null
13+
if (ref.current) {
14+
const links = ref.current.querySelectorAll('a'); // Select all anchor tags in the current ref
1415
links.forEach(link => {
1516
link.setAttribute('target', '_blank'); // Open in new tab
1617
link.setAttribute('rel', 'noopener noreferrer'); // Security measure

0 commit comments

Comments
 (0)