Skip to content

Add custom bulleted list styles - #3512

Draft
Julia Roldi (juliaroldi) wants to merge 1 commit into
masterfrom
u/juliaroldi/customize-list-style
Draft

Julia Roldi (juliaroldi) wants to merge 1 commit into
masterfrom
u/juliaroldi/customize-list-style

Conversation

@juliaroldi

Copy link
Copy Markdown
Contributor

Summary

Add setCustomListStyle and setModelCustomListStyle to apply literal text or emoji markers to the selected bulleted list thread at its current nesting level. Escape CSS string characters and clear overriding list styles while preserving nested markers, selection, and undo/redo behavior; numbered lists and paragraphs outside lists remain unchanged.

Expose a "Set custom list style" button in the demo ribbon and add model/editor tests covering thread boundaries, escaping, DOM/model round trips, built-in style replacement, selection, and undo/redo.

How to test

  1. Run yarn test:fast --testPathPattern=CustomListStyle (14 tests passed).
  2. Run yarn eslint and yarn b (both passed).
  3. In the demo, create a bulleted list with nested items, place the caret in a parent item, and choose Set custom list style from the Paragraph ribbon. Enter a text or emoji marker with a trailing space. Verify that the current list thread uses that marker while nested markers remain unchanged.
  4. Undo and redo the change, then apply a built-in bullet style. Verify that undo/redo restores the marker in one step and the built-in style replaces it. The custom-style button should be disabled in numbered lists and outside lists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c6348eb5-9e42-40af-a194-c257b55596b8
Copilot AI balanced review requested due to automatic review settings December 4, 2026 20:43
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://microsoft.github.io/roosterjs/pr-preview/pr-3512/

Built to branch gh-pages at 2026-12-04 20:45 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Applying a custom marker in one table cell also changes an unrelated list in an adjacent cell because the list lookup crosses cell boundaries.

1 open issue
What changed in this PR

Adds custom text and emoji bullet markers through RoosterJS’s model and editor APIs, with demo ribbon support.

Changes:

  • Adds and exports custom list-style APIs with CSS string escaping.
  • Adds a dialog for entering custom markers.
  • Tests list boundaries, nested markers, selection, round trips, and undo/redo.
File Description
packages/​roosterjs-content-model-api/​test/​publicApi/​list/​setCustomListStyleTest.ts Tests editor integration and undo/redo.
packages/​roosterjs-content-model-api/​test/​modelApi/​list/​setModelCustomListStyleTest.ts Tests list scope, style cleanup, and escaping.
packages/​roosterjs-content-model-api/​lib/​publicApi/​list/​setCustomListStyle.ts Wraps formatting in an editor transaction.
packages/​roosterjs-content-model-api/​lib/​modelApi/​list/​setModelCustomListStyle.ts Applies custom markers to list threads.
packages/​roosterjs-content-model-api/​lib/​index.ts Exports both new APIs.
demo/​scripts/​controlsV2/​tabs/​ribbonButtons.ts Registers the custom-style button.
demo/​scripts/​controlsV2/​demoButtons/​setCustomListStyleButton.ts Adds marker input and validation.

Review effort: Balanced

}) +
'"';

findListItemsInSameThread(model, listItem).forEach(item => {

This branch has not been deployed

No deployments
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.

2 participants