From df75e02efc359979d3bcb80b8c5ae11949f75be1 Mon Sep 17 00:00:00 2001 From: ffqq Date: Thu, 13 Jul 2023 02:50:16 +0000 Subject: [PATCH] fix: wrap links inside of for convenience --- static/js/chat.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/chat.js b/static/js/chat.js index 52d97c1..92116c2 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -20,7 +20,11 @@ async function updateMessages(id) { const timeParagraph = document.createElement("p"); const { creator, content, id, created } = message; - messageParagraph.appendChild(document.createTextNode(`${creator.username}: ${content}`)); + // Check if the message content contains any links that are not image links + const linkRegex = /(https?:\/\/[^\s]+(?$1"); + + messageParagraph.innerHTML = `${creator.username}: ${messageContent}`; messageParagraph.classList.add("messageParagraph"); messageParagraph.id = `messageParagraph${id}`; messageParagraph.appendChild(timeParagraph);