May 22, 2020
Estimated Post Reading Time ~

cq:editConfig not applying outside of parsys

We have an image component, its _cq_editConfig.xml is:
<?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>

We have a page component ("Blurb") which includes this component as the "featuredImage", as well as a "body" parsys which allows the same component to be used:

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

If I place a sitename/components/image component in the parsys, I can drag an image from the content finder onto the component to set it. The featuredImage, however, will not accept the drag-n-drop from the content finder (the "not allowed" cursor appears, dropping the image does nothing). If I open the featureImage's edit dialog, I can drag a content finder image to there. I am the admin user, there are no permission restrictions.

The same issue applies to text components configured for inline editing. When the text component is placed in the body parsys (or any parsys), the inline editor works. When the text component is placed outside of the parsys (Page Title in the example above), the inline editor will not appear.

Interestingly, when I change the Blurb page component use foundation components, the featuredImage drag-n-drop works, but the pageTitle inline editing does not.

<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>
Is this a WCM bug? Are our components' cq:editConfig definitions missing something?

EDIT: This is running on AEM 5.6.1.

Our Image component's .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"/>
And 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>
And the 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>
And /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"/>

Best How To:
Since I don't have the full source I can only guess which problem you are actually experiencing. I see one of the following as the possible reasons:

You either do not provide the CQ editor classes.
Your custom parsys is misconfigured, try replacing it with the foundation one.
I tried to reproduce the issue but didn't succeed, it's working for me.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.