mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-10 14:10:59 +08:00
impr(custom text): add checkbox to toggle control character replacing (Shuja-Mahmood) (#4648)
This commit is contained in:
parent
2508d9d556
commit
aee1cc1581
2 changed files with 15 additions and 4 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue