in packages/roosterjs-react-emoji/lib/plugins/EmojiPlugin.tsx [233:258]
private _onKeyUpSuggestingDomEvent(event: PluginDomEvent): void {
if (this._eventHandledOnKeyDown) {
return;
}
const keyboardEvent = event.rawEvent as KeyboardEvent;
// If this is a character key or backspace
// Clear the timer as we will either queue a new timer or stop suggesting
if ((keyboardEvent.key.length === 1 && keyboardEvent.which !== KeyCodes.space) || keyboardEvent.which === KeyCodes.backspace) {
window.clearTimeout(this._timer);
this._timer = null;
}
const wordBeforeCursor = this._getWordBeforeCursor(event);
if (wordBeforeCursor) {
this._timer = window.setTimeout(() => {
if (this._pane) {
this._pane.setSearch(wordBeforeCursor);
this._timer = null;
}
}, EMOJI_SEARCH_DELAY);
} else {
this._setIsSuggesting(false);
}
}