You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
526 B
30 lines
526 B
3 years ago
|
import { mergeAttributes, Node } from '@tiptap/core'
|
||
|
|
||
|
export interface TableRowOptions {
|
||
|
HTMLAttributes: Record<string, any>,
|
||
|
}
|
||
|
|
||
|
export const TableRow = Node.create<TableRowOptions>({
|
||
|
name: 'tableRow',
|
||
|
|
||
|
addOptions() {
|
||
|
return {
|
||
|
HTMLAttributes: {},
|
||
|
}
|
||
|
},
|
||
|
|
||
|
content: '(tableCell | tableHeader)*',
|
||
|
|
||
|
tableRole: 'row',
|
||
|
|
||
|
parseHTML() {
|
||
|
return [
|
||
|
{ tag: 'tr' },
|
||
|
]
|
||
|
},
|
||
|
|
||
|
renderHTML({ HTMLAttributes }) {
|
||
|
return ['tr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
|
||
|
},
|
||
|
})
|