Composer: Don't steal pasted content (#1044)
This commit is contained in:
parent
4df0f08365
commit
5b8c34fc9b
@ -2,6 +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, 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;
|
||||||
@ -17,6 +18,11 @@ export default (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const input = document.activeElement;
|
||||||
|
if (input && input.tagName === '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