Composer / Attachment: Allow pasting without focus on input (#1040)
This commit is contained in:
parent
648d2ea23f
commit
97bbfbfa94
@ -2,7 +2,6 @@ import { StateHookSetter, useEffect } from '../../../../lib/teact/teact';
|
|||||||
import { ApiAttachment, ApiMessage } from '../../../../api/types';
|
import { ApiAttachment, ApiMessage } from '../../../../api/types';
|
||||||
|
|
||||||
import buildAttachment from '../helpers/buildAttachment';
|
import buildAttachment from '../helpers/buildAttachment';
|
||||||
import { EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID } from '../../../../config';
|
|
||||||
|
|
||||||
const CLIPBOARD_ACCEPTED_TYPES = ['image/png', 'image/jpeg', 'image/gif'];
|
const CLIPBOARD_ACCEPTED_TYPES = ['image/png', 'image/jpeg', 'image/gif'];
|
||||||
const MAX_MESSAGE_LENGTH = 4096;
|
const MAX_MESSAGE_LENGTH = 4096;
|
||||||
@ -18,11 +17,6 @@ export default (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = document.activeElement;
|
|
||||||
if (!input || ![EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID].includes(input.id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { items } = e.clipboardData;
|
const { items } = e.clipboardData;
|
||||||
const media = Array.from(items).find((item) => CLIPBOARD_ACCEPTED_TYPES.includes(item.type));
|
const media = Array.from(items).find((item) => CLIPBOARD_ACCEPTED_TYPES.includes(item.type));
|
||||||
const file = media && media.getAsFile();
|
const file = media && media.getAsFile();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user