CKBoxConfig
The configuration of the CKBox feature.
The minimal configuration for the CKBox feature requires providing the
config.ckbox.tokenUrl:
ClassicEditor
.create( editorElement, {
ckbox: {
tokenUrl: 'https://example.com/cs-token-endpoint'
}
} )
.then( ... )
.catch( ... );
Hovewer, you can also adjust the feature to fit your needs:
ClassicEditor
.create( editorElement, {
ckbox: {
defaultUploadCategories: {
Bitmaps: [ 'bmp' ],
Pictures: [ 'jpg', 'jpeg' ],
Scans: [ 'png', 'tiff' ]
},
ignoreDataId: true,
serviceOrigin: 'https://example.com/',
tokenUrl: 'https://example.com/cs-token-endpoint'
}
} )
.then( ... )
.catch( ... );
See all editor options.
Properties
-
allowExternalImagesEditing : ArrayOrItem<RegExp | 'origin' | ( src: string ) => boolean> | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#allowExternalImagesEditingAllows editing images that are not hosted in CKBox service.
This configuration option should whitelist URL(s) of images that should be editable. Make sure that allowed image resources have CORS enabled.
The image is editable if this option is:
- a regular expression and it matches the image URL, or
- a custom function that returns
truefor the image URL, or 'origin'literal and the image URL is from the same origin, or- an array of the above and the image URL matches one of the array elements.
Images hosted in CKBox are always editable.
Defaults to
[] -
categories : CKBoxCategoriesConfig | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#categoriesAllows setting custom icons for categories.
-
choosableFileExtensions : Array<string> | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#choosableFileExtensionsSpecifies the file extensions considered valid for user interaction. Whith this option developers can restrict user interaction to only those assets whose file extensions match those listed in the array. Assets whose file extensions are not listed in the
choosableFileExtensionsarray are automatically disabled within the CKBox interface.const ckboxConfig = { choosableFileExtensions: ['jpg', 'png'] };Copy code -
defaultUploadCategories : null | Record<string, Array<string>> | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#defaultUploadCategoriesDefines the categories to which the uploaded images will be assigned. If configured, it overrides the category mappings defined on the cloud service. The value of this option should be an object, where the keys define categories and their values are the types of images that will be uploaded to these categories. The categories might be referenced by their name or ID.
Example:
const ckboxConfig = { defaultUploadCategories: { Bitmaps: [ 'bmp' ], Pictures: [ 'jpg', 'jpeg' ], Scans: [ 'png', 'tiff' ], // The category below is referenced by its ID. 'fdf2a647-b67f-4a6c-b692-5ba1dc1ed87b': [ 'gif' ] } };Copy codeDefaults to
null -
defaultUploadWorkspaceId : string | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#defaultUploadWorkspaceIdDefines the workspace id to use during upload when the user has access to more than one workspace.
If defined, it is an error, when the user has no access to the specified workspace.
-
dialog : CKBoxDialogConfig | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#dialogThis option allows opening CKBox in dialog mode. It takes a configuration object with the width and height attributes.
-
downloadableFiles : ( asset: CKBoxRawAssetDefinition ) => boolean | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#downloadableFilesControls when to enable the download attribute for inserted links.
By default, files are downloadable.
const ckboxConfig = { downloadableFiles: asset => asset.data.extension !== 'pdf' };Copy code -
forceDemoLabel : boolean | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#forceDemoLabelEnforces displaying the "Powered by CKBox" link regardless of the CKBox plan used.
-
ignoreDataId : boolean | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#ignoreDataIdInserts the unique asset ID as the
data-ckbox-resource-idattribute. To disable this behavior, set it totrue.Defaults to
false -
language : string | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#languageConfigures the language for the CKBox dialog.
Defaults to
Locale#uiLanguage -
serviceOrigin : string | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#serviceOriginConfigures the base URL of the API service. Required only in on-premises installations.
Defaults to
'https://api.ckbox.io' -
theme : string | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#themeThe theme for CKBox dialog.
-
module:ckbox/ckboxconfig~CKBoxConfig#tokenUrlThe authentication token URL for CKBox feature.
Defaults to
config.cloudServices.tokenUrl -
upload : CKBoxUploadConfig | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#uploadConfigures when dialog should be minimized and hidden.
-
view : CKBoxViewConfig | undefinedmodule:ckbox/ckboxconfig~CKBoxConfig#viewConfigures the view of CKBox.