Commit 28b51f75 authored by Kim Alvefur's avatar Kim Alvefur Committed by JC Brand

Support sending files from clipboard (fixes #1585)

parent 3bd8c6db
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
- #1576: Converse gets stuck with spinner when logging out with `auto_login` set to `true` - #1576: Converse gets stuck with spinner when logging out with `auto_login` set to `true`
- #1579: Trim spaces at the beginning and end of a JID (when adding contact) - #1579: Trim spaces at the beginning and end of a JID (when adding contact)
- #1586: Not possible to kick someone with a space in their nickname - #1586: Not possible to kick someone with a space in their nickname
- #1585: Upload files by pasting from clipboard
### Breaking changes ### Breaking changes
......
...@@ -972,6 +972,15 @@ converse.plugins.add('converse-chatview', { ...@@ -972,6 +972,15 @@ converse.plugins.add('converse-chatview', {
}, },
onPaste (ev) { onPaste (ev) {
if (ev.clipboardData.files.length !== 0) {
ev.preventDefault();
// Workaround for quirk in at least Firefox 60.7 ESR:
// It seems that pasted files disappear from the event payload after
// the event has finished, which apparently happens during async
// processing in sendFiles(). So we copy the array here.
this.model.sendFiles(Array.from(ev.clipboardData.files));
return;
}
this.updateCharCounter(ev.clipboardData.getData('text/plain')); this.updateCharCounter(ev.clipboardData.getData('text/plain'));
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment