Sign up (with export icon)

ImageUploadCompleteEvent

Api-typedef icon typedef

An event fired when an image is uploaded. You can hook into this event to provide custom attributes to the image element based on the data from the server.

const imageUploadEditing = editor.plugins.get( 'ImageUploadEditing' );

imageUploadEditing.on( 'uploadComplete', ( evt, { data, imageElement } ) => {
	editor.model.change( writer => {
		writer.setAttribute( 'someAttribute', 'foo', imageElement );
	} );
} );
Copy code

You can also stop the default handler that sets the src and srcset attributes if you want to provide custom values for these attributes.

imageUploadEditing.on( 'uploadComplete', ( evt, { data, imageElement } ) => {
	evt.stop();
} );
Copy code

Note: This event is fired by the ImageUploadEditing plugin.

Properties

  • args : tuple

  • name : 'uploadComplete'

Fired by