Skip to content

[Table Improvements] Add Shift Cells Table Operation#3271

Merged
juliaroldi merged 3 commits intomasterfrom
u/juliaroldi/shift-tables
Feb 2, 2026
Merged

[Table Improvements] Add Shift Cells Table Operation#3271
juliaroldi merged 3 commits intomasterfrom
u/juliaroldi/shift-tables

Conversation

@juliaroldi
Copy link
Contributor

Add new shift cells up and shift cells left table operations. These operations move the table cell content to the cells at left or above.
ShiftCells

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 adds new table-editing operations to shift selected table cell contents left or up, wires them through the public editTable API, and exposes them in the demo ribbon UI, with accompanying unit tests.

Changes:

  • Extend table operation types with TableCellShiftOperation (shiftCellsLeft and shiftCellsUp) and export them from the types package.
  • Implement shiftCells model API to move cell contents left or up based on rectangular cell selections, and integrate it into the editTable public API.
  • Add comprehensive unit tests for shiftCells behavior and route the new operations through existing public API tests and demo ribbon menu entries.

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/index.ts Re-exports TableCellShiftOperation so it can be used by API and consumers.
packages/roosterjs-content-model-types/lib/enum/TableOperation.ts Introduces TableCellShiftOperation union and includes it in TableOperation; JSDoc updated to describe new shift operations.
packages/roosterjs-content-model-api/test/publicApi/table/editTableTest.ts Extends editTable routing tests to assert that shiftCellsLeft/shiftCellsUp call the shiftCells model API.
packages/roosterjs-content-model-api/test/modelApi/table/shiftCellsTest.ts Adds detailed unit tests for shiftCells covering single/multiple cells, multi-row/column selections, edge positions, and 3×3 scenarios.
packages/roosterjs-content-model-api/lib/publicApi/table/editTable.ts Wires new operations shiftCellsUp and shiftCellsLeft into the editTable switch to call shiftCells.
packages/roosterjs-content-model-api/lib/modelApi/table/shiftCells.ts Implements shiftCells logic using getSelectedCells and mutateBlock to shift cell contents left or up by the selection width/height, clearing vacated cells.
demo/scripts/controlsV2/demoButtons/tableEditButtons.ts Extends the demo ribbon “Delete” table menu with “Shift cells up/left” items and maps them to the new table operations for interactive testing.

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

| 'shiftCellsLeft'

/**
* Move the table cell content to the cell at above
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "Move the table cell content to the cell at above" is grammatically incorrect; please change it to "Move the table cell content to the cell above" to match standard English and the style used elsewhere in this file.

Suggested change
* Move the table cell content to the cell at above
* Move the table cell content to the cell above

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@juliaroldi juliaroldi changed the title Add Shift Cells Table Operation [Table Improvements] Add Shift Cells Table Operation Jan 26, 2026
@juliaroldi juliaroldi merged commit 5794d0a into master Feb 2, 2026
7 checks passed
@juliaroldi juliaroldi deleted the u/juliaroldi/shift-tables branch February 2, 2026 16:55
BryanValverdeU added a commit that referenced this pull request Feb 12, 2026
* Fix publish file (#3267)

* fix publish file

* remove file

* [Table Improvements] Add undoSnapshot when tab on a table cell (#3265)

Add undoSnapshot after pressing Tab key in a table that has new content, otherwise if the user type content in a table and press tab to move to another cell and then undo the content, all the typed content will be removed.

* [Table Improvements] Use keyboard to delete rows and columns (#3270)

When press backspace or shift + delete when an entire row or column, delete the column and row.

* [Table Improvements] Add Shift Cells Table Operation (#3271)

Add new shift cells up and shift cells left table operations. These operations move the table cell content to the cells at left or above.

* align table cell list (#3275)

When apply alignment in table cells that has list items, also apply the alignment to the list items.

* fill gaps (#3272)

* Bump lodash from 4.17.21 to 4.17.23 (#3266)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiuqing Song <jisong@microsoft.com>

* fix table format (#3277)

When triggering clearFormat on table cells, do not clear the cell or the table format.

* [Table Improvements] Add preview for table cell selection (#3274)

When start shadow edit, check if table cells are selected, if they are selected, remove the background color to make the styles changes visible in the table.

* Fix outdated JSDoc comments in setTableCellsStyle.ts (#3278)

 Fix JSDoc comments for removeTableCellsStyle function to match actual parameters
 Fix JSDoc comments for setTableCellsStyle function to match actual parameters

* Fix 329516 (#3276)

Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>

* [Table Improvements] Insert table content (#3258)

When inserting a table in a range selection, insert the selected content inside the table.

* Bump webpack from 5.94.0 to 5.104.1 (#3285)

Bumps [webpack](https://github.com/webpack/webpack) from 5.94.0 to 5.104.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md)
- [Commits](webpack/webpack@v5.94.0...v5.104.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.104.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Filter temporary EOP elements in Word Online paste and add test pattern support (#3283)

* Filter temporary EOP elements in Word Online paste and add test pattern support

- Skip elements with both 'Selected' and 'EOP' classes during WAC paste processing to remove temporary End of Paragraph markers
- Add unit tests for EOP element filtering behavior (3 test cases)
- Enhance test runner with --testPathPattern and --testNamePattern flags for faster targeted test execution

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Update packages/roosterjs-content-model-plugins/lib/paste/WacComponents/processPastedContentWacComponents.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Dark color improvement (#3279)

* Dark color improvement

* improve

* Fix #3280 (#3282)

* [Table Improvements] Ignore span cells when merge table cells (#3281)

When merging table cells, count table that are span as one cell, so two or more cells cannot be merge to one single span cell.

* Bump main and legacyAdapter versions in versions.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiuqing Song <jisong@microsoft.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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