diff --git a/frontend/src/ts/popups/custom-text-popup.ts b/frontend/src/ts/popups/custom-text-popup.ts index 1cf28a1cd..54382428d 100644 --- a/frontend/src/ts/popups/custom-text-popup.ts +++ b/frontend/src/ts/popups/custom-text-popup.ts @@ -236,10 +236,13 @@ function apply(): void { //replace zero width characters text = text.replace(/[\u200B-\u200D\u2060\uFEFF]/g, ""); - text = text.replace(/\\\\t/gm, "\t"); - text = text.replace(/\\\\n/gm, "\n"); - text = text.replace(/\\t/gm, "\t"); - text = text.replace(/\\n/gm, "\n"); + if ($(`${popup} .replaceControlCharacters input`).prop("checked")) { + text = text.replace(/\\\\t/gm, "\t"); + text = text.replace(/\\\\n/gm, "\n"); + text = text.replace(/\\t/gm, "\t"); + text = text.replace(/\\n/gm, "\n"); + } + text = text.replace(/ +/gm, " "); // text = text.replace(/(\r\n)+/g, "\r\n"); // text = text.replace(/(\n)+/g, "\n"); diff --git a/frontend/static/html/popups.html b/frontend/static/html/popups.html index b3e00ee0c..9234c5b7e 100644 --- a/frontend/static/html/popups.html +++ b/frontend/static/html/popups.html @@ -440,6 +440,14 @@ Standardises typography symbols (for example “ and ” become ") + + + Replace control characters + + Replace control characters (\n becomes a new line and \t becomes a + tab) + + Pipe Delimiter