Skip to content

Commit 32f79e7

Browse files
Fix(ChatInput): preserve multiline input by converting newlines to <br> in HTML output (#695)
- Ensures that multiline user input in ChatInput is correctly rendered as multiline in emails and other HTML consumers.
1 parent 78fcf47 commit 32f79e7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/components/ChatInput/ChatInput.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const labels = {
114114

115115
const convertMentionsToHTMLAndPlainText = ({ suggestions, value }) => {
116116
const mentionsRegex = new RegExp(/@\[[^)]*\)/g);
117-
let html = `<p>${value}</p>`;
117+
let html = `<p>${value.replace(/\n/g, "<br>")}</p>`; // Replace newlines with <br> for HTML output
118118
let plainText = value;
119119
const allMentions = html.matchAll(mentionsRegex);
120120

@@ -140,7 +140,6 @@ const convertMentionsToHTMLAndPlainText = ({ suggestions, value }) => {
140140

141141
return { html, plainText };
142142
};
143-
144143
export const ChatInput = forwardRef(
145144
(
146145
{

0 commit comments

Comments
 (0)