In AEM 6.0, I am having a component and, it has a text field and one video file uploader. I want to enable the drag and drop of this video from the content finder. My normal upload using the dialog is working, but this drag and drop is not working. I searched and found out that I can do this by using cq:editConfig. Can somebidy tell me that how can I do this?
2 Answers
Define the cq:dropTargets
, as a child of the cq:editConfig
node to configure the list of drop targets that can accept a drop from an asset of the content finder.
In your case, for a video, you can refer the foundation/components/video
whose edit config is shown below.
<cq:editConfig jcr:primaryType="cq:EditConfig" cq:layout="editbar">
<cq:dropTargets jcr:primaryType="nt:unstructured">
<video jcr:primaryType="cq:DropTargetConfig" propertyName="./asset">
<parameters jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/video"/>
</video>
</cq:dropTargets>
</cq:editConfig>
Also make sure you specify the ddGroups
and ddAccept
properties on the html5smartfile
widget used for video file upload component.
Refer Configuring the Edit Behaviour of a component to get more insights on configuring the edit config and its child nodes.
You must be careful doing this because it can have an unexpected side effect of changing your component type to the type specified in the drop target.
To avoid that happening, you can distinguish between component type and target type by using this format:
<cq:dropTargets jcr:primaryType="nt:unstructured">
<video
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
propertyName="./asset">
<parameters
jcr:primaryType="nt:unstructured"
sling:resourceType="myfolder/components/videoandtext">
<video
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/video"
/>
</parameters>
</video>
</cq:dropTargets>
See here for more info: Drop Target Issue