mirror of
https://github.com/ankitects/anki.git
synced 2025-12-15 07:40:58 -05:00
Ensure trailing spaces are placed outside cloze deletions (#4446)
This commit is contained in:
parent
5614d20bed
commit
2d4de33cf3
1 changed files with 6 additions and 1 deletions
|
|
@ -4,7 +4,12 @@
|
||||||
import { getRange, getSelection } from "./cross-browser";
|
import { getRange, getSelection } from "./cross-browser";
|
||||||
|
|
||||||
function wrappedExceptForWhitespace(text: string, front: string, back: string): string {
|
function wrappedExceptForWhitespace(text: string, front: string, back: string): string {
|
||||||
const match = text.match(/^(\s*)([^]*?)(\s*)$/)!;
|
const normalizedText = text
|
||||||
|
.replace(/ /g, " ")
|
||||||
|
.replace(/ /g, " ")
|
||||||
|
.replace(/\u00A0/g, " ");
|
||||||
|
|
||||||
|
const match = normalizedText.match(/^(\s*)([^]*?)(\s*)$/)!;
|
||||||
return match[1] + front + match[2] + back + match[3];
|
return match[1] + front + match[2] + back + match[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue