# ViewDataTransfer

class

A facade over the native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L15)

<a id="properties">

## Properties

<a id="member-dropEffect">

### `dropEffect: 'link' | 'none' | 'copy' | 'move'`

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L94)

#### Parameters

* `value: 'link' | 'none' | 'copy' | 'move'`

<a id="member-effectAllowed">

### `effectAllowed: 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'`

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L83)

#### Parameters

* `value: 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'`

<a id="member-files">

### `files: Array<File>` _(readonly)_

The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L43)

<a id="member-isCanceled">

### `isCanceled: boolean` _(readonly)_

Whether the dragging operation was canceled.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L112)

<a id="member-types">

### `types: readonly Array<string>` _(readonly)_

Returns an array of available native content types.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L54)

<a id="member-_files">

### `_files: Array<File> | null` _(private)_

The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L19)

<a id="member-_native">

### `_native: DataTransfer` _(private)_

The native DataTransfer object.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L24)

<a id="methods">

## Methods

<a id="function-constructor">

### `constructor( nativeDataTransfer, options = { options.cacheFiles? } )`

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L30)

#### Parameters

* `nativeDataTransfer: DataTransfer`

  The native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.

* `options: object`

  Properties

  * `options.cacheFiles?: boolean`

    Whether `files` list should be initialized in the constructor.

  Defaults to `{}`

<a id="function-getData">

### `getData( type ) → string`

Gets the data from the data transfer by its MIME type.

```typescript
dataTransfer.getData( 'text/plain' );
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L67)

#### Parameters

* `type: string`

  The MIME type. E.g. `text/html` or `text/plain`.

#### Returns

* `string`

<a id="function-setData">

### `setData( type, data ) → void`

Sets the data in the data transfer.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L76)

#### Parameters

* `type: string`

  The MIME type. E.g. `text/html` or `text/plain`.

* `data: string`

#### Returns

* `void`

<a id="function-setDragImage">

### `setDragImage( image, x, y ) → void`

Set a preview image of the dragged content.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/datatransfer.ts#L105)

#### Parameters

* `image: Element`
* `x: number`
* `y: number`

#### Returns

* `void`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
