Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
editor.ui.componentFactory.add( 'imageUpload', locale => {
const view = new FileDialogButtonView( locale );
const command = editor.commands.get( 'imageUpload' );
const imageTypes = editor.config.get( 'image.upload.types' );
const imageTypesRegExp = createImageTypeRegExp( imageTypes );
view.set( {
acceptedType: imageTypes.map( type => `image/${ type }` ).join( ',' ),
allowMultipleFiles: true
} );
view.buttonView.set( {
label: t( 'Insert image' ),
icon: imageIcon,
tooltip: true
} );
view.buttonView.bind( 'isEnabled' ).to( command );