below is my tiptap code which creates paragraph
<script>
this.editor.commands.insertContent({
type: 'paragraph',
HTMLAttributes: {
class: 'created-paragraph',
},
content: [{ type: 'text', text }],
});
</script>
i created a paragraph like this, but "HTMLAttributes" is not working, how to add a class in other way? i cant figure it out :(
i hope guys u can help me
you can use the
addClassmethod to add a class to a node.The
chainmethod is used for chaining commands. Each call to a method likefocus,insertContent, oraddClassreturns a new chain instance, and therunmethod is used to execute the chain of commands.