Skip to content

Suggestion: Option to prevent dragging and dropping elements on the page onto the dropzone #255

@akinnee-gl

Description

@akinnee-gl

In the meantime, here is my solution for doing this:

onDragEnter={function( event ) {
    const dt = event.dataTransfer;
    if ( !(
        dt.types &&
        ( dt.types.indexOf ? dt.types.indexOf( "Files" ) !== -1 : dt.types.contains( "Files" ) )
    ) ) {
        this.setState( { isDragActive: false } );
    }
}}
onDrop={files => {
    if ( files.length === 0 ) {
        return;
    }

    // handle files dropped here
}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions