diff --git a/docs/src/demos/Nodes/Table/index.vue b/docs/src/demos/Nodes/Table/index.vue index 8d82ce82..6df0fecd 100644 --- a/docs/src/demos/Nodes/Table/index.vue +++ b/docs/src/demos/Nodes/Table/index.vue @@ -42,8 +42,8 @@ mergeOrSplit - - setCellAttributes + + setCellAttribute fixTables @@ -120,9 +120,6 @@ export default { }), ], content: ` - - People - diff --git a/docs/src/docPages/api/nodes/table-cell.md b/docs/src/docPages/api/nodes/table-cell.md index 60f98068..fd03660e 100644 --- a/docs/src/docPages/api/nodes/table-cell.md +++ b/docs/src/docPages/api/nodes/table-cell.md @@ -1,8 +1,26 @@ # TableCell +[](https://www.npmjs.com/package/@tiptap/extension-table-cell) +[](https://npmcharts.com/compare/@tiptap/extension-table-cell?minimal=true) -:::pro Fund the development π -We need your support to maintain, update, support and develop tiptap 2. If youβre waiting for this extension, [become a sponsor and fund open source](/sponsor). +:::warning β οΈ Preview +Work in progress ::: -TODO +## Installation +::: warning Use with Table, TableRow and TableHeader +This extension requires the [`Table`](/api/nodes/table), [`TableRow`](/api/nodes/table-row) and [`TableHeader`](/api/nodes/table-header) nodes. +::: +```bash +# with npm +npm install @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell + +# with Yarn +yarn add @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell +``` + +## Source code +[packages/extension-table-cell/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-table-cell/) + +## Usage + diff --git a/docs/src/docPages/api/nodes/table-header.md b/docs/src/docPages/api/nodes/table-header.md index ea9e355a..20e5ffb9 100644 --- a/docs/src/docPages/api/nodes/table-header.md +++ b/docs/src/docPages/api/nodes/table-header.md @@ -1,8 +1,26 @@ # TableHeader +[](https://www.npmjs.com/package/@tiptap/extension-table-header) +[](https://npmcharts.com/compare/@tiptap/extension-table-header?minimal=true) -:::pro Fund the development π -We need your support to maintain, update, support and develop tiptap 2. If youβre waiting for this extension, [become a sponsor and fund open source](/sponsor). +:::warning β οΈ Preview +Work in progress ::: -TODO +## Installation +::: warning Use with Table, TableRow and TableCell +This extension requires the [`Table`](/api/nodes/table), [`TableRow`](/api/nodes/table-row) and [`TableCell`](/api/nodes/table-cell) nodes. +::: +```bash +# with npm +npm install @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell + +# with Yarn +yarn add @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell +``` + +## Source code +[packages/extension-table-header/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-table-header/) + +## Usage + diff --git a/docs/src/docPages/api/nodes/table-row.md b/docs/src/docPages/api/nodes/table-row.md index 8e404803..90e443ee 100644 --- a/docs/src/docPages/api/nodes/table-row.md +++ b/docs/src/docPages/api/nodes/table-row.md @@ -1,7 +1,26 @@ # TableRow +[](https://www.npmjs.com/package/@tiptap/extension-table-row) +[](https://npmcharts.com/compare/@tiptap/extension-table-row?minimal=true) -:::pro Fund the development π -We need your support to maintain, update, support and develop tiptap 2. If youβre waiting for this extension, [become a sponsor and fund open source](/sponsor). +:::warning β οΈ Preview +Work in progress ::: -TODO +## Installation +::: warning Use with Table, TableHeader and TableCell +This extension requires the [`Table`](/api/nodes/table), [`TableHeader`](/api/nodes/table-header) and [`TableCell`](/api/nodes/table-cell) nodes. +::: + +```bash +# with npm +npm install @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell + +# with Yarn +yarn add @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell +``` + +## Source code +[packages/extension-table-row/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-table-row/) + +## Usage + diff --git a/docs/src/docPages/api/nodes/table.md b/docs/src/docPages/api/nodes/table.md index cbb8ac30..378cff28 100644 --- a/docs/src/docPages/api/nodes/table.md +++ b/docs/src/docPages/api/nodes/table.md @@ -1,11 +1,58 @@ # Table +[](https://www.npmjs.com/package/@tiptap/extension-table) +[](https://npmcharts.com/compare/@tiptap/extension-table?minimal=true) -:::pro Fund the development π -We need your support to maintain, update, support and develop tiptap 2. If youβre waiting for this extension, [become a sponsor and fund open source](/sponsor). +β οΈ Work in progress + +## Installation +::: warning Use with TableRow, TableHeader and TableCell +This extension requires the [`TableRow`](/api/nodes/table-row), [`TableHeader`](/api/nodes/table-header) and [`TableCell`](/api/nodes/table-cell) nodes. ::: -TODO +```bash +# with npm +npm install @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell -β οΈ Preview +# with Yarn +yarn add @tiptap/extension-table @tiptap/extension-table-row @tiptap/extension-table-header @tiptap/extension-table-cell +``` +## Settings +| Option | Type | Default | Description | +| ----------------------- | --------- | ----------- | --------------------------------------------------------------------- | +| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. | +| resizable | `Boolean` | `false` | | +| handleWidth | `Number` | `5` | | +| cellMinWidth | `Number` | `25` | | +| View | `View` | `TableView` | | +| lastColumnResizable | `Boolean` | `true` | | +| allowTableNodeSelection | `Boolean` | `false` | | + +## Commands +| Command | Parameters | Description | +| ------------------ | ---------------------------------------------- | ----------- | +| insertTable | `{ rows = 3, cols = 3, withHeaderRow = true }` | | +| addColumnBefore | β | | +| addColumnAfter | β | | +| deleteColumn | β | | +| addRowBefore | β | | +| addRowAfter | β | | +| deleteRow | β | | +| deleteTable | β | | +| mergeCells | β | | +| splitCell | β | | +| toggleHeaderColumn | β | | +| toggleHeaderRow | β | | +| toggleHeaderCell | β | | +| mergeOrSplit | β | | +| setCellAttribute | `name`, `value` | | +| goToNextCell | β | | +| goToPreviousCell | β | | +| fixTables | β | | + + +## Source code +[packages/extension-table/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-table/) + +## Usage diff --git a/packages/extension-table/src/table.ts b/packages/extension-table/src/table.ts index 2b96b101..5856a450 100644 --- a/packages/extension-table/src/table.ts +++ b/packages/extension-table/src/table.ts @@ -129,7 +129,7 @@ export const Table = Node.create({ return splitCell(state, dispatch) }, - setCellAttributes: ({ name, value }: { name: string, value: any }): Command => ({ state, dispatch }) => { + setCellAttribute: (name: string, value: any): Command => ({ state, dispatch }) => { return setCellAttr(name, value)(state, dispatch) }, goToNextCell: (): Command => ({ state, dispatch }) => {
- People -