fix(chat): added emoji tooltip and enter key in smiley panel

This commit is contained in:
ilaydadastan
2024-03-29 02:13:31 +02:00
committed by Дамян Минков
parent 4e50546773
commit 38be09fc54

View File

@@ -1,6 +1,7 @@
import React, { PureComponent } from 'react';
import Emoji from 'react-emoji-render';
import Tooltip from '../../../base/tooltip/components/Tooltip';
import { smileys } from '../../smileys';
/**
@@ -60,7 +61,7 @@ class SmileysPanel extends PureComponent<IProps> {
* @returns {void}
*/
_onKeyPress(e: React.KeyboardEvent<HTMLDivElement>) {
if (e.key === ' ') {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault(); // @ts-ignore
this.props.onSmileySelect(e.target.id && smileys[e.target.id]);
}
@@ -95,9 +96,11 @@ class SmileysPanel extends PureComponent<IProps> {
onKeyPress = { this._onKeyPress }
role = 'option'
tabIndex = { 0 }>
<Emoji
onlyEmojiClassName = 'smiley'
text = { smileys[smileyKey as keyof typeof smileys] } />
<Tooltip content = { smileys[smileyKey as keyof typeof smileys] }>
<Emoji
onlyEmojiClassName = 'smiley'
text = { smileys[smileyKey as keyof typeof smileys] } />
</Tooltip>
</div>
));