@microsoft/omnichannel-chat-widget 1.8.2-main.b882454 → 1.8.2-main.c423ac4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -705,10 +705,23 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
|
705
705
|
reader.readAsDataURL(blob);
|
|
706
706
|
});
|
|
707
707
|
};
|
|
708
|
+
|
|
709
|
+
// Configure DOMPurify to remove target attribute from br tags
|
|
710
|
+
const hook = function (node) {
|
|
711
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
712
|
+
// Remove target attribute from br tags as it causes them to display as literal text
|
|
713
|
+
if (node.tagName === "BR" && node.hasAttribute("target")) {
|
|
714
|
+
node.removeAttribute("target");
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
_dompurify.default.addHook("afterSanitizeAttributes", hook);
|
|
708
718
|
let messages = transcriptMessages.filter(message => {
|
|
709
719
|
message.content = _dompurify.default.sanitize(message.content);
|
|
710
720
|
return message;
|
|
711
721
|
});
|
|
722
|
+
|
|
723
|
+
// Clean up the hook after processing all messages
|
|
724
|
+
_dompurify.default.removeHook("afterSanitizeAttributes", hook);
|
|
712
725
|
if (renderAttachments) {
|
|
713
726
|
messages = await Promise.all(transcriptMessages.map(async message => {
|
|
714
727
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -700,10 +700,23 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
|
700
700
|
reader.readAsDataURL(blob);
|
|
701
701
|
});
|
|
702
702
|
};
|
|
703
|
+
|
|
704
|
+
// Configure DOMPurify to remove target attribute from br tags
|
|
705
|
+
const hook = function (node) {
|
|
706
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
707
|
+
// Remove target attribute from br tags as it causes them to display as literal text
|
|
708
|
+
if (node.tagName === "BR" && node.hasAttribute("target")) {
|
|
709
|
+
node.removeAttribute("target");
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
DOMPurify.addHook("afterSanitizeAttributes", hook);
|
|
703
713
|
let messages = transcriptMessages.filter(message => {
|
|
704
714
|
message.content = DOMPurify.sanitize(message.content);
|
|
705
715
|
return message;
|
|
706
716
|
});
|
|
717
|
+
|
|
718
|
+
// Clean up the hook after processing all messages
|
|
719
|
+
DOMPurify.removeHook("afterSanitizeAttributes", hook);
|
|
707
720
|
if (renderAttachments) {
|
|
708
721
|
messages = await Promise.all(transcriptMessages.map(async message => {
|
|
709
722
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|