blob: 234093548145be746790501558681efd7c0168db (
plain)
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
|
import { Node } from '@tiptap/core';
import { PARSE_HTML_PRIORITY_LOWEST } from '../constants';
const tags = ['div', 'pre'];
const createHtmlNodeExtension = (tagName) =>
Node.create({
name: tagName,
content: 'block*',
group: 'block',
defining: true,
addOptions() {
return {
tagName,
};
},
parseHTML() {
return [{ tag: tagName, priority: PARSE_HTML_PRIORITY_LOWEST }];
},
renderHTML({ HTMLAttributes }) {
return [tagName, HTMLAttributes, 0];
},
});
export default tags.map(createHtmlNodeExtension);
|