diff --git a/src/components/ChatBotBody/ChatBotBody.css b/src/components/ChatBotBody/ChatBotBody.css index 84837bad..913ecf4d 100644 --- a/src/components/ChatBotBody/ChatBotBody.css +++ b/src/components/ChatBotBody/ChatBotBody.css @@ -52,6 +52,7 @@ font-size: 15px; overflow-wrap: anywhere; overflow: hidden; + white-space: pre-wrap; } .rcb-bot-message { diff --git a/src/components/ChatBotInput/ChatBotInput.tsx b/src/components/ChatBotInput/ChatBotInput.tsx index b89b1418..ea64dd58 100644 --- a/src/components/ChatBotInput/ChatBotInput.tsx +++ b/src/components/ChatBotInput/ChatBotInput.tsx @@ -123,7 +123,12 @@ const ChatBotInput = ({ */ const handleKeyDown = (event: KeyboardEvent) => { if (event.key === "Enter") { - event.preventDefault(); + if (event.shiftKey) { + if (!botOptions.chatInput?.allowNewline) { + event.preventDefault(); + } + return; + } handleSubmit(event); } }; diff --git a/src/services/BotOptionsService.tsx b/src/services/BotOptionsService.tsx index a6b6fb9c..41b13b3a 100644 --- a/src/services/BotOptionsService.tsx +++ b/src/services/BotOptionsService.tsx @@ -79,6 +79,7 @@ const defaultOptions = { }, chatInput: { disabled: false, + allowNewline: false, enabledPlaceholderText: "Type your message...", disabledPlaceholderText: "", showCharacterCount: false,