Open
Conversation
nperez0111
reviewed
Feb 22, 2026
nperez0111
reviewed
Feb 22, 2026
.specstory/history/2026-01-18_11-29Z-paste-handler-list-item-bug.md
Outdated
Show resolved
Hide resolved
nperez0111
reviewed
Feb 22, 2026
nperez0111
reviewed
Feb 22, 2026
.specstory/timestamps/2026-01-18_11-29Z-paste-handler-list-item-bug.timestamps
Outdated
Show resolved
Hide resolved
nperez0111
reviewed
Feb 22, 2026
nperez0111
reviewed
Feb 22, 2026
packages/core/src/api/clipboard/fromClipboard/pasteExtension.ts
Outdated
Show resolved
Hide resolved
nperez0111
reviewed
Feb 22, 2026
packages/core/src/api/clipboard/fromClipboard/pasteExtension.ts
Outdated
Show resolved
Hide resolved
nperez0111
reviewed
Feb 22, 2026
packages/core/src/api/clipboard/fromClipboard/pasteExtension.ts
Outdated
Show resolved
Hide resolved
nperez0111
reviewed
Feb 22, 2026
nperez0111
requested changes
Feb 22, 2026
Author
|
@nperez0111 I have added changes you requested |
Author
|
@nperez0111 I have fixed code conflits |
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.

Closes #4
Summary
Fixed a bug where pasting text into empty list items (bullet, numbered, checklist, toggle) caused them to be replaced with paragraphs. Added a special case in the
defaultPasteHandlerfunction to detect empty list items with inline content and usepasteText()instead of the default HTML/Markdown paste flow, preserving the list item structure.Rationale
When pasting content into an empty list item, the default paste handler uses
pasteHTML()orpasteMarkdown(), which can replace the block structure. This happens because ProseMirror's paste behavior may interpret the pasted content as incompatible with the empty list item structure, causing it to be converted to a paragraph block instead.The fix follows the same pattern as the existing code block special case, which also uses
pasteText()to preserve block structure when pasting plain text into blocks that require specific content types.Changes
Modified Files
packages/core/src/api/clipboard/fromClipboard/pasteExtension.tsImplementation Details
Added a special case check in the
defaultPasteHandlerfunction (lines 47-70) that:editor.getTextCursorPosition().blockblockSpec?.content === "inline")!currentBlock.content || (Array.isArray(currentBlock.content) && currentBlock.content.length === 0))bulletListItem,numberedListItem,checkListItem, ortoggleListItem)editor.pasteText()instead of the default handlerThe implementation:
Impact
Positive Impacts
Potential Considerations
Testing
Manual Testing Performed
Test Coverage
The codebase has existing paste test infrastructure in:
tests/src/unit/core/clipboard/paste/- Unit tests for paste functionalitytests/src/unit/shared/clipboard/paste/- Shared paste test utilitiesNote: While unit tests for this specific case would be valuable, the fix follows established patterns and has been verified through manual testing. Consider adding automated tests in a follow-up PR if needed.
Recommended Test Cases (for future automation)
Screenshots/Video
Checklist
docs/content/docs/reference/editor/paste-handling.mdxAdditional Notes
Code Quality
Future Considerations
tests/src/unit/core/clipboard/paste/pasteTestInstances.tsto cover this specific caseisListItemcheckRelated Issues
This fix addresses the bug where empty list items were being replaced with paragraphs when pasting text, improving the overall paste handling experience for list items.