Skip to content

Conversation

@BryanValverdeU
Copy link
Contributor

Translate lineHeight normal to 120% when pasting from Word Desktop and move parsers to their own file

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

This PR refactors Word Desktop paste handling by extracting three inline parsers into separate, reusable files and adds support for translating line-height: normal to 120% when pasting from Word Desktop.

Key Changes:

  • Adds translation of CSS line-height: normal to 120% for better rendering consistency
  • Extracts three parsers (adjustPercentileLineHeight, listLevelParser, wordTableParser) from the main file into separate modules for better code organization
  • Adds comprehensive unit tests for each extracted parser

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
processPastedContentFromWordDesktop.ts Refactored to import and use extracted parsers instead of inline implementations
adjustPercentileLineHeightParser.ts New file with extracted line height parser, now handles "normal" value conversion to 120%
listLevelParser.ts New file with extracted list level formatting parser
wordTableParser.ts New file with extracted table formatting parser
processPastedContentFromWordDesktopTest.ts Added four new test cases covering normal line height conversion and edge cases
adjustPercentileLineHeightParserTest.ts New comprehensive test file with 9 test cases for line height parser
listLevelParserTest.ts New test file with 8 test cases for list level parser
wordTableParserTest.ts New test file with 9 test cases for table parser

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BryanValverdeU BryanValverdeU enabled auto-merge (squash) November 21, 2025 00:14
@BryanValverdeU BryanValverdeU merged commit 2fac28c into master Nov 21, 2025
7 checks passed
ianeli1 added a commit that referenced this pull request Nov 21, 2025
* support RTL (#3177)

* Update ContextMenuProvider to accept event parameter and adjust related tests (#3175)

* refactor: remove deprecated features and clean up related code in CachePlugin and CopyPastePlugin (#3178)

* Add `test:fast`  for faster unit test runs (#3179)

* refactor: optimize karma configuration for improved performance

* feat: add fast karma configuration and update package.json for debugging

* refactor: streamline karma plugin declaration and update test scripts for clarity

* refactor: update test commands to use fast karma configuration

* Add support for retaining formats when splitting paragraphs on Enter/Delete/Backspace keypress (#3180)

* refactor: optimize karma configuration for improved performance

* feat: add fast karma configuration and update package.json for debugging

* refactor: streamline karma plugin declaration and update test scripts for clarity

* Add support for retaining formats when splitting paragraphs on Enter key press

- Introduced `formatsToKeep` option in `EditOptions` to specify which formats to retain.
- Updated `keyboardEnter`, `handleEnterOnParagraph`, and `splitParagraph` functions to handle the new formats.
- Enhanced tests to verify the correct behavior of format retention during paragraph splits.

* Remove unused import for handleEnterOnParagraph in keyboardEnterTest

* Remove stray backtick from splitParagraph function

* refactor: update test commands to use fast karma configuration

* feat: implement class format handling and preserve formatting on paragraph split

* feat: rename formatsToKeep to formatsToPreserveOnMerge and update related functionality

* test: update spies in keyboardDelete tests and fix format property in preserveParagraphFormat tests

* Support rowSpan equal to 0 (#3181)

* fix: handle zero colSpan and rowSpan in tableProcessor to ensure proper cell creation

* fix: correct colSpan condition in tableProcessor for accurate cell processing

* feat: add spanUntilNextSection support in table cell processing and handling

* refactor: remove spanUntilNextSection from table cell handling and related tests

* refactor: simplify rowSpan handling and improve tableProcessor tests for edge cases

* Remove unneeded changes

* Remove

* fix: update source map configuration for improved debugging accuracy (#3186)

* Support passing event to getContextMenuItems when plugin is a MixedPlugin (#3188)

* feat: enhance context menu handling to support V9 providers with event parameter

* fix: enhance isV9ContextMenuProvider to check for mixed plugins

* refactor: simplify spyOn usage for DarkColorHandler in BridgePlugin tests

* fix: enhance isV9ContextMenuProvider to validate V9 provider signature

* fix: update context menu provider check to use isMixedPluginProvider

* New getContentForCopy API (#3182)

New getContentForCopy API

* feat: add announce options for bold, italic, and underline formatting (#3194)

* feat: add announce options for bold, italic, and underline formatting; update shortcuts and tests

* refactor: update context initialization in toggleBold, toggleItalic, and toggleUnderline tests for type safety

* Address comments from review

* test: add unit tests for bold, italic, and underline shortcuts with announceFormatChange

* Add Find and Replace API and plugin (#3190)

* Add Find and Replace API and plugin

* Fix a comment

* improve

* feat: add announcements for table selection and unselection in the editor (#3195)

* feat: add announce options for bold, italic, and underline formatting; update shortcuts and tests

* refactor: update context initialization in toggleBold, toggleItalic, and toggleUnderline tests for type safety

* feat: add announcements for text selection and unselection in the editor

* refactor: simplify table selection logic by using TableSelection type in getIsSelectingOrUnselecting function

* Update packages/roosterjs-content-model-core/lib/corePlugin/selection/tableSelectionUtils.ts

Co-authored-by: Copilot <[email protected]>

* Address comments from review

* test: add unit tests for bold, italic, and underline shortcuts with announceFormatChange

* Move functionality to a new plugin

* Fix

* Fix

* Fix comment

---------

Co-authored-by: Copilot <[email protected]>

* Fix #396891 (#3199)

* Fix #396891

* improve

* improve

* first colunm (#3202)

* Fix 400434 (#3200)

* Add format when insert table (#3203)

Add the format parameter in the insertTable API, then it will be possible to insert a table with a predefined format. It can be used to add margin bottom to the table, then when a table is inserted under another their border does not overlay.

* Move graduated feature to a separate type (#3205)

* Move graduated feature to a separate type

* improve

* fix build

* Translate lineHeight normal to 120% when pasting from Word Desktop and move parsers to their own file (#3209)

* Translate lineHeight normal to 120% and move parsers to their own file

* Apply suggestions from code review

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>

* Fix text to bullet issue (#3210)

* Fix text to bullet issue

* fix test

* Update version

* Update version on react pkgs

---------

Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Bryan Valverde U <[email protected]>
Co-authored-by: Jiuqing Song <[email protected]>
Co-authored-by: Copilot <[email protected]>
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