Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle NBSP in tiptap parsing #8148

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Handle NBSP in tiptap parsing #8148

merged 2 commits into from
Oct 28, 2024

Conversation

thomtrp
Copy link
Contributor

@thomtrp thomtrp commented Oct 28, 2024

Tiptap uses non breaking spaces between nodes (like variables). Those html characters are not properly handles in emails. Replacing by regular spaces during parsing.

I tried to fix it in settings but looks like this is only for preserving those nbsp and not for removal (see ueberdosis/tiptap#254)

@thomtrp thomtrp force-pushed the tt-handle-non-breaking-space branch from bf66a65 to 249b6c8 Compare October 28, 2024 14:07
Copy link
Contributor

@martmull martmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you

@@ -11,7 +11,8 @@ export const parseEditorContent = (json: JSONContent): string => {
}

if (node.type === 'text') {
return node.text || '';
// Replace   with regular space
return (node.text || '').replace(/\u00A0/g, ' ');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer: node.text ? node.text.replace(/\u00A0/g, ' ') : ''

@thomtrp thomtrp merged commit 2ba98dd into main Oct 28, 2024
18 checks passed
@thomtrp thomtrp deleted the tt-handle-non-breaking-space branch October 28, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants