mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-05 21:48:03 +00:00
13 lines
432 B
JavaScript
13 lines
432 B
JavaScript
export const stripStyleCharacters = emailContent => {
|
|
let contentToBeParsed = emailContent.replace(/<style(.|\s)*?<\/style>/g, '');
|
|
contentToBeParsed = contentToBeParsed.replace(/style="(.*?)"/g, '');
|
|
let parsedContent = new DOMParser().parseFromString(
|
|
contentToBeParsed,
|
|
'text/html'
|
|
);
|
|
if (!parsedContent.getElementsByTagName('parsererror').length) {
|
|
return parsedContent.body.innerHTML;
|
|
}
|
|
return '';
|
|
};
|