Skip to content

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
JiuqingSong merged 4 commits into
masterfrom
u/jisong/428673
May 13, 2026
Merged

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
JiuqingSong merged 4 commits into
masterfrom
u/jisong/428673

Conversation

@JiuqingSong
Copy link
Copy Markdown
Collaborator

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

JiuqingSong and others added 2 commits May 8, 2026 14:41
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>
Copy link
Copy Markdown
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

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 createSelectionMarker to only retain keys that are part of ContentModelSegmentFormat (as enumerated by EmptySegmentFormat).
  • 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.

@JiuqingSong JiuqingSong merged commit 8f08301 into master May 13, 2026
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/428673 branch May 13, 2026 03:22
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