From b29d9034c68f6c8199a6a10af5664ec6e8858832 Mon Sep 17 00:00:00 2001 From: mic Date: Tue, 15 Oct 2024 22:24:15 +0200 Subject: [PATCH] sanitizeHtml method added --- js/mzta-utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/mzta-utils.js b/js/mzta-utils.js index 3c046e71..ef604ba0 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -107,6 +107,11 @@ export async function replaceBody(tabId, replyHtml) { await messenger.compose.setComposeDetails(tabId, {body: fullBody}); } +export function sanitizeHtml(input) { + // Keep only
tags and remove all other HTML tags + return input.replace(/<(?!br\s*\/?)[^>]+>/gi, ''); +} + export function i18nConditionalGet(str) { // if we are getting a string that starts with '__MSG_' and ends with '__' we return the translated string // using the browser.i18n API