diff --git a/res/css/views/rooms/_MessageComposer.scss b/res/css/views/rooms/_MessageComposer.scss
index 7b223be3a4c..c1cda7bf24c 100644
--- a/res/css/views/rooms/_MessageComposer.scss
+++ b/res/css/views/rooms/_MessageComposer.scss
@@ -214,8 +214,12 @@ limitations under the License.
mask-image: url('$(res)/img/feather-customised/video.svg');
}
+.mx_MessageComposer_emoji::before {
+ mask-image: url('$(res)/img/feather-customised/emoji3.custom.svg');
+}
+
.mx_MessageComposer_stickers::before {
- mask-image: url('$(res)/img/feather-customised/face.svg');
+ mask-image: url('$(res)/img/feather-customised/sticker.custom.svg');
}
.mx_MessageComposer_formatting {
diff --git a/res/img/feather-customised/emoji3.custom.svg b/res/img/feather-customised/emoji3.custom.svg
new file mode 100644
index 00000000000..d91ba1c132d
--- /dev/null
+++ b/res/img/feather-customised/emoji3.custom.svg
@@ -0,0 +1,6 @@
+
diff --git a/res/img/feather-customised/sticker.custom.svg b/res/img/feather-customised/sticker.custom.svg
new file mode 100644
index 00000000000..691e3b39256
--- /dev/null
+++ b/res/img/feather-customised/sticker.custom.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js
index 732df3dbbf1..5cb59f7b840 100644
--- a/src/components/views/rooms/MessageComposer.js
+++ b/src/components/views/rooms/MessageComposer.js
@@ -27,6 +27,7 @@ import { makeRoomPermalink } from '../../../utils/permalinks/Permalinks';
import ContentMessages from '../../../ContentMessages';
import E2EIcon from './E2EIcon';
import SettingsStore from "../../../settings/SettingsStore";
+import {aboveLeftOf, ContextMenu, ContextMenuButton, useContextMenu} from "../../structures/ContextMenu";
function ComposerAvatar(props) {
const MemberStatusMessageAvatar = sdk.getComponent('avatars.MemberStatusMessageAvatar');
@@ -103,6 +104,32 @@ HangupButton.propTypes = {
roomId: PropTypes.string.isRequired,
};
+const EmojiButton = ({addEmoji}) => {
+ const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu();
+
+ let contextMenu;
+ if (menuDisplayed) {
+ const buttonRect = button.current.getBoundingClientRect();
+ const EmojiPicker = sdk.getComponent('emojipicker.EmojiPicker');
+ contextMenu =
+
+ ;
+ }
+
+ return
+
+
+
+
+ { contextMenu }
+ ;
+};
+
class UploadButton extends React.Component {
static propTypes = {
roomId: PropTypes.string.isRequired,
@@ -312,6 +339,13 @@ export default class MessageComposer extends React.Component {
}
}
+ addEmoji(emoji) {
+ dis.dispatch({
+ action: "insert_emoji",
+ emoji,
+ });
+ }
+
render() {
const controls = [
this.state.me ? : null,
@@ -335,8 +369,9 @@ export default class MessageComposer extends React.Component {
room={this.props.room}
placeholder={this.renderPlaceholderText()}
permalinkCreator={this.props.permalinkCreator} />,
- ,
,
+ ,
+ ,
);
if (this.state.showCallButtons) {
diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js
index 30f62c55f88..3098c62433f 100644
--- a/src/components/views/rooms/SendMessageComposer.js
+++ b/src/components/views/rooms/SendMessageComposer.js
@@ -373,6 +373,9 @@ export default class SendMessageComposer extends React.Component {
case 'quote':
this._insertQuotedMessage(payload.event);
break;
+ case 'insert_emoji':
+ this._insertEmoji(payload.emoji);
+ break;
}
};
@@ -410,6 +413,17 @@ export default class SendMessageComposer extends React.Component {
this._editorRef && this._editorRef.focus();
}
+ _insertEmoji = (emoji) => {
+ const {model} = this;
+ const {partCreator} = model;
+ const caret = this._editorRef.getCaret();
+ const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
+ model.transform(() => {
+ const addedLen = model.insert([partCreator.plain(emoji)], position);
+ return model.positionForOffset(caret.offset + addedLen, true);
+ });
+ };
+
_onPaste = (event) => {
const {clipboardData} = event;
if (clipboardData.files.length) {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index e866ea638d4..476755e0df8 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -1091,6 +1091,7 @@
"Voice call": "Voice call",
"Video call": "Video call",
"Hangup": "Hangup",
+ "Emoji picker": "Emoji picker",
"Upload file": "Upload file",
"Send an encrypted reply…": "Send an encrypted reply…",
"Send a reply…": "Send a reply…",