Skip to content

Conversation

@JiuqingSong
Copy link
Collaborator

<ol style="margin-top: 0px; margin-bottom: 0px; list-style-type: decimal;" data-editing-info="{&quot;applyListStyleFromLevel&quot;:false,&quot;orderedStyleType&quot;:1}" start="1"><li style="font-family: Corbel, Skia, sans-serif; font-size: 12pt; color: rgb(12, 100, 192);"><div role="presentation" class="elementToProof">Aaaa</div></li><ol style="margin-top: 0px; margin-bottom: 0px; list-style-type: lower-alpha;" data-editing-info="{&quot;applyListStyleFromLevel&quot;:true}" start="1"><li style="font-family: Corbel, Skia, sans-serif; font-size: 12pt; color: rgb(12, 100, 192);"><div role="presentation">bb</div></li></ol></ol><!--{"type":"range","start":[0,1,0,0,0,0],"end":[0,1,0,0,0,0],"isReverted":false,"isDarkMode":false}-->

Press Backspack key, expect the list item number "2" should keep the same color.

Before:
before

After:
after

Copy link
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 fixes a bug where list item color formatting was lost when outdenting a list item (pressing Backspace). The fix ensures that segment-level formatting (like text color) is preserved by using the formatHolder.format property instead of the list item's format property when creating a new list item during the outdent operation.

  • Changed deleteList.ts to pass formatHolder.format instead of format when creating a new outdented list item
  • Added comprehensive test case to verify format preservation during list outdent operation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/roosterjs-content-model-plugins/lib/edit/deleteSteps/deleteList.ts Fixed the format parameter in createListItem call to use formatHolder.format instead of format to preserve text color and other segment-level formatting during outdent
packages/roosterjs-content-model-plugins/test/edit/deleteSteps/deleteListTest.ts Added test case verifying that list item format (specifically textColor) is preserved in both the original and newly created list items after outdenting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JiuqingSong JiuqingSong merged commit b8fab1f into master Jan 8, 2026
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/listformat branch January 8, 2026 17:51
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