Composer / Attachement: Fix multiple paste (#1014)

This commit is contained in:
Alexander Zinchuk 2021-04-16 14:48:18 +03:00
parent 747a3cc5bd
commit 2ddd3a3087

View File

@ -2,7 +2,7 @@ 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 } from '../../../../config'; 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,8 +18,8 @@ export default (
return; return;
} }
const input = document.getElementById(EDITABLE_INPUT_ID); const input = document.activeElement;
if (input !== document.activeElement) { if (!input || ![EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID].includes(input.id)) {
return; return;
} }