From 601e8209d8ad53e5f807f4342394896a09fd8196 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 10 Jun 2020 21:48:39 +0100 Subject: [PATCH] Prioritize text on the clipboard over file Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/SendMessageComposer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js index 25ad192ea4..130135f641 100644 --- a/src/components/views/rooms/SendMessageComposer.js +++ b/src/components/views/rooms/SendMessageComposer.js @@ -427,7 +427,9 @@ export default class SendMessageComposer extends React.Component { _onPaste = (event) => { const {clipboardData} = event; - if (clipboardData.files.length) { + // Prioritize text on the clipboard over files as Office on macOS puts a bitmap + // in the clipboard as well as the content being copied. + if (clipboardData.files.length && !clipboardData.types.some(t => t === "text/plain")) { // This actually not so much for 'files' as such (at time of writing // neither chrome nor firefox let you paste a plain file copied // from Finder) but more images copied from a different website