DefaultDragAndDropTarget and ContentArea. How to configure drag and drop to add a page into a ContentArea?



I have a block which represents list of items:

    public class ShortListBlock : BlockBase
        [Display(Name = "List Source")]
        public virtual ContentArea ListSource { get; set; }

        [Display(Name = "List Display Options")]
        public virtual ListDisplayOptionsBlock ListDisplayOptions { get; set; }

And I'd like to allow user drag and drop pages into the list source, tying something like:

    [EditorDescriptorRegistration(TargetType = typeof(ShortListBlock))]
    public class ShortListDroppableListSourceEditorDescriptor : EditorDescriptor
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable attributes)
            base.ModifyMetadata(metadata, attributes);
            metadata.AdditionalValues["DropTargetType"] = new[] { "epi.cms.pagereference" };
            metadata.AdditionalValues["DropTargetChildProperty"] = "ListSource";

But the default behavior replaces whole ContentArea contents with a dropped page. How to modify it not to replace but just add a new item into the ListSource content area?

Oct 30, 2014 8:36

I've reported this as a bug a while ago. DefaultDragAndDropTarget doesn't work with content areas, only content references and url, which is weird. However, I don't know the latest status on the bug, not more than it's still in triage.

Oct 30, 2014 18:44

Giving this post a bump as I'm running into the same problem today, and getting this functionality down would represent a clear improvement to the editing experience for the project I am working on.

I'm assuming you are referring to bug #117952 from [DefaultDragAndDropTarget] doesn't work with ContenArea properties? I couldn't find the bug in the bug list. Do you know what became of the issue?

Jul 21, 2015 14:06

I can't find the bug either. And I'm pretty sure it's not fixed. Please report the issue to EPiServer and maybe they will actually mark it as a bug this time.

Jul 21, 2015 20:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.