【问题标题】:cq:editConfig not applying outside of parsyscq:editConfig 不在 parsys 之外应用
【发布时间】:2015-05-28 20:54:56
【问题描述】:

来自 Adob​​e 社区论坛的交叉帖子:http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__qugo-we_have_an_imagecom.html

我们有一个图片组件,它的_cq_editConfig.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    cq:disableTargeting="{Boolean}true"
    jcr:primaryType="cq:EditConfig">
    <cq:dropTargets jcr:primaryType="nt:unstructured">
        <image
            jcr:primaryType="cq:DropTargetConfig"
            accept="[image/.*]"
            groups="[media]"
            propertyName="./fileReference">
        </image>
    </cq:dropTargets>
</jcr:root>

我们有一个页面组件(“Blurb”),它包含这个组件作为“featuredImage”,以及一个“body” parsys,它允许使用相同的组件:

<div>
  <h1>*Page Title</h1>
  <cq:include path="pageTitle" resourceType="sitename/components/plainText"/>
</div>

<div>
  <h1>*Featured Image</h1>
  <cq:include path="featuredImage" resourceType="sitename/components/image"/>
</div>

<div>
  <h1>*Body</h1>
  <cq:include path="body" resourceType="sitename/components/page/blurb/parsys"/>
</div>

如果我在 parsys 中放置一个 sitename/components/image 组件,我可以将图像从内容查找器拖到组件上进行设置。然而,featuredImage 将不接受来自内容查找器的拖放操作(“不允许”光标出现,拖放图像没有任何作用)。如果我打开 featureImage 的编辑对话框,我可以将内容查找器图像拖到那里。我是admin用户,没有权限限制。

同样的问题也适用于为内联编辑配置的文本组件。当文本组件放置在正文 parsys(或任何 parsys)中时,内联编辑器将起作用。当文本组件放在 parsys 之外时(上例中的 Page Title),内联编辑器将不会出现。

有趣的是,当我将 Blurb 页面组件更改为使用基础组件时,featuredImage 拖放有效,但 pageTitle 内联编辑不起作用。

<div>
  <h1>*Page Title</h1>
  <cq:include path="pageTitle" resourceType="foundation/components/text"/>
</div>

<div>
  <h1>*Featured Image</h1>
  <cq:include path="featuredImage" resourceType="foundation/components/image"/>
</div>

<div>
  <h1>*Body</h1>
  <cq:include path="body" resourceType="sitename/components/page/blurb/parsys"/>
</div>

这是 WCM 错误吗?我们组件的 cq:editConfig 定义是否缺少某些内容?


编辑:这是在 AEM 5.6.1 上运行的。

我们的 Image 组件的 .content.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Component"
    jcr:title="Image (Custom)"
    sling:resourceSuperType="foundation/components/image"
    allowedParents="[*/parsys]"
    componentGroup="Site Name Group"/>

还有dialog.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    xtype="tabpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <advanced
            jcr:primaryType="cq:Widget"
            path="/apps/sitename/components/image/tab_advanced.infinity.json"
            xtype="cqinclude"/>
        <image
            jcr:primaryType="cq:Widget"
            path="/apps/sitename/old/components/image/dialog/items/image.infinity.json"
            xtype="cqinclude"/>
    </items>
</jcr:root>

还有 cqinclude'd /apps/sitename/components/image/tab_advanced.infinity.json

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Panel"
    title="Advanced">
    <items jcr:primaryType="cq:WidgetCollection">
        <image
            jcr:primaryType="cq:Widget"
            collapsed="{Boolean}false"
            collapsible="{Boolean}true"
            title="Image"
            xtype="dialogfieldset">
            <items jcr:primaryType="cq:WidgetCollection">
                <title
                    jcr:primaryType="cq:Widget"
                    allowBlank="{Boolean}false"
                    fieldDescription="Required Field: If the Alt Text field is left blank, the image title will be used instead. "
                    fieldLabel="Image Title"
                    maxLength="{Long}60"
                    name="./jcr:title"
                    xtype="textfield"/>
                <linkUrl
                    jcr:primaryType="cq:Widget"
                    fieldDescription="Optional Field: use the link field to specify where the image ought to link to."
                    fieldLabel="Link to"
                    name="./linkUrl"
                    regex="/^\\S*$/"
                    regexText="Please enter a valid link"
                    xtype="pathfield"/>
                <alt
                    jcr:primaryType="cq:Widget"
                    fieldDescription="Optional Field: When text is entered into the Alt text field it will be used instead of the image Title. If the image is used as a link, the Alt text is used for the name of the link. For example &lt;a href=&quot;http://slipsum.com/&quot;> Visit Samuel L. Ipsum&lt;/a>"
                    fieldLabel="Alt Text"
                    maxLength="{Long}100"
                    name="./alt"
                    xtype="textfield"/>
                <description
                    jcr:primaryType="cq:Widget"
                    fieldDescription="Optional Field: used to populate the image caption"
                    fieldLabel="Caption"
                    maxLength="{Long}256"
                    name="./jcr:caption"
                    xtype="textarea"/>
            </items>
        </image>
    </items>
</jcr:root>

还有/apps/sitename/old/components/image/dialog/items/image.infinity.json

<image
            jcr:primaryType="cq:Widget"
            allowUpload="{Boolean}false"
            ddGroups="[media]"
            fileNameParameter="./fileName"
            fileReferenceParameter="./fileReference"
            name="./file"
            requestSuffix=".img.png"
            title="Image"
            xtype="html5smartimage"/>

用于测试的示例包(带有文本组件内联编辑)位于:http://s000.tinyupload.com/index.php?file_id=05420490884931180108

【问题讨论】:

  • 请发布您的图像组件的 .content.xml 和 xml 对话框定义。了解您的系统上安装了哪个服务包也很有趣,因为自 AEM 6 的初始版本以来,许多问题都已解决。
  • 我已编辑问题以添加其他信息。
  • 我已向 DayCare 确认这是 5.6.1 中的一个已知问题。

标签: aem


【解决方案1】:

由于我没有完整的来源,我只能猜测您实际遇到的问题。我认为可能的原因有以下之一:

  1. 您要么不提供here 所述的 CQ 编辑器类
  2. 您的自定义 parsys 配置错误,请尝试将其替换为基础版本。

我试图重现该问题,但没有成功,它对我有用。我为你创建了这个sample project

【讨论】:

  • 感谢您的回复。关于#1,我已经包含了_cq_editConfig.xml,除了省略 子元素之外,它与foundation/components/image 相同。关于 #2,自定义 parsys 是基础/组件/页面/parsys 的直接副本。此外,editConfig 在 parsys 中正常工作,所以我不认为 parsys 有问题。同样,问题只存在于页面上嵌入的组件(jcr:content 的子组件)。 parsys 中的组件按预期工作。我稍后会试试你的样品。
  • 我已经测试了你的示例项目。正如我所指出的,基础 Image 组件工作正常,示例项目也演示了这一点。然而,基础文本组件的内联编辑在相同条件下中断。我已经扩展了示例项目包,添加了 Text 组件; 1.1 版位于:s000.tinyupload.com/index.php?file_id=05420490884931180108 请查看并帮助确定这两个组件之间的不同之处。
  • 我用你所有的测试用例扩展了我的示例项目:使用自定义 parsys 嵌入自定义和基础图像和文本组件。一切都按预期工作,除了嵌入页面时文本组件的内联编辑。这可能是一个 CQ 错误,如果您认为它对您的项目很重要,请向 daycare 报告。可以找到最新的示例包here
  • 感谢 d33t。尽管您的回答并未完全回答问题,但您最后的评论证实了我的怀疑,即此处存在 AEM 错误。标记为正确。
  • 您更新的示例项目的另一个发现:当我修改 test/components/image/image.jsp 以删除占位符图像时,它不再适用于拖放(甚至在 parsys 中),直到图像设置在它上面。这与我们的图像组件不同,它们在位于 parsys 之外时从不接受拖放操作。
猜你喜欢
  • 1970-01-01
  • 2013-04-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多