aem - 更新 RTE 组件以在 AEM 中使用 block 引号

标签 aem rte

我目前在 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> 

引用:

RTE in JCR

Dialog View

谢谢。

最佳答案

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

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

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

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/

相关文章:

javascript - AEM:使用 JavaScript Use-API 访问 DAM 中的 JS 文件

angularjs-directive - Ng-repeat 在 Sightly 中

java - ResourceResolverFactory 为 NULL (Adobe Experience Manager AEM)

aem - 如何在 JAVA 中删除 CQ 节点的属性

javascript - C# 替换字符串的动态内容

java - 如何将 AEM 节点从一个位置复制到另一个位置?

editor - 如何强制 BE 用户在 TYPO3 6.x 中粘贴为纯文本?

javascript - 使用 tinymce,当我从 <div> 复制内容时,格式似乎发生了变化

javascript - Tinymce 编辑器错误

javascript - 使用 tinyMCE 插入/更新链接的问题