* Enables IME composition handling. * Dynamically loads the InputComposition feature and sets up event listeners. * @private
()
| 1514 | * @private |
| 1515 | */ |
| 1516 | _enableComposition() { |
| 1517 | if (this._composition) { |
| 1518 | return; |
| 1519 | } |
| 1520 | const setup = (FeatureClass: typeof InputComposition) => { |
| 1521 | this._composition = new FeatureClass({ |
| 1522 | getInputEl: () => this.getInputDOMRefSync(), |
| 1523 | updateCompositionState: (isComposing: boolean) => { |
| 1524 | this._isComposing = isComposing; |
| 1525 | }, |
| 1526 | }); |
| 1527 | this._composition.addEventListeners(); |
| 1528 | }; |
| 1529 | |
| 1530 | if (Input.composition) { |
| 1531 | setup(Input.composition); |
| 1532 | } else { |
| 1533 | import("./features/InputComposition.js").then(CompositionModule => { |
| 1534 | Input.composition = CompositionModule.default; |
| 1535 | setup(CompositionModule.default); |
| 1536 | }); |
| 1537 | } |
| 1538 | } |
| 1539 | |
| 1540 | acceptSuggestion(item: IInputSuggestionItemSelectable, keyboardUsed: boolean) { |
| 1541 | if (this._isGroupItem(item)) { |