Skip to content

Commit 76a4568

Browse files
committed
Workaround whitespace replacement
1 parent 93cb942 commit 76a4568

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/quill/src/core/editor.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,11 @@ function convertHTML(
371371
}
372372
if (blot instanceof TextBlot) {
373373
const escapedText = escapeText(blot.value().slice(index, index + length));
374-
return escapedText.replaceAll(' ', ' ');
374+
// Based on https://github.com/slab/quill/issues/4509#issuecomment-2521334016
375+
return escapedText.replaceAll(
376+
/ +/g,
377+
(match) => ' '.repeat(match.length - 1) + ' ',
378+
);
375379
}
376380
if (blot instanceof ParentBlot) {
377381
// TODO fix API

0 commit comments

Comments
 (0)