2

I'm currently using Rich Text Editor (RTE) in my AEM 6.2 project. I would like to configure RTE to use blockquote tag. How can achieve this?

<blockquote>

Component code:

<paraformat jcr:primaryType="nt:unstructured" features="*">
    <formats jcr:primaryType="cq:WidgetCollection">
        <p  jcr:primaryType="nt:unstructured" description="Paragraph" tag="p"/>
        <h1 jcr:primaryType="nt:unstructured" description="Heading 1" tag="h1"/>
        <h2 jcr:primaryType="nt:unstructured" description="Heading 2" tag="h2"/>
        <h3 jcr:primaryType="nt:unstructured" description="Heading 3" tag="h3"/>
        <h4 jcr:primaryType="nt:unstructured" description="Heading 4" tag="h4"/>
        <h5 jcr:primaryType="nt:unstructured" description="Heading 5" tag="h5"/>
        <blockquote jcr:primaryType="nt:unstructured" description="Block Quote" tag="blockquote"/>
    </formats>
</paraformat> 

Reference:

RTE in JCR

Dialog View

Thanks.

phemanthkumar28
  • 408
  • 1
  • 5
  • 25

1 Answers1

4

You can add a new block element by following the instructions at official documents:

Adding custom paragraph formats to RTE

Basically, you overlay the RTE and extend the paraformat plugin by introducing the new elements. Summary steps are:

  1. Overlay your RTE
  2. Create cq:EditConfig/inplaceEditing/paraformat/format node under your RTE control.
  3. Create a node for your style, name it blockquote and give it the following properties -> Description: Block Quote & Tag: blockquote
  4. Make sure you add all other default formats like p, H1, H2 etc.

That's it. You should see your new paragraph style available in the paragraph styles dropdown.

This is a summary as all the pictures will make this post too long but a detailed post can be found at: http://www.aemcq5tutorials.com/tutorials/configure-rte-plugin-in-touch-ui/

Optionally, you will need to check if blockquote element is allowed by inspecting your /libs/cq/xssprotection/config.xml file. The file is self explanatory with lots of comments but in general you should check under <tag-rules> to ensure that your tag is supported. OOTB AEM 6.2 allows blockquote element but some upgrades might have lost it.

Imran Saeed
  • 3,414
  • 1
  • 16
  • 27
  • Awesome!! It worked!! Thank you!! The last step regarding `config.xml` is very nice to know. – phemanthkumar28 Mar 20 '17 at 17:46
  • Glad it worked. I was scratching my head after your update on what could be wrong! Accept answer if you wish. This might help others. The config.xml is a pain especially for legacy configs carried over from upgrades. – Imran Saeed Mar 20 '17 at 17:48