|
|
@@ -36,6 +36,7 @@ export default class ImageUploadButton extends Plugin {
|
|
|
// Setup `insertImage` button.
|
|
|
editor.ui.componentFactory.add( 'insertImage', locale => {
|
|
|
const view = new FileDialogButtonView( locale );
|
|
|
+ const command = editor.commands.get( 'imageUpload' );
|
|
|
|
|
|
view.set( {
|
|
|
label: t( 'Insert image' ),
|
|
|
@@ -45,6 +46,8 @@ export default class ImageUploadButton extends Plugin {
|
|
|
allowMultipleFiles: true
|
|
|
} );
|
|
|
|
|
|
+ view.bind( 'isEnabled' ).to( command );
|
|
|
+
|
|
|
view.on( 'done', ( evt, files ) => {
|
|
|
for ( const file of files ) {
|
|
|
editor.execute( 'imageUpload', { file } );
|