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

Function isFallbackCompositionEnd

code/new-context-api/public/app.js:2601–2618  ·  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

2599 * @return {boolean}
2600 */
2601function isFallbackCompositionEnd(topLevelType, nativeEvent) {
2602 switch (topLevelType) {
2603 case 'topKeyUp':
2604 // Command keys insert or clear IME input.
2605 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
2606 case 'topKeyDown':
2607 // Expect IME keyCode on each keydown. If we get any other
2608 // code we must have exited earlier.
2609 return nativeEvent.keyCode !== START_KEYCODE;
2610 case 'topKeyPress':
2611 case 'topMouseDown':
2612 case 'topBlur':
2613 // Events are not possible without cancelling IME.
2614 return true;
2615 default:
2616 return false;
2617 }
2618}
2619
2620/**
2621 * Google Input Tools provides composition data via a CustomEvent,

Callers 2

extractCompositionEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected