From 4b9631db47b86f744965e1a175a523b1f6c4c4d1 Mon Sep 17 00:00:00 2001 From: mic Date: Wed, 18 Jun 2025 23:22:05 +0200 Subject: [PATCH] Refactor stripHtmlKeepLines to utilize convertBrToNewlines for improved HTML handling --- js/mzta-utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/mzta-utils.js b/js/mzta-utils.js index 9b6714cc..48b68a4c 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -192,7 +192,7 @@ export function sanitizeHtml(input) { export function stripHtmlKeepLines(htmlString) { // Replaces

tags with a newline at the beginning // and removes all other HTML tags - return htmlString + return convertBrToNewlines(htmlString) .replace(/

/gi, '') // removes

tags .replace(/<\/p>/gi, '\n') // replaces

tags with newline .replace(/<[^>]*>/g, '') // removes any other HTML tags @@ -203,6 +203,10 @@ export function convertNewlinesToBr(text) { return text.replace(/\n/g, '
'); } +function convertBrToNewlines(html) { + return html.replace(//gi, '\n'); +} + // This method is used to convert the model string id used in the URL // to the model string used in the webpage export function getGPTWebModelString(model) {