}
function pickEmoji(e, roomId, eventId, roomTimeline) {
+ const boxInfo = e.target.getBoundingClientRect();
openEmojiBoard({
- x: e.detail ? e.clientX : '50%',
- y: e.detail ? e.clientY : '50%',
+ x: boxInfo.x,
+ y: boxInfo.y,
detail: e.detail,
}, (emoji) => {
toggleEmoji(roomId, eventId, emoji.unicode, roomTimeline);
iconSrc={EmojiAddIC}
onClick={(e) => pickEmoji(e, roomId, mEvent.getId(), roomTimeline)}
>
- Add reaciton
+ Add reaction
</MenuItem>
<MenuItem
iconSrc={ReplyArrowIC}
<div ref={rightOptionsRef} className="channel-input__option-container">
<IconButton
onClick={(e) => {
+ const boxInfo = e.target.getBoundingClientRect();
openEmojiBoard({
- x: '10%',
- y: 300,
- isReverse: true,
+ x: boxInfo.x + (document.dir === 'rtl' ? -80 : 80),
+ y: boxInfo.y - 250,
detail: e.detail,
}, addEmoji);
}}
return;
}
- const x = typeof cords.x === 'string' ? cords.x : `${cords.x}px`;
- const y = typeof cords.y === 'string' ? cords.y : `${cords.y}px`;
-
- openerRef.current.style.left = cords.isReverse ? 'unset' : x;
- openerRef.current.style.top = cords.isReverse ? 'unset' : y;
- openerRef.current.style.right = cords.isReverse ? x : 'unset';
- openerRef.current.style.bottom = cords.isReverse ? y : 'unset';
+ openerRef.current.style.transform = `translate(${cords.x}px, ${cords.y}px)`;
requestCallback = requestEmojiCallback;
openerRef.current.click();
}