Skip to content

Commit

Permalink
Merge branch 'cbeer-dragAndDropManager'
Browse files Browse the repository at this point in the history
  • Loading branch information
nomcopter committed Aug 3, 2022
2 parents b7990e3 + c572217 commit 734348d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
* default: 'bp3'
*/
blueprintNamespace?: 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 @@ -68,6 +68,7 @@
"@types/webpack": "^3.8.21",
"chai": "^4.3.6",
"css-loader": "^0.28.11",
"dnd-core": "14.0.1",
"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 @@ -58,6 +59,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
* default: 'bp3'
*/
blueprintNamespace?: 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 @@ -217,7 +222,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

0 comments on commit 734348d

Please sign in to comment.