Home Manual Reference Source Repository

Function

Static Public Summary
public

getDetails(event: DragEvent): object

Retrieves details about dropped content in a drag-drop operation.

Static Public

public getDetails(event: DragEvent): object source

import getDetails from 'dnd-details/src/dnd-details.js'

Retrieves details about dropped content in a drag-drop operation.

Expects the DragEvent object of a drop event. Returns an object with info, depending of the kind of content that was dragged.

  • When dragging files from the local filesystem, "files" will be the only set property, the other properties will have empty or default values
  • When dragging content from another browser window, "files" will be always empty, but some or all of the other values might be set

Params:

NameTypeAttributeDescription
event DragEvent

The ondrop event object

Return:

object

details

Return Properties:

NameTypeAttributeDescription
files FileList

A list of files dragged in from the local filesystem

html String

The HTML code of an element dragged in from another browser window

text String

A text, e.g. the text of a dragged link, or simply dragged text content

links Array

An array of URLs found in links of dropped HTML content.

images Array

An array of image URLs found in src attributes of images in dropped HTML content.