diff --git a/packages/markups/src/elements/Emoji.js b/packages/markups/src/elements/Emoji.js
index af1b13401..344696b9a 100644
--- a/packages/markups/src/elements/Emoji.js
+++ b/packages/markups/src/elements/Emoji.js
@@ -14,14 +14,26 @@ const Emoji = ({ big = false, emoji }) => {
[emoji]
);
- const emojiHtml = big
- ? emojione.toImage(fallback).replace('joypixels', 'joypixels_BigEmoji')
- : emojione.toImage(fallback);
+ let emojiHtml;
+
+ if (!emoji.unicode) {
+ emojiHtml = big
+ ? emojione.toImage(fallback).replace('joypixels', 'joypixels_BigEmoji')
+ : emojione.toImage(fallback);
+ }
+
+ if ('unicode' in emoji) {
+ emojiHtml = emoji.unicode;
+ }
return (
);
diff --git a/packages/markups/src/elements/elements.styles.js b/packages/markups/src/elements/elements.styles.js
index 31497a651..8e351b368 100644
--- a/packages/markups/src/elements/elements.styles.js
+++ b/packages/markups/src/elements/elements.styles.js
@@ -59,7 +59,6 @@ export const EmojiStyles = {
img.joypixels {
height: 1.5rem;
width: 1.5rem;
- image-rendering: pixelated;
font-size: inherit;
vertical-align: middle;
}
@@ -67,7 +66,6 @@ export const EmojiStyles = {
img.joypixels_BigEmoji {
height: 2.25rem;
width: 2.25rem;
- image-rendering: pixelated;
font-size: inherit;
}
`,
diff --git a/packages/react/src/views/ChatInput/ChatInput.styles.js b/packages/react/src/views/ChatInput/ChatInput.styles.js
index b193d0692..2add976bd 100644
--- a/packages/react/src/views/ChatInput/ChatInput.styles.js
+++ b/packages/react/src/views/ChatInput/ChatInput.styles.js
@@ -151,9 +151,11 @@ export const getInsertLinkModalStyles = (theme) => {
inputWithFormattingBox: css`
border: 1px solid ${theme.colors.border};
border-radius: ${theme.radius};
- margin: 0.5rem 1rem;
- &.focused {
- border: ${`1.5px solid ${theme.colors.ring}`};
+ margin: 0rem 1rem 0.5rem 1rem;
+ transition: border 0.3s ease;
+
+ &:focus {
+ border: 1.5px solid ${theme.colors.ring};
}
`,
modalHeader: css`
diff --git a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js
index 5d8c20a60..472af572d 100644
--- a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js
+++ b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js
@@ -60,10 +60,14 @@ const ChatInputFormattingToolbar = ({
};
const handleEmojiClick = (emojiEvent) => {
const [emoji] = emojiEvent.names;
- const message = `${messageRef.current.value} :${emoji.replace(
+ const start = messageRef.current.selectionStart;
+ const end = messageRef.current.selectionEnd;
+ const msg = messageRef.current.value;
+ const message = `${msg.slice(0, start)}:${emoji.replace(
/[\s-]+/g,
'_'
- )}: `;
+ )}: ${msg.slice(end)}`;
+
triggerButton?.(null, message);
};
@@ -83,6 +87,7 @@ const ChatInputFormattingToolbar = ({
setInsertLinkOpen(false);
};
+ const isTyping = messageRef.current?.value.length > 0;
const chatToolMap = {
emoji:
isPopoverOpen && popOverItems.includes('emoji') ? (
@@ -119,7 +124,7 @@ const ChatInputFormattingToolbar = ({
displayName={
isPopoverOpen && popOverItems.includes('audio') ? 'audio' : null
}
- disabled={isRecordingMessage}
+ disabled={isRecordingMessage || isTyping}
popOverItemStyles={styles.popOverItemStyles}
/>
),
@@ -129,7 +134,7 @@ const ChatInputFormattingToolbar = ({
isPopoverOpen && popOverItems.includes('video') ? 'video' : null
}
popOverItemStyles={styles.popOverItemStyles}
- disabled={isRecordingMessage}
+ disabled={isRecordingMessage || isTyping}
/>
),
file:
@@ -137,9 +142,9 @@ const ChatInputFormattingToolbar = ({
{
- if (isRecordingMessage) return;
+ if (isRecordingMessage || isTyping) return;
handleClickToOpenFiles();
}}
>
@@ -151,7 +156,7 @@ const ChatInputFormattingToolbar = ({
{
if (isRecordingMessage) return;
handleClickToOpenFiles();
@@ -343,8 +348,8 @@ const ChatInputFormattingToolbar = ({
onClose={() => setEmojiOpen(false)}
positionStyles={css`
position: absolute;
- bottom: 7rem;
- left: 0.7rem;
+ bottom: 8.5rem;
+ left: 2rem;
`}
/>
)}
diff --git a/packages/react/src/views/ChatInput/InsertLinkToolBox.js b/packages/react/src/views/ChatInput/InsertLinkToolBox.js
index 49e8e0d4a..172ec20b2 100644
--- a/packages/react/src/views/ChatInput/InsertLinkToolBox.js
+++ b/packages/react/src/views/ChatInput/InsertLinkToolBox.js
@@ -1,5 +1,13 @@
import React, { useState } from 'react';
-import { Modal, Input, Button, useTheme } from '@embeddedchat/ui-elements';
+import {
+ Modal,
+ Input,
+ Button,
+ useTheme,
+ Icon,
+ Box,
+} from '@embeddedchat/ui-elements';
+import { css } from '@emotion/react';
import { getInsertLinkModalStyles } from './ChatInput.styles';
const InsertLinkToolBox = ({
@@ -9,7 +17,7 @@ const InsertLinkToolBox = ({
}) => {
const { theme } = useTheme();
const styles = getInsertLinkModalStyles(theme);
- const [linkText, setLinkText] = useState(selectedText || 'Text');
+ const [linkText, setLinkText] = useState(selectedText);
const [linkUrl, setLinkUrl] = useState(null);
const handleLinkTextOnChange = (e) => {
@@ -18,26 +26,86 @@ const InsertLinkToolBox = ({
const handleLinkUrlOnChange = (e) => {
setLinkUrl(e.target.value);
};
+ const handleKeyDown = (e) => {
+ if (e.key === 'Enter') {
+ handleAddLink(linkText, linkUrl);
+ }
+ };
return (
-
-
- Add link
+
+
+ {' '}
+ Add Link
-
-
-
+
+
+
+ {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
+
+
+
+
+ {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
+
+
+
+