Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

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

Vote:
 

Hi, 

I have a block which represents list of items:

    public class ShortListBlock : BlockBase
    {
        [Display(Name = "List Source")]
        [DefaultDragAndDropTarget]
        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?

#112561
Oct 30, 2014 8:36
Vote:
 

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.

#112597
Oct 30, 2014 18:44
Vote:
 

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?

#131345
Jul 21, 2015 14:06
Vote:
 

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.

#131354
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.