Type Editor / @type-editor/tables / tableview/TableView / TableView
Class: TableView
Defined in: tables/src/tableview/TableView.ts:21
Custom NodeView implementation for rendering table nodes with column resizing support.
This view creates a wrapper <div> containing a <table> element with a <colgroup> for column width management and a <tbody> for the actual table content. The column widths are synchronized with the document's column width attributes.
Example
const tableView = new TableView(tableNode, 100);
// tableView.dom returns the wrapper div
// tableView.contentDOM returns the tbody where content is renderedImplements
NodeView
Constructors
Constructor
new TableView(node, defaultCellMinWidth): TableView;Defined in: tables/src/tableview/TableView.ts:64
Creates a new TableView instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Node_2 | The table node to render. |
defaultCellMinWidth | number | The default minimum width in pixels for cells without explicit widths. |
Returns
TableView
Accessors
contentDOM
Get Signature
get contentDOM(): HTMLTableSectionElement;Defined in: tables/src/tableview/TableView.ts:88
The DOM element where ProseMirror should render the node's content. For tables, this is the tbody element.
Returns
HTMLTableSectionElement
Implementation of
NodeView.contentDOM;dom
Get Signature
get dom(): HTMLDivElement;Defined in: tables/src/tableview/TableView.ts:80
The outer DOM element for this node view. ProseMirror uses this as the root element for the table.
Returns
HTMLDivElement
Implementation of
NodeView.dom;Methods
ignoreMutation()
ignoreMutation(record): boolean;Defined in: tables/src/tableview/TableView.ts:122
Determines whether a DOM mutation should be ignored by ProseMirror.
Attribute mutations on the table or colgroup elements are ignored because these are managed by the column resizing logic, not by document changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
record | ViewMutationRecord | The mutation record to evaluate. |
Returns
boolean
true if the mutation should be ignored, false otherwise.
Implementation of
NodeView.ignoreMutation;update()
update(node): boolean;Defined in: tables/src/tableview/TableView.ts:98
Updates the view when the underlying node changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | Node_2 | The new table node to render. |
Returns
boolean
true if the update was handled, false if the view should be recreated.
Implementation of
NodeView.update;