diff --git a/packages/chat-sdk/src/components/SendMessage.tsx b/packages/chat-sdk/src/components/SendMessage.tsx index cf518be3c..2aba35662 100644 --- a/packages/chat-sdk/src/components/SendMessage.tsx +++ b/packages/chat-sdk/src/components/SendMessage.tsx @@ -306,7 +306,7 @@ export const SendMessage = ({ )} - + {pluginMenuOpen ? (
diff --git a/packages/chat-sdk/src/components/messageInput/MessageInput.tsx b/packages/chat-sdk/src/components/messageInput/MessageInput.tsx index 801cd6f93..6687f1068 100644 --- a/packages/chat-sdk/src/components/messageInput/MessageInput.tsx +++ b/packages/chat-sdk/src/components/messageInput/MessageInput.tsx @@ -21,15 +21,24 @@ export const chatMessageInputId = "backpack-message-input"; export function MessageInput({ setPluginMenuOpen, autoFocus = true, + onMediaSelect }: { setPluginMenuOpen: any; autoFocus?: boolean; + onMediaSelect: any; }) { const classes = useStyles(); const theme = useCustomTheme(); const { type, remoteUsername, activeReply } = useChatContext(); const { activeSearch } = useContext(RichMentionsContext); + const uploadFromClipboard = (e:React.ClipboardEvent):void => { + if(e.clipboardData.files.length > 0) { + let file = e.clipboardData.files[0]; + onMediaSelect(file) + } + } + useEffect(() => { if (autoFocus) { const messageElement = document.getElementById(chatMessageInputId); @@ -51,6 +60,7 @@ export function MessageInput({ }} className={classes.input} onClick={() => setPluginMenuOpen(false)} + onPaste={(e) => uploadFromClipboard(e)} placeholder={ type === "individual" ? `Message @${remoteUsername}`