Class: DropArea

html.DropArea

Class representing a drop area for drag-and-drop operations.

Dropped items are delivered as a HTML5 DataTransferItemList (see https://devdocs.io/dom/datatransferitemlist). The drag source cannot be a descendant of this element.

new html.DropArea ()

Properties:
Name Type Description
accepted bool

[readonly] Whether the area would accept the current drop item.

hovering bool

[readonly] Whether a drop item is hovering the area.

Extends

Type Definitions

html.DropArea.DropEnterEvent

A drop-enter event. The event must be accepted in order to allow dropping.

Properties:
Name Type Description
accepted bool

(default: false) Set to true to accept the event.

dropEffect string

Set to change the current HTML5 drop effect. One of copy|move|link|none

original DragEvent

[readonly] The original HTML5 DragEvent object.

source html.Draggable

[readonly] The source of the drag operation, or null if the drag was from outside.

types Array.<string>

The list of transfer types.

html.DropArea.DropEvent

A drop event.

Properties:
Name Type Description
accepted bool

(default: false) Set to true to accept the event.

data object

[readonly] A map of the contained data types and values.

dropEffect string

[readonly] The selected HTML5 drop effect. One of copy|move|link|none

items Array.<DataTransferItem>

The list of HTML5 data transfer items (see https://devdocs.io/dom/datatransferitem).

original DragEvent

[readonly] The original HTML5 DragEvent object.

source html.Draggable

[readonly] The source of the drag operation, or null if the drag was from outside.

types Array.<string>

The list of transfer types.

Events

html.DropArea.event:drop

Is triggered when an item is dropped on the drop area.

Name Type Description
event html.DropArea.DropEvent

The event object.

html.DropArea.event:dropAccept

Is triggered when the drop area is hovered by a drop item and has to decide whether to accept the item. Set event.accepted to true to accept after investigating event.types.

types may contain MIME types, or the special type Files, which denotes external files, e.g. when dropping files from a file manager.

Name Type Description
event html.DropArea.DropEnterEvent

The event object.