Preserve style after double line break#5692
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1c509c4 to
e956d22
Compare
zurfyx
left a comment
There was a problem hiding this comment.
Hmm, which editors are you checking against for the table case? What I can see on GDocs and Word is that they retain the format regardless of whether you click again, but only for that specific position.
For the create paragraph, my hunch is that this logic is a one-off and they simply replicate the format when you insert a new paragraph.
Also, this PR seems to be preserving the style when clicking on a element position.
Screen.Recording.2024-03-12.at.9.42.24.AM.mov
|
^ We should really be writing some tests for all this discussion we're having above 😛 |
Fair enough on tables, happy to keep it losing the current style between cells. Losing the current format after a double line break, should be fixed though. If you have better suggestion on the approach, open to suggestions, since this is a super annoying problem when using the editor extensively. |
Gave it a stab since I wasn't sure either, happy to follow up with a polished PR if you want - main...eventsftw Screen.Recording.2024-03-12.at.2.37.16.PM.movThis should be very close to Word and GDoc. They seem to reset format but they leverage the empty "TextNode" to store this information when there's no text (this is a guess, I have no idea about their codebase). |
Looking good, you can use $getPreviousSelection I think, the rest makes sense. Go for a proper PR :) |
Fixes: #5620
The issue: When you press Enter twice, the styling gets lost in the skipped paragraph, same when you type inside a table cells.
Why change this: consistent behaviour with other text editors.
This essentially undoes the changes done in here: #5292 while still fixing the issue that PR officially addressed.
Before:
2024-03-09_18-52-45.mp4
After:
2024-03-09_18-59-13.mp4