MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / isFallbackCompositionEnd

Function isFallbackCompositionEnd

code/event-handlers/public/app.js:2570–2587  ·  view source on GitHub ↗

* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}

(topLevelType, nativeEvent)

Source from the content-addressed store, hash-verified

2568 * @return {boolean}
2569 */
2570function isFallbackCompositionEnd(topLevelType, nativeEvent) {
2571 switch (topLevelType) {
2572 case 'topKeyUp':
2573 // Command keys insert or clear IME input.
2574 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
2575 case 'topKeyDown':
2576 // Expect IME keyCode on each keydown. If we get any other
2577 // code we must have exited earlier.
2578 return nativeEvent.keyCode !== START_KEYCODE;
2579 case 'topKeyPress':
2580 case 'topMouseDown':
2581 case 'topBlur':
2582 // Events are not possible without cancelling IME.
2583 return true;
2584 default:
2585 return false;
2586 }
2587}
2588
2589/**
2590 * Google Input Tools provides composition data via a CustomEvent,

Callers 2

extractCompositionEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected