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.
37 lines
914 B
37 lines
914 B
3 years ago
|
import { Node, mergeAttributes } from '@tiptap/core';
|
||
|
|
||
|
const Paragraph = Node.create({
|
||
|
name: 'paragraph',
|
||
|
priority: 1000,
|
||
|
addOptions() {
|
||
|
return {
|
||
|
HTMLAttributes: {},
|
||
|
};
|
||
|
},
|
||
|
group: 'block',
|
||
|
content: 'inline*',
|
||
|
parseHTML() {
|
||
|
return [
|
||
|
{ tag: 'p' },
|
||
|
];
|
||
|
},
|
||
|
renderHTML({ HTMLAttributes }) {
|
||
|
return ['p', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
||
|
},
|
||
|
addCommands() {
|
||
|
return {
|
||
|
setParagraph: () => ({ commands }) => {
|
||
|
return commands.setNode(this.name);
|
||
|
},
|
||
|
};
|
||
|
},
|
||
|
addKeyboardShortcuts() {
|
||
|
return {
|
||
|
'Mod-Alt-0': () => this.editor.commands.setParagraph(),
|
||
|
};
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export { Paragraph, Paragraph as default };
|
||
|
//# sourceMappingURL=tiptap-extension-paragraph.esm.js.map
|