我目前在 AEM 6.2 项目中使用富文本编辑器 (RTE)。我想配置 RTE 以使用 block 引用标签。如何才能实现这一目标?
<blockquote>
组件代码:
<paraformat jcr:primaryType="nt:unstructured" features="*">
<formats jcr:primaryType="cq:WidgetCollection">
<p jcr:primaryType="nt:unstructured" description="Paragraph" tag="p"/>
<h1 jcr:primaryType="nt:unstructured" description="Heading 1" tag="h1"/>
<h2 jcr:primaryType="nt:unstructured" description="Heading 2" tag="h2"/>
<h3 jcr:primaryType="nt:unstructured" description="Heading 3" tag="h3"/>
<h4 jcr:primaryType="nt:unstructured" description="Heading 4" tag="h4"/>
<h5 jcr:primaryType="nt:unstructured" description="Heading 5" tag="h5"/>
<blockquote jcr:primaryType="nt:unstructured" description="Block Quote" tag="blockquote"/>
</formats>
</paraformat>
引用:
谢谢。
最佳答案
您可以按照官方文档的说明添加新的 block 元素:
Adding custom paragraph formats to RTE
基本上,您可以通过引入新元素来覆盖 RTE 并扩展 paraformat 插件。总结步骤是:
- 覆盖您的 RTE
- 在 RTE 控制下创建 cq:EditConfig/inplaceEditing/paraformat/format 节点。
- 为您的样式创建一个节点,将其命名为
blockquote
并赋予它以下属性 ->Description: Block Quote
&Tag: blockquote
- 确保添加所有其他默认格式,例如 p、H1、H2 等。
就是这样。您应该会在段落样式下拉列表中看到新的段落样式。
This is a summary as all the pictures will make this post too long but a detailed post can be found at: http://www.aemcq5tutorials.com/tutorials/configure-rte-plugin-in-touch-ui/
(可选)您需要通过检查 /libs/cq/xssprotection/config.xml
来检查是否允许使用 blockquote 元素。文件。该文件是不言自明的,有很多注释,但一般来说,您应该在 <tag-rules>
下检查以确保您的标签受支持。 OOTB AEM 6.2 允许 blockquote
元素,但某些升级可能会丢失它。
关于aem - 更新 RTE 组件以在 AEM 中使用 block 引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42907708/