0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Replace nbsp with regular sp when extracting text

The nbsp are used by the browser to stop HTML white space collapsing
from applying, but we don't want them in the plain text version.
This commit is contained in:
Neil Jenkins 2023-10-02 13:23:12 +11:00
parent 3937c10b55
commit 96e4bf2e98

View file

@ -53,6 +53,9 @@ const getTextContentsOfRange = (range: Range) => {
}
node = walker.nextNode();
}
// Replace nbsp with regular space;
// eslint-disable-next-line no-irregular-whitespace
textContent = textContent.replace(/ /g, ' ');
return textContent;
};