In html you can have <br>
tags inside <p>
blocks. Is this part of prosemirror’s default schema? Is there a command or already existing plugin that allows for inserting, serializing and deserializing these tags?
Thank you, Bruno
In html you can have <br>
tags inside <p>
blocks. Is this part of prosemirror’s default schema? Is there a command or already existing plugin that allows for inserting, serializing and deserializing these tags?
Thank you, Bruno
OK, I figured it out. I had forgotten that the example editor had this feature, so I just went and copied the code from there.
Assuming you have imported chainCommands
and exitCode
from the prosemirror-commands
module, and that you have a global variable called “schema” containing a prosermirror schema which defines the hard_break
node, here is the code for a command to insert the hard break.
br_command = chainCommands exitCode, (state, onAction) =>
onAction(state.tr.replaceSelectionWith(schema.nodes.hard_break.create()).scrollAction())
return true