Files
Website/resources/js/editor/Small.js
2024-04-24 22:34:28 +10:00

37 lines
688 B
JavaScript

import {mergeAttributes, Node} from '@tiptap/core'
export const Small = Node.create({
name: 'small',
addOptions() {
return {
HTMLAttributes: {
class: 'text-sm pb-4',
},
}
},
group: 'block',
content: 'inline*',
parseHTML() {
return [{
tag: 'div.text-sm.pb-4',
}]
},
renderHTML({ HTMLAttributes }) {
return ['div', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
},
addCommands() {
return {
setSmall: () => ({ commands }) => {
return commands.setNode(this.name)
},
}
},
})