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.
33 lines
902 B
33 lines
902 B
3 years ago
|
import { Node, mergeAttributes } from '@tiptap/core';
|
||
|
|
||
|
const ListItem = Node.create({
|
||
|
name: 'listItem',
|
||
|
addOptions() {
|
||
|
return {
|
||
|
HTMLAttributes: {},
|
||
|
};
|
||
|
},
|
||
|
content: 'paragraph block*',
|
||
|
defining: true,
|
||
|
parseHTML() {
|
||
|
return [
|
||
|
{
|
||
|
tag: 'li',
|
||
|
},
|
||
|
];
|
||
|
},
|
||
|
renderHTML({ HTMLAttributes }) {
|
||
|
return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
||
|
},
|
||
|
addKeyboardShortcuts() {
|
||
|
return {
|
||
|
Enter: () => this.editor.commands.splitListItem(this.name),
|
||
|
Tab: () => this.editor.commands.sinkListItem(this.name),
|
||
|
'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
|
||
|
};
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export { ListItem, ListItem as default };
|
||
|
//# sourceMappingURL=tiptap-extension-list-item.esm.js.map
|