1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { Node, mergeAttributes } from '@tiptap/core';
import { PARSE_HTML_PRIORITY_HIGHEST } from '../constants';
export default Node.create({
name: 'detailsContent',
content: 'block+',
defining: true,
addOptions() {
return {
HTMLAttributes: {
dir: 'auto',
},
};
},
parseHTML() {
return [
{ tag: '*', consuming: false, context: 'details/', priority: PARSE_HTML_PRIORITY_HIGHEST },
];
},
renderHTML({ HTMLAttributes }) {
return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
},
addKeyboardShortcuts() {
return {
Enter: () => this.editor.commands.splitListItem('detailsContent'),
'Shift-Tab': () => this.editor.commands.liftListItem('detailsContent'),
};
},
});
|