Skip to content

Commit

Permalink
0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 11, 2015
1 parent db97efb commit 69e91b5
Show file tree
Hide file tree
Showing 31 changed files with 374 additions and 396 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-dnd",
"version": "0.6.4",
"version": "0.7.0",
"homepage": "https://github.com/gaearon/react-dnd",
"authors": [
"Dan Abramov <dan.abramov@me.com>"
Expand Down
12 changes: 6 additions & 6 deletions dist-modules/actions/DragDropActionCreators.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
"use strict";

var DragDropDispatcher = require('../dispatcher/DragDropDispatcher'),
DragDropActionTypes = require('../constants/DragDropActionTypes');
var DragDropDispatcher = require("../dispatcher/DragDropDispatcher"),
DragDropActionTypes = require("../constants/DragDropActionTypes");

var DragDropActionCreators = {
startDragging:function(itemType, item, effectsAllowed) {
startDragging: function startDragging(itemType, item, effectsAllowed) {
DragDropDispatcher.handleAction({
type: DragDropActionTypes.DRAG_START,
itemType: itemType,
Expand All @@ -13,14 +13,14 @@ var DragDropActionCreators = {
});
},

recordDrop:function(dropEffect) {
recordDrop: function recordDrop(dropEffect) {
DragDropDispatcher.handleAction({
type: DragDropActionTypes.DROP,
dropEffect: dropEffect
});
},

endDragging:function() {
endDragging: function endDragging() {
DragDropDispatcher.handleAction({
type: DragDropActionTypes.DRAG_END
});
Expand Down
69 changes: 33 additions & 36 deletions dist-modules/backends/HTML5.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

var DragDropActionCreators = require('../actions/DragDropActionCreators'),
NativeDragItemTypes = require('../constants/NativeDragItemTypes'),
DropEffects = require('../constants/DropEffects'),
EnterLeaveMonitor = require('../utils/EnterLeaveMonitor'),
isFileDragDropEvent = require('../utils/isFileDragDropEvent'),
shallowEqual = require('react/lib/shallowEqual'),
union = require('lodash-node/modern/arrays/union'),
without = require('lodash-node/modern/arrays/without'),
isWebkit = require('../utils/isWebkit'),
isFirefox = require('../utils/isFirefox');
"use strict";

var DragDropActionCreators = require("../actions/DragDropActionCreators"),
NativeDragItemTypes = require("../constants/NativeDragItemTypes"),
DropEffects = require("../constants/DropEffects"),
EnterLeaveMonitor = require("../utils/EnterLeaveMonitor"),
isFileDragDropEvent = require("../utils/isFileDragDropEvent"),
shallowEqual = require("react/lib/shallowEqual"),
union = require("lodash/array/union"),
without = require("lodash/array/without"),
isWebkit = require("../utils/isWebkit"),
isFirefox = require("../utils/isFirefox");

// Store global state for browser-specific fixes and workarounds
var _monitor = new EnterLeaveMonitor(),
Expand All @@ -35,10 +35,7 @@ function checkIfCurrentDragTargetRectChanged() {
}

function triggerDragEndIfDragSourceWasRemovedFromDOM() {
if (_currentDragTarget &&
_imitateCurrentDragEnd &&
!document.body.contains(_currentDragTarget)) {

if (_currentDragTarget && _imitateCurrentDragEnd && !document.body.contains(_currentDragTarget)) {
_imitateCurrentDragEnd();
}
}
Expand Down Expand Up @@ -99,25 +96,25 @@ function handleDrop(e) {
}

var HTML5 = {
setup:function() {
if (typeof window !== 'undefined') {
window.addEventListener('dragenter', handleDragEnter);
window.addEventListener('dragover', handleDragOver);
window.addEventListener('dragleave', handleDragLeave);
window.addEventListener('drop', handleDrop);
setup: function setup() {
if (typeof window !== "undefined") {
window.addEventListener("dragenter", handleDragEnter);
window.addEventListener("dragover", handleDragOver);
window.addEventListener("dragleave", handleDragLeave);
window.addEventListener("drop", handleDrop);
}
},

teardown:function() {
if (typeof window !== 'undefined') {
window.removeEventListener('dragenter', handleDragEnter);
window.removeEventListener('dragover', handleDragOver);
window.removeEventListener('dragleave', handleDragLeave);
window.removeEventListener('drop', handleDrop);
teardown: function teardown() {
if (typeof window !== "undefined") {
window.removeEventListener("dragenter", handleDragEnter);
window.removeEventListener("dragover", handleDragOver);
window.removeEventListener("dragleave", handleDragLeave);
window.removeEventListener("drop", handleDrop);
}
},

beginDrag:function(dragTarget, imitateDragEnd) {
beginDrag: function beginDrag(dragTarget, imitateDragEnd) {
_currentDragTarget = dragTarget;
_initialDragTargetRect = getElementRect(dragTarget);
_dragTargetRectDidChange = false;
Expand All @@ -126,26 +123,26 @@ var HTML5 = {
// Mouse event tell us that dragging has ended but `dragend` didn't fire.
// This may happen if source DOM was removed while dragging.

window.addEventListener('mousemove', triggerDragEndIfDragSourceWasRemovedFromDOM);
window.addEventListener('mousein', triggerDragEndIfDragSourceWasRemovedFromDOM);
window.addEventListener("mousemove", triggerDragEndIfDragSourceWasRemovedFromDOM);
window.addEventListener("mousein", triggerDragEndIfDragSourceWasRemovedFromDOM);
},

endDrag:function() {
endDrag: function endDrag() {
_currentDragTarget = null;
_initialDragTargetRect = null;
_dragTargetRectDidChange = false;
_imitateCurrentDragEnd = null;

window.removeEventListener('mousemove', triggerDragEndIfDragSourceWasRemovedFromDOM);
window.removeEventListener('mousein', triggerDragEndIfDragSourceWasRemovedFromDOM);
window.removeEventListener("mousemove", triggerDragEndIfDragSourceWasRemovedFromDOM);
window.removeEventListener("mousein", triggerDragEndIfDragSourceWasRemovedFromDOM);
},

dragOver:function(e, dropEffect) {
dragOver: function dragOver(e, dropEffect) {
// As event bubbles top-down, first specified effect will be used
if (!_currentDropEffect) {
_currentDropEffect = dropEffect;
}
}
};

module.exports = HTML5;
module.exports = HTML5;
4 changes: 2 additions & 2 deletions dist-modules/constants/DragDropActionTypes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
"use strict";

var keyMirror = require('react/lib/keyMirror');
var keyMirror = require("react/lib/keyMirror");

var DragDropActionTypes = keyMirror({
DRAG_START: null,
Expand Down
8 changes: 4 additions & 4 deletions dist-modules/constants/DropEffects.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
"use strict";

var DropEffects = {
COPY: 'copy',
MOVE: 'move',
LINK: 'link'
COPY: "copy",
MOVE: "move",
LINK: "link"
};

module.exports = DropEffects;
4 changes: 2 additions & 2 deletions dist-modules/constants/HorizontalDragAnchors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
"use strict";

var keyMirror = require('react/lib/keyMirror');
var keyMirror = require("react/lib/keyMirror");

var HorizontalDragAnchors = keyMirror({
LEFT: null,
Expand Down
6 changes: 3 additions & 3 deletions dist-modules/constants/NativeDragItemTypes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
"use strict";

var keyMirror = require('react/lib/keyMirror');
var keyMirror = require("react/lib/keyMirror");

var NativeDragItemTypes = {
FILE: '__NATIVE_FILE__'
FILE: "__NATIVE_FILE__"
};

module.exports = NativeDragItemTypes;
4 changes: 2 additions & 2 deletions dist-modules/constants/VerticalDragAnchors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
"use strict";

var keyMirror = require('react/lib/keyMirror');
var keyMirror = require("react/lib/keyMirror");

var VerticalDragAnchors = keyMirror({
TOP: null,
Expand Down
8 changes: 4 additions & 4 deletions dist-modules/dispatcher/DragDropDispatcher.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
"use strict";

var Dispatcher = require('flux').Dispatcher,
assign = require('react/lib/Object.assign');
var Dispatcher = require("flux").Dispatcher,
assign = require("react/lib/Object.assign");

var DragDropDispatcher = assign(new Dispatcher(), {
handleAction:function(action) {
handleAction: function handleAction(action) {
this.dispatch({
action: action
});
Expand Down
14 changes: 7 additions & 7 deletions dist-modules/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
"use strict";

module.exports = {
DragDropMixin: require('./mixins/DragDropMixin'),
ImagePreloaderMixin: require('./mixins/ImagePreloaderMixin'),
HorizontalDragAnchors: require('./constants/HorizontalDragAnchors'),
VerticalDragAnchors: require('./constants/VerticalDragAnchors'),
NativeDragItemTypes: require('./constants/NativeDragItemTypes'),
DropEffects: require('./constants/DropEffects')
DragDropMixin: require("./mixins/DragDropMixin"),
ImagePreloaderMixin: require("./mixins/ImagePreloaderMixin"),
HorizontalDragAnchors: require("./constants/HorizontalDragAnchors"),
VerticalDragAnchors: require("./constants/VerticalDragAnchors"),
NativeDragItemTypes: require("./constants/NativeDragItemTypes"),
DropEffects: require("./constants/DropEffects")
};
Loading

0 comments on commit 69e91b5

Please sign in to comment.