@@ -80,10 +80,11 @@ define(function (require, exports, module) {
8080 ValidationUtils = require ( "utils/ValidationUtils" ) ,
8181 ViewUtils = require ( "utils/ViewUtils" ) ,
8282 _ = require ( "thirdparty/lodash" ) ;
83-
83+
8484 /** Editor preferences */
8585 var CLOSE_BRACKETS = "closeBrackets" ,
8686 CLOSE_TAGS = "closeTags" ,
87+ DRAG_DROP = "dragDropText" ,
8788 HIGHLIGHT_MATCHES = "highlightMatches" ,
8889 SCROLL_PAST_END = "scrollPastEnd" ,
8990 SHOW_CURSOR_SELECT = "showCursorWhenSelecting" ,
@@ -112,6 +113,7 @@ define(function (require, exports, module) {
112113 // Mappings from Brackets preferences to CodeMirror options
113114 cmOptions [ CLOSE_BRACKETS ] = "autoCloseBrackets" ;
114115 cmOptions [ CLOSE_TAGS ] = "autoCloseTags" ;
116+ cmOptions [ DRAG_DROP ] = "dragDrop" ;
115117 cmOptions [ HIGHLIGHT_MATCHES ] = "highlightSelectionMatches" ;
116118 cmOptions [ SCROLL_PAST_END ] = "scrollPastEnd" ;
117119 cmOptions [ SHOW_CURSOR_SELECT ] = "showCursorWhenSelecting" ;
@@ -125,6 +127,7 @@ define(function (require, exports, module) {
125127
126128 PreferencesManager . definePreference ( CLOSE_BRACKETS , "boolean" , false ) ;
127129 PreferencesManager . definePreference ( CLOSE_TAGS , "Object" , { whenOpening : true , whenClosing : true , indentTags : [ ] } ) ;
130+ PreferencesManager . definePreference ( DRAG_DROP , "boolean" , true ) ;
128131 PreferencesManager . definePreference ( HIGHLIGHT_MATCHES , "boolean" , false ) ;
129132 PreferencesManager . definePreference ( SCROLL_PAST_END , "boolean" , false ) ;
130133 PreferencesManager . definePreference ( SHOW_CURSOR_SELECT , "boolean" , false ) ;
@@ -307,7 +310,7 @@ define(function (require, exports, module) {
307310 autoCloseTags : currentOptions [ CLOSE_TAGS ] ,
308311 coverGutterNextToScrollbar : true ,
309312 cursorScrollMargin : 3 ,
310- dragDrop : false ,
313+ dragDrop : currentOptions [ DRAG_DROP ] ,
311314 electricChars : false , // we use our own impl of this to avoid CodeMirror bugs; see _checkElectricChars()
312315 extraKeys : codeMirrorKeyMap ,
313316 highlightSelectionMatches : currentOptions [ HIGHLIGHT_MATCHES ] ,
@@ -908,6 +911,14 @@ define(function (require, exports, module) {
908911 this . _codeMirror . on ( "overwriteToggle" , function ( instance , newstate ) {
909912 self . trigger ( "overwriteToggle" , self , newstate ) ;
910913 } ) ;
914+
915+ // Disable CodeMirror's drop handling if a file/folder is dropped
916+ this . _codeMirror . on ( "drop" , function ( cm , event ) {
917+ var files = event . dataTransfer . files ;
918+ if ( files && files . length ) {
919+ event . preventDefault ( ) ;
920+ }
921+ } ) ;
911922 } ;
912923
913924 /**
0 commit comments