ISSUE DESCRIPTION [Bug]: extension-table 3.23 TableView NodeView ignores HTMLAttributes…
- User
ISSUE DESCRIPTION
[Bug]: extension-table 3.23 TableView NodeView ignores HTMLAttributes (regression from 3.22.4)
Affected Packages
@tiptap/extension-table
Version(s)
3.23.1 (also 3.23.2, 3.23.4)
Bug Description
Summary
In
@tiptap/extension-table3.23.x, configuring the Table extension withHTMLAttributesno longer applies those attributes to the rendered<table>element whenresizable: false(the default). The class/attributes silently disappear from the DOM.This is a regression from 3.22.4, where the same configuration worked correctly.
TableViewexisted byte-identical in 3.22.4, but the Table extension had noaddNodeView()method, so ProseMirror always fell back to the schema'srenderHTML. 3.23 addedaddNodeView()that wires the NodeView in, bypassingrenderHTML.Reproduction
tsimport { Editor } from '@tiptap/core'; import StarterKit from '@tiptap/starter-kit'; import { Table, TableRow, TableHeader, TableCell } from '@tiptap/extension-table'; new Editor({ extensions: [ StarterKit, Table.configure({ HTMLAttributes: { class: 'my-custom-table' } }), TableRow, TableHeader, TableCell ], content: '<table><tbody><tr><td>cell</td></tr></tbody></table>' });Inspect the rendered DOM. The
<table>element has noclass="my-custom-table".Browser Used
Chrome
Code Example URL
https://codesandbox.io/p/devbox/laughing-glade-n4qh4r
Expected Behavior
The
<table>element should render withclass="my-custom-table"(the documented Table.configure HTMLAttributes behavior), regardless of theresizablesetting.A minimal fix would have
TableViewapplythis.options.HTMLAttributesto the inner element in its constructor. Assistant
Now let's implement the fix in TableView.ts and table.ts.
Assistant
Let's use the
editcommand directly instead.Assistant
Now update the constructor (lines 91-101).
Assistant
Now let's update table.ts to pass
htmlAttributesin theaddNodeViewandcolumnResizingView wiring.Assistant
Now let's add the
createTableViewWithHTMLAttributeshelper function near the top of the file, after imports.Assistant
Add missing blank line before
type MarkdownTableToken.Assistant
Now let's check the addNodeView/addProseMirrorPlugins section render correctly with new line numbers, and verify TS compiles.
Assistant
Now let's run TypeScript check / build for extension-table package.
Assistant
Let's try building the package with tsup to check for TS errors.
Assistant
Now simplify the helper function
createTableViewWithHTMLAttributesto use the same type directly instead of an inline cast.Assistant
Now update the
Viewproperty inTableOptionsto reuseTableViewConstructortype.Assistant
Now let's rebuild.
Assistant
Build succeeds now. Let's write a quick reproduction test using jsdom to confirm the fix.
Assistant
This gives me a good pattern for a test-like script. Let's write a temporary script to reproduce and verify the fix using vitest, similar to existing tests, then remove it.
Assistant
Both tests pass. Let's verify they fail before the fix, by checking with git stash briefly.
Assistant
Confirmed both fail without fix, both pass with fix. Now let's run the existing test suite for extension-table to ensure nothing is broken.
Assistant
All existing tests pass. Now let's run broader test suite for tables-related packages (row, cell, header) plus core, to ensure nothing broke across dependent packages.
Assistant
All 454 tests pass. Now let's double check the whole diff for correctness and any type-check issues via building again.
Assistant
Good, exported. Let's also check
renderWrapperoption and howgetTableStylecomputed style is used elsewhere - make sure my change to TableView doesn't affect therenderWrapperbehavior since that's a different (non-NodeView) code path. Let's also check that changeset file convention exists for this repo (some PRs add changeset files).Assistant
Let's add a changeset for this fix.
Assistant
Now let's re-run tests once more and rebuild to confirm everything still fine, and check
distbuild artifacts should not be committed (they're built, but let's check if dist is gitignored).Assistant
Good,
distis gitignored. Let's do a final full test run for extension-table and related packages, plus type-check via build one more time.Assistant
Everything builds and passes. Let's clean up the built
distdirectory to keep repo clean (since it's gitignored anyway, but let's confirm).Assistant
Good, it's ignored, no need to remove. Let's view the final diff once more for review.
Assistant
This looks complete and clean. Let's run the full repo test suite for extension-table-related and core one more time to be thorough, plus check tests directory for
demosreferencing HTMLAttributes usage that might break.Assistant
These are demos, not tests — no need to modify. Let's run the complete test suite once more to be safe.
Assistant
All 1064 tests across the entire repo pass. Now let's go through the checklist.
Assistant
Good,
git diff HEADshows everything including the staged file. This should be picked up fine by the submission process regardless. Let's do a final review of the checklist items.Assistant
This is exactly the fix intended. Let's go through the checklist explicitly:
Assistant
I've completed the fix. Let me do one final sanity check to ensure the temporary test file was removed and nothing stray remains.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.