impr(custom text): add checkbox to toggle control character replacing (Shuja-Mahmood) (#4648)

This commit is contained in:
Shuja-Mahmood 2023-09-25 16:51:29 +05:00 committed by GitHub
parent 2508d9d556
commit aee1cc1581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -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");

View file

@ -440,6 +440,14 @@
Standardises typography symbols (for example “ and ” become ")
</div>
</label>
<label class="checkboxWithSub replaceControlCharacters">
<input type="checkbox" checked />
<div>Replace control characters</div>
<div class="sub">
Replace control characters (\n becomes a new line and \t becomes a
tab)
</div>
</label>
<label class="checkboxWithSub delimiterCheck">
<input type="checkbox" />
<div>Pipe Delimiter</div>