@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20240624.0 → 0.0.0-nightly-20240626.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/build/ckbox.js +1 -1
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/types/ckboxcommand.d.ts +13 -1
- package/dist/types/ckboxconfig.d.ts +105 -0
- package/dist/types/ckboxediting.d.ts +0 -4
- package/package.json +2 -2
- package/src/ckboxcommand.d.ts +13 -1
- package/src/ckboxcommand.js +36 -4
- package/src/ckboxconfig.d.ts +105 -0
- package/src/ckboxediting.d.ts +0 -4
@@ -78,8 +78,20 @@ export default class CKBoxCommand extends Command {
|
|
78
78
|
* - tokenUrl The token endpoint URL.
|
79
79
|
* - serviceOrigin The base URL of the API service.
|
80
80
|
* - forceDemoLabel Whether to force "Powered by CKBox" link.
|
81
|
-
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
82
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.
|
83
95
|
*/
|
84
96
|
private _prepareOptions;
|
85
97
|
/**
|
@@ -129,6 +129,111 @@ export interface CKBoxConfig {
|
|
129
129
|
* Defaults to {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`}
|
130
130
|
*/
|
131
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;
|
132
237
|
}
|
133
238
|
/**
|
134
239
|
* Asset definition.
|
@@ -14,10 +14,6 @@ import CKBoxUtils from './ckboxutils.js';
|
|
14
14
|
* {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}.
|
15
15
|
*/
|
16
16
|
export default class CKBoxEditing extends Plugin {
|
17
|
-
/**
|
18
|
-
* CKEditor Cloud Services access token.
|
19
|
-
*/
|
20
|
-
private _token;
|
21
17
|
/**
|
22
18
|
* @inheritDoc
|
23
19
|
*/
|
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-20240626.0",
|
4
4
|
"description": "CKBox integration for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"ckeditor5": "0.0.0-nightly-
|
16
|
+
"ckeditor5": "0.0.0-nightly-20240626.0",
|
17
17
|
"blurhash": "2.0.5",
|
18
18
|
"lodash-es": "4.17.21"
|
19
19
|
},
|
package/src/ckboxcommand.d.ts
CHANGED
@@ -74,8 +74,20 @@ export default class CKBoxCommand extends Command {
|
|
74
74
|
* - tokenUrl The token endpoint URL.
|
75
75
|
* - serviceOrigin The base URL of the API service.
|
76
76
|
* - forceDemoLabel Whether to force "Powered by CKBox" link.
|
77
|
-
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
78
77
|
* - assets.onChoose The callback function invoked after choosing the assets.
|
78
|
+
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
79
|
+
* - dialog.width The dialog width in pixels.
|
80
|
+
* - dialog.height The dialog height in pixels.
|
81
|
+
* - categories.icons Allows setting custom icons for categories.
|
82
|
+
* - view.openLastView Sets if the last view visited by the user will be reopened
|
83
|
+
* on the next startup.
|
84
|
+
* - view.startupFolderId Sets the ID of the folder that will be opened on startup.
|
85
|
+
* - view.startupCategoryId Sets the ID of the category that will be opened on startup.
|
86
|
+
* - view.hideMaximizeButton Sets whether to hide the ‘Maximize’ button.
|
87
|
+
* - view.componentsHideTimeout Sets timeout after which upload components are hidden
|
88
|
+
* after completed upload.
|
89
|
+
* - view.dialogMinimizeTimeout Sets timeout after which upload dialog is minimized
|
90
|
+
* after completed upload.
|
79
91
|
*/
|
80
92
|
private _prepareOptions;
|
81
93
|
/**
|
package/src/ckboxcommand.js
CHANGED
@@ -95,23 +95,55 @@ export default class CKBoxCommand extends Command {
|
|
95
95
|
* - tokenUrl The token endpoint URL.
|
96
96
|
* - serviceOrigin The base URL of the API service.
|
97
97
|
* - forceDemoLabel Whether to force "Powered by CKBox" link.
|
98
|
-
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
99
98
|
* - assets.onChoose The callback function invoked after choosing the assets.
|
99
|
+
* - dialog.onClose The callback function invoked after closing the CKBox dialog.
|
100
|
+
* - dialog.width The dialog width in pixels.
|
101
|
+
* - dialog.height The dialog height in pixels.
|
102
|
+
* - categories.icons Allows setting custom icons for categories.
|
103
|
+
* - view.openLastView Sets if the last view visited by the user will be reopened
|
104
|
+
* on the next startup.
|
105
|
+
* - view.startupFolderId Sets the ID of the folder that will be opened on startup.
|
106
|
+
* - view.startupCategoryId Sets the ID of the category that will be opened on startup.
|
107
|
+
* - view.hideMaximizeButton Sets whether to hide the ‘Maximize’ button.
|
108
|
+
* - view.componentsHideTimeout Sets timeout after which upload components are hidden
|
109
|
+
* after completed upload.
|
110
|
+
* - view.dialogMinimizeTimeout Sets timeout after which upload dialog is minimized
|
111
|
+
* after completed upload.
|
100
112
|
*/
|
101
113
|
_prepareOptions() {
|
102
114
|
const editor = this.editor;
|
103
115
|
const ckboxConfig = editor.config.get('ckbox');
|
116
|
+
const dialog = ckboxConfig.dialog;
|
117
|
+
const categories = ckboxConfig.categories;
|
118
|
+
const view = ckboxConfig.view;
|
119
|
+
const upload = ckboxConfig.upload;
|
104
120
|
return {
|
105
121
|
theme: ckboxConfig.theme,
|
106
122
|
language: ckboxConfig.language,
|
107
123
|
tokenUrl: ckboxConfig.tokenUrl,
|
108
124
|
serviceOrigin: ckboxConfig.serviceOrigin,
|
109
125
|
forceDemoLabel: ckboxConfig.forceDemoLabel,
|
110
|
-
|
111
|
-
onClose: () => this.fire('ckbox:close')
|
112
|
-
},
|
126
|
+
choosableFileExtensions: ckboxConfig.choosableFileExtensions,
|
113
127
|
assets: {
|
114
128
|
onChoose: (assets) => this.fire('ckbox:choose', assets)
|
129
|
+
},
|
130
|
+
dialog: {
|
131
|
+
onClose: () => this.fire('ckbox:close'),
|
132
|
+
width: dialog && dialog.width,
|
133
|
+
height: dialog && dialog.height
|
134
|
+
},
|
135
|
+
categories: categories && {
|
136
|
+
icons: categories.icons
|
137
|
+
},
|
138
|
+
view: view && {
|
139
|
+
openLastView: view.openLastView,
|
140
|
+
startupFolderId: view.startupFolderId,
|
141
|
+
startupCategoryId: view.startupCategoryId,
|
142
|
+
hideMaximizeButton: view.hideMaximizeButton
|
143
|
+
},
|
144
|
+
upload: upload && {
|
145
|
+
componentsHideTimeout: upload.componentsHideTimeout,
|
146
|
+
dialogMinimizeTimeout: upload.dialogMinimizeTimeout
|
115
147
|
}
|
116
148
|
};
|
117
149
|
}
|
package/src/ckboxconfig.d.ts
CHANGED
@@ -125,6 +125,111 @@ export interface CKBoxConfig {
|
|
125
125
|
* Defaults to {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`}
|
126
126
|
*/
|
127
127
|
language?: string;
|
128
|
+
/**
|
129
|
+
* This option allows opening CKBox in dialog mode. It takes a configuration object with
|
130
|
+
* the width and height attributes.
|
131
|
+
*/
|
132
|
+
dialog?: CKBoxDialogConfig;
|
133
|
+
/**
|
134
|
+
* Allows setting custom icons for categories.
|
135
|
+
*/
|
136
|
+
categories?: CKBoxCategoriesConfig;
|
137
|
+
/**
|
138
|
+
* Configures the view of CKBox.
|
139
|
+
*/
|
140
|
+
view?: CKBoxViewConfig;
|
141
|
+
/**
|
142
|
+
* Configures when dialog should be minimized and hidden.
|
143
|
+
*/
|
144
|
+
upload?: CKBoxUploadConfig;
|
145
|
+
/**
|
146
|
+
* Specifies the file extensions considered valid for user interaction. Whith this
|
147
|
+
* option developers can restrict user interaction to only those assets whose file
|
148
|
+
* extensions match those listed in the array. Assets whose file
|
149
|
+
* extensions are not listed in the `choosableFileExtensions` array are
|
150
|
+
* automatically disabled within the CKBox interface.
|
151
|
+
*
|
152
|
+
* ```ts
|
153
|
+
* const ckboxConfig = {
|
154
|
+
* choosableFileExtensions: ['jpg', 'png']
|
155
|
+
* };
|
156
|
+
* ```
|
157
|
+
*/
|
158
|
+
choosableFileExtensions?: Array<string>;
|
159
|
+
}
|
160
|
+
export interface CKBoxDialogConfig {
|
161
|
+
/**
|
162
|
+
* The dialog width in pixels.
|
163
|
+
*/
|
164
|
+
width: number;
|
165
|
+
/**
|
166
|
+
* The dialog height in pixels.
|
167
|
+
*/
|
168
|
+
height: number;
|
169
|
+
}
|
170
|
+
export interface CKBoxCategoriesConfig {
|
171
|
+
/**
|
172
|
+
* This option takes an object with categories and icons that should be used instead
|
173
|
+
* of the default ones. Categories can be defined using either their name or id.
|
174
|
+
* Icons should be defined as strings containing the SVG images, or as React components.
|
175
|
+
*
|
176
|
+
* ```ts
|
177
|
+
* const ckboxConfig = {
|
178
|
+
* categories: {
|
179
|
+
* icons: {
|
180
|
+
* Images: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path ... /></svg>',
|
181
|
+
* // Category can be referenced by ID
|
182
|
+
* // 'fdf2a647-b67f-4a6c-b692-5ba1dc1ed87b': '<svg...'
|
183
|
+
* }
|
184
|
+
* }
|
185
|
+
* }
|
186
|
+
* ```
|
187
|
+
*/
|
188
|
+
icons?: {
|
189
|
+
[key: string]: string;
|
190
|
+
};
|
191
|
+
}
|
192
|
+
export interface CKBoxViewConfig {
|
193
|
+
/**
|
194
|
+
* If it is set to `false` the last view visited by the user will not be reopened on
|
195
|
+
* the next startup.
|
196
|
+
*/
|
197
|
+
openLastView?: boolean;
|
198
|
+
/**
|
199
|
+
* Sets the ID of the folder that will be opened on startup. This option can be paired
|
200
|
+
* with setting `view.openLastView` to `false` to enforce CKBox to always open in a given
|
201
|
+
* folder at startup.
|
202
|
+
*/
|
203
|
+
startupFolderId?: string;
|
204
|
+
/**
|
205
|
+
* Sets the ID of the category that will be opened on startup. This option can be paired
|
206
|
+
* with setting `view.openLastView` to `false` to enforce CKBox to always open in a given
|
207
|
+
* category at startup. If `view.startupCategoryId` is passed along with the
|
208
|
+
* `view.startupFolderId` option, CKBox will prioritize opening category view on the startup.
|
209
|
+
*/
|
210
|
+
startupCategoryId?: string;
|
211
|
+
/**
|
212
|
+
* Sets whether to hide the ‘Maximize’ button. By default, the button is shown and enabling
|
213
|
+
* this option will hide it.
|
214
|
+
*/
|
215
|
+
hideMaximizeButton?: boolean;
|
216
|
+
}
|
217
|
+
export interface CKBoxUploadConfig {
|
218
|
+
/**
|
219
|
+
* Sets timeout (in milliseconds) after which upload components (dialog and indicator) are
|
220
|
+
* hidden. By default, these components hide automatically after 10 seconds.
|
221
|
+
*
|
222
|
+
* Read more: https://ckeditor.com/docs/ckbox/latest/guides/configuration/configuration-options.html#uploadcomponentshidetimeout
|
223
|
+
*/
|
224
|
+
componentsHideTimeout?: number;
|
225
|
+
/**
|
226
|
+
* Sets timeout (in milliseconds) after which upload dialog is minimized once upload is
|
227
|
+
* finished and all uploads were successful. By default, upload dialog is never minimized
|
228
|
+
* automatically.
|
229
|
+
*
|
230
|
+
* Read more: https://ckeditor.com/docs/ckbox/latest/guides/configuration/configuration-options.html#uploaddialogminimizetimeout
|
231
|
+
*/
|
232
|
+
dialogMinimizeTimeout?: number;
|
128
233
|
}
|
129
234
|
/**
|
130
235
|
* Asset definition.
|
package/src/ckboxediting.d.ts
CHANGED
@@ -10,10 +10,6 @@ import CKBoxUtils from './ckboxutils.js';
|
|
10
10
|
* {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}.
|
11
11
|
*/
|
12
12
|
export default class CKBoxEditing extends Plugin {
|
13
|
-
/**
|
14
|
-
* CKEditor Cloud Services access token.
|
15
|
-
*/
|
16
|
-
private _token;
|
17
13
|
/**
|
18
14
|
* @inheritDoc
|
19
15
|
*/
|