lt;stronggt; tag getting replaced to lt;bgt; tag in CQ5(lt;强gt;标签被替换为 lt;bgt;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):
这篇关于<强>标签被替换为 <b>CQ5中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:<强>标签被替换为 <b>CQ5中的标签
- Fetch API 如何获取响应体? 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
