Skip to content

Commit 1843988

Browse files
committed
chore: remove trailing   from rich text lines
1 parent ff0cc54 commit 1843988

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.changeset/small-masks-return.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@blinkk/root': patch
3+
'@blinkk/root-cms': patch
4+
---
5+
6+
chore: remove trailing   from rich text lines

packages/root-cms/ui/utils/l10n.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,16 @@ export function normalizeString(str: string) {
125125
const lines = String(str)
126126
.trim()
127127
.split('\n')
128-
.map((line) => line.trimEnd());
128+
.map((line) => removeTrailingWhitespace(line));
129129
return lines.join('\n');
130130
}
131131

132+
function removeTrailingWhitespace(str: string) {
133+
return String(str)
134+
.trimEnd()
135+
.replace(/ $/, '');
136+
}
137+
132138
export function normalizeLocale(locale: string) {
133139
const i18nConfig = window.__ROOT_CTX.rootConfig.i18n || {};
134140
const i18nLocales = i18nConfig.locales || ['en'];

packages/root/src/core/hooks/useTranslations.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export function normalizeString(str: string) {
4545
const lines = String(str)
4646
.trim()
4747
.split('\n')
48-
.map((line) => line.trimEnd());
48+
.map((line) => removeTrailingWhitespace(line));
4949
return lines.join('\n');
5050
}
51+
52+
function removeTrailingWhitespace(str: string) {
53+
return String(str)
54+
.trimEnd()
55+
.replace(/ $/, '');
56+
}

0 commit comments

Comments
 (0)