Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit 5c0add3

Browse files
committed
build
1 parent a284fd9 commit 5c0add3

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

dist/react-contextmenu.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/context-menu/wrapper.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
2323
var modalStyle = {
2424
position: "fixed",
2525
zIndex: 1040,
26-
top: 0, bottom: 0, left: 0, right: 0
26+
top: 0,
27+
bottom: 0,
28+
left: 0,
29+
right: 0
2730
},
2831
backdropStyle = _extends({}, modalStyle, {
2932
zIndex: "auto",
@@ -49,13 +52,20 @@ var ContextMenuWrapper = _react2.default.createClass({
4952
var wrapper = window.requestAnimationFrame || setTimeout;
5053

5154
wrapper(function () {
52-
return _this.setState(_this.getMenuPosition(nextProps.x, nextProps.y));
55+
_this.setState(_this.getMenuPosition(nextProps.x, nextProps.y));
56+
_this.menu.parentNode.addEventListener("contextmenu", _this.hideMenu);
5357
});
58+
} else {
59+
this.menu.parentNode.removeEventListener("contextmenu", this.hideMenu);
5460
}
5561
},
5662
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
5763
return this.props.isVisible !== nextProps.visible;
5864
},
65+
hideMenu: function hideMenu(e) {
66+
e.preventDefault();
67+
_monitor2.default.hideMenu();
68+
},
5969
getMenuPosition: function getMenuPosition(x, y) {
6070
var scrollX = document.documentElement.scrollTop;
6171
var scrollY = document.documentElement.scrollLeft;

modules/contextmenu-layer.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ exports.default = function (identifier, configure) {
1818

1919
return _react2.default.createClass({
2020
displayName: displayName + "ContextMenuLayer",
21-
mouseDown: false,
2221
getDefaultProps: function getDefaultProps() {
2322
return {
2423
renderTag: "div",
2524
attributes: {}
2625
};
2726
},
27+
28+
mouseDown: false,
2829
handleMouseDown: function handleMouseDown(event) {
2930
var _this = this;
3031

@@ -33,9 +34,7 @@ exports.default = function (identifier, configure) {
3334

3435
this.mouseDown = true;
3536
setTimeout(function () {
36-
if (_this.mouseDown) {
37-
_this.handleContextClick(event);
38-
}
37+
if (_this.mouseDown) _this.handleContextClick(event);
3938
}, this.props.holdToDisplay);
4039
}
4140
},
@@ -46,9 +45,7 @@ exports.default = function (identifier, configure) {
4645

4746
this.mouseDown = true;
4847
setTimeout(function () {
49-
if (_this2.mouseDown) {
50-
_this2.handleContextClick(event);
51-
}
48+
if (_this2.mouseDown) _this2.handleContextClick(event);
5249
}, this.props.holdToDisplay);
5350
},
5451
handleTouchEnd: function handleTouchEnd(event) {
@@ -67,8 +64,8 @@ exports.default = function (identifier, configure) {
6764

6865
event.preventDefault();
6966

70-
var xPos = event.clientX || event.touches[0].pageX;
71-
var yPos = event.clientY || event.touches[0].pageY;
67+
var xPos = event.clientX || event.touches[0].pageX,
68+
yPos = event.clientY || event.touches[0].pageY;
7269

7370
_store2.default.dispatch({
7471
type: "SET_PARAMS",

modules/monitor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ exports.default = {
3232
}
3333
});
3434
}
35-
};
35+
}; /* eslint-disable object-property-newline */

modules/submenu/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ var SubMenu = _react2.default.createClass({
4343
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
4444
return this.state.isVisible !== nextState.visible;
4545
},
46+
componentWillUnmount: function componentWillUnmount() {
47+
if (this.opentimer) clearTimeout(this.opentimer);
48+
49+
if (this.closetimer) clearTimeout(this.closetimer);
50+
},
4651
handleClick: function handleClick(e) {
4752
e.preventDefault();
4853
},
@@ -68,11 +73,6 @@ var SubMenu = _react2.default.createClass({
6873
return _this2.setState({ visible: false });
6974
}, this.props.hoverDelay);
7075
},
71-
componentWillUnmount: function componentWillUnmount() {
72-
if (this.opentimer) clearTimeout(this.opentimer);
73-
74-
if (this.closetimer) clearTimeout(this.closetimer);
75-
},
7676
render: function render() {
7777
var _this3 = this;
7878

0 commit comments

Comments
 (0)