【问题标题】:Update RTE component to use Block Quotes in AEM更新 RTE 组件以在 AEM 中使用块报价
【发布时间】:2017-08-11 23:21:59
【问题描述】:

我目前在我的 AEM 6.2 项目中使用富文本编辑器 (RTE)。我想将 RTE 配置为使用 blockquote 标签。如何做到这一点?

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

参考:

RTE in JCR

Dialog View

谢谢。

【问题讨论】:

  • 你说的配置是什么意思?您希望 RTE 将 blockquote 显示为选项,还是希望它允许呈现 blockquote?这是两个不同的问题,因此要问。
  • 我的意思是允许 RTE 使用blockquote
  • 在下面查看我的答案。我已经涵盖了这两个问题。如果您需要更多详细信息,请告诉我

标签: aem rte


【解决方案1】:

您可以按照官方文档中的说明添加新的块元素:

Adding custom paragraph formats to RTE

基本上,您覆盖 RTE 并通过引入新元素来扩展 paraformat 插件。总结步骤是:

  1. 覆盖您的 RTE
  2. 在您的 RTE 控制下创建 cq:EditConfig/inplaceEditing/paraformat/format 节点。
  3. 为您的样式创建一个节点,将其命名为blockquote 并为其赋予以下属性 -> Description: Block Quote & Tag: blockquote
  4. 确保添加所有其他默认格式,例如 p、H1、H2 等。

就是这样。您应该会在段落样式下拉菜单中看到您的新段落样式。

这是一个摘要,因为所有图片都会使这篇文章太长,但可以在以下位置找到详细的帖子:http://www.aemcq5tutorials.com/tutorials/configure-rte-plugin-in-touch-ui/

或者,您需要通过检查/libs/cq/xssprotection/config.xml 文件来检查是否允许使用blockquote 元素。该文件包含许多 cmets 是不言自明的,但通常您应该在&lt;tag-rules&gt; 下检查以确保您的标签受支持。 OOTB AEM 6.2 允许 blockquote 元素,但某些升级可能会丢失它。

【讨论】:

  • 太棒了!有效!!谢谢!!关于config.xml 的最后一步很高兴知道。
  • 很高兴它成功了。在您更新可能出了什么问题后,我一直在摸不着头脑!如果您愿意,请接受答案。这可能对其他人有帮助。 config.xml 很痛苦,尤其是对于升级后遗留下来的配置。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多