(suggestion: RenderedSuggestion, leftoverText = '')
| 554 | } |
| 555 | |
| 556 | onSelected(suggestion: RenderedSuggestion, leftoverText = '') { |
| 557 | const { selection } = this.props |
| 558 | const node = suggestion.node.clone() |
| 559 | if (suggestion.hasOverrideLocation()) { |
| 560 | if (suggestion.wrapChildSetId) { |
| 561 | selection.wrapNode( |
| 562 | suggestion.overrideLocationChildSet, |
| 563 | suggestion.overrideLocationIndex, |
| 564 | node, |
| 565 | suggestion.wrapChildSetId |
| 566 | ) |
| 567 | } else { |
| 568 | selection.insertNodeByChildSet(suggestion.overrideLocationChildSet, suggestion.overrideLocationIndex, node) |
| 569 | } |
| 570 | } else if (suggestion.wrapChildSetId) { |
| 571 | selection.wrapNode(suggestion.childSet, suggestion.index - 1, node, suggestion.wrapChildSetId) |
| 572 | } else { |
| 573 | selection.insertNodeByChildSet(suggestion.childSet, suggestion.index, node) |
| 574 | } |
| 575 | this.setState({ userInput: leftoverText }) |
| 576 | } |
| 577 | |
| 578 | // Event fired when the user clicks on a suggestion |
| 579 | onClickSuggestion = (suggestion: RenderedSuggestion) => { |
no test coverage detected