src/utils/DragAndDrop.js
function stopURIListPropagation(files, event) {
        var types = event.dataTransfer.types;
            
        if ((!files || !files.length) && types) { // We only want to check if a string of text was dragged into the editor
            types.forEach(function (value) {
                //Dragging text externally (dragging text from another file): types has "text/plain" and "text/html"
                //Dragging text internally (dragging text to another line): types has just "text/plain"
                //Dragging a file: types has "Files"
                //Dragging a url: types has "text/plain" and "text/uri-list" <-what we are interested in
                if (value === "text/uri-list") { 
                    event.stopPropagation();
                    event.preventDefault();
                    return;
                }
            });
        }
    }
function stopURIListPropagation(files, event) {
        var types = event.dataTransfer.types;
            
        if ((!files || !files.length) && types) { // We only want to check if a string of text was dragged into the editor
            types.forEach(function (value) {
                //Dragging text externally (dragging text from another file): types has "text/plain" and "text/html"
                //Dragging text internally (dragging text to another line): types has just "text/plain"
                //Dragging a file: types has "Files"
                //Dragging a url: types has "text/plain" and "text/uri-list" <-what we are interested in
                if (value === "text/uri-list") { 
                    event.stopPropagation();
                    event.preventDefault();
                    return;
                }
            });
        }
    }
function stopURIListPropagation ( files , event ) { var types = event . dataTransfer . types ; if ( ( ! files || ! files . length ) && types ) { // We only want to check if a string of text was dragged into the editor types . forEach ( function ( value ) { //Dragging text externally (dragging text from another file): types has "text/plain" and "text/html" //Dragging text internally (dragging text to another line): types has just "text/plain" //Dragging a file: types has "Files" //Dragging a url: types has "text/plain" and "text/uri-list" <-what we are interested in if ( value === "text/uri-list" ) { event . stopPropagation ( ) ; event . preventDefault ( ) ; return ; } } ) ; } }
Determines if the event contains a type list that has a URI-list.
If it does and contains an empty file list, then what is being dropped is a URL.
If that is true then we stop the event propagation and default behavior to save Brackets editor from the browser taking over.
@param {Array.<File>} files Array of File objects from the event datastructure. URLs are the only drop item that would contain a URI-list.
@param {event} event The event datastucture containing datatransfer information about the drag/drop event. Contains a type list which may or may not hold a URI-list depending on what was dragged/dropped. Interested if it does.
Determines if the event contains a type list that has a URI - list . If it does and contains an empty file list then what is being dropped is a URL . If that is true then we stop the event propagation and default behavior to save Brackets editor from the browser taking over .