Module

ckbox/utils

@ckeditor/ckeditor5-ckbox/src/utils

module

Filtering

Functions

  • blurHashToDataUrl( [ hash ] ) → string | undefined

    Generates an image data URL from its blurhash representation.

    Parameters

    [ hash ] : string

    Returns

    string | undefined
  • convertMimeTypeToExtension( mimeType ) → string

    Returns an extension a typical file in the specified mimeType format would have.

    Parameters

    mimeType : string

    Returns

    string
  • getContentTypeOfUrl( url, options = { options.signal } ) → Promise<string>

    Tries to fetch the given url and returns 'content-type' of the response.

    Parameters

    url : string
    options : object
    Properties
    options.signal : AbortSignal

    Returns

    Promise<string>
  • getFileExtension( file ) → string

    Returns an extension from the given value.

    Parameters

    file : File

    Returns

    string
  • getImageUrls( imageUrls ) → object

    Converts image source set provided by the CKBox into an object containing:

    • responsive URLs for the "webp" image format,
    • one fallback URL for browsers that do not support the "webp" format.

    Parameters

    imageUrls : CKBoxImageUrls

    Returns

    object
  • getWorkspaceId( token, [ defaultWorkspaceId ] ) → string | null

    Returns a workspace id to use for communication with the CKBox service.

    Parameters

    token : InitializedToken
    [ defaultWorkspaceId ] : string

    The default workspace to use taken from editor config.

    Returns

    string | null
  • internal

    sendHttpRequest( __namedParameters = { __namedParameters.authorization, [__namedParameters.data], [__namedParameters.method], [__namedParameters.onUploadProgress], __namedParameters.signal, __namedParameters.url } ) → Promise<any>

    Sends the HTTP request.

    Parameters

    __namedParameters : object
    Properties
    __namedParameters.authorization : string
    [ __namedParameters.data ] : null | FormData
    [ __namedParameters.method ] : 'POST' | 'GET'
    [ __namedParameters.onUploadProgress ] : ( ProgressEvent<EventTarget> ) => void
    __namedParameters.signal : AbortSignal
    __namedParameters.url : URL

    Returns

    Promise<any>