Skip to content

Fix 422986#3325

Merged
JiuqingSong merged 4 commits intomasterfrom
u/jisong/422986
Apr 23, 2026
Merged

Fix 422986#3325
JiuqingSong merged 4 commits intomasterfrom
u/jisong/422986

Conversation

@JiuqingSong
Copy link
Copy Markdown
Collaborator

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>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 listItemProcessor to always create a ListItem model for <li> elements, defaulting to a UL level when no list context exists.
  • Update WAC paste tests and DOM-to-model list item processor tests to expect ListItem output instead of General elements 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.

@JiuqingSong JiuqingSong merged commit f37616a into master Apr 23, 2026
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/422986 branch April 23, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants