Class

Adapter (ckbox)

@ckeditor/ckeditor5-ckbox/src/ckboxuploadadapter

class private

Upload adapter for CKBox.

Filtering

Properties

  • assetsOrigin : String

    The base URL from where all assets are served.

  • controller : AbortController

    The abort controller for aborting asynchronous processes.

  • editor : Editor

    The editor instance.

  • loader : FileLoader

    FileLoader instance to use during the upload.

  • serviceOrigin : String

    The base URL where all requests should be sent.

  • token : Token

    CKEditor Cloud Services access token.

Methods

  • constructor( loader, token, editor )

    Creates a new adapter instance.

    Parameters

    loader : FileLoader
    token : Token
    editor : Editor
  • abort()

    Aborts the upload process.

    Related:

  • getAvailableCategories( [ offset ] ) → Promise.<Array>

    Resolves a promise with an array containing available categories with which the uploaded file can be associated.

    If the API returns limited results, the method will collect all items.

    Parameters

    [ offset ] : Number

    Defaults to 0

    Returns

    Promise.<Array>
  • getCategoryIdForFile( file ) → Promise.<(String | null)>

    Resolves a promise with an object containing a category with which the uploaded file is associated or an error code.

    Parameters

    file : File

    Returns

    Promise.<(String | null)>
  • upload() → Promise.<Object>

    Starts the upload process.

    Returns

    Promise.<Object>

    Related:

  • protected

    _getImageWidth() → Promise.<Number>

    Resolves a promise with a number representing the width of a given image file.

    Returns

    Promise.<Number>
  • protected

    _sendHttpRequest( config.url, [ config.method ], [ config.data ], [ config.onUploadProgress ] ) → Promise

    Sends the HTTP request.

    Parameters

    config.url : URL

    the URL where the request will be sent.

    [ config.method ] : 'GET' | 'POST'

    The HTTP method.

    Defaults to 'GET'

    [ config.data ] : FormData | null

    Additional data to send.

    [ config.onUploadProgress ] : function

    A callback informing about the upload progress.

    Returns

    Promise