electron-drag-drop
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -58,5 +58,5 @@ 'use strict'; | ||
// NOTE: https://github.com/atom/electron/issues/1276 | ||
dataTransfer.setData('text', type); | ||
dataTransfer.setData('drag/type', type); | ||
dataTransfer.setData('drag/items', JSON.stringify(items)); | ||
// dataTransfer.setData('text', type); | ||
// dataTransfer.setData('drag/type', type); | ||
// dataTransfer.setData('drag/items', JSON.stringify(items)); | ||
dataTransfer.effectAllowed = effect; | ||
@@ -113,3 +113,3 @@ dataTransfer.dropEffect = 'none'; | ||
// check if this is a file type | ||
if ( dataTransfer.files.length > 0 ) { | ||
if ( dataTransfer.types.indexOf('Files') !== -1 ) { | ||
return 'file'; | ||
@@ -169,2 +169,3 @@ } | ||
// try to extract items from files | ||
// NOTE: only available in `drop` event | ||
if ( dataTransfer.files.length > 0 ) { | ||
@@ -253,2 +254,10 @@ let results = new Array(dataTransfer.files.length); | ||
/** | ||
* @method getLength | ||
* @return {number} | ||
*/ | ||
drag.getLength = function () { | ||
return _items.length; | ||
}; | ||
/** | ||
* @property {boolean} dragging | ||
@@ -255,0 +264,0 @@ */ |
@@ -71,4 +71,4 @@ 'use strict'; | ||
// 2. check if we follow the multi drop rule | ||
let dragItems = drag.items(event.dataTransfer); | ||
if ( !this.multi && dragItems.length > 1 ) { | ||
let length = dragType === 'file' ? event.dataTransfer.items.length : drag.getLength(); | ||
if ( !this.multi && length > 1 ) { | ||
this._canDrop = false; | ||
@@ -95,3 +95,3 @@ return; | ||
dragType: dragType, | ||
dragItems: dragItems, | ||
dragItems: drag.items(event.dataTransfer), | ||
dragOptions: drag.options(), | ||
@@ -98,0 +98,0 @@ } |
{ | ||
"name": "electron-drag-drop", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Easily manipulate drag and drop in Electron.", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node run.js", | ||
"start": "electron", | ||
"test": "mocha test/*.spec.js" | ||
@@ -26,3 +26,3 @@ }, | ||
"devDependencies": { | ||
"electron": "^1.4.15", | ||
"electron": "^1.8.1", | ||
"mocha": "^3.2.0", | ||
@@ -29,0 +29,0 @@ "spectron": "^3.6.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
88768
27
0
0
532