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
I’ll inspect the table extension and its tests, identify the source and build conventions, then update the NodeView to preserve configured HTML attributes without disrupting styles or existing behavior. I’ll run the most relevant tests and inspect the resulting diff before submitting.
- Assistant
The NodeView factory already receives the fully rendered
HTMLAttributesfrom Tiptap’s extension manager, including configured attributes and node attributes. I’ll pass those toTableViewas an additional argument (preserving the existing customViewthirdEditorViewargument), apply them to the table DOM, and synchronize them on updates so changing table attributes cannot leave stale DOM attributes. - Assistant
The implementation is now formatted. I corrected the constructor placement so the existing third
Viewargument remains the editor view, while rendered attributes are added as an optional fourth argument; this avoids breaking custom table views or the default constructor typing. I’ll run the table package tests and a build/type check next. - Assistant
The focused table tests pass (9/9), the package build including declaration generation succeeds, and the diff is clean. The first test command used unsupported Vitest flags in this repository version, so I reran the relevant spec with supported options and verified it successfully. I’ll do a final diff/status review and submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.