MDL-83579 tiny_media: pass filepicker accepted types to dropzone.
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@ import uploadFile from 'editor_tiny/uploader';
|
||||
import {prefetchStrings} from 'core/prefetch';
|
||||
import {getStrings} from 'core/str';
|
||||
import {component} from "./common";
|
||||
import {getFilePicker} from 'editor_tiny/options';
|
||||
import {displayFilepicker} from 'editor_tiny/utils';
|
||||
import {ImageDetails} from 'tiny_media/imagedetails';
|
||||
import {
|
||||
@@ -82,9 +83,16 @@ export class ImageInsert {
|
||||
this.currentModal.setTitle(this.langStrings.insertimage);
|
||||
if (this.canShowDropZone) {
|
||||
const dropZoneEle = document.querySelector(Selectors.IMAGE.elements.dropzoneContainer);
|
||||
|
||||
// Accepted types can be either a string or an array.
|
||||
let acceptedTypes = getFilePicker(this.editor, 'image').accepted_types;
|
||||
if (Array.isArray(acceptedTypes)) {
|
||||
acceptedTypes = acceptedTypes.join(',');
|
||||
}
|
||||
|
||||
const dropZone = new Dropzone(
|
||||
dropZoneEle,
|
||||
'image/*',
|
||||
acceptedTypes,
|
||||
files => {
|
||||
this.handleUploadedFile(files);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user