Fix #3292 Put B/I/U/S under hyperlink#3297
Merged
JiuqingSong merged 4 commits intomasterfrom Mar 11, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates segment formatting application order during model-to-DOM conversion so that bold/italic/underline/strike are rendered inside hyperlinks, while keeping superscript/subscript behavior unchanged (applied outside hyperlinks) to avoid rendering issues.
Changes:
- Reorders
segmentDecoratorvs. segment format application inhandleSegmentCommonso B/I/U/S wrappers end up under<a>. - Splits
superOrSubScriptinto its own format-applier category so it can be applied after hyperlink decoration. - Updates/extends unit and end-to-end tests to reflect the new DOM structure and format-applier ordering.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/roosterjs-content-model-types/lib/contentModel/format/ContentModelFormatMap.ts | Adds new superOrSubScript category to the format-map type to enable separate applier ordering. |
| packages/roosterjs-content-model-dom/lib/modelToDom/utils/handleSegmentCommon.ts | Moves segmentDecorator after element-based B/I/U/S and applies superscript/subscript after decoration. |
| packages/roosterjs-content-model-dom/lib/formatHandlers/defaultFormatHandlers.ts | Splits element-based segment format keys into “size-neutral” vs. superOrSubScript, and wires new category into defaults. |
| packages/roosterjs-content-model-dom/test/modelToDom/utils/handleSegmentCommonTest.ts | Updates expected HTML nesting for bold-with-link scenario. |
| packages/roosterjs-content-model-dom/test/modelToDom/context/createModelToDomContextTest.ts | Updates format-applier index expectations due to reordered/split keys. |
| packages/roosterjs-content-model-dom/test/domToModel/context/createDomToModelContextTest.ts | Updates format-parser index expectations due to reordered/split keys. |
| packages/roosterjs-content-model-dom/test/endToEndTest.ts | Adds coverage for link + B/I/U and validates superscript/link output expectations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/roosterjs-content-model-types/lib/contentModel/format/ContentModelFormatMap.ts
Show resolved
Hide resolved
packages/roosterjs-content-model-types/lib/contentModel/format/ContentModelFormatMap.ts
Outdated
Show resolved
Hide resolved
…/ContentModelFormatMap.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
BryanValverdeU
approved these changes
Mar 10, 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.
Call
segmentDecoratorafter formatters for B/I/U/S when handle text, so that B/I/U/S will be put inside<A>.But keep formatters for SUB/SUP after segmentDecorator to avoid rendering a weird result of SUB/SUP with link.
Add/update test cases acccordingly.