Fix 428673: While replying to messages in OWA , replacing old images with new ones doesnt show up in sent items and at the recipient end intermittently#3337
Merged
Conversation
When pasting an image, the new image inherits any existing segment format from the selection marker. An extra inherited format (originalsrc) caused saved HTML to read image content id from the wrong source, producing a broken image. Filter the format passed to createSelectionMarker so that only properties that are part of ContentModelSegmentFormat (as enumerated by EmptySegmentFormat) are retained. This prevents stray properties from propagating through the selection marker into newly inserted images. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
These tests previously seeded selection-marker pending/segment formats with placeholder keys (a, b, c, d, e). With the new filter in createSelectionMarker those keys are stripped from the marker format, so the assertions no longer match. Replace them with real format keys (fontFamily, fontSize, fontWeight, letterSpacing, lineHeight) so the tests still exercise the same precedence and override behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an intermittent broken-image issue in OWA replies by preventing stray/inherited properties (e.g., originalsrc) from being carried through the selection marker’s segment format into newly inserted content.
Changes:
- Update
createSelectionMarkerto only retain keys that are part ofContentModelSegmentFormat(as enumerated byEmptySegmentFormat). - Update/strengthen unit tests to use real segment-format keys and validate filtering behavior across DOM-to-model selection marker creation paths.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/roosterjs-content-model-dom/lib/modelApi/creators/createSelectionMarker.ts | Filters the format input to known ContentModelSegmentFormat keys before storing it on the selection marker. |
| packages/roosterjs-content-model-dom/test/modelApi/creators/creatorsTest.ts | Updates selection marker creator test to verify unknown keys are dropped and the format is not aliased. |
| packages/roosterjs-content-model-dom/test/domToModel/utils/addSelectionMarkerTest.ts | Updates expectations to use real segment-format properties and validate merged marker formatting. |
| packages/roosterjs-content-model-dom/test/domToModel/processors/textWithSelectionProcessorTest.ts | Adjusts selection marker pending-format assertions to use valid segment-format keys. |
| packages/roosterjs-content-model-dom/test/domToModel/processors/textProcessorTest.ts | Adjusts selection marker pending-format assertions to use valid segment-format keys. |
| packages/roosterjs-content-model-dom/test/domToModel/processors/childProcessorTest.ts | Updates segment/marker format assertions to use valid segment-format keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BryanValverdeU
approved these changes
May 12, 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.
Bug 428673: While replying to messages in OWA , replacing old images with new ones doesnt show up in sent items and at the recipient end intermittently
Fix 428673: Filter selection marker format to known segment format keys
When pasting an image, the new image inherits any existing segment format from
the selection marker. An extra inherited format (originalsrc) caused saved HTML
to read image content id from the wrong source, producing a broken image.
Filter the format passed to createSelectionMarker so that only properties that
are part of ContentModelSegmentFormat (as enumerated by EmptySegmentFormat) are
retained. This prevents stray properties from propagating through the selection
marker into newly inserted images.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com