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
addClass
method to add a class to a node.The
chain
method is used for chaining commands. Each call to a method likefocus
,insertContent
, oraddClass
returns a new chain instance, and therun
method is used to execute the chain of commands.