tiptap/packages/extension-table-row/src/table-row.ts
Philipp Kühn 56417a44a7 refactoring
2021-01-23 22:48:34 +01:00

36 lines
615 B
TypeScript

import { Node, mergeAttributes } from '@tiptap/core'
export interface TableRowOptions {
HTMLAttributes: {
[key: string]: any
},
}
export const TableRow = Node.create({
name: 'tableRow',
defaultOptions: <TableRowOptions>{
HTMLAttributes: {},
},
content: '(tableCell | tableHeader)*',
tableRole: 'row',
parseHTML() {
return [
{ tag: 'tr' },
]
},
renderHTML({ HTMLAttributes }) {
return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
},
})
declare module '@tiptap/core' {
interface AllExtensions {
TableRow: typeof TableRow,
}
}