2021-01-21 06:53:53 +08:00
|
|
|
import { Node, mergeAttributes } from '@tiptap/core'
|
|
|
|
|
|
|
|
export interface TableRowOptions {
|
|
|
|
HTMLAttributes: {
|
|
|
|
[key: string]: any
|
|
|
|
},
|
|
|
|
}
|
2021-01-21 06:42:01 +08:00
|
|
|
|
|
|
|
export const TableRow = Node.create({
|
2021-01-23 06:33:08 +08:00
|
|
|
name: 'tableRow',
|
2021-01-21 06:53:53 +08:00
|
|
|
|
|
|
|
defaultOptions: <TableRowOptions>{
|
|
|
|
HTMLAttributes: {},
|
|
|
|
},
|
|
|
|
|
2021-01-23 06:33:08 +08:00
|
|
|
content: '(tableCell | tableHeader)*',
|
2021-01-21 06:53:53 +08:00
|
|
|
|
2021-01-21 07:16:45 +08:00
|
|
|
tableRole: 'row',
|
2021-01-21 06:53:53 +08:00
|
|
|
|
|
|
|
parseHTML() {
|
2021-01-24 05:48:34 +08:00
|
|
|
return [
|
|
|
|
{ tag: 'tr' },
|
|
|
|
]
|
2021-01-21 06:53:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
|
|
|
return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
|
|
|
|
},
|
2021-01-21 06:42:01 +08:00
|
|
|
})
|