问题
I've managed to implement my single cq:dropTarget into my component with the following sightly code:
<div data-sly-test="${wcmmode.edit}" class="cq-dd-videoplayer" data-sly-text="Drop video here"></div>
And the cq:dropTargets is setup like so:
<cq:dropTargets jcr:primaryType="nt:unstructured">
<videoplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
groups="[media]"
propertyName="./videoPath"/>
</cq:dropTargets>
This works perfectly... The issue I'm having is having multiple cq:dropTargets in the one component. The issue I have is when I drop an asset into one of the cq:dropTargets both values in the dropTargets are updated with the same value.
This is my current setup:
Sightly:
<div data-sly-test="${wcmmode.edit}" class="cq-dd-videoplayer cq-video-placeholder cq-block-sm-placeholder md-dropzone-video" data-sly-text="Drop video here"></div>
<div data-sly-test="${wcmmode.edit}" class="cq-dd-imageofplayer cq-video-placeholder cq-block-sm-placeholder md-dropzone-video" data-sly-text="Drop image here"></div>
cq:dropTargets
<cq:dropTargets jcr:primaryType="nt:unstructured">
<videoplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
groups="[media]"
propertyName="./videoPath"/>
<imageofplayer
jcr:primaryType="cq:DropTargetConfig"
accept="[image/.*]"
groups="[media]"
propertyName="./imagePath"/>
</cq:dropTargets>
so now the ./videoPath and ./imagePath become the same value from the dragged in asset.
回答1:
On the 22nd of August 2015 has been released a new featurepack CQ-6.1.0-FEATUREPACK-6563 which solved this problem. Related bugs fixed: - CQ-39715 - Make multiple in-place editors smarter - CQ-41631 - Can't place multiple fileupload widgets on the same dialog - CQ-42676 - Inplace editing does not work for static included components
So now you need to create inside cq:inplaceEditing a node called cq:childEditors primaryType unstructured and inside that one node type cq:ChildEditorConfig for each element composed by two properties: "title" and "type" where title will be showed in a dropdown menu when you click on the edit link. I created a 3 columns image component and I can drag-and-drop images from the Content Finder for each of them. Also the Configure section is working with 3 tabs where I can drag-and-drop/upload images for each of them. I suggest to use wcm/foundation/components/textimage as example. References: https://docs.adobe.com/docs/en/aem/6-1/develop/components/multiple-inplace-editors.html
回答2:
Are you trying to drop an image after video?
If so, just looking at your cq:dropTargetConfig
for "imageofplayer",
according to docs,
accept
property value should be "Regex applied to the asset mime type to validate if dropping is allowed."
So if you are trying to drop an image , it should be:
accept="[image/.*]"
来源:https://stackoverflow.com/questions/25185809/having-multiple-cqdroptargets-in-one-component