Expand all

ve.ui.DataTransferItem

Constructor

new ve.ui.DataTransferItem(kind, type, [data], [name]) #

Data transfer item wrapper

Parameters:

Name Type Attributes Description
kind string

Item kind, e.g. 'string' or 'file'

type string

MIME type

data Object optional

Data object to wrap or convert

Properties:
Name Type Attributes Description
dataUri string optional

Data URI to convert to a blob

blob Blob optional

File blob

stringData string optional

String data

htmlStringData string optional

HTML string data

item DataTransferItem optional

Native data transfer item

name string optional

Item's name, for types which support it, e.g. File

Source:
Data transfer item wrapper

Methods

getAsFile() → {Blob} #

Get file blob

Generically getAsFile returns a Blob, which could be a File.

Source:

Returns:

File blob

Type
Blob

Get file blob

Generically getAsFile returns a Blob, which could be a File.

getAsString() → {string} #

Get string data

Differs from native DataTransferItem#getAsString by being synchronous

Source:

Returns:

String data

Type
string

Get string data

Differs from native DataTransferItem#getAsString by being synchronous

getExtension() → {string|null} #

Get the extension of the item's name

Source:

Returns:

The extension of the item's name, or null if not present

Type
string | null
Get the extension of the item's name

newFromBlob(blob, [htmlStringData]) → {ve.ui.DataTransferItem}static #

Create a data transfer item from a file blob.

Parameters:

Name Type Attributes Description
blob Blob

File blob

htmlStringData string optional

HTML string representation of data transfer

Source:

Returns:

New data transfer item

Type
ve.ui.DataTransferItem
Create a data transfer item from a file blob.

newFromDataUri(dataUri, [htmlStringData]) → {ve.ui.DataTransferItem}static #

Create a data transfer item from a data URI.

Parameters:

Name Type Attributes Description
dataUri string

Data URI

htmlStringData string optional

HTML string representation of data transfer

Source:

Returns:

New data transfer item

Type
ve.ui.DataTransferItem
Create a data transfer item from a data URI.

newFromItem(item, [htmlStringData]) → {ve.ui.DataTransferItem}static #

Create a data transfer item from a native data transfer item.

Parameters:

Name Type Attributes Description
item DataTransferItem

Native data transfer item

htmlStringData string optional

HTML string representation of data transfer

Source:

Returns:

New data transfer item

Type
ve.ui.DataTransferItem
Create a data transfer item from a native data transfer item.

newFromString(stringData, [type], [htmlStringData]) → {ve.ui.DataTransferItem}static #

Create a data transfer item from string data.

Parameters:

Name Type Attributes Description
stringData string

Native string data

type string optional

Native MIME type

htmlStringData string optional

HTML string representation of data transfer

Source:

Returns:

New data transfer item

Type
ve.ui.DataTransferItem
Create a data transfer item from string data.