Skip to content

Commit 08b4bee

Browse files
committed
Changed prop name to "disableIfShiftIsPressed" and updated the api doc
1 parent 3d5d3f8 commit 08b4bee

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

docs/api.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ Contextmenu Trigger Component
2727

2828
#### PropTypes
2929

30-
| Property | Type | Required? | Default | Description |
31-
|---------------|-------------------------|-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
32-
| id | String || | The unique identifier of the menu to be called. |
33-
| attributes | Object | | | The attributes will be passed directly passed to the root element of component. Use this to customize it like adding custom classes, adding `colspan` etc. |
34-
| collect | Function | | | A simple function which takes `props` as input and returns the data to be passed to contextmenu. |
35-
| disable | Boolean | | `false` | Prop to ignore right clicks and display the default browser context menu. |
36-
| holdToDisplay | Number | | `1000` | This is applicable only for touch screens. The time (in ms) for which, user has to hold down his/her finger before the menu is shown. **Note:** To disable the long press trigger on left-click just set a negative holdToDisplay value such as `-1` |
37-
| renderTag | String or React Element | | | The element inside which the Component must be wrapped. By default `div` is used. But this prop can used to customize it. |
30+
| Property | Type | Required? | Default | Description |
31+
|-------------------------|-------------------------|-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
32+
| id | String || | The unique identifier of the menu to be called. |
33+
| attributes | Object | | | The attributes will be passed directly passed to the root element of component. Use this to customize it like adding custom classes, adding `colspan` etc. |
34+
| collect | Function | | | A simple function which takes `props` as input and returns the data to be passed to contextmenu. |
35+
| disable | Boolean | | `false` | Prop to ignore right clicks and display the default browser context menu. |
36+
| holdToDisplay | Number | | `1000` | This is applicable only for touch screens. The time (in ms) for which, user has to hold down his/her finger before the menu is shown. **Note:** To disable the long press trigger on left-click just set a negative holdToDisplay value such as `-1` |
37+
| renderTag | String or React Element | | | The element inside which the Component must be wrapped. By default `div` is used. But this prop can used to customize it. |
38+
| disableIfShiftIsPressed | Boolean | | `false` | If true and shift is pressed, it will open the native browser context menu and ignore this custom component |
3839

3940
### `<MenuItem />`
4041

src/ContextMenuTrigger.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class ContextMenuTrigger extends Component {
2020
PropTypes.node,
2121
PropTypes.func
2222
]),
23-
disableOnShiftPressed: PropTypes.bool
23+
disableIfShiftIsPressed: PropTypes.bool
2424
};
2525

2626
static defaultProps = {
@@ -31,7 +31,7 @@ export default class ContextMenuTrigger extends Component {
3131
renderTag: 'div',
3232
posX: 0,
3333
posY: 0,
34-
disableOnShiftPressed: false
34+
disableIfShiftIsPressed: false
3535
};
3636

3737
touchHandled = false;
@@ -96,7 +96,7 @@ export default class ContextMenuTrigger extends Component {
9696

9797
handleContextClick = (event) => {
9898
if (this.props.disable) return;
99-
if (this.props.disableOnShiftPressed && event.shiftKey) return;
99+
if (this.props.disableIfShiftIsPressed && event.shiftKey) return;
100100

101101
event.preventDefault();
102102
event.stopPropagation();

0 commit comments

Comments
 (0)