<强>标签被替换为 <b>CQ5中的标签 [英] <strong> tag getting replaced to <b> tag in CQ5

查看:13
本文介绍了<强>标签被替换为 <b>CQ5中的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 富文本编辑器MiscTools 用于在我的网站中编辑文本的插件,但是当我打开 HTML 编辑器并像这样创建某物时

I'm using Rich Text Editor with MiscTools plugin to edit text in my website but when I open the HTML editor and create sth like this

<p><strong>Strong text</strong></p>

CQ 立即将其重写为

<p><b>Strong text</b></p>

是否可以禁用此行为?由于我的 CSS 样式,我需要使用 <strong> 标记.

Is it possible to disable this behaviour? I need to use the <strong> tag because of my CSS styles.

我正在使用 /libs/foundation/components/text 中的文本组件副本.

I'm using copy of text component from /libs/foundation/components/text.

感谢您的帮助

推荐答案

没有太多关于这个的文档,但是默认的 htmlRules 配置正在吃掉你的标签,作为其 DOM 处理/清理的一部分.

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.

特别是 HtmlRules.DocType semanticMarkupMap(typeConfig 配置属性的一部分)将改变 <em> 标签到 <i> 标签和 <strong> 标签到 <b> 标签.

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.

我不知道您是否可以直接禁用此功能,但您可以使用身份映射更新地图(即将 b 标签映射到 b 标签),以便什么都没有改变.

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.

将如下所示的 htmlRules 节点添加到您的 dialog.xml(作为 rtePlugins 节点的同级):

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>
...
...

或者,如果您不使用 maven 或类似的东西,您可以直接在 CRXDE Lite 中的对话框中添加节点(此屏幕截图显示了默认的、未修改的 <i><em> 映射——如果这不是你想要的,别忘了改变它):

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):

这篇关于&lt;强&gt;标签被替换为 &lt;b&gt;CQ5中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆