From 2dd9a71306721dd1849d89d926bb1ce4fd7ceee9 Mon Sep 17 00:00:00 2001 From: allardy Date: Thu, 15 Feb 2024 12:23:42 -0500 Subject: [PATCH] fix(webchat): make html escaping configurable --- packages/webchat/src/components/messages/Message.tsx | 2 +- packages/webchat/src/typings.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/webchat/src/components/messages/Message.tsx b/packages/webchat/src/components/messages/Message.tsx index 207aeabeb..15d099f4f 100644 --- a/packages/webchat/src/components/messages/Message.tsx +++ b/packages/webchat/src/components/messages/Message.tsx @@ -68,7 +68,7 @@ class Message extends Component { onAudioEnded: this.props.onAudioEnded, shouldPlay: this.props.shouldPlay, intl: this.props.store!.intl, - escapeHTML: true, + escapeHTML: this.props.store!.config.escapeHtml === undefined ? true : this.props.store!.config.escapeHtml, showTimestamp: this.props.store!.config.showTimestamp!, googleMapsAPIKey: this.props.store!.config.googleMapsAPIKey }} diff --git a/packages/webchat/src/typings.ts b/packages/webchat/src/typings.ts index dfec11fc9..8104783f6 100644 --- a/packages/webchat/src/typings.ts +++ b/packages/webchat/src/typings.ts @@ -376,6 +376,12 @@ export interface Config { * Display's the webchat close button when the webchat is opened */ showCloseButton?: boolean + /** + * Replaces < and > with their HTML entities < and >. + * Setting it to false will let the markdown parser handle html itself + * @default true + */ + escapeHtml?: boolean } export interface BotDetails {