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 Table extension / TableView code related to the HTMLAttributes regression.
- Assistant
Next I'll inspect the Table extension source and TableView implementation.
- Assistant
I'll open
TableView.tsand search the package for related HTMLAttributes / NodeView usage. - Assistant
I'll read the rest of
TableViewand the relevanttable.tssections next. - Assistant
I'll check how
mergeAttributesworks and whether column resizing has its own TableView path. - Assistant
Checking table attributes and whether similar NodeViews apply HTMLAttributes elsewhere.
- Assistant
I'll compare ProseMirror's table view and TipTap's NodeView attribute handling next.
- Assistant
Let me look at how attributes are applied when creating nodeviews in tip tap core, and also check prosemirror-tables TableView implementation:
- Assistant
The cleanest fix according to the issue is to apply HTMLAttributes in TableView. Since TableView doesn't currently receive options, I should pass HTMLAttributes.
- Assistant
Checking what props
addNodeViewactually receives: - Assistant
Let me read the ExtensionManager nodeViews section fully.
- Assistant
I'll check table node attributes and whether any tests cover TableView.
- Assistant
Let me look at the commit that added addNodeView for non-resizable tables - d2ad165b7
- Assistant
I'll review the colgroup tests and search for helpers that map attribute objects onto DOM nodes.
- Assistant
Let me check how ReactNodeViewRenderer applies HTMLAttributes to DOM - that might be the pattern.
- Assistant
I'll inspect
updateMarkViewAttributesnext for the DOM attribute-application pattern. - Assistant
Checking whether the table node defines a style attribute and reviewing attribute handling more carefully.
- Assistant
I'll inspect how
columnResizingis wired and what we can pass through asView. - Assistant
I'll see how tiptap turns attribute objects into DOM properties.
- Assistant
Checking build setup and whether
distis committed: - Assistant
I'll implement the TableView and addNodeView fixes for HTMLAttributes now.
- Assistant
I'll update
TableViewso HTTPSAttributes are applied to the table element. - Assistant
Next I'll wire HTMLAttributes through
addNodeViewand the resizablecolumnResizingpath intable.ts. - Assistant
I'll update the View type and the addNodeView / columnResizing sections.
- Assistant
Now update addProseMirrorPlugins and addNodeView.
- Assistant
I'll update both addProseMirrorPlugins and addNodeView.
- Assistant
I'll replace the fragile
extends.Viewwrapper with a constructor that proxies attributes instead. - Assistant
I'll build the table package and run a quick reproduction script.
- Assistant
There's package-dist-artifacts.tar - maybe I need to extract it. Let me check if dist exists.
- Assistant
I'll extract the dist artifacts and rebuild the table package.
- Assistant
Corepack is prompting interactively, so I'll switch approach and avoid that.
- Assistant
Dist is extracted. I'll build extension-table with tsup directly, avoiding pnpm.
- Assistant
I need to fix the TypeScript error where View may be null.
- Assistant
Using a local non-null View binding should be cleaner.
- Assistant
Rebuild and run tests.
- Assistant
Build succeeded. Now I'll write a reproduction script and run the table tests.
- Assistant
I'll put the script inside the repo so module resolution works.
- Assistant
colgroup tests pass. I'll run the repro next—either under vitest or node with proper resolution.
- Assistant
I'll create a temporary vitest dib specif and run it next.
- Assistant
All tests passed. I'll clean up the temp files and run the full extension-table suite.
- Assistant
I'll check git status so only the intended source changes get submitted.
- Assistant
I'll keep
applyHTMLAttributesunexported to avoid expanding the public API. - Assistant
Rebuild, re-run tests one last time, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.