@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20240422.0 → 0.0.0-nightly-20240424.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-content.css +4 -0
- package/dist/index-editor.css +31 -0
- package/dist/index.css +55 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +1545 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +5 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/types/augmentation.d.ts +36 -0
- package/dist/types/ckbox.d.ts +37 -0
- package/dist/types/ckboxcommand.d.ts +118 -0
- package/dist/types/ckboxconfig.d.ts +329 -0
- package/dist/types/ckboxediting.d.ts +58 -0
- package/dist/types/ckboximageedit/ckboximageeditcommand.d.ts +101 -0
- package/dist/types/ckboximageedit/ckboximageeditediting.d.ts +32 -0
- package/dist/types/ckboximageedit/ckboximageeditui.d.ts +28 -0
- package/dist/types/ckboximageedit/utils.d.ts +14 -0
- package/dist/types/ckboximageedit.d.ts +28 -0
- package/dist/types/ckboxui.d.ts +29 -0
- package/dist/types/ckboxuploadadapter.d.ts +37 -0
- package/dist/types/ckboxutils.d.ts +54 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/utils.d.ts +67 -0
- package/package.json +3 -2
@@ -0,0 +1,329 @@
|
|
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-oss-license
|
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
|
+
/**
|
134
|
+
* Asset definition.
|
135
|
+
*
|
136
|
+
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
137
|
+
*/
|
138
|
+
export type CKBoxAssetDefinition = CKBoxAssetImageDefinition | CKBoxAssetLinkDefinition;
|
139
|
+
/**
|
140
|
+
* Image asset definition.
|
141
|
+
*
|
142
|
+
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
143
|
+
*/
|
144
|
+
export interface CKBoxAssetImageDefinition {
|
145
|
+
/**
|
146
|
+
* An unique asset id.
|
147
|
+
*/
|
148
|
+
id: string;
|
149
|
+
/**
|
150
|
+
* Asset type.
|
151
|
+
*/
|
152
|
+
type: 'image';
|
153
|
+
/**
|
154
|
+
* Asset attributes.
|
155
|
+
*/
|
156
|
+
attributes: CKBoxAssetImageAttributesDefinition;
|
157
|
+
}
|
158
|
+
/**
|
159
|
+
* Link asset definition.
|
160
|
+
*
|
161
|
+
* The definition contains the unique `id`, asset `type` and an `attributes` definition.
|
162
|
+
*/
|
163
|
+
export interface CKBoxAssetLinkDefinition {
|
164
|
+
/**
|
165
|
+
* An unique asset id.
|
166
|
+
*/
|
167
|
+
id: string;
|
168
|
+
/**
|
169
|
+
* Asset type.
|
170
|
+
*/
|
171
|
+
type: 'link';
|
172
|
+
/**
|
173
|
+
* Asset attributes.
|
174
|
+
*/
|
175
|
+
attributes: CKBoxAssetLinkAttributesDefinition;
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* Asset attributes definition for an image.
|
179
|
+
*
|
180
|
+
* The definition contains the `imageFallbackUrl`, an `imageSources` array with one image source definition object and the
|
181
|
+
* `imageTextAlternative`.
|
182
|
+
*
|
183
|
+
* ```ts
|
184
|
+
* {
|
185
|
+
* imageFallbackUrl: 'https://example.com/assets/asset-id/images/1000.png',
|
186
|
+
* imageSources: [
|
187
|
+
* {
|
188
|
+
* sizes: '1000px',
|
189
|
+
* srcset:
|
190
|
+
* 'https://example.com/assets/asset-id/images/100.webp 100w,' +
|
191
|
+
* 'https://example.com/assets/asset-id/images/200.webp 200w,' +
|
192
|
+
* 'https://example.com/assets/asset-id/images/300.webp 300w,' +
|
193
|
+
* 'https://example.com/assets/asset-id/images/400.webp 400w,' +
|
194
|
+
* 'https://example.com/assets/asset-id/images/500.webp 500w,' +
|
195
|
+
* 'https://example.com/assets/asset-id/images/600.webp 600w,' +
|
196
|
+
* 'https://example.com/assets/asset-id/images/700.webp 700w,' +
|
197
|
+
* 'https://example.com/assets/asset-id/images/800.webp 800w,' +
|
198
|
+
* 'https://example.com/assets/asset-id/images/900.webp 900w,' +
|
199
|
+
* 'https://example.com/assets/asset-id/images/1000.webp 1000w',
|
200
|
+
* type: 'image/webp'
|
201
|
+
* }
|
202
|
+
* ],
|
203
|
+
* imageTextAlternative: 'An alternative text for the image'
|
204
|
+
* }
|
205
|
+
* ```
|
206
|
+
*/
|
207
|
+
export interface CKBoxAssetImageAttributesDefinition {
|
208
|
+
/**
|
209
|
+
* A fallback URL for browsers that do not support the "webp" format.
|
210
|
+
*/
|
211
|
+
imageFallbackUrl: string;
|
212
|
+
/**
|
213
|
+
* An array containing one image source definition object.
|
214
|
+
*/
|
215
|
+
imageSources: Array<{
|
216
|
+
srcset: string;
|
217
|
+
sizes: string;
|
218
|
+
type: string;
|
219
|
+
}>;
|
220
|
+
/**
|
221
|
+
* An alternative text for an image.
|
222
|
+
*/
|
223
|
+
imageTextAlternative: string;
|
224
|
+
/**
|
225
|
+
* Image width.
|
226
|
+
*/
|
227
|
+
imageWidth?: number;
|
228
|
+
/**
|
229
|
+
* Image height.
|
230
|
+
*/
|
231
|
+
imageHeight?: number;
|
232
|
+
/**
|
233
|
+
* Image placeholder image.
|
234
|
+
*/
|
235
|
+
imagePlaceholder?: string;
|
236
|
+
}
|
237
|
+
/**
|
238
|
+
* Asset attributes definition for a link.
|
239
|
+
*
|
240
|
+
* The definition contains the `linkName` and `linkHref` strings.
|
241
|
+
*
|
242
|
+
* ```ts
|
243
|
+
* {
|
244
|
+
* linkName: 'File name',
|
245
|
+
* linkHref: 'https://example.com/assets/asset-id/file.pdf'
|
246
|
+
* }
|
247
|
+
* ```
|
248
|
+
*/
|
249
|
+
export interface CKBoxAssetLinkAttributesDefinition {
|
250
|
+
/**
|
251
|
+
* A link name.
|
252
|
+
*/
|
253
|
+
linkName: string;
|
254
|
+
/**
|
255
|
+
* An URL for the asset.
|
256
|
+
*/
|
257
|
+
linkHref: string;
|
258
|
+
}
|
259
|
+
/**
|
260
|
+
* The source set of the responsive image provided by the CKBox backend.
|
261
|
+
*
|
262
|
+
* Each numeric key corresponds to display width of the image.
|
263
|
+
*/
|
264
|
+
export interface CKBoxImageUrls {
|
265
|
+
[width: number]: string;
|
266
|
+
/**
|
267
|
+
* A fallback URL for browsers that do not support the "webp" format.
|
268
|
+
*/
|
269
|
+
default: string;
|
270
|
+
}
|
271
|
+
/**
|
272
|
+
* Raw asset definition that is received from the CKBox feature.
|
273
|
+
*/
|
274
|
+
export interface CKBoxRawAssetDefinition {
|
275
|
+
/**
|
276
|
+
* A raw asset data definition.
|
277
|
+
*/
|
278
|
+
data: CKBoxRawAssetDataDefinition;
|
279
|
+
}
|
280
|
+
/**
|
281
|
+
* Part of raw asset data that is received from the CKBox feature.
|
282
|
+
*/
|
283
|
+
export interface CKBoxRawAssetDataDefinition {
|
284
|
+
/**
|
285
|
+
* An unique asset id.
|
286
|
+
*/
|
287
|
+
id: string;
|
288
|
+
/**
|
289
|
+
* An asset name.
|
290
|
+
*/
|
291
|
+
name: string;
|
292
|
+
/**
|
293
|
+
* A raw asset metadata definition.
|
294
|
+
*/
|
295
|
+
metadata?: CKBoxRawAssetMetadataDefinition;
|
296
|
+
/**
|
297
|
+
* The source set of the responsive image.
|
298
|
+
*/
|
299
|
+
imageUrls?: CKBoxImageUrls;
|
300
|
+
/**
|
301
|
+
* The asset location.
|
302
|
+
*/
|
303
|
+
url: string;
|
304
|
+
}
|
305
|
+
/**
|
306
|
+
* Part of raw asset data that is received from the CKBox feature. Properties are set only if the chosen asset is an image.
|
307
|
+
*/
|
308
|
+
export interface CKBoxRawAssetMetadataDefinition {
|
309
|
+
/**
|
310
|
+
* Image description.
|
311
|
+
*/
|
312
|
+
description?: string;
|
313
|
+
/**
|
314
|
+
* Image width.
|
315
|
+
*/
|
316
|
+
width?: number;
|
317
|
+
/**
|
318
|
+
* Image height.
|
319
|
+
*/
|
320
|
+
height?: number;
|
321
|
+
/**
|
322
|
+
* The blurhash placeholder value.
|
323
|
+
*/
|
324
|
+
blurHash?: string;
|
325
|
+
/**
|
326
|
+
* The processing status of the asset.
|
327
|
+
*/
|
328
|
+
metadataProcessingStatus?: string;
|
329
|
+
}
|
@@ -0,0 +1,58 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
10
|
+
import CKBoxUploadAdapter from './ckboxuploadadapter.js';
|
11
|
+
import CKBoxUtils from './ckboxutils.js';
|
12
|
+
/**
|
13
|
+
* The CKBox editing feature. It introduces the {@link module:ckbox/ckboxcommand~CKBoxCommand CKBox command} and
|
14
|
+
* {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}.
|
15
|
+
*/
|
16
|
+
export default class CKBoxEditing extends Plugin {
|
17
|
+
/**
|
18
|
+
* CKEditor Cloud Services access token.
|
19
|
+
*/
|
20
|
+
private _token;
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
static get pluginName(): "CKBoxEditing";
|
25
|
+
/**
|
26
|
+
* @inheritDoc
|
27
|
+
*/
|
28
|
+
static get requires(): readonly ["LinkEditing", "PictureEditing", typeof CKBoxUploadAdapter, typeof CKBoxUtils];
|
29
|
+
/**
|
30
|
+
* @inheritDoc
|
31
|
+
*/
|
32
|
+
init(): void;
|
33
|
+
/**
|
34
|
+
* @inheritDoc
|
35
|
+
*/
|
36
|
+
afterInit(): void;
|
37
|
+
/**
|
38
|
+
* Returns true only when the integrator intentionally wants to use the plugin, i.e. when the `config.ckbox` exists or
|
39
|
+
* the CKBox JavaScript library is loaded.
|
40
|
+
*/
|
41
|
+
private _shouldBeInitialised;
|
42
|
+
/**
|
43
|
+
* Checks if at least one image plugin is loaded.
|
44
|
+
*/
|
45
|
+
private _checkImagePlugins;
|
46
|
+
/**
|
47
|
+
* Extends the schema to allow the `ckboxImageId` and `ckboxLinkId` attributes for links and images.
|
48
|
+
*/
|
49
|
+
private _initSchema;
|
50
|
+
/**
|
51
|
+
* Configures the upcast and downcast conversions for the `ckboxImageId` and `ckboxLinkId` attributes.
|
52
|
+
*/
|
53
|
+
private _initConversion;
|
54
|
+
/**
|
55
|
+
* Registers post-fixers that add or remove the `ckboxLinkId` and `ckboxImageId` attributes.
|
56
|
+
*/
|
57
|
+
private _initFixers;
|
58
|
+
}
|
@@ -0,0 +1,101 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboximageedit/ckboximageeditcommand
|
11
|
+
*/
|
12
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
13
|
+
/**
|
14
|
+
* The CKBox edit image command.
|
15
|
+
*
|
16
|
+
* Opens the CKBox dialog for editing the image.
|
17
|
+
*/
|
18
|
+
export default class CKBoxImageEditCommand extends Command {
|
19
|
+
/**
|
20
|
+
* Flag indicating whether the command is active, i.e. dialog is open.
|
21
|
+
*/
|
22
|
+
value: boolean;
|
23
|
+
/**
|
24
|
+
* The DOM element that acts as a mounting point for the CKBox Edit Image dialog.
|
25
|
+
*/
|
26
|
+
private _wrapper;
|
27
|
+
/**
|
28
|
+
* The states of image processing in progress.
|
29
|
+
*/
|
30
|
+
private _processInProgress;
|
31
|
+
/**
|
32
|
+
* Determines if the element can be edited.
|
33
|
+
*/
|
34
|
+
private _canEdit;
|
35
|
+
/**
|
36
|
+
* A wrapper function to prepare mount options. Ensures that at most one preparation is in-flight.
|
37
|
+
*/
|
38
|
+
private _prepareOptions;
|
39
|
+
/**
|
40
|
+
* @inheritDoc
|
41
|
+
*/
|
42
|
+
constructor(editor: Editor);
|
43
|
+
/**
|
44
|
+
* @inheritDoc
|
45
|
+
*/
|
46
|
+
refresh(): void;
|
47
|
+
/**
|
48
|
+
* Opens the CKBox Image Editor dialog for editing the image.
|
49
|
+
*/
|
50
|
+
execute(): void;
|
51
|
+
/**
|
52
|
+
* @inheritDoc
|
53
|
+
*/
|
54
|
+
destroy(): void;
|
55
|
+
/**
|
56
|
+
* Indicates if the CKBox Image Editor dialog is already opened.
|
57
|
+
*/
|
58
|
+
private _getValue;
|
59
|
+
/**
|
60
|
+
* Creates the options object for the CKBox Image Editor dialog.
|
61
|
+
*/
|
62
|
+
private _prepareOptionsAbortable;
|
63
|
+
/**
|
64
|
+
* Initializes event lister for an event of removing an image.
|
65
|
+
*/
|
66
|
+
private _prepareListeners;
|
67
|
+
/**
|
68
|
+
* Gets processing states of images that have been deleted in the mean time.
|
69
|
+
*/
|
70
|
+
private _getProcessingStatesOfDeletedImages;
|
71
|
+
private _checkIfElementIsBeingProcessed;
|
72
|
+
/**
|
73
|
+
* Closes the CKBox Image Editor dialog.
|
74
|
+
*/
|
75
|
+
private _handleImageEditorClose;
|
76
|
+
/**
|
77
|
+
* Save edited image. In case server respond with "success" replace with edited image,
|
78
|
+
* otherwise show notification error.
|
79
|
+
*/
|
80
|
+
private _handleImageEditorSave;
|
81
|
+
/**
|
82
|
+
* Get asset's status on server. If server responds with "success" status then
|
83
|
+
* image is already proceeded and ready for saving.
|
84
|
+
*/
|
85
|
+
private _getAssetStatusFromServer;
|
86
|
+
/**
|
87
|
+
* Waits for an asset to be processed.
|
88
|
+
* It retries retrieving asset status from the server in case of failure.
|
89
|
+
*/
|
90
|
+
private _waitForAssetProcessed;
|
91
|
+
/**
|
92
|
+
* Shows processing indicator while image is processing.
|
93
|
+
*
|
94
|
+
* @param asset Data about certain asset.
|
95
|
+
*/
|
96
|
+
private _showImageProcessingIndicator;
|
97
|
+
/**
|
98
|
+
* Replace the edited image with the new one.
|
99
|
+
*/
|
100
|
+
private _replaceImage;
|
101
|
+
}
|
@@ -0,0 +1,32 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboximageedit/ckboximageeditediting
|
11
|
+
*/
|
12
|
+
import { PendingActions, Plugin } from 'ckeditor5/src/core.js';
|
13
|
+
import { Notification } from 'ckeditor5/src/ui.js';
|
14
|
+
import CKBoxEditing from '../ckboxediting.js';
|
15
|
+
import CKBoxUtils from '../ckboxutils.js';
|
16
|
+
/**
|
17
|
+
* The CKBox image edit editing plugin.
|
18
|
+
*/
|
19
|
+
export default class CKBoxImageEditEditing extends Plugin {
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
static get pluginName(): "CKBoxImageEditEditing";
|
24
|
+
/**
|
25
|
+
* @inheritDoc
|
26
|
+
*/
|
27
|
+
static get requires(): readonly [typeof CKBoxEditing, typeof CKBoxUtils, typeof PendingActions, typeof Notification, "ImageUtils", "ImageEditing"];
|
28
|
+
/**
|
29
|
+
* @inheritDoc
|
30
|
+
*/
|
31
|
+
init(): void;
|
32
|
+
}
|
@@ -0,0 +1,28 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboximageedit/ckboximageeditui
|
11
|
+
*/
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
+
/**
|
14
|
+
* The UI plugin of the CKBox image edit feature.
|
15
|
+
*
|
16
|
+
* It registers the `'ckboxImageEdit'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}
|
17
|
+
* that allows you to open the CKBox dialog and edit the image.
|
18
|
+
*/
|
19
|
+
export default class CKBoxImageEditUI extends Plugin {
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
static get pluginName(): "CKBoxImageEditUI";
|
24
|
+
/**
|
25
|
+
* @inheritDoc
|
26
|
+
*/
|
27
|
+
init(): void;
|
28
|
+
}
|
@@ -0,0 +1,14 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
10
|
+
import type { CKBoxConfig } from '../ckboxconfig.js';
|
11
|
+
/**
|
12
|
+
* @internal
|
13
|
+
*/
|
14
|
+
export declare function createEditabilityChecker(allowExternalImagesEditing: CKBoxConfig['allowExternalImagesEditing']): (element: Element) => boolean;
|
@@ -0,0 +1,28 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboximageedit
|
11
|
+
*/
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
+
import CKBoxImageEditEditing from './ckboximageedit/ckboximageeditediting.js';
|
14
|
+
import CKBoxImageEditUI from './ckboximageedit/ckboximageeditui.js';
|
15
|
+
import '../theme/ckboximageedit.css';
|
16
|
+
/**
|
17
|
+
* The CKBox image edit feature.
|
18
|
+
*/
|
19
|
+
export default class CKBoxImageEdit extends Plugin {
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
static get pluginName(): "CKBoxImageEdit";
|
24
|
+
/**
|
25
|
+
* @inheritDoc
|
26
|
+
*/
|
27
|
+
static get requires(): readonly [typeof CKBoxImageEditEditing, typeof CKBoxImageEditUI];
|
28
|
+
}
|
@@ -0,0 +1,29 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboxui
|
11
|
+
*/
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
+
/**
|
14
|
+
* The CKBoxUI plugin. It introduces the `'ckbox'` toolbar button.
|
15
|
+
*/
|
16
|
+
export default class CKBoxUI extends Plugin {
|
17
|
+
/**
|
18
|
+
* @inheritDoc
|
19
|
+
*/
|
20
|
+
static get pluginName(): "CKBoxUI";
|
21
|
+
/**
|
22
|
+
* @inheritDoc
|
23
|
+
*/
|
24
|
+
afterInit(): void;
|
25
|
+
/**
|
26
|
+
* Creates a button for CKBox command to use either in toolbar or in menu bar.
|
27
|
+
*/
|
28
|
+
private _createButton;
|
29
|
+
}
|
@@ -0,0 +1,37 @@
|
|
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-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module ckbox/ckboxuploadadapter
|
11
|
+
*/
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
13
|
+
import { FileRepository } from 'ckeditor5/src/upload.js';
|
14
|
+
import CKBoxEditing from './ckboxediting.js';
|
15
|
+
/**
|
16
|
+
* A plugin that enables file uploads in CKEditor 5 using the CKBox server–side connector.
|
17
|
+
* See the {@glink features/file-management/ckbox CKBox file manager integration} guide to learn how to configure
|
18
|
+
* and use this feature as well as find out more about the full integration with the file manager
|
19
|
+
* provided by the {@link module:ckbox/ckbox~CKBox} plugin.
|
20
|
+
*
|
21
|
+
* Check out the {@glink features/images/image-upload/image-upload Image upload overview} guide to learn about
|
22
|
+
* other ways to upload images into CKEditor 5.
|
23
|
+
*/
|
24
|
+
export default class CKBoxUploadAdapter extends Plugin {
|
25
|
+
/**
|
26
|
+
* @inheritDoc
|
27
|
+
*/
|
28
|
+
static get requires(): readonly ["ImageUploadEditing", "ImageUploadProgress", typeof FileRepository, typeof CKBoxEditing];
|
29
|
+
/**
|
30
|
+
* @inheritDoc
|
31
|
+
*/
|
32
|
+
static get pluginName(): "CKBoxUploadAdapter";
|
33
|
+
/**
|
34
|
+
* @inheritDoc
|
35
|
+
*/
|
36
|
+
afterInit(): Promise<void>;
|
37
|
+
}
|