mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add support for oncontextmenu in React.
This commit is contained in:
committed by
Paul O’Shannessy
parent
4eb9487c97
commit
f142b9b99b
@@ -241,6 +241,7 @@ var ReactEventEmitter = merge(ReactEventEmitterMixin, {
|
||||
trapBubbledEvent(topLevelTypes.topMouseOut, 'mouseout', mountAt);
|
||||
trapBubbledEvent(topLevelTypes.topClick, 'click', mountAt);
|
||||
trapBubbledEvent(topLevelTypes.topDoubleClick, 'dblclick', mountAt);
|
||||
trapBubbledEvent(topLevelTypes.topContextMenu, 'contextmenu', mountAt);
|
||||
if (touchNotMouse) {
|
||||
trapBubbledEvent(topLevelTypes.topTouchStart, 'touchstart', mountAt);
|
||||
trapBubbledEvent(topLevelTypes.topTouchEnd, 'touchend', mountAt);
|
||||
|
||||
@@ -32,6 +32,7 @@ var topLevelTypes = keyMirror({
|
||||
topCompositionEnd: null,
|
||||
topCompositionStart: null,
|
||||
topCompositionUpdate: null,
|
||||
topContextMenu: null,
|
||||
topCopy: null,
|
||||
topCut: null,
|
||||
topDoubleClick: null,
|
||||
|
||||
@@ -47,6 +47,12 @@ var eventTypes = {
|
||||
captured: keyOf({onClickCapture: true})
|
||||
}
|
||||
},
|
||||
contextMenu: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onContextMenu: true}),
|
||||
captured: keyOf({onContextMenuCapture: true})
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onCopy: true}),
|
||||
@@ -216,6 +222,7 @@ var eventTypes = {
|
||||
var topLevelEventsToDispatchConfig = {
|
||||
topBlur: eventTypes.blur,
|
||||
topClick: eventTypes.click,
|
||||
topContextMenu: eventTypes.contextMenu,
|
||||
topCopy: eventTypes.copy,
|
||||
topCut: eventTypes.cut,
|
||||
topDoubleClick: eventTypes.doubleClick,
|
||||
@@ -306,6 +313,7 @@ var SimpleEventPlugin = {
|
||||
return null;
|
||||
}
|
||||
/* falls through */
|
||||
case topLevelTypes.topContextMenu:
|
||||
case topLevelTypes.topDoubleClick:
|
||||
case topLevelTypes.topDrag:
|
||||
case topLevelTypes.topDragEnd:
|
||||
|
||||
Reference in New Issue
Block a user