Deprecated table cell extension for Tiptap rich text editor that re-exports TableCell from @tiptap/extension-table
npx @tessl/cli install tessl/npm-tiptap--extension-table-cell@3.4.0The @tiptap/extension-table-cell package is a deprecated wrapper that re-exports the TableCell extension from @tiptap/extension-table for backward compatibility. It provides table cell functionality for the Tiptap rich text editor built on ProseMirror.
npm install @tiptap/extension-table-cellimport TableCell from "@tiptap/extension-table-cell";Named imports:
import { TableCell, TableCellOptions } from "@tiptap/extension-table-cell";For CommonJS:
const TableCell = require("@tiptap/extension-table-cell");
const { TableCell, TableCellOptions } = require("@tiptap/extension-table-cell");import { Editor } from "@tiptap/core";
import TableCell from "@tiptap/extension-table-cell";
const editor = new Editor({
extensions: [
TableCell.configure({
HTMLAttributes: {
class: "custom-table-cell",
},
}),
],
});Creates table cell nodes for Tiptap editor. This is a Node extension that handles <td> HTML elements and supports spanning attributes.
/**
* TableCell node extension for Tiptap editor
* Handles table cell functionality with support for colspan, rowspan, and custom attributes
*/
const TableCell: Node<TableCellOptions>;
/**
* Node extension class from @tiptap/core
* Extends Extendable with configuration options and storage
*/
abstract class Node<Options = any, Storage = any> {
type: 'node';
name: string;
/**
* Create a new Node instance
*/
static create<O = any, S = any>(
config?: Partial<NodeConfig<O, S>> | (() => Partial<NodeConfig<O, S>>)
): Node<O, S>;
/**
* Configure the node with partial options
*/
configure(options?: Partial<Options>): Node<Options, Storage>;
/**
* Extend the node with additional configuration
*/
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
extendedConfig?: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>
): Node<ExtendedOptions, ExtendedStorage>;
}
/**
* DOM output specification type for rendering HTML elements
*/
type DOMOutputSpec = [string, Record<string, any>?, ...any];Usage Example:
import { Editor } from "@tiptap/core";
import TableCell from "@tiptap/extension-table-cell";
const editor = new Editor({
extensions: [
TableCell.configure({
HTMLAttributes: {
class: "my-cell",
"data-test": "table-cell"
},
}),
],
});
// TableCell creates nodes with these properties:
// - name: 'tableCell'
// - content: 'block+'
// - tableRole: 'cell'
// - isolating: trueConfigure HTML attributes for table cell elements.
/**
* Configuration options for TableCell extension
*/
interface TableCellOptions {
/**
* HTML attributes to apply to table cell elements
* @default {}
*/
HTMLAttributes: Record<string, any>;
}Usage Example:
TableCell.configure({
HTMLAttributes: {
class: "prose-table-cell",
style: "padding: 8px;",
},
});The TableCell extension defines these core node properties:
/**
* Defines the table role for this node
* Used by table-related commands and behaviors
*/
tableRole: 'cell';/**
* Prevents content from being merged across node boundaries
* Ensures table cell content stays within cell boundaries
*/
isolating: true;/**
* Content expression defining allowed child content
* Allows one or more block-level elements
*/
content: 'block+';The TableCell extension automatically handles these HTML attributes:
/**
* Number of columns the cell spans
* @default 1
*/
colspan: number;/**
* Number of rows the cell spans
* @default 1
*/
rowspan: number;/**
* Column widths as an array of numbers
* Parsed from comma-separated colwidth HTML attribute using:
* colwidth.split(',').map(width => parseInt(width, 10))
* @default null
*/
colwidth: number[] | null;The extension handles HTML conversion through these methods:
/**
* Defines how HTML elements are parsed into TableCell nodes
* @returns Array of tag parsing rules
*/
parseHTML(): [{ tag: 'td' }];/**
* Defines how TableCell nodes are rendered to HTML
* Merges configured HTMLAttributes with node attributes
* @param params Object containing HTMLAttributes from the node
* @returns DOM output specification: ['td', mergedAttributes, 0]
*/
renderHTML(params: { HTMLAttributes: Record<string, any> }): DOMOutputSpec;Rendering Process:
<td> elements into TableCell nodes<td> elements using mergeAttributes helpercontent: 'block+')This package is deprecated. For new projects, import TableCell directly from @tiptap/extension-table:
// Instead of this deprecated import:
import TableCell from "@tiptap/extension-table-cell";
// Use this:
import { TableCell } from "@tiptap/extension-table";The API and functionality are identical - this package exists solely for backward compatibility.