CKEDITOR.plugins.imagebase.featuresDefinitions.upload
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
-
_beginUpload( widget, loader )
private
Initializes the upload process for a given
widget
usingloader
.Parameters
widget : widget
loader : fileLoader
-
_insertWidget( editor, widgetDef, blobUrl, [ finalize ] ) → widget | element
private
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 tofalse
.
-
_isLoaderDone( loader ) → Boolean
private
Informs whether the loader is complete.
-
_spawnLoader( editor, file, widgetDef, [ fileName ] ) → fileLoader
private
Parameters
editor : editor
file : Blob | String
widgetDef : definition
The widget definition that the loader is spawned for.
[ fileName ] : String
Preferred file name to be passed to the upload process.
Returns
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 )
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.