Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
* default: Random UUID
*/
mosaicId?: string;
/**
* Override the react-dnd provider to allow applications to inject an existing drag and drop context
*/
dragAndDropManager?: DragDropManager | undefined;
}

export interface MosaicControlledProps<T extends MosaicKey> extends MosaicBaseProps<T> {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/webpack": "^3.8.18",
"chai": "^4.2.0",
"css-loader": "^0.28.11",
"dnd-core": "^10.0.2",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^2.30.1",
Expand Down
11 changes: 10 additions & 1 deletion src/Mosaic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import { DragDropManager } from 'dnd-core';
import countBy from 'lodash/countBy';
import keys from 'lodash/keys';
import pickBy from 'lodash/pickBy';
Expand Down Expand Up @@ -52,6 +53,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
* default: Random UUID
*/
mosaicId?: string;
/**
* Override the react-dnd provider to allow applications to inject an existing drag and drop context
*/
dragAndDropManager?: DragDropManager | undefined;
}

export interface MosaicControlledProps<T extends MosaicKey> extends MosaicBaseProps<T> {
Expand Down Expand Up @@ -209,7 +214,11 @@ export class MosaicWithoutDragDropContext<T extends MosaicKey = string> extends
export class Mosaic<T extends MosaicKey = string> extends React.PureComponent<MosaicProps<T>> {
render() {
return (
<DndProvider backend={MultiBackend} options={HTML5ToTouch}>
<DndProvider
backend={MultiBackend}
options={HTML5ToTouch}
{...(this.props.dragAndDropManager && { manager: this.props.dragAndDropManager })}
>
<MosaicWithoutDragDropContext<T> {...this.props} />
</DndProvider>
);
Expand Down