ckbox/utils
@ckeditor/ckeditor5-ckbox/src/utils
Filtering
Functions
-
blurHashToDataUrl( [ hash ] ) → undefined | string
module:ckbox/utils~blurHashToDataUrl
Generates an image data URL from its
blurhash
representation.Parameters
[ hash ] : string
Returns
undefined | string
-
convertMimeTypeToExtension( mimeType ) → string
module:ckbox/utils~convertMimeTypeToExtension
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>
module:ckbox/utils~getContentTypeOfUrl
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
module:ckbox/utils~getFileExtension
-
getImageUrls( imageUrls ) → object
module:ckbox/utils~getImageUrls
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 ] ) → null | string
module:ckbox/utils~getWorkspaceId
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
null | string
-
internal
sendHttpRequest( options = { options.authorization, [options.data], [options.method], [options.onUploadProgress], options.signal, options.url } ) → Promise<any>
module:ckbox/utils~sendHttpRequest
Sends the HTTP request.
Parameters
options : object
Configuration options
Propertiesoptions.authorization : string
The authorization token for the request.
[ options.data ] : null | FormData
Additional data to send.
[ options.method ] : 'POST' | 'GET'
The HTTP method (default: 'GET').
Defaults to
'GET'
[ options.onUploadProgress ] : ( evt: ProgressEvent ) => void
A callback informing about the upload progress.
options.signal : AbortSignal
The AbortSignal to abort the request when needed.
options.url : URL
The URL where the request will be sent.
Returns
Promise<any>
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.