【问题标题】:How to use children editor on custom component in AEM?如何在 AEM 中的自定义组件上使用子编辑器?
【发布时间】:2020-05-20 13:07:52
【问题描述】:

就像核心中的 Accordion 和 Carousel 组件一样,您可以打开组件对话框并通过单击多字段上的“添加”按钮添加自定义嵌套组件。我正在尝试将此功能添加到我的自定义组件的对话框中。

在我的对话框的 .content.xml 中,我有这个 sn-p 用于我的多字段或子编辑器。

<slides
  jcr:primaryType="nt:unstructured"
  sling:resourceType="core/wcm/components/commons/editor/dialog/childreneditor/v1/childreneditor"/>

在这个文件的顶部,我有

    extraClientlibs=" 
   [my_custom_clientlibs,core.wcm.components.commons.editor.dialog.childreneditor.v1]

问题是当我在我的新组件上单击对话框的添加按钮时,什么都没有弹出。

我在这里错过了什么?

【问题讨论】:

    标签: aem aem-core-wcm-components


    【解决方案1】:

    我认为您缺少将sling:resourceSuperType = core/wcm/components/carousel/v1/carousel 添加到您的自定义组件中。

    如果您不想覆盖,请在您的组件 HTL 文件中添加以下代码:

     <sly data-sly-resource="${resource.path @ resourceType='wcm/foundation/components/parsys/newpar', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
         data-sly-test="${(wcmmode.edit || wcmmode.preview)}"></sly>
    

    这是因为您在 newpar 中插入了一个子组件。

    【讨论】:

    • 但这不是轮播。为什么我需要放“sling:resourceSuperType = core/wcm/components/carousel/v1/carousel”
    • 因为此功能继承自 /apps/core/wcm/components/tabs/v1/tabs 或 /apps/core/wcm/components/carousel/v1/carousel,如果您不想然后你可以在这里使用所有的客户端库 /apps/core/wcm/components/commons/editor。让我知道它是否能解决您的问题
    • @Rongeegee,因为它解决了您的问题,如果您遵循 SO 的指导方针并接受答案,我将不胜感激:meta.stackexchange.com/questions/5234/…
    • 抱歉迟到了。谢谢你
    • 我遇到了另一个类似的问题,github.com/adobe/aem-core-wcm-components/issues/696。我将轮播中的 editConfig 添加到我的新组件中,但仍然没有解决新问题。你知道我应该做什么吗?
    猜你喜欢
    • 1970-01-01
    • 2015-10-01
    • 1970-01-01
    • 2017-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-12
    相关资源
    最近更新 更多