我正在使用富文本编辑器和MiscTools插件来编辑我的网站中的文本但是当我打开HTML编辑器并创建这样的时候
<p><strong>Strong text</strong></p>
Run Code Online (Sandbox Code Playgroud)
CQ立即将其重写为
<p><b>Strong text</b></p>
Run Code Online (Sandbox Code Playgroud)
是否可以禁用此行为?<strong>
因为我的CSS样式,我需要使用标签.
我正在使用来自的文本组件的副本/libs/foundation/components/text
.
谢谢你的帮助
小智 9
关于此问题的文档并不多,但默认的htmlRules配置正在将您的标记作为其DOM处理/清理的一部分.
特别是,HtmlRules.DocType semanticMarkupMap
(typeConfig
配置属性的一部分)的默认值将<em>
标签更改为<i>
标签,<strong>
标签更改为<b>
标签.
我不知道你是否可以直接禁用它,但是你可以用身份映射(即映射b
标签到b
标签)来更新地图,这样就不会有任何改变.
htmlRules
将以下节点添加到dialog.xml(作为rtePlugins
节点的兄弟):
...
<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>
...
...
Run Code Online (Sandbox Code Playgroud)
或者你可以直接在CRXDE Lite中的对话框中添加节点,如果你没有使用maven或类似的东西(这个截图显示默认的,未经修改<i>
的<em>
映射 - 不要忘记改变它,如果那不是你想要的):