Quick note

Specifying drag-n-drop support in custom EPiServer editor descriptor

Editor descriptors can be used to change how a property, or properties of a given type, is edited. One such example is described in my article about how to let editors populate content reference properties using dropdowns.

When using an editor that doesn't support drag-n-drop the drag-n-drop functionality can be restored by specifying a drop target type in the editor descriptor. Example:

public override void ModifyMetadata(
    ExtendedMetadata metadata,
    IEnumerable<System.Attribute> attributes)
    base.ModifyMetadata(metadata, attributes);
    metadata.AdditionalValues["DropTargetType"] = new[] { "epi.cms.pagereference" };

Similarly for files the drop target type can be set to "fileurl":

metadata.AdditionalValues["DropTargetType"] = new [] { "fileurl" };

To restrict the type of content that can be dropped to pages the editor descriptors EditorConfiguration property can be used:

EditorConfiguration["typeIdentifiers"] = "epi.cms.page";

If the editor descriptor is for a block type used as a property what property in the block to map the dropped item to can be specified using:

metadata.AdditionalValues["DropTargetChildProperty"] = "LinkedPage";
Joel Abrahamsson

Joel Abrahamsson

I'm a passionate web developer and systems architect living in Stockholm, Sweden. I work as CTO for a large media site and enjoy developing with all technologies, especially .NET, Node.js, and ElasticSearch. Read more

More about EPiServer CMS