Control <p> wrapper element in RichEditor
What i'm trying to do
have rich text content with bold and italic inside a heading
What I'm doing
I'm adding a RichEditor and selecting the desired options (bold, italic) in the toolbar.
What I would expect
An option to set the desired html wrapper element if something different then <p> is needed.
Is there a way to achieve this easily?
Thank you for your help.
9 Replies
Following. The sheer amount of <p> tags that get added to my content (which I'm then using to send emails) means that my spacing is alllll over the place
I think that needs quite some overwriting in TipTap
What ouput are you guys getting?
I don't want to hijack OP's thread - but in my case, every line is a
<p></p>
and then every empty line is too. I'd rather just have <br>
's. Mostly because the editor has styles on the p tags, then when I display them on the screen there is different styles. And then when it finally goes via email, then the clients just do whatever they want
I'm not sure if OP wants to change p to br or be able to add extra classes etc to the existing p tagsThat's pretty much expected. You can use
Shift + Enter
for <br>
. I think that pattern is quite common. Maybe add a hint for users.And make sure the same styling is used in both places for wysiwyg (I'm guessing tailwind's
prose
)The users would only ever want to use
Shift + Enter
and so it ideally would be a default.
This is the tricky bit for me, as sending an email you're at the mercy of whatever client receives itI think your usecase is a bit special and you should do some postprocessing.
to follow up on this, I used dehydrateStateUsing to remove the wrapping <p> tag before saving in the database.