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.

  • 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 Jul 13 '15 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. – Jason Morehead Jul 14 '15 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 Jul 15 '15 at 6:01
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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