Skip to content

Commit 087b07a

Browse files
committed
Add ability to add onMouseDown extra functionality
1 parent 960970f commit 087b07a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/draggable.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,13 @@ module.exports = React.createClass({
239239
* }
240240
* ```
241241
*/
242-
onStop: React.PropTypes.func
242+
onStop: React.PropTypes.func,
243+
244+
/**
245+
* A workaround option which can be passed if onMouseDown needs to be accessed, since it'll always be blocked (due to that there's internal use of onMouseDown)
246+
*
247+
*/
248+
onMouseDown: React.PropTypes.func
243249
},
244250

245251
componentWillUnmount: function() {
@@ -261,7 +267,8 @@ module.exports = React.createClass({
261267
zIndex: NaN,
262268
onStart: emptyFunction,
263269
onDrag: emptyFunction,
264-
onStop: emptyFunction
270+
onStop: emptyFunction,
271+
onMouseDown: emptyFunction
265272
};
266273
},
267274

@@ -282,6 +289,9 @@ module.exports = React.createClass({
282289
},
283290

284291
handleMouseDown: function (e) {
292+
// Make it possible to attach event handlers on top of this one
293+
this.props.onMouseDown(e);
294+
285295
var node = this.getDOMNode();
286296

287297
// Short circuit if handle or cancel prop was provided and selector doesn't match

0 commit comments

Comments
 (0)