fix(extension-table): stop rendering default colspan and rowspan on cells - #8177
fix(extension-table): stop rendering default colspan and rowspan on cells#8177lazerg wants to merge 2 commits into
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 9afc1b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary
WalkthroughTable cell and header HTML rendering now omits ChangesTable span serialization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.changeset/2026-08-11-table-default-spans.md (1)
5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the changeset to one short user-facing sentence.
Line 5 uses two sentences and includes the internal
prosemirror-tablescomparison. Replace it with a concise description of the serialized HTML change.Suggested wording
-Table cells and headers no longer render `colspan="1"` and `rowspan="1"`. Both attributes are only written to the HTML when a cell actually spans more than one column or row, which matches how prosemirror-tables serializes them. +Table cells and headers omit default `colspan` and `rowspan` attributes from serialized HTML.As per coding guidelines,
.changeset/*.md: Changesets should contain one short sentence describing user-visible behavior without internals or root-cause details.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/2026-08-11-table-default-spans.md at line 5, Rewrite the changeset entry as one short user-facing sentence describing that table cells and headers only serialize colspan and rowspan when their values exceed one; remove the second sentence and the internal prosemirror-tables reference.Source: Coding guidelines
packages/extension-table/__tests__/tableCell.spec.ts (1)
140-144: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winComplete coverage for both cell types and both span dimensions.
The tests do not fully prove the serialization contract. Add explicit absence checks for default spans and cover non-default
rowspanonTableHeader.
packages/extension-table/__tests__/tableCell.spec.ts#L140-L144: assert that the serialized HTML does not containcolspan="1"orrowspan="1".packages/extension-table/__tests__/tableHeader.spec.ts#L101-L114: add a valid header fixture withrowspan="2"and assert that it is retained; also assert that default span attributes are absent.As per coding guidelines,
**/*.{ts,tsx}: Add or update unit tests for deterministic user-visible behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/extension-table/__tests__/tableCell.spec.ts` around lines 140 - 144, Update the serialization assertions in packages/extension-table/__tests__/tableCell.spec.ts lines 140-144 to verify colspan="1" and rowspan="1" are absent. In packages/extension-table/__tests__/tableHeader.spec.ts lines 101-114, add a valid TableHeader fixture with rowspan="2" and assert it is preserved, while also asserting default colspan="1" and rowspan="1" attributes are absent.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.changeset/2026-08-11-table-default-spans.md:
- Line 5: Rewrite the changeset entry as one short user-facing sentence
describing that table cells and headers only serialize colspan and rowspan when
their values exceed one; remove the second sentence and the internal
prosemirror-tables reference.
In `@packages/extension-table/__tests__/tableCell.spec.ts`:
- Around line 140-144: Update the serialization assertions in
packages/extension-table/__tests__/tableCell.spec.ts lines 140-144 to verify
colspan="1" and rowspan="1" are absent. In
packages/extension-table/__tests__/tableHeader.spec.ts lines 101-114, add a
valid TableHeader fixture with rowspan="2" and assert it is preserved, while
also asserting default colspan="1" and rowspan="1" attributes are absent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 7921546f-7ea4-4dc8-b8a0-fe7f7a1dce2a
📒 Files selected for processing (6)
.changeset/2026-08-11-table-default-spans.mdpackages/extension-table/__tests__/tableCell.spec.tspackages/extension-table/__tests__/tableCommands.spec.tspackages/extension-table/__tests__/tableHeader.spec.tspackages/extension-table/src/cell/table-cell.tspackages/extension-table/src/header/table-header.ts
Fixes
Fixes #8176
Changes and Review
Every
<td>and<th>came out withcolspan="1" rowspan="1", because both attributes default to 1 in the schema and that default was rendered like any other value. Parsing existing table HTML and serializing it again therefore changed the markup. Both attributes now render only when they are greater than 1, which is what prosemirror-tables does.To verify: load a table with plain cells into the editor and call
getHTML(). Cells come back as<td><p>Cell</p></td>, and cells that really span still carrycolspan/rowspan.Checklist
Responsibility