mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
fix: Use textContent as fallback for htmlContent instead of content.value (#10901)
Some emails contain HTML content within the text part, but our content parser currently strips HTML automatically, which needs a proper fix. In the new UI, the fallback for HTML content was set to the parsed content, which may omit HTML tags, leading to issues like missing inline attachments. This PR updates the fallback mechanism to use the text content instead of the parsed content, ensuring HTML elements are preserved. Fixes https://linear.app/chatwoot/issue/CW-4046/text-content-is-not-respected-in-emails
This commit is contained in:
@@ -29,8 +29,15 @@ const isOutgoing = computed(() => {
|
||||
});
|
||||
const isIncoming = computed(() => !isOutgoing.value);
|
||||
|
||||
const textToShow = computed(() => {
|
||||
const text =
|
||||
contentAttributes?.value?.email?.textContent?.full ?? content.value;
|
||||
return text?.replace(/\n/g, '<br>');
|
||||
});
|
||||
|
||||
// Use TextContent as the default to fullHTML
|
||||
const fullHTML = computed(() => {
|
||||
return contentAttributes?.value?.email?.htmlContent?.full ?? content.value;
|
||||
return contentAttributes?.value?.email?.htmlContent?.full ?? textToShow.value;
|
||||
});
|
||||
|
||||
const unquotedHTML = computed(() => {
|
||||
@@ -40,12 +47,6 @@ const unquotedHTML = computed(() => {
|
||||
const hasQuotedMessage = computed(() => {
|
||||
return EmailQuoteExtractor.hasQuotes(fullHTML.value);
|
||||
});
|
||||
|
||||
const textToShow = computed(() => {
|
||||
const text =
|
||||
contentAttributes?.value?.email?.textContent?.full ?? content.value;
|
||||
return text?.replace(/\n/g, '<br>');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user