fixed pasting files and images
This commit is contained in:
@@ -199,7 +199,7 @@ export function blobToBase64(blob) {
|
||||
// File pasted from the clipboard. It's either an inline image or a file attachment.
|
||||
export function filePasted(event, onImageSuccess, onAttachmentSuccess, onError) {
|
||||
const items = (event.clipboardData || event.originalEvent.clipboardData || {}).items;
|
||||
if (!Array.isArray(items)) {
|
||||
if (!items || !items.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,12 +104,8 @@ class SendMessage extends React.PureComponent {
|
||||
}
|
||||
// FIXME: handle large files too.
|
||||
if (filePasted(e,
|
||||
(bits, mime, width, height, fname) => {
|
||||
this.props.onAttachImage(mime, bits, width, height, fname);
|
||||
},
|
||||
(mime, bits, fname) => {
|
||||
this.props.onAttachFile(mime, bits, fname);
|
||||
},
|
||||
file => { this.props.onAttachImage(file); },
|
||||
file => { this.props.onAttachFile(file); },
|
||||
this.props.onError)) {
|
||||
|
||||
// If a file was pasted, don't paste base64 data into input field.
|
||||
|
||||
Reference in New Issue
Block a user