Some ways related to my previous question. Let say we have
<p class="text-red ProseMirror-selectednode">
Vivamus rhoncus justo vitae sem consequat,
ac tristique neque maximus. Etiam et sapien vel ipsum tincidunt iaculis. Nullam sed purus mi. Morbi eu vestibulum augue, at dignissim metus.
</p>
Notice that the node is selected because it has ProseMirror-selectednode
class.
So I can get the selected node by
const selectedNode = view.state.selection.node
How do I go from here ? How do I set the paragraph class to read “text-red ProseMirror-selectednode” ?
Thank you !
EDIT:
TL;DR this is in the guide section here with an actual example
Blockquote
setNodeMarkup
is a method that can be used to change the type or set of attributes for the node at a given