Repository navigation
fix: strip trailing newlines from pasted text to prevent list breakage - #2050
Merged
Philipinho merged 1 commit intoMar 28, 2026
Merged
Conversation
Terminals (GNOME Terminal, etc.) include trailing whitespace in their HTML clipboard data. ProseMirror parses this as an extra paragraph, which inside a list item creates an orphan empty line that breaks the list structure. Pressing backspace on that empty line then incorrectly removes the bullet formatting of the previous line. The fix adds a transformPasted handler that strips trailing whitespace-only paragraphs from the pasted slice before insertion. This runs on the final slice regardless of clipboard source (HTML or plain text), so it catches all paste paths. Fixes docmost#2049 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
olivierlambert
force-pushed
the
fix/paste-trailing-newline-in-lists
branch
from
March 25, 2026 13:36
0d9064c to
ad9dd70
Compare
|
I was able to test this PR with my usual reproducer:
Now with this PR, after pasting, it does not create the empty newline anymore and I don't have the bug. 👍 |
Contributor
Author
|
@Philipinho we split the PR code (done on my side) with the functional testing (done @fallen side), and we are happy so say that #2049 is fixed with this 👍 |
Member
|
Thanks for contributing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
\n, which the markdown parser (withbreaks: true) converts to a<br>, creating an empty line outside the list itemFixes #2049
Test plan
uname -a) into the bullet🤖 Generated with Claude Code