Repository navigation
Add custom bulleted list styles - #3512
Draft
Julia Roldi (juliaroldi) wants to merge 1 commit into
Draft
Julia Roldi (juliaroldi) wants to merge 1 commit into
Julia Roldi (juliaroldi) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6348eb5-9e42-40af-a194-c257b55596b8
|
Contributor
There was a problem hiding this comment.
🟡 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
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.

Summary
Add
setCustomListStyleandsetModelCustomListStyleto 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
yarn test:fast --testPathPattern=CustomListStyle(14 tests passed).yarn eslintandyarn b(both passed).