mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-32576] Text copied from Microsoft OneNote pastes as an image (v2) (#23530)
* [MM-32576] Text copied from Microsoft OneNote pastes as an image * [MM-32576] Text copied from Microsoft OneNote pastes as an image (linter and tests fix) * [MM-32576] Text copied from Microsoft OneNote pastes as an image (E2E tests fix: mock clipboardData.getData()) --------- Co-authored-by: Andrey Karavashkin <akaravashkin@stsoft.ru>
This commit is contained in:
parent
7b0b0d8609
commit
56a0becbca
@ -140,6 +140,7 @@ describe('Upload Files - Settings', () => {
|
||||
},
|
||||
}],
|
||||
types: [],
|
||||
getData: () => {},
|
||||
}});
|
||||
|
||||
// * An error should be visible saying 'File attachments are disabled'
|
||||
@ -165,6 +166,7 @@ describe('Upload Files - Settings', () => {
|
||||
},
|
||||
}],
|
||||
types: [],
|
||||
getData: () => {},
|
||||
}});
|
||||
|
||||
// * An error should be visible saying 'File attachments are disabled'
|
||||
|
@ -41,6 +41,7 @@ describe('Paste Image', () => {
|
||||
},
|
||||
}],
|
||||
types: [],
|
||||
getData: () => {},
|
||||
}});
|
||||
|
||||
cy.uiWaitForFileUploadPreview();
|
||||
|
@ -206,7 +206,7 @@ describe('components/FileUpload', () => {
|
||||
event.preventDefault = jest.fn();
|
||||
const getAsFile = jest.fn().mockReturnValue(new File(['test'], 'test.png'));
|
||||
const file = {getAsFile, kind: 'file', name: 'test.png'};
|
||||
(event as any).clipboardData = {items: [file], types: ['image/png']};
|
||||
(event as any).clipboardData = {items: [file], types: ['image/png'], getData: () => {}};
|
||||
|
||||
const wrapper = shallowWithIntl(
|
||||
<FileUpload
|
||||
@ -229,7 +229,7 @@ describe('components/FileUpload', () => {
|
||||
const event = new Event('paste');
|
||||
event.preventDefault = jest.fn();
|
||||
const getAsString = jest.fn();
|
||||
(event as any).clipboardData = {items: [{getAsString, kind: 'string', type: 'text/plain'}], types: ['text/plain']};
|
||||
(event as any).clipboardData = {items: [{getAsString, kind: 'string', type: 'text/plain'}], types: ['text/plain'], getData: () => {}};
|
||||
|
||||
const wrapper = shallowWithIntl(
|
||||
<FileUpload
|
||||
|
@ -18,7 +18,6 @@ import {
|
||||
isIosChrome,
|
||||
isMobileApp,
|
||||
} from 'utils/user_agent';
|
||||
import {getHtmlTable} from 'utils/paste';
|
||||
import {
|
||||
clearFileInput,
|
||||
generateId,
|
||||
@ -451,7 +450,7 @@ export class FileUpload extends PureComponent<Props, State> {
|
||||
pasteUpload = (e: ClipboardEvent) => {
|
||||
const {formatMessage} = this.props.intl;
|
||||
|
||||
if (!e.clipboardData || !e.clipboardData.items || getHtmlTable(e.clipboardData)) {
|
||||
if (!e.clipboardData || !e.clipboardData.items || e.clipboardData.getData('text/html')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user