gpt4 book ai didi

html - 标签在 CQ5 中被替换为 标签

转载 作者:太空宇宙 更新时间:2023-11-04 13:47:34 26 4
gpt4 key购买 nike

我正在使用 Rich Text EditorMiscTools在我的网站上编辑文本的插件,但是当我打开 HTML 编辑器并创建这样的东西时

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

CQ 立即将其重写为

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

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

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

感谢您的帮助

最佳答案

关于此的文档不​​多,但默认的 htmlRules 配置正在吞噬您的标签,作为其 DOM 处理/清理的一部分。

特别是 HtmlRules.DocType 的默认值semanticMarkupMap (typeConfig 配置属性的一部分)将更改 <em>标记为 <i>标签和 <strong>标记为 <b>标签。

我不知道你是否可以直接禁用它,但你可以使用身份映射更新 map (即将 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>
...
...

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

CRXDE Lite node view

关于html - <strong> 标签在 CQ5 中被替换为 <b> 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17946117/

26 4 0