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
import { 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<table>element in its constructor.Additional Context (Optional)
Root cause
3.23 introduced
addNodeView()on the Table extension (extension-tabledist/index.jsaround line 645):addNodeView() { const isResizable = this.options.resizable && this.editor.isEditable; const View = this.options.View; if (isResizable || !View) { return null; } return ({ node, view }) => new View(node, this.options.cellMinWidth, view); } Assistant
I'll start by exploring the repository structure to understand the codebase and locate the relevant files.
Assistant
I'll explore the repository structure first.
Assistant
Let me see the full table.ts file, particularly the renderHTML and addNodeView methods.
Assistant
Let me look at how
mergeAttributesworks and how the View type is used with columnResizing.Assistant
I need to make one command at a time. Let me look at the renderHTML method more carefully and understand the issue.
Assistant
Now let me understand how the
Viewoption is used by thecolumnResizingplugin (resizable case) vs theaddNodeView(non-resizable case).Assistant
Let me look at the prosemirror-tables internal TableView to understand the constructor signature used in both cases.
Assistant
Let me look at the changeset directory and recent git history for context.
Assistant
Let me look at the commit that introduced the
addNodeViewfor the colgroup sync (issue #7015).Assistant
Now let me look at the existing tests to understand the test setup.
Assistant
Let me look at the table node's attributes and how
HTMLAttributesis computed in renderHTML.Assistant
Assistant
Let me write a reproduction script to confirm the bug. First, let me check the test configuration.
Assistant
Let me write a reproduction script to confirm the bug.
Assistant
I've confirmed the bug. Now let me understand
getRenderedAttributesto know whatHTMLAttributescontains in renderHTML for the table node.Assistant
Let me check the actual schema attributes of the table node.
Assistant
Let me read the full
mergeAttributesfunction to understand howstyleis merged.Assistant
Let me search for any existing helper that applies attributes to a DOM element in the codebase.
Assistant
Let me look at the
createColGrouputility which computes tableWidth/tableMinWidth used in renderHTML's style.Assistant
Let me check the TypeScript config for strictness settings and the View type usage.
Assistant
Let me check the prosemirror-tables
columnResizingoptions type forView.Assistant
Let me check the linter configuration to ensure my changes won't be flagged.
Assistant
Let me check the oxlint configuration for unused variable rules.
Assistant
I have a clear understanding now. Let me look at the full current
TableView.tsonce more and then implement the fix. The approach: modifyTableViewto accept and applyHTMLAttributes(mirroringrenderHTML), wire it throughaddNodeView(non-resizable) and a wrapper forcolumnResizing(resizable).Assistant
Now let me implement the fix. First, modify
TableView.tsto accept and applyHTMLAttributes:Assistant
Now let me implement the fix. First, update the imports in
TableView.ts:Assistant
Now let me update the imports to include
EditorViewandmergeAttributes:Assistant
Now let me update the
TableViewclass — add theHTMLAttributesfield, update the constructor,update, and add anapplyHTMLAttributesmethod:Assistant
TableView.tslooks good. Now let me updatetable.ts— theViewtype,addNodeView, andaddProseMirrorPlugins. Let me view the relevant sections:Assistant
Now let me update the
Viewtype to accept an optionalHTMLAttributesparameter:Assistant
Now let me update
addNodeViewto passHTMLAttributes:Assistant
Let me view the exact lines and use the
editcommand:Assistant
My edit was misaligned — it replaced the wrong line, leaving a broken section with two
returnstatements and a missing},. Let me fix this:Assistant
There's a duplicate
extendNodeSchema(extension) {line. Let me fix it:Assistant
Now I need to update
addProseMirrorPluginsto wrap theViewsoHTMLAttributesreaches the NodeView in the resizable case (sincecolumnResizinginstantiates the View itself). Let me add a helper function. First, let me view the area before theTableexport:Assistant
There's a duplicated comment/export block. Let me remove the duplicate lines:
Assistant
Now let me update
addProseMirrorPluginsto wrap theViewfor the resizable case:Assistant
The replace command needs the file to be scrolled to that area. Let me use the edit command with line numbers. Lines 548-550.
Assistant
All the edits are in place. Let me verify the full
TableView.ts:Assistant
I see an extra
}at the end of the file. Let me check:Assistant
There's an extra
}at the end. Let me remove it:Assistant
The file looks correct now. Let me run my reproduction test to confirm the fix works:
Assistant
There's a TypeScript parsing issue with the inline constructor return type. Let me rewrite the helper using a type alias and removing the problematic explicit return type:
Assistant
Let me rewrite the helper to avoid the inline constructor type in the return annotation (which esbuild misparses). I'll use a type alias and remove the explicit return type:
Assistant
Now let me run the reproduction test again:
Assistant
Let me isolate the esbuild parsing issue with a minimal test:
Assistant
Let me find the esbuild package location.
Assistant
The simple type alias works. Let me test the exact multi-line form I used:
Assistant
The isolated form works, so the issue is context. Let me examine the structure around the
declare moduleblock close:Assistant
I see a brace issue. Let me check the original structure with git:
Assistant
I found it — my earlier edit removed two closing braces (
}fortable:and}forinterface Commands), leaving thedeclare moduleblock unclosed. Let me fix the brace structure:Assistant
The brace structure is fixed. Let me run the reproduction test again:
Assistant
The non-resizable case works. Let me extend the test to cover the resizable case, style merging, and other attributes:
Assistant
The 5th test failed due to my test setup (the editor had initial content;
insertTableadded a second table). Let me fix the test to mirror the existing colgroupUpdate test approach:Assistant
All 5 tests pass, including the resizable case and update-sync. Now let me run the existing extension-table test suite to ensure I didn't break anything:
Assistant
All tests pass. Now let me clean up my temporary test files (I shouldn't add new tests to the repo):
Assistant
Let me run a TypeScript type check to verify my type changes are correct:
Assistant
There's a TypeScript error:
Viewis possiblynullinside the closure. Let me fix by capturing a non-null const after the guard. Let me also verify the other error is pre-existing:Assistant
Confirmed the
collaboration-careterror is pre-existing. I only need to fix theViewpossibly-null error I introduced. Let me fix the wrapper:Assistant
My edit removed the function signature closing and the final brace. Let me view and fix:
Assistant
The helper is correct now. Let me re-run the type check:
Assistant
The only error is the pre-existing
collaboration-caretone. Let me verify I didn't introduce any new errors elsewhere by comparing the full error list before/after my changes:Assistant
Same number of errors (373) before and after — no new TypeScript errors introduced. Let me confirm the error lists are identical:
Assistant
No new TypeScript errors. Let me run the linter to ensure my code is clean:
Assistant
Lint passes. Let me check formatting with
oxfmt:Assistant
Let me fix the formatting with oxfmt:
Assistant
Formatting is fixed. Let me view the final state of the modified sections to verify correctness:
Assistant
Let me re-run the existing tests to confirm everything still passes after formatting:
Assistant
Let me do a final end-to-end verification with a temporary reproduction test matching the issue exactly:
Assistant
Both resizable cases now work. Let me add a changeset following the repo's convention:
Assistant
Now let me do a final review of all my changes with
git diff:Assistant
The diff is clean and correct. Let me run the broader test suite to ensure nothing else is affected:
Assistant
All 454 tests pass. Let me verify the final git status to ensure only intended changes are present:
Assistant
All changes are clean. Let me verify the package builds successfully (since the
testscript runsturbo run buildfirst):Assistant
The build succeeds. Let me verify
distis gitignored so I don't accidentally submit build artifacts:Assistant
distis gitignored. Let me do a final confirmation run of the most relevant existing tests (colgroupUpdate) to be 100% sure:Assistant
All tests pass. Let me provide a final summary of the changes and submit.
Summary
The issue was a regression in
@tiptap/extension-table3.23.x: configuringHTMLAttributesno longer applied them to the rendered<table>element whenresizable: false(the default). The root cause was that 3.23 introduced an method (for colgroup sync, issue #7015) that wires in , which builds its DOM manually and never reads — bypassing the schema's that does apply them.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.