Skip to content

Conversation

@BryanValverdeU
Copy link
Contributor

Fix #3054 by parsing the Word and Power point custom bullet element and applying the format to the format holder of the list items.

Add and update unit tests to reflect the the new functionality.

Use the clipboardData in the above issue to test

Before After
image image

- Updated multiple test cases in processPastedContentFromWordDesktopTest.ts to include specific font properties such as fontFamily, fontSize, and fontWeight for SelectionMarker format holders.
- Ensured consistency in font styling across various test scenarios to better reflect expected pasted content from Word.
@BryanValverdeU BryanValverdeU changed the title Enhance font formatting in Word paste tests Enhance font formatting in Word paste. Jun 3, 2025
Copy link
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

Enhance font formatting support for pasted Word and PowerPoint lists by extracting bullet element styles and applying them to the list-item marker, and update tests to assert the new behavior.

  • Parse and apply the actual bullet element’s font styles to formatHolder in processAsListItem.
  • Update Word and PowerPoint unit/E2E tests to expect the new fontFamily and fontSize on list markers.
  • Add a new E2E HTML template (wordClipboardContent2) and associated model setup for Word list paste scenarios.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/paste/word/processPastedContentFromWordDesktopTest.ts Updated selection-marker tests to expect fontFamily/fontSize from Word bullets
test/paste/e2e/htmlTemplates/wordClipboardContent.ts Added wordClipboardContent2 with full HTML, modelBeforePaste, and image clipboard
test/paste/e2e/cmPasteFromPowerPointDesktopTest.ts Updated PowerPoint paste tests to match new default and bullet font styles
lib/paste/utils/customListUtils.ts Extended processAsListItem to accept a bulletElement and merge its segment format
lib/paste/WordDesktop/processWordLists.ts Introduced getBulletElement to locate Word’s bullet span and pass it into parsing
lib/paste/PowerPoint/processPastedContentFromPowerPoint.ts Updated list processing to forward bulletElement and removed manual size override
Comments suppressed due to low confidence (2)

packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts:265

  • The helper isNodeOfType is used here but not imported, causing a ReferenceError at runtime. Add import { isNodeOfType } from 'roosterjs-editor-dom'; (or the appropriate module) at the top of this file.
if (isNodeOfType(child, 'ELEMENT_NODE')) {

packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts:25

  • [nitpick] The constant BULLET_METADATA is declared but never used in this file. Consider removing it or integrating it into the metadata handling to avoid dead code.
const BULLET_METADATA = 'bullet';

@BryanValverdeU BryanValverdeU merged commit aa6edaa into master Jun 5, 2025
7 checks passed
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.

List icon color lost when copying colored list from Word

4 participants