react-dnd-html5-backend
Advanced tools
Comparing version 8.0.3 to 9.0.0
@@ -1,1 +0,1 @@ | ||
export default function getEmptyImage(): HTMLImageElement; | ||
export declare function getEmptyImage(): HTMLImageElement; |
let emptyImage; | ||
export default function getEmptyImage() { | ||
export function getEmptyImage() { | ||
if (!emptyImage) { | ||
@@ -4,0 +4,0 @@ emptyImage = new Image(); |
@@ -8,6 +8,6 @@ import { Backend, DragDropManager } from 'dnd-core'; | ||
export default class HTML5Backend implements Backend { | ||
private options; | ||
private actions; | ||
private monitor; | ||
private registry; | ||
private context; | ||
private enterLeaveCounter; | ||
@@ -28,4 +28,5 @@ private sourcePreviewNodes; | ||
private dragOverTargetIds; | ||
constructor(manager: DragDropManager<any>); | ||
readonly window: Window | undefined; | ||
constructor(manager: DragDropManager, globalContext: any); | ||
readonly window: any; | ||
readonly document: any; | ||
setup(): void; | ||
@@ -32,0 +33,0 @@ teardown(): void; |
@@ -6,4 +6,5 @@ import EnterLeaveCounter from './EnterLeaveCounter'; | ||
import * as NativeTypes from './NativeTypes'; | ||
import { OptionsReader } from './OptionsReader'; | ||
export default class HTML5Backend { | ||
constructor(manager) { | ||
constructor(manager, globalContext) { | ||
this.sourcePreviewNodes = new Map(); | ||
@@ -37,4 +38,3 @@ this.sourcePreviewNodeOptions = new Map(); | ||
// Check the node either in the main document or in the current context | ||
return ((!!document && document.body.contains(node)) || | ||
(!!this.window && this.window.document.body.contains(node))); | ||
return this.document && this.document.body && document.body.contains(node); | ||
}; | ||
@@ -55,2 +55,5 @@ this.endDragIfSourceWasRemovedFromDOM = () => { | ||
this.handleTopDragStart = (e) => { | ||
if (e.defaultPrevented) { | ||
return; | ||
} | ||
const { dragStartSourceIds } = this; | ||
@@ -278,6 +281,6 @@ this.dragStartSourceIds = null; | ||
}; | ||
this.options = new OptionsReader(globalContext); | ||
this.actions = manager.getActions(); | ||
this.monitor = manager.getMonitor(); | ||
this.registry = manager.getRegistry(); | ||
this.context = manager.getContext(); | ||
this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument); | ||
@@ -287,10 +290,7 @@ } | ||
get window() { | ||
if (this.context && this.context.window) { | ||
return this.context.window; | ||
} | ||
else if (typeof window !== 'undefined') { | ||
return window; | ||
} | ||
return undefined; | ||
return this.options.window; | ||
} | ||
get document() { | ||
return this.options.document; | ||
} | ||
setup() { | ||
@@ -463,2 +463,5 @@ if (this.window === undefined) { | ||
handleDragStart(e, sourceId) { | ||
if (e.defaultPrevented) { | ||
return; | ||
} | ||
if (!this.dragStartSourceIds) { | ||
@@ -465,0 +468,0 @@ this.dragStartSourceIds = []; |
@@ -1,7 +0,6 @@ | ||
export * from './interfaces'; | ||
import HTML5Backend from './HTML5Backend'; | ||
import getEmptyImage from './getEmptyImage'; | ||
import * as NativeTypes from './NativeTypes'; | ||
import { DragDropManager } from 'dnd-core'; | ||
export { NativeTypes, getEmptyImage }; | ||
export default function createHTML5Backend(manager: DragDropManager<any>): HTML5Backend; | ||
import { BackendFactory } from 'dnd-core'; | ||
export { getEmptyImage } from './getEmptyImage'; | ||
export { NativeTypes }; | ||
declare const createHTML5Backend: BackendFactory; | ||
export default createHTML5Backend; |
import HTML5Backend from './HTML5Backend'; | ||
import getEmptyImage from './getEmptyImage'; | ||
import * as NativeTypes from './NativeTypes'; | ||
export { NativeTypes, getEmptyImage }; | ||
export default function createHTML5Backend(manager) { | ||
return new HTML5Backend(manager); | ||
} | ||
export { getEmptyImage } from './getEmptyImage'; | ||
export { NativeTypes }; | ||
const createHTML5Backend = (manager, context) => new HTML5Backend(manager, context); | ||
export default createHTML5Backend; |
{ | ||
"name": "react-dnd-html5-backend", | ||
"version": "8.0.3", | ||
"version": "9.0.0", | ||
"description": "HTML5 backend for React DnD", | ||
@@ -20,14 +20,14 @@ "type": "module", | ||
"dependencies": { | ||
"dnd-core": "^8.0.3" | ||
"dnd-core": "^9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.8.19", | ||
"@types/react": "^16.8.23", | ||
"npm-run-all": "^4.1.5", | ||
"react": "^16.8.6", | ||
"react-dnd-test-backend": "^8.0.3", | ||
"react-dnd-test-backend": "^9.0.0", | ||
"react-dom": "^16.8.6", | ||
"rimraf": "^2.6.3", | ||
"ts-loader": "^6.0.2", | ||
"typescript": "^3.5.2" | ||
} | ||
}, | ||
"gitHead": "f591828f0ccaf70aa712785a8601017da2df4b45" | ||
} |
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
207004
7
970
+ Addeddnd-core@9.5.1(transitive)
- Removeddnd-core@8.0.3(transitive)
Updateddnd-core@^9.0.0