Skip to content

Toggle matching table borders - #3464

Open
Julia Roldi (juliaroldi) wants to merge 3 commits into
masterfrom
u/juliaroldi/toggle-borders
Open

Julia Roldi (juliaroldi) wants to merge 3 commits into
masterfrom
u/juliaroldi/toggle-borders

Conversation

@juliaroldi

@juliaroldi Julia Roldi (juliaroldi) commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Update applyTableBorderFormat to toggle the targeted table borders off when every selected border already matches the requested format, while preserving the existing apply behavior when any target differs. Normalize equivalent CSS border values before comparison and add coverage for border operations across selection shapes, directions, repeated operations, and table defaults.
borderToggle

How to test

  1. Run yarn test:fast --testPathPattern=applyTableBorderFormat.
  2. In a table selection, apply a border format once and confirm the targeted borders appear; apply the same format again and confirm only those targeted borders are removed. Apply it again and confirm the borders reappear.

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://microsoft.github.io/roosterjs/pr-preview/pr-3464/

Built to branch gh-pages at 2026-09-14 19:18 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

}

if (!comparisonStyle) {
comparisonStyle = editor.getDocument().createElement('div').style;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why need to create a DIV?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was to normalize the border color before comparing the border color being set with the previous one. I refactored the code to use parseColor before comparing the color, then we do not need the div anymore.

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.

2 participants