@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20241216.0 → 0.0.0-nightly-20241217.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +267 -294
- package/dist/index.js.map +1 -1
- package/package.json +27 -8
- package/dist/augmentation.d.ts +0 -36
- package/dist/ckbox.d.ts +0 -41
- package/dist/ckboxcommand.d.ts +0 -130
- package/dist/ckboxconfig.d.ts +0 -434
- package/dist/ckboxediting.d.ts +0 -65
- package/dist/ckboximageedit/ckboximageeditcommand.d.ts +0 -109
- package/dist/ckboximageedit/ckboximageeditediting.d.ts +0 -36
- package/dist/ckboximageedit/ckboximageeditui.d.ts +0 -32
- package/dist/ckboximageedit/utils.d.ts +0 -14
- package/dist/ckboximageedit.d.ts +0 -32
- package/dist/ckboxui.d.ts +0 -60
- package/dist/ckboxuploadadapter.d.ts +0 -41
- package/dist/ckboxutils.d.ts +0 -58
- package/dist/index.d.ts +0 -21
- package/dist/utils.d.ts +0 -67
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-ckbox",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20241217.0",
|
4
4
|
"description": "CKBox integration for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,12 +13,12 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
17
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
18
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
19
|
-
"@ckeditor/ckeditor5-upload": "0.0.0-nightly-
|
20
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
21
|
-
"ckeditor5": "0.0.0-nightly-
|
16
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20241217.0",
|
17
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20241217.0",
|
18
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241217.0",
|
19
|
+
"@ckeditor/ckeditor5-upload": "0.0.0-nightly-20241217.0",
|
20
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20241217.0",
|
21
|
+
"ckeditor5": "0.0.0-nightly-20241217.0",
|
22
22
|
"blurhash": "2.0.5",
|
23
23
|
"lodash-es": "4.17.21"
|
24
24
|
},
|
@@ -41,5 +41,24 @@
|
|
41
41
|
"ckeditor5-metadata.json",
|
42
42
|
"CHANGELOG.md"
|
43
43
|
],
|
44
|
-
"types": "src/index.d.ts"
|
44
|
+
"types": "src/index.d.ts",
|
45
|
+
"exports": {
|
46
|
+
".": {
|
47
|
+
"types": "./src/index.d.ts",
|
48
|
+
"import": "./src/index.js"
|
49
|
+
},
|
50
|
+
"./dist/*": {
|
51
|
+
"types": "./src/index.d.ts",
|
52
|
+
"import": "./dist/*"
|
53
|
+
},
|
54
|
+
"./src/*": {
|
55
|
+
"types": "./src/index.d.ts",
|
56
|
+
"import": "./src/*"
|
57
|
+
},
|
58
|
+
"./build/*": "./build/*",
|
59
|
+
"./lang/*": "./lang/*",
|
60
|
+
"./theme/*": "./theme/*",
|
61
|
+
"./ckeditor5-metadata.json": "./ckeditor5-metadata.json",
|
62
|
+
"./package.json": "./package.json"
|
63
|
+
}
|
45
64
|
}
|
package/dist/augmentation.d.ts
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
8
|
-
*/
|
9
|
-
import type { CKBox, CKBoxCommand, CKBoxConfig, CKBoxEditing, CKBoxImageEdit, CKBoxImageEditEditing, CKBoxImageEditCommand, CKBoxImageEditUI } from './index.js';
|
10
|
-
declare module '@ckeditor/ckeditor5-core' {
|
11
|
-
interface EditorConfig {
|
12
|
-
/**
|
13
|
-
* The configuration of the {@link module:ckbox/ckbox~CKBox CKBox feature}.
|
14
|
-
*
|
15
|
-
* Read more in {@link module:ckbox/ckboxconfig~CKBoxConfig}.
|
16
|
-
*/
|
17
|
-
ckbox?: CKBoxConfig;
|
18
|
-
}
|
19
|
-
interface PluginsMap {
|
20
|
-
[CKBox.pluginName]: CKBox;
|
21
|
-
[CKBoxEditing.pluginName]: CKBoxEditing;
|
22
|
-
[CKBoxImageEdit.pluginName]: CKBoxImageEdit;
|
23
|
-
[CKBoxImageEditEditing.pluginName]: CKBoxImageEditEditing;
|
24
|
-
[CKBoxImageEditUI.pluginName]: CKBoxImageEditUI;
|
25
|
-
}
|
26
|
-
interface CommandsMap {
|
27
|
-
ckbox: CKBoxCommand;
|
28
|
-
ckboxImageEdit: CKBoxImageEditCommand;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
declare global {
|
32
|
-
var CKBox: {
|
33
|
-
mount(wrapper: Element, options: Record<string, unknown>): void;
|
34
|
-
mountImageEditor(wrapper: Element, options: Record<string, unknown>): void;
|
35
|
-
};
|
36
|
-
}
|
package/dist/ckbox.d.ts
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module ckbox/ckbox
|
11
|
-
*/
|
12
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
-
import CKBoxUI from './ckboxui.js';
|
14
|
-
import CKBoxEditing from './ckboxediting.js';
|
15
|
-
/**
|
16
|
-
* The CKBox feature, a bridge between the CKEditor 5 WYSIWYG editor and the CKBox file manager and uploader.
|
17
|
-
*
|
18
|
-
* This is a "glue" plugin which enables:
|
19
|
-
*
|
20
|
-
* * {@link module:ckbox/ckboxediting~CKBoxEditing},
|
21
|
-
* * {@link module:ckbox/ckboxui~CKBoxUI},
|
22
|
-
*
|
23
|
-
* See the {@glink features/file-management/ckbox CKBox integration} guide to learn how to configure and use this feature.
|
24
|
-
*
|
25
|
-
* Check out the {@glink features/images/image-upload/image-upload Image upload} guide to learn about other ways to upload
|
26
|
-
* images into CKEditor 5.
|
27
|
-
*/
|
28
|
-
export default class CKBox extends Plugin {
|
29
|
-
/**
|
30
|
-
* @inheritDoc
|
31
|
-
*/
|
32
|
-
static get pluginName(): "CKBox";
|
33
|
-
/**
|
34
|
-
* @inheritDoc
|
35
|
-
*/
|
36
|
-
static get isOfficialPlugin(): true;
|
37
|
-
/**
|
38
|
-
* @inheritDoc
|
39
|
-
*/
|
40
|
-
static get requires(): readonly [typeof CKBoxEditing, typeof CKBoxUI];
|
41
|
-
}
|
package/dist/ckboxcommand.d.ts
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
8
|
-
*/
|
9
|
-
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
10
|
-
import type { CKBoxAssetDefinition, CKBoxAssetImageAttributesDefinition, CKBoxRawAssetDefinition } from './ckboxconfig.js';
|
11
|
-
/**
|
12
|
-
* The CKBox command. It is used by the {@link module:ckbox/ckboxediting~CKBoxEditing CKBox editing feature} to open the CKBox file manager.
|
13
|
-
* The file manager allows inserting an image or a link to a file into the editor content.
|
14
|
-
*
|
15
|
-
* ```ts
|
16
|
-
* editor.execute( 'ckbox' );
|
17
|
-
* ```
|
18
|
-
*
|
19
|
-
* **Note:** This command uses other features to perform the following tasks:
|
20
|
-
* - To insert images it uses the {@link module:image/image/insertimagecommand~InsertImageCommand 'insertImage'} command from the
|
21
|
-
* {@link module:image/image~Image Image feature}.
|
22
|
-
* - To insert links to other files it uses the {@link module:link/linkcommand~LinkCommand 'link'} command from the
|
23
|
-
* {@link module:link/link~Link Link feature}.
|
24
|
-
*/
|
25
|
-
export default class CKBoxCommand extends Command {
|
26
|
-
value: boolean;
|
27
|
-
/**
|
28
|
-
* A set of all chosen assets. They are stored temporarily and they are automatically removed 1 second after being chosen.
|
29
|
-
* Chosen assets have to be "remembered" for a while to be able to map the given asset with the element inserted into the model.
|
30
|
-
* This association map is then used to set the ID on the model element.
|
31
|
-
*
|
32
|
-
* All chosen assets are automatically removed after the timeout, because (theoretically) it may happen that they will never be
|
33
|
-
* inserted into the model, even if the {@link module:link/linkcommand~LinkCommand `'link'`} command or the
|
34
|
-
* {@link module:image/image/insertimagecommand~InsertImageCommand `'insertImage'`} command is enabled. Such a case may arise when
|
35
|
-
* another plugin blocks the command execution. Then, in order not to keep the chosen (but not inserted) assets forever, we delete
|
36
|
-
* them automatically to prevent memory leakage. The 1 second timeout is enough to insert the asset into the model and extract the
|
37
|
-
* ID from the chosen asset.
|
38
|
-
*
|
39
|
-
* The assets are stored only if
|
40
|
-
* the {@link module:ckbox/ckboxconfig~CKBoxConfig#ignoreDataId `config.ckbox.ignoreDataId`} option is set to `false` (by default).
|
41
|
-
*
|
42
|
-
* @internal
|
43
|
-
*/
|
44
|
-
readonly _chosenAssets: Set<CKBoxAssetDefinition>;
|
45
|
-
/**
|
46
|
-
* The DOM element that acts as a mounting point for the CKBox dialog.
|
47
|
-
*/
|
48
|
-
private _wrapper;
|
49
|
-
/**
|
50
|
-
* @inheritDoc
|
51
|
-
*/
|
52
|
-
constructor(editor: Editor);
|
53
|
-
/**
|
54
|
-
* @inheritDoc
|
55
|
-
*/
|
56
|
-
refresh(): void;
|
57
|
-
/**
|
58
|
-
* @inheritDoc
|
59
|
-
*/
|
60
|
-
execute(): void;
|
61
|
-
/**
|
62
|
-
* Indicates if the CKBox dialog is already opened.
|
63
|
-
*
|
64
|
-
* @protected
|
65
|
-
* @returns {Boolean}
|
66
|
-
*/
|
67
|
-
private _getValue;
|
68
|
-
/**
|
69
|
-
* Checks whether the command can be enabled in the current context.
|
70
|
-
*/
|
71
|
-
private _checkEnabled;
|
72
|
-
/**
|
73
|
-
* Creates the options object for the CKBox dialog.
|
74
|
-
*
|
75
|
-
* @returns The object with properties:
|
76
|
-
* - theme The theme for CKBox dialog.
|
77
|
-
* - language The language for CKBox dialog.
|
78
|
-
* - tokenUrl The token endpoint URL.
|
79
|
-
* - serviceOrigin The base URL of the API service.
|
80
|
-
* - forceDemoLabel Whether to force "Powered by CKBox" link.
|
81
|
-
* - assets.onChoose The callback function invoked after choosing the assets.
|
82
|
-
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
83
|
-
* - dialog.width The dialog width in pixels.
|
84
|
-
* - dialog.height The dialog height in pixels.
|
85
|
-
* - categories.icons Allows setting custom icons for categories.
|
86
|
-
* - view.openLastView Sets if the last view visited by the user will be reopened
|
87
|
-
* on the next startup.
|
88
|
-
* - view.startupFolderId Sets the ID of the folder that will be opened on startup.
|
89
|
-
* - view.startupCategoryId Sets the ID of the category that will be opened on startup.
|
90
|
-
* - view.hideMaximizeButton Sets whether to hide the ‘Maximize’ button.
|
91
|
-
* - view.componentsHideTimeout Sets timeout after which upload components are hidden
|
92
|
-
* after completed upload.
|
93
|
-
* - view.dialogMinimizeTimeout Sets timeout after which upload dialog is minimized
|
94
|
-
* after completed upload.
|
95
|
-
*/
|
96
|
-
private _prepareOptions;
|
97
|
-
/**
|
98
|
-
* Initializes various event listeners for the `ckbox:*` events, because all functionality of the `ckbox` command is event-based.
|
99
|
-
*/
|
100
|
-
private _initListeners;
|
101
|
-
/**
|
102
|
-
* Inserts the asset into the model.
|
103
|
-
*
|
104
|
-
* @param asset The asset to be inserted.
|
105
|
-
* @param isLastAsset Indicates if the current asset is the last one from the chosen set.
|
106
|
-
* @param writer An instance of the model writer.
|
107
|
-
* @param isSingleAsset It's true when only one asset is processed.
|
108
|
-
*/
|
109
|
-
private _insertAsset;
|
110
|
-
/**
|
111
|
-
* Inserts the image by calling the `insertImage` command.
|
112
|
-
*
|
113
|
-
* @param asset The asset to be inserted.
|
114
|
-
*/
|
115
|
-
private _insertImage;
|
116
|
-
/**
|
117
|
-
* Inserts the link to the asset by calling the `link` command.
|
118
|
-
*
|
119
|
-
* @param asset The asset to be inserted.
|
120
|
-
* @param writer An instance of the model writer.
|
121
|
-
* @param isSingleAsset It's true when only one asset is processed.
|
122
|
-
*/
|
123
|
-
private _insertLink;
|
124
|
-
}
|
125
|
-
/**
|
126
|
-
* Parses the assets attributes into the internal data format.
|
127
|
-
*
|
128
|
-
* @internal
|
129
|
-
*/
|
130
|
-
export declare function prepareImageAssetAttributes(asset: CKBoxRawAssetDefinition): CKBoxAssetImageAttributesDefinition;
|
package/dist/ckboxconfig.d.ts
DELETED
@@ -1,434 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
8
|
-
*/
|
9
|
-
/**
|
10
|
-
* @module ckbox/ckboxconfig
|
11
|
-
*/
|
12
|
-
import type { TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
|
13
|
-
import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
|
14
|
-
/**
|
15
|
-
* The configuration of the {@link module:ckbox/ckbox~CKBox CKBox feature}.
|
16
|
-
*
|
17
|
-
* The minimal configuration for the CKBox feature requires providing the
|
18
|
-
* {@link module:ckbox/ckboxconfig~CKBoxConfig#tokenUrl `config.ckbox.tokenUrl`}:
|
19
|
-
*
|
20
|
-
* ```ts
|
21
|
-
* ClassicEditor
|
22
|
-
* .create( editorElement, {
|
23
|
-
* ckbox: {
|
24
|
-
* tokenUrl: 'https://example.com/cs-token-endpoint'
|
25
|
-
* }
|
26
|
-
* } )
|
27
|
-
* .then( ... )
|
28
|
-
* .catch( ... );
|
29
|
-
* ```
|
30
|
-
*
|
31
|
-
* Hovewer, you can also adjust the feature to fit your needs:
|
32
|
-
*
|
33
|
-
* ```ts
|
34
|
-
* ClassicEditor
|
35
|
-
* .create( editorElement, {
|
36
|
-
* ckbox: {
|
37
|
-
* defaultUploadCategories: {
|
38
|
-
* Bitmaps: [ 'bmp' ],
|
39
|
-
* Pictures: [ 'jpg', 'jpeg' ],
|
40
|
-
* Scans: [ 'png', 'tiff' ]
|
41
|
-
* },
|
42
|
-
* ignoreDataId: true,
|
43
|
-
* serviceOrigin: 'https://example.com/',
|
44
|
-
* tokenUrl: 'https://example.com/cs-token-endpoint'
|
45
|
-
* }
|
46
|
-
* } )
|
47
|
-
* .then( ... )
|
48
|
-
* .catch( ... );
|
49
|
-
* ```
|
50
|
-
*
|
51
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
52
|
-
*/
|
53
|
-
export interface CKBoxConfig {
|
54
|
-
/**
|
55
|
-
* The authentication token URL for CKBox feature.
|
56
|
-
*
|
57
|
-
* Defaults to {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl `config.cloudServices.tokenUrl`}
|
58
|
-
*/
|
59
|
-
tokenUrl?: TokenUrl;
|
60
|
-
/**
|
61
|
-
* The theme for CKBox dialog.
|
62
|
-
*/
|
63
|
-
theme?: string;
|
64
|
-
/**
|
65
|
-
* Defines the categories to which the uploaded images will be assigned.
|
66
|
-
* If configured, it overrides the category mappings defined on the cloud service.
|
67
|
-
* The value of this option should be an object, where the keys define categories and their values are the types of images
|
68
|
-
* that will be uploaded to these categories. The categories might be referenced by their name or ID.
|
69
|
-
*
|
70
|
-
* Example:
|
71
|
-
*
|
72
|
-
* ```ts
|
73
|
-
* const ckboxConfig = {
|
74
|
-
* defaultUploadCategories: {
|
75
|
-
* Bitmaps: [ 'bmp' ],
|
76
|
-
* Pictures: [ 'jpg', 'jpeg' ],
|
77
|
-
* Scans: [ 'png', 'tiff' ],
|
78
|
-
* // The category below is referenced by its ID.
|
79
|
-
* 'fdf2a647-b67f-4a6c-b692-5ba1dc1ed87b': [ 'gif' ]
|
80
|
-
* }
|
81
|
-
* };
|
82
|
-
* ```
|
83
|
-
*
|
84
|
-
* @default null
|
85
|
-
*/
|
86
|
-
defaultUploadCategories?: Record<string, Array<string>> | null;
|
87
|
-
/**
|
88
|
-
* Defines the workspace id to use during upload when the user has access to more than one workspace.
|
89
|
-
*
|
90
|
-
* If defined, it is an error, when the user has no access to the specified workspace.
|
91
|
-
*/
|
92
|
-
defaultUploadWorkspaceId?: string;
|
93
|
-
/**
|
94
|
-
* Enforces displaying the "Powered by CKBox" link regardless of the CKBox plan used.
|
95
|
-
*/
|
96
|
-
forceDemoLabel?: boolean;
|
97
|
-
/**
|
98
|
-
* Allows editing images that are not hosted in CKBox service.
|
99
|
-
*
|
100
|
-
* This configuration option should whitelist URL(s) of images that should be editable.
|
101
|
-
* Make sure that allowed image resources have CORS enabled.
|
102
|
-
*
|
103
|
-
* The image is editable if this option is:
|
104
|
-
* * a regular expression and it matches the image URL, or
|
105
|
-
* * a custom function that returns `true` for the image URL, or
|
106
|
-
* * `'origin'` literal and the image URL is from the same origin, or
|
107
|
-
* * an array of the above and the image URL matches one of the array elements.
|
108
|
-
*
|
109
|
-
* Images hosted in CKBox are always editable.
|
110
|
-
*
|
111
|
-
* @default []
|
112
|
-
*/
|
113
|
-
allowExternalImagesEditing?: ArrayOrItem<RegExp | 'origin' | ((src: string) => boolean)>;
|
114
|
-
/**
|
115
|
-
* Inserts the unique asset ID as the `data-ckbox-resource-id` attribute. To disable this behavior, set it to `true`.
|
116
|
-
*
|
117
|
-
* @default false
|
118
|
-
*/
|
119
|
-
ignoreDataId?: boolean;
|
120
|
-
/**
|
121
|
-
* Configures the base URL of the API service. Required only in on-premises installations.
|
122
|
-
*
|
123
|
-
* @default 'https://api.ckbox.io'
|
124
|
-
*/
|
125
|
-
serviceOrigin?: string;
|
126
|
-
/**
|
127
|
-
* Configures the language for the CKBox dialog.
|
128
|
-
*
|
129
|
-
* Defaults to {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`}
|
130
|
-
*/
|
131
|
-
language?: string;
|
132
|
-
/**
|
133
|
-
* This option allows opening CKBox in dialog mode. It takes a configuration object with
|
134
|
-
* the width and height attributes.
|
135
|
-
*/
|
136
|
-
dialog?: CKBoxDialogConfig;
|
137
|
-
/**
|
138
|
-
* Allows setting custom icons for categories.
|
139
|
-
*/
|
140
|
-
categories?: CKBoxCategoriesConfig;
|
141
|
-
/**
|
142
|
-
* Configures the view of CKBox.
|
143
|
-
*/
|
144
|
-
view?: CKBoxViewConfig;
|
145
|
-
/**
|
146
|
-
* Configures when dialog should be minimized and hidden.
|
147
|
-
*/
|
148
|
-
upload?: CKBoxUploadConfig;
|
149
|
-
/**
|
150
|
-
* Specifies the file extensions considered valid for user interaction. Whith this
|
151
|
-
* option developers can restrict user interaction to only those assets whose file
|
152
|
-
* extensions match those listed in the array. Assets whose file
|
153
|
-
* extensions are not listed in the `choosableFileExtensions` array are
|
154
|
-
* automatically disabled within the CKBox interface.
|
155
|
-
*
|
156
|
-
* ```ts
|
157
|
-
* const ckboxConfig = {
|
158
|
-
* choosableFileExtensions: ['jpg', 'png']
|
159
|
-
* };
|
160
|
-
* ```
|
161
|
-
*/
|
162
|
-
choosableFileExtensions?: Array<string>;
|
163
|
-
}
|
164
|
-
export interface CKBoxDialogConfig {
|
165
|
-
/**
|
166
|
-
* The dialog width in pixels.
|
167
|
-
*/
|
168
|
-
width: number;
|
169
|
-
/**
|
170
|
-
* The dialog height in pixels.
|
171
|
-
*/
|
172
|
-
height: number;
|
173
|
-
}
|
174
|
-
export interface CKBoxCategoriesConfig {
|
175
|
-
/**
|
176
|
-
* This option takes an object with categories and icons that should be used instead
|
177
|
-
* of the default ones. Categories can be defined using either their name or id.
|
178
|
-
* Icons should be defined as strings containing the SVG images, or as React components.
|
179
|
-
*
|
180
|
-
* ```ts
|
181
|
-
* const ckboxConfig = {
|
182
|
-
* categories: {
|
183
|
-
* icons: {
|
184
|
-
* Images: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path ... /></svg>',
|
185
|
-
* // Category can be referenced by ID
|
186
|
-
* // 'fdf2a647-b67f-4a6c-b692-5ba1dc1ed87b': '<svg...'
|
187
|
-
* }
|
188
|
-
* }
|
189
|
-
* }
|
190
|
-
* ```
|
191
|
-
*/
|
192
|
-
icons?: {
|
193
|
-
[key: string]: string;
|
194
|
-
};
|
195
|
-
}
|
196
|
-
export interface CKBoxViewConfig {
|
197
|
-
/**
|
198
|
-
* If it is set to `false` the last view visited by the user will not be reopened on
|
199
|
-
* the next startup.
|
200
|
-
*/
|
201
|
-
openLastView?: boolean;
|
202
|
-
/**
|
203
|
-
* Sets the ID of the folder that will be opened on startup. This option can be paired
|
204
|
-
* with setting `view.openLastView` to `false` to enforce CKBox to always open in a given
|
205
|
-
* folder at startup.
|
206
|
-
*/
|
207
|
-
startupFolderId?: string;
|
208
|
-
/**
|
209
|
-
* Sets the ID of the category that will be opened on startup. This option can be paired
|
210
|
-
* with setting `view.openLastView` to `false` to enforce CKBox to always open in a given
|
211
|
-
* category at startup. If `view.startupCategoryId` is passed along with the
|
212
|
-
* `view.startupFolderId` option, CKBox will prioritize opening category view on the startup.
|
213
|
-
*/
|
214
|
-
startupCategoryId?: string;
|
215
|
-
/**
|
216
|
-
* Sets whether to hide the ‘Maximize’ button. By default, the button is shown and enabling
|
217
|
-
* this option will hide it.
|
218
|
-
*/
|
219
|
-
hideMaximizeButton?: boolean;
|
220
|
-
}
|
221
|
-
export interface CKBoxUploadConfig {
|
222
|
-
/**
|
223
|
-
* Sets timeout (in milliseconds) after which upload components (dialog and indicator) are
|
224
|
-
* hidden. By default, these components hide automatically after 10 seconds.
|
225
|
-
*
|
226
|
-
* Read more: https://ckeditor.com/docs/ckbox/latest/guides/configuration/configuration-options.html#uploadcomponentshidetimeout
|
227
|
-
*/
|
228
|
-
componentsHideTimeout?: number;
|
229
|
-
/**
|
230
|
-
* Sets timeout (in milliseconds) after which upload dialog is minimized once upload is
|
231
|
-
* finished and all uploads were successful. By default, upload dialog is never minimized
|
232
|
-
* automatically.
|
233
|
-
*
|
234
|
-
* Read more: https://ckeditor.com/docs/ckbox/latest/guides/configuration/configuration-options.html#uploaddialogminimizetimeout
|
235
|
-
*/
|
236
|
-
dialogMinimizeTimeout?: number;
|
237
|
-
}
|
238
|
-
/**
|
239
|
-
* Asset definition.
|
240
|
-
*
|
241
|
-
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
242
|
-
*/
|
243
|
-
export type CKBoxAssetDefinition = CKBoxAssetImageDefinition | CKBoxAssetLinkDefinition;
|
244
|
-
/**
|
245
|
-
* Image asset definition.
|
246
|
-
*
|
247
|
-
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
248
|
-
*/
|
249
|
-
export interface CKBoxAssetImageDefinition {
|
250
|
-
/**
|
251
|
-
* An unique asset id.
|
252
|
-
*/
|
253
|
-
id: string;
|
254
|
-
/**
|
255
|
-
* Asset type.
|
256
|
-
*/
|
257
|
-
type: 'image';
|
258
|
-
/**
|
259
|
-
* Asset attributes.
|
260
|
-
*/
|
261
|
-
attributes: CKBoxAssetImageAttributesDefinition;
|
262
|
-
}
|
263
|
-
/**
|
264
|
-
* Link asset definition.
|
265
|
-
*
|
266
|
-
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
267
|
-
*/
|
268
|
-
export interface CKBoxAssetLinkDefinition {
|
269
|
-
/**
|
270
|
-
* An unique asset id.
|
271
|
-
*/
|
272
|
-
id: string;
|
273
|
-
/**
|
274
|
-
* Asset type.
|
275
|
-
*/
|
276
|
-
type: 'link';
|
277
|
-
/**
|
278
|
-
* Asset attributes.
|
279
|
-
*/
|
280
|
-
attributes: CKBoxAssetLinkAttributesDefinition;
|
281
|
-
}
|
282
|
-
/**
|
283
|
-
* Asset attributes definition for an image.
|
284
|
-
*
|
285
|
-
* The definition contains the `imageFallbackUrl`, an `imageSources` array with one image source definition object and the
|
286
|
-
* `imageTextAlternative`.
|
287
|
-
*
|
288
|
-
* ```ts
|
289
|
-
* {
|
290
|
-
* imageFallbackUrl: 'https://example.com/assets/asset-id/images/1000.png',
|
291
|
-
* imageSources: [
|
292
|
-
* {
|
293
|
-
* sizes: '1000px',
|
294
|
-
* srcset:
|
295
|
-
* 'https://example.com/assets/asset-id/images/100.webp 100w,' +
|
296
|
-
* 'https://example.com/assets/asset-id/images/200.webp 200w,' +
|
297
|
-
* 'https://example.com/assets/asset-id/images/300.webp 300w,' +
|
298
|
-
* 'https://example.com/assets/asset-id/images/400.webp 400w,' +
|
299
|
-
* 'https://example.com/assets/asset-id/images/500.webp 500w,' +
|
300
|
-
* 'https://example.com/assets/asset-id/images/600.webp 600w,' +
|
301
|
-
* 'https://example.com/assets/asset-id/images/700.webp 700w,' +
|
302
|
-
* 'https://example.com/assets/asset-id/images/800.webp 800w,' +
|
303
|
-
* 'https://example.com/assets/asset-id/images/900.webp 900w,' +
|
304
|
-
* 'https://example.com/assets/asset-id/images/1000.webp 1000w',
|
305
|
-
* type: 'image/webp'
|
306
|
-
* }
|
307
|
-
* ],
|
308
|
-
* imageTextAlternative: 'An alternative text for the image'
|
309
|
-
* }
|
310
|
-
* ```
|
311
|
-
*/
|
312
|
-
export interface CKBoxAssetImageAttributesDefinition {
|
313
|
-
/**
|
314
|
-
* A fallback URL for browsers that do not support the "webp" format.
|
315
|
-
*/
|
316
|
-
imageFallbackUrl: string;
|
317
|
-
/**
|
318
|
-
* An array containing one image source definition object.
|
319
|
-
*/
|
320
|
-
imageSources: Array<{
|
321
|
-
srcset: string;
|
322
|
-
sizes: string;
|
323
|
-
type: string;
|
324
|
-
}>;
|
325
|
-
/**
|
326
|
-
* An alternative text for an image.
|
327
|
-
*/
|
328
|
-
imageTextAlternative: string;
|
329
|
-
/**
|
330
|
-
* Image width.
|
331
|
-
*/
|
332
|
-
imageWidth?: number;
|
333
|
-
/**
|
334
|
-
* Image height.
|
335
|
-
*/
|
336
|
-
imageHeight?: number;
|
337
|
-
/**
|
338
|
-
* Image placeholder image.
|
339
|
-
*/
|
340
|
-
imagePlaceholder?: string;
|
341
|
-
}
|
342
|
-
/**
|
343
|
-
* Asset attributes definition for a link.
|
344
|
-
*
|
345
|
-
* The definition contains the `linkName` and `linkHref` strings.
|
346
|
-
*
|
347
|
-
* ```ts
|
348
|
-
* {
|
349
|
-
* linkName: 'File name',
|
350
|
-
* linkHref: 'https://example.com/assets/asset-id/file.pdf'
|
351
|
-
* }
|
352
|
-
* ```
|
353
|
-
*/
|
354
|
-
export interface CKBoxAssetLinkAttributesDefinition {
|
355
|
-
/**
|
356
|
-
* A link name.
|
357
|
-
*/
|
358
|
-
linkName: string;
|
359
|
-
/**
|
360
|
-
* An URL for the asset.
|
361
|
-
*/
|
362
|
-
linkHref: string;
|
363
|
-
}
|
364
|
-
/**
|
365
|
-
* The source set of the responsive image provided by the CKBox backend.
|
366
|
-
*
|
367
|
-
* Each numeric key corresponds to display width of the image.
|
368
|
-
*/
|
369
|
-
export interface CKBoxImageUrls {
|
370
|
-
[width: number]: string;
|
371
|
-
/**
|
372
|
-
* A fallback URL for browsers that do not support the "webp" format.
|
373
|
-
*/
|
374
|
-
default: string;
|
375
|
-
}
|
376
|
-
/**
|
377
|
-
* Raw asset definition that is received from the CKBox feature.
|
378
|
-
*/
|
379
|
-
export interface CKBoxRawAssetDefinition {
|
380
|
-
/**
|
381
|
-
* A raw asset data definition.
|
382
|
-
*/
|
383
|
-
data: CKBoxRawAssetDataDefinition;
|
384
|
-
}
|
385
|
-
/**
|
386
|
-
* Part of raw asset data that is received from the CKBox feature.
|
387
|
-
*/
|
388
|
-
export interface CKBoxRawAssetDataDefinition {
|
389
|
-
/**
|
390
|
-
* An unique asset id.
|
391
|
-
*/
|
392
|
-
id: string;
|
393
|
-
/**
|
394
|
-
* An asset name.
|
395
|
-
*/
|
396
|
-
name: string;
|
397
|
-
/**
|
398
|
-
* A raw asset metadata definition.
|
399
|
-
*/
|
400
|
-
metadata?: CKBoxRawAssetMetadataDefinition;
|
401
|
-
/**
|
402
|
-
* The source set of the responsive image.
|
403
|
-
*/
|
404
|
-
imageUrls?: CKBoxImageUrls;
|
405
|
-
/**
|
406
|
-
* The asset location.
|
407
|
-
*/
|
408
|
-
url: string;
|
409
|
-
}
|
410
|
-
/**
|
411
|
-
* Part of raw asset data that is received from the CKBox feature. Properties are set only if the chosen asset is an image.
|
412
|
-
*/
|
413
|
-
export interface CKBoxRawAssetMetadataDefinition {
|
414
|
-
/**
|
415
|
-
* Image description.
|
416
|
-
*/
|
417
|
-
description?: string;
|
418
|
-
/**
|
419
|
-
* Image width.
|
420
|
-
*/
|
421
|
-
width?: number;
|
422
|
-
/**
|
423
|
-
* Image height.
|
424
|
-
*/
|
425
|
-
height?: number;
|
426
|
-
/**
|
427
|
-
* The blurhash placeholder value.
|
428
|
-
*/
|
429
|
-
blurHash?: string;
|
430
|
-
/**
|
431
|
-
* The processing status of the asset.
|
432
|
-
*/
|
433
|
-
metadataProcessingStatus?: string;
|
434
|
-
}
|