Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Table Improvements] Align list in table cells #3275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
juliaroldi wants to merge 1 commit into master
base: master
Choose a base branch
Loading
from u/juliaroldi/align-list-table

Conversation

@juliaroldi
Copy link
Contributor

@juliaroldi juliaroldi commented Jan 30, 2026

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

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 pull request adds alignment support for list items within table cells. When applying horizontal alignment to table cells containing list items, the alignment now propagates to the list items themselves, ensuring consistent formatting.

Changes:

  • Extended alignTableCellHorizontally to apply text alignment to list items within table cells
  • Maintained existing behavior of removing paragraph-level text align properties
  • Added comprehensive test coverage for list item alignment in various scenarios (LTR, RTL, mixed content)

Reviewed changes

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

File Description
packages/roosterjs-content-model-api/lib/modelApi/table/alignTableCell.ts Added logic to apply alignment to ListItem blocks and moved paragraph textAlign removal logic into the alignment callback
packages/roosterjs-content-model-api/test/modelApi/table/alignTableCellTest.ts Added comprehensive test cases for list item alignment in table cells, including RTL scenarios and mixed content

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

for (const block of cell.blocks) {
if (block.blockType === 'Paragraph' && block.format.textAlign) {
delete mutateBlock(block).format.textAlign;
} else if (block.blockType == 'BlockGroup' && block.blockGroupType == 'ListItem') {
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Inconsistent equality operator used. Line 52 uses strict equality (===) for blockType comparison, but this line uses loose equality (==) for both blockType and blockGroupType comparisons. For consistency and to avoid potential type coercion issues, use strict equality (===) for both comparisons on this line.

Suggested change
} else if (block.blockType == 'BlockGroup' && block.blockGroupType == 'ListItem') {
} else if (block.blockType === 'BlockGroup' && block.blockGroupType === 'ListItem') {

Copilot uses AI. Check for mistakes.
alignTableCellInternal(table, cell => {
cell.format.textAlign =
const alignment =
TextAlignValueMap[operation][cell.format.direction == 'rtl' ? 'rtl' : 'ltr'];
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Inconsistent equality operator used. For consistency with line 52 which uses strict equality (===), this comparison should also use strict equality (===) instead of loose equality (==).

Suggested change
TextAlignValueMap[operation][cell.format.direction == 'rtl' ? 'rtl' : 'ltr'];
TextAlignValueMap[operation][cell.format.direction === 'rtl' ? 'rtl' : 'ltr'];

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

@flyingbee2012 flyingbee2012 Awaiting requested review from flyingbee2012

@BryanValverdeU BryanValverdeU Awaiting requested review from BryanValverdeU

@JiuqingSong JiuqingSong Awaiting requested review from JiuqingSong

@ianeli1 ianeli1 Awaiting requested review from ianeli1

@vinguyen12 vinguyen12 Awaiting requested review from vinguyen12

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /