5

If I have multiple paragraphs of text in a rich text field, and I select them all and select "Quote" from the formatting menu, the <p> tags are stripped out and replaced with double <br> tags, like so:

<blockquote>
This is some text.<br><br>
Here's some more text.<br>
</blockquote>

Is there any way to preserve the <p> tags, like so?

<blockquote>
    <p>This is some text.</p>
    <p>Here's some more text.</p>
</blockquote>

I've been through the Redactor documentation and config settings and haven't found anything that seems relevant.

3
  • I don't think this is currently possible with Redactor. I tried to add custom formatting styles with the formattingAdd config, but it looks like you can't nest block elements, just replace one with another, like you're seeing with p and blockquote. Wrapping multiple block elements with an inline element is also not possible.
    – carlcs
    Commented Jul 13, 2015 at 20:50
  • That's unfortunate. AFAIK, it's perfectly valid to place <p> tags and other block elements inside <blockquote> tags. Thanks for your response. Commented Jul 14, 2015 at 22:30
  • It's also not possible to add inline styles to headings, so no em or span in h2! And Imperavi has no plans changing this :(
    – carlcs
    Commented Jul 15, 2015 at 6:01

1 Answer 1

4

Would you consider an alternative Matrix based approach where one rich text field was used for article-copy and another separate rich text field, used for the blockquote?

So: Matrix field: "Article blocks"

  • Block 1: "Article"
  • Block 2: "Quote"

e.g. (screen shot from a current project...)

matrix block buttons

That way you could leverage Matrix functionality and allow more layout control as well - such as alignment etc - to the blockqoutes, and maintain your paragraphs as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.