fix(editor): preserve paragraph styles when splitting with Enter - #3705
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: c5deffc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@cursor can you add a changeset to this pull request? it should be one short sentence |
|
Done — I added a changeset to the PR. The new file |
commit: |
Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
…ration suite Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
|
@cursor lint |
|
Fixed the lint failure. Biome's formatter was flagging a stray blank line before the closing |
Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
klotty
left a comment
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Focused bug fix: removes the Enter shortcuts that reset paragraph style/class after a split, and adds a regression test showing both paragraphs retain the attributes. No public, operational, or data tradeoff remains for human review.
Re-trigger cubic
…mpty paragraphs Instead of removing the StyleAttribute/ClassAttribute Enter shortcuts, keep them but skip the reset when Enter splits a paragraph mid-text, so the content moved into the new paragraph keeps its style/class. Pressing Enter at the end of a styled paragraph still starts a fresh default paragraph, preserving the original intent of the shortcuts. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Dismissed because Cubic found issues in a newer review.
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic


Summary
Pressing Enter in the middle of a paragraph with custom styles (e.g. a font size set via the inspector) split the paragraph but stripped the styles from the second half. Text color survived because it lives as a mark on the text nodes, while font size lives on the paragraph's
styleattribute.The split itself was never the problem: TipTap attributes default to
keepOnSplit: true, so thestyleattribute was correctly copied to the new paragraph. The bug was an Enter keyboard shortcut in theStyleAttributeextension that ranresetAttributes('paragraph', 'style')in arequestAnimationFramecallback right after the split — wiping the styles off the paragraph the cursor landed in.ClassAttributehad the identical reset forclass.Those shortcuts exist for a reason, though: without them, pressing Enter at the end of a styled paragraph would produce an empty paragraph that inherits the custom style/class, and everything typed next would continue in it. So instead of removing them, this PR makes the reset conditional:
StyleAttributeandClassAttribute, but skip the reset when the selection end is not at the end of its block — i.e. when Enter actually splits text and the content moved into the new paragraph must keep itsstyle/classstyle/classon both halves, and Enter at the end still yields a default new paragraphTest plan
react-emailpackage-resolution error, reproducible on a cleancanarycheckout)Made with Cursor