fix: decode   entities from contenteditable in checklist items

Browsers inject   in contenteditable elements, which was not being
decoded by unlinkifyHtml, causing double-escaped " " to appear in
checklist item text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Frederic Cabassut
2026-04-10 08:51:14 +02:00
co-authored by Claude Opus 4.6
parent cccdcd2036
commit 0a30145996
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -318,4 +318,9 @@ describe('unlinkifyHtml', () => {
expect(unlinkifyHtml('&lt;b&gt;bold&lt;/b&gt;')).toBe('<b>bold</b>');
expect(unlinkifyHtml('say &quot;hello&quot;')).toBe('say "hello"');
});
it('converts &nbsp; from contenteditable to regular spaces', () => {
expect(unlinkifyHtml('hello&nbsp;world')).toBe('hello world');
expect(unlinkifyHtml('a&nbsp;&nbsp;b')).toBe('a b');
});
});
+1
View File
@@ -191,6 +191,7 @@ export function unlinkifyHtml(html: string): string {
if (!html) return '';
return html
.replace(/<[^>]*>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')