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

  • private

    _beginUpload( widget, loader )

    Initializes the upload process for a given widget using loader.

    Parameters

    widget : widget
    loader : fileLoader
  • private

    _insertWidget( editor, widgetDef, blobUrl, [ finalize ] ) → widget | element

    Parameters

    editor : editor
    widgetDef : definition
    blobUrl : String

    Blob URL of an image.

    [ finalize ] : Boolean

    If false, the widget will not be automatically finalized (added to CKEDITOR.plugins.widget.repository), but will be returned as a CKEDITOR.dom.element instance.

    Defaults to true

    Returns

    widget | element

    The widget instance or CKEDITOR.dom.element of a widget wrapper if finalize was set to false.

  • private

    _isLoaderDone( loader ) → Boolean

    Informs whether the loader is complete.

    Parameters

    loader : fileLoader

    Returns

    Boolean
  • private

    _spawnLoader( editor, file, widgetDef, [ fileName ] ) → fileLoader

    Parameters

    editor : editor
    file : Blob | String

    See CKEDITOR.fileTools.fileLoader.

    widgetDef : definition

    The widget definition that the loader is spawned for.

    [ fileName ] : String

    Preferred file name to be passed to the upload process.

    Returns

    fileLoader

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
  • 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
  • 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