TableKit 扩展
TableKit 是所有必要的 Tiptap 表格扩展的集合。如果您想快速在 Tiptap 中设置表格,这个扩展非常适合您。
安装
npm install @tiptap/extension-table包含的扩展
节点
源代码
使用 TableKit 扩展
将 TableKit 传递给编辑器,以一次加载所有包含的扩展。
import { Editor } from '@tiptap/core'
import { TableKit } from '@tiptap/extension-table'
const editor = new Editor({
extensions: [TableKit],
})您可以配置包含的扩展,甚至可以禁用其中一些,如下所示。
import { Editor } from '@tiptap/core'
import { TableKit } from '@tiptap/extension-table'
const editor = new Editor({
extensions: [
TableKit.configure({
// 禁用一个扩展
tableRow: false,
// 配置一个扩展
tableCell: {
HTMLAttributes: { class: 'list-item' },
},
}),
],
})