<strong> tag getting replaced to <b> tag in CQ5

喜欢而已 提交于 2019-12-02 02:20:34

There isn't very much documentation around this, but the default htmlRules configuration is eating your tags as part of its DOM processing/clean-up.

In particular, the defaults for the HtmlRules.DocType semanticMarkupMap (part of the typeConfig configuration property) will change <em> tags to <i> tags and <strong> tags to <b> tags.

I don't know if you can disable this directly, but you can update the map with an identity mapping (i.e. map b tags to b tags) so that nothing gets changed.

Add an htmlRules node like the following to your dialog.xml (as a sibling of the rtePlugins node):

...
<rtePlugins jcr:primaryType="nt:unstructured">
  ...
  <misctools
    jcr:primaryType="nt:unstructured"
    features="sourceedit"/>
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
  <docType jcr:primaryType="nt:unstructured">
    <typeConfig jcr:primaryType="nt:unstructured">
      <semanticMarkupMap jcr:primaryType="nt:unstructured"
        b="b" 
        i="i"/>
    </typeConfig>
  </docType>
</htmlRules>
...
...

or you can add nodes directly to your dialog in CRXDE Lite if you're not using maven or something similar (this screenshot shows the default, unmodified <i> to <em> mapping -- don't forget to change that if that's not what you want):

in semanticMarkupMap, add property "strong" with value "b" to automatically replace tags with in your rte text (and "em" property with value "i" for italic)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!