Class

DataTransfer (engine/view)

@ckeditor/ckeditor5-engine/src/view/datatransfer

class

A facade over the native DataTransfer object.

Filtering

Properties

  • dropEffect : 'link' | 'none' | 'copy' | 'move'

    Parameters

    value : 'link' | 'none' | 'copy' | 'move'
  • effectAllowed : 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'

    Parameters

    value : 'link' | 'none' | 'copy' | 'move' | 'copyLink' | 'copyMove' | 'linkMove' | 'all' | 'uninitialized'
  • readonly

    files : Array<File>

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

  • readonly

    isCanceled : boolean

    Whether the dragging operation was canceled.

  • readonly

    types : readonly Array<string>

    Returns an array of available native content types.

  • private

    _files : null | Array<File>

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

  • private

    _native : DataTransfer

    The native DataTransfer object.

Methods

  • constructor( nativeDataTransfer, options = { [options.cacheFiles] } )

    Parameters

    nativeDataTransfer : DataTransfer

    The native DataTransfer object.

    options : object
    Properties
    [ options.cacheFiles ] : boolean

    Whether files list should be initialized in the constructor.

    Defaults to {}

  • getData( type ) → string

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

    dataTransfer.getData( 'text/plain' );
    

    Parameters

    type : string

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

    Returns

    string
  • setData( type, data ) → void

    Sets the data in the data transfer.

    Parameters

    type : string

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

    data : string

    Returns

    void
  • setDragImage( image, x, y ) → void

    Set a preview image of the dragged content.

    Parameters

    image : Element
    x : number
    y : number

    Returns

    void