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 start by exploring the repository structure and locating the TableView / Table extension code related to the HTMLAttributes regression.
- Assistant
Let me look at the TableView and the table extension source files.
- Assistant
Let me read the TableView.ts and table.ts files.
- Assistant
Let me read the rest of TableView and check how other NodeViews apply HTMLAttributes.
- Assistant
I'll check how the columnResizing plugin constructs the View and review related tests.
- Assistant
Checking ProseMirror tables' View constructor and how mergeAttributes is used.
- Assistant
Let me look at how columnResizing constructs the View.
- Assistant
I'll inspect mergeAttributes and related attribute helpers next.
- Assistant
Looking for utilities that apply HTML attributes to DOM elements, and scanning recent changelog entries.
- Assistant
I'll check the recent commits and the full constructor signature / types around View.
- Assistant
Checking how NodeView renderers receive and use HTMLAttributes.
- Assistant
Checking what
getRenderedAttributesreturns and how renderHTML merges attributes. - Assistant
Let me look at table node attributes - does table have a style attribute?
- Assistant
Let me look at prosemirror-tables' TableView for comparison.
- Assistant
Checking for existing helpers for applying attributes, and reviewing how other packages implement similar behavior.
- Assistant
The task-item NodeView looks like a good reference for applying HTMLAttributes.
- Assistant
I'll inspect how node.attrs.style is used and review related tests.
- Assistant
Checking other constructions of TableView and the TypeScript types.
- Assistant
Implementing the fix: TableView will accept and apply HTMLAttributes, and table.ts will pass them through.
- Assistant
The edit landed in the wrong file — reverting it and applying the change to TableView.ts.
- Assistant
Good, TableView is open now. Let me edit it properly.
- Assistant
Updating table.ts to pass HTMLAttributes into TableView and the columnResizing plugin.
- Assistant
I'll update the View type and the addNodeView / addProseMirrorPlugins methods.
- Assistant
Updating addProseMirrorPlugins and addNodeView next.
- Assistant
I'll update addProseMirrorPlugins to wrap the View with HTMLAttributes, and update addNodeView similarly.
- Assistant
Fixing the null View case so we don't accidentally fall back to ProseMirror's TableView.
- Assistant
Next I’ll build and run the extension-table tests.
- Assistant
Vitest maps packages to source, so I'll run the extension-table unit tests directly.
- Assistant
The test timed out. Let me try a different approach.
- Assistant
All existing tests passed. I'll write a temporary script to verify the HTMLAttributes fix.
- Assistant
Removing the temporary test file, then verifying TypeScript compiles.
- Assistant
Building the package to check for type errors.
- Assistant
Build timed out. Let me try differently.
- Assistant
Improving style merging so options and node attrs styles combine correctly via mergeAttributes.
- Assistant
Need to use absolute path or relative from current dir.
- Assistant
Reviewing the final diff and re-running the tests.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.