mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-17 04:17:52 +08:00
28 lines
509 B
TypeScript
28 lines
509 B
TypeScript
import { createNode } from '@tiptap/core'
|
|
|
|
export default createNode({
|
|
name: 'list_item',
|
|
|
|
content: 'paragraph block*',
|
|
|
|
defining: true,
|
|
|
|
parseHTML() {
|
|
return [
|
|
{ tag: 'li' },
|
|
]
|
|
},
|
|
|
|
renderHTML({ attributes }) {
|
|
return ['li', attributes, 0]
|
|
},
|
|
|
|
addKeyboardShortcuts() {
|
|
return {
|
|
Enter: () => this.editor.splitListItem('list_item'),
|
|
Tab: () => this.editor.sinkListItem('list_item'),
|
|
'Shift-Tab': () => this.editor.liftListItem('list_item'),
|
|
}
|
|
},
|
|
})
|