Report an issue
Class

CKEDITOR.plugins.imagebase.featuresDefinitions.upload

class private abstract

Widget feature dedicated to handling seamless file uploads.

This type serves solely as a mixin, and should be added using the CKEDITOR.plugins.imagebase.addFeature method.

This API is not yet in a final shape, thus it is marked as private. It can change at any point in the future.

Filtering

Properties

  • loaderType : Function

    Preferred file loader type used for requests.

    Defaults to CKEDITOR.fileTools.fileLoader

  • progressReporterType : Function | Boolean

    The type used for progress reporting. It has to be a subclass of CKEDITOR.plugins.imagebase.progressReporter.

    It can be set to false so that there is no progress reporter created at all.

    Defaults to CKEDITOR.plugins.imagebase.progressBar

Methods

Events

  • uploadDone( evt )

    Fired when the upload process succeeded. This is the event where you want apply the data from your response into a widget.

    progress.once( 'uploadDone', function( evt ) {
        var response = evt.data.loader.responseData.response;
        this.setData( 'backendUrl', response.url );
    } );
    

    Parameters

    evt : eventInfo
    Properties
    data : Object
    Properties
    loader : fileLoader

    The loader that caused this event.

  • uploadFailed( evt )

    Fired when the upload process failed or was aborted.

    progress.once( 'uploadFailed', function( evt ) {
        console.log( 'Loader: ' + evt.data.loader + ' failed to upload data.' );
    } );
    

    This event is cancelable. If it is not canceled, it will remove the widget.

    Parameters

    evt : eventInfo
    Properties
    data : Object
    Properties
    loader : fileLoader

    The loader that caused this event.

  • uploadStarted( evt )

    Fired when upload was initiated and before the response is fetched.

    progress.once( 'uploadStarted', function( evt ) {
        evt.cancel();
        // Implement a custom progress bar.
    } );
    

    This event is cancelable. If canceled, the default progress bar will not be created and the widget wrapper will not be marked with the cke_widget_wrapper_uploading class.

    Note that the event will be fired even if the widget was created for a loader that is already resolved.

    Parameters

    evt : eventInfo
    Properties
    data : fileLoader

    The loader that is used for this widget.