From 3d136630c57af2d15eed859e4856a3c6b7d1a0cf Mon Sep 17 00:00:00 2001 From: Shashank Date: Thu, 12 Jun 2025 20:22:31 +0530 Subject: [PATCH] Fix(ChatInput): preserve multiline input by converting newlines to
in HTML output - Ensures that multiline user input in ChatInput is correctly rendered as multiline in emails and other HTML consumers. --- src/components/ChatInput/ChatInput.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/ChatInput/ChatInput.jsx b/src/components/ChatInput/ChatInput.jsx index 53afb9a3..8dfbd892 100644 --- a/src/components/ChatInput/ChatInput.jsx +++ b/src/components/ChatInput/ChatInput.jsx @@ -114,7 +114,7 @@ const labels = { const convertMentionsToHTMLAndPlainText = ({ suggestions, value }) => { const mentionsRegex = new RegExp(/@\[[^)]*\)/g); - let html = `

${value}

`; + let html = `

${value.replace(/\n/g, "
")}

`; // Replace newlines with
for HTML output let plainText = value; const allMentions = html.matchAll(mentionsRegex); @@ -140,7 +140,6 @@ const convertMentionsToHTMLAndPlainText = ({ suggestions, value }) => { return { html, plainText }; }; - export const ChatInput = forwardRef( ( {