How to use dnd-core - 10 common examples

To help you get started, we’ve selected a few dnd-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-dnd / react-dnd / packages / core / react-dnd / src / __tests__ / DndProvider.tsx View on Github external
it('reuses DragDropManager provided to it', () => {
		let capturedManager
		const manager = createDragDropManager(TestBackend, {}, {})

		const ManagerCapture = () => (
			
				
					{({ dragDropManager }) => {
						capturedManager = dragDropManager
						return null
					}}
				
			
		)

		TestUtils.renderIntoDocument()
		expect(capturedManager).toBe(manager)
	})
})
github react-dnd / react-dnd / packages / react-dnd / src / __tests__ / DndProvider.tsx View on Github external
it('reuses DragDropManager provided to it', () => {
		let capturedManager
		const manager = createDragDropManager(TestBackend, {})

		const ManagerCapture = () => (
			
				
					{({ dragDropManager }) => {
						capturedManager = dragDropManager
						return null
					}}
				
			
		)

		TestUtils.renderIntoDocument()
		expect(capturedManager).toBe(manager)
	})
})
github react-dnd / react-dnd / dist-modules / backends / HTML5.js View on Github external
});
  }

  _inherits(FileDragSource, _DragSource);

  FileDragSource.prototype.mutateItemByReadingDataTransfer = function mutateItemByReadingDataTransfer(dataTransfer) {
    delete this.item.files;
    this.item.files = Array.prototype.slice.call(dataTransfer.files);
  };

  FileDragSource.prototype.beginDrag = function beginDrag() {
    return this.item;
  };

  return FileDragSource;
})(_DragSource3.DragSource);

var UrlDragSource = (function (_DragSource2) {
  function UrlDragSource() {
    _classCallCheck(this, UrlDragSource);

    _DragSource2.call(this);
    this.item = Object.defineProperties({}, {
      urls: {
        get: function () {
          console.warn('Browser doesn\'t allow reading URL information until the link is dropped.');
          return null;
        },
        configurable: true,
        enumerable: true
      }
    });
github neo4j / neo4j-browser / src / browser / components / FileImporter / dndGlobalContext.js View on Github external
const getDndContext = () => {
  if (defaultManager) return defaultManager
  defaultManager = new DragDropManager(HTML5Backend)

  return defaultManager
}
github mendersoftware / gui / node_modules / react-dnd / lib / DragDropContext.js View on Github external
var createChildContext = exports.createChildContext = function createChildContext(backend, context) {
	return {
		dragDropManager: new _dndCore.DragDropManager(backend, context)
	};
};
github react-dnd / react-dnd / dist-modules / configureDragDropContext.js View on Github external
Object.keys(backendFactories).forEach(function (key) {
    childContextTypes[key] = _React$Component$PropTypes.PropTypes.object.isRequired;
    childContext[key] = new _DragDropManager.DragDropManager(backendFactories[key]);
  });
github cormacrelf / angular-skyhook / packages / angular-dnd / src / internal / manager.ts View on Github external
  return zone.runOutsideAngular(() => new DragDropManager(unpackBackendForEs5Users(backend), context))
}
github jenshaase / vue-react-dnd / src / DragDropContextProvider.vue View on Github external
provide () {
    return {
      dragDropManager: new DragDropManager(this.getBackend(), {
        window: this.getWindow()
      })
    }
  },
  methods: {
github react-page / react-page / packages / core / src / helper / dnd / index.js View on Github external
export default (): DragDropManager => {
  if (defaultManager) {
    return defaultManager
  }

  defaultManager = new DragDropManager(HTML5Backend)
  return defaultManager
}

dnd-core

Drag and drop sans the GUI

MIT
Latest version published 2 years ago

Package Health Score

86 / 100
Full package analysis

Similar packages