Skip to content

Commit 1bfa3d2

Browse files
committed
Fix ref issue of Draggable
related to #250
1 parent 7bf2df0 commit 1bfa3d2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

app/components/Draggable.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,23 @@ export default class Draggable extends PureComponent {
2626

2727
onUp = evt => {
2828
evt.preventDefault();
29-
const doc = this.node.ownerDocument;
30-
doc.removeEventListener('mousemove', this.onMove);
31-
doc.removeEventListener('mouseup', this.onUp);
29+
document.removeEventListener('mousemove', this.onMove);
30+
document.removeEventListener('mouseup', this.onUp);
3231
if (this.props.onStop) {
3332
this.props.onStop();
3433
}
3534
};
3635

37-
onRef = ref => (this.node = ref);
38-
3936
startDragging = evt => {
4037
evt.preventDefault();
41-
const doc = this.node.ownerDocument;
42-
doc.addEventListener('mousemove', this.onMove);
43-
doc.addEventListener('mouseup', this.onUp);
38+
document.addEventListener('mousemove', this.onMove);
39+
document.addEventListener('mouseup', this.onUp);
4440
if (this.props.onStart) {
4541
this.props.onStart();
4642
}
4743
};
4844

4945
render() {
50-
return <div ref={this.onRef} style={styles.draggable} onMouseDown={this.startDragging} />;
46+
return <div style={styles.draggable} onMouseDown={this.startDragging} />;
5147
}
5248
}

webpack/main.prod.babel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
new webpack.optimize.ModuleConcatenationPlugin(),
2121
],
2222
optimization: {
23+
minimize: true,
2324
minimizer: [
2425
new UglifyJsPlugin({
2526
sourceMap: true,

webpack/renderer.prod.babel.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ const baseProdConfig = {
2929
new webpack.optimize.ModuleConcatenationPlugin(),
3030
],
3131
optimization: {
32+
minimize: true,
3233
minimizer: [
3334
new UglifyJsPlugin({
3435
sourceMap: true,
35-
uglifyOptions: { output: { comments: false } },
36+
uglifyOptions: {
37+
output: { comments: false },
38+
},
3639
}),
3740
],
3841
},

0 commit comments

Comments
 (0)