Skip to content

Commit 734348d

Browse files
committed
Merge branch 'cbeer-dragAndDropManager'
2 parents b7990e3 + c572217 commit 734348d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
206206
* default: 'bp3'
207207
*/
208208
blueprintNamespace?: string;
209+
/**
210+
* Override the react-dnd provider to allow applications to inject an existing drag and drop context
211+
*/
212+
dragAndDropManager?: DragDropManager | undefined;
209213
}
210214

211215
export interface MosaicControlledProps<T extends MosaicKey> extends MosaicBaseProps<T> {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"@types/webpack": "^3.8.21",
6969
"chai": "^4.3.6",
7070
"css-loader": "^0.28.11",
71+
"dnd-core": "14.0.1",
7172
"file-loader": "^1.1.11",
7273
"html-loader": "^0.5.5",
7374
"html-webpack-plugin": "^2.30.1",

src/Mosaic.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import classNames from 'classnames';
2+
import { DragDropManager } from 'dnd-core';
23
import countBy from 'lodash/countBy';
34
import keys from 'lodash/keys';
45
import pickBy from 'lodash/pickBy';
@@ -58,6 +59,10 @@ export interface MosaicBaseProps<T extends MosaicKey> {
5859
* default: 'bp3'
5960
*/
6061
blueprintNamespace?: string;
62+
/**
63+
* Override the react-dnd provider to allow applications to inject an existing drag and drop context
64+
*/
65+
dragAndDropManager?: DragDropManager | undefined;
6166
}
6267

6368
export interface MosaicControlledProps<T extends MosaicKey> extends MosaicBaseProps<T> {
@@ -217,7 +222,11 @@ export class MosaicWithoutDragDropContext<T extends MosaicKey = string> extends
217222
export class Mosaic<T extends MosaicKey = string> extends React.PureComponent<MosaicProps<T>> {
218223
render() {
219224
return (
220-
<DndProvider backend={MultiBackend} options={HTML5ToTouch}>
225+
<DndProvider
226+
backend={MultiBackend}
227+
options={HTML5ToTouch}
228+
{...(this.props.dragAndDropManager && { manager: this.props.dragAndDropManager })}
229+
>
221230
<MosaicWithoutDragDropContext<T> {...this.props} />
222231
</DndProvider>
223232
);

0 commit comments

Comments
 (0)