Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a paste-formatting bug where copied HTML may contain standalone <li> elements without a surrounding <ul>/<ol>, leading to invalid list nesting and incorrect Content Model representation during paste.
Changes:
- Update
listItemProcessorto always create aListItemmodel for<li>elements, defaulting to aULlevel when no list context exists. - Update WAC paste tests and DOM-to-model list item processor tests to expect
ListItemoutput instead ofGeneralelements for standalone<li>scenarios. - Fix typos in test case names.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/roosterjs-content-model-plugins/test/paste/word/processPastedContentFromWacTest.ts | Updates paste expectations for standalone <li> cases to produce ListItem models / <ul> output. |
| packages/roosterjs-content-model-dom/test/domToModel/processors/listItemProcessorTest.ts | Updates unit tests to reflect new ListItem behavior when <li> lacks list context. |
| packages/roosterjs-content-model-dom/lib/domToModel/processors/listItemProcessor.ts | Changes <li> processing to synthesize list context and always emit ListItem. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
juliaroldi
approved these changes
Apr 23, 2026
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.
Bug 422986: Re: Monarch Feedback 🎁 - Formatting issues with bullet points in emails
This is because when copy from copilot, if the selection is in a list, copilot will copy
<li>without<ol>or<ul>wrapper, causes Content Model uses GeneralElement to represent it. When paste,<li>will be put under an existing<li>makes double layer list item, which is not allowed by HTML.Fix: When seeing
<li>without wrapper, always assume there is a<ul>around it so we can use ListItem to represent this<li>