@ckeditor/ckeditor5-ckbox 41.3.0-alpha.3 → 41.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/build/ckbox.js +1 -1
  2. package/package.json +2 -3
  3. package/src/ckboxui.d.ts +4 -0
  4. package/src/ckboxui.js +24 -13
  5. package/dist/content-index.css +0 -4
  6. package/dist/editor-index.css +0 -31
  7. package/dist/index.css +0 -55
  8. package/dist/index.css.map +0 -1
  9. package/dist/translations/ar.d.ts +0 -8
  10. package/dist/translations/ar.js +0 -5
  11. package/dist/translations/az.d.ts +0 -8
  12. package/dist/translations/az.js +0 -5
  13. package/dist/translations/bg.d.ts +0 -8
  14. package/dist/translations/bg.js +0 -5
  15. package/dist/translations/bn.d.ts +0 -8
  16. package/dist/translations/bn.js +0 -5
  17. package/dist/translations/ca.d.ts +0 -8
  18. package/dist/translations/ca.js +0 -5
  19. package/dist/translations/cs.d.ts +0 -8
  20. package/dist/translations/cs.js +0 -5
  21. package/dist/translations/da.d.ts +0 -8
  22. package/dist/translations/da.js +0 -5
  23. package/dist/translations/de.d.ts +0 -8
  24. package/dist/translations/de.js +0 -5
  25. package/dist/translations/el.d.ts +0 -8
  26. package/dist/translations/el.js +0 -5
  27. package/dist/translations/en-au.d.ts +0 -8
  28. package/dist/translations/en-au.js +0 -5
  29. package/dist/translations/en.d.ts +0 -8
  30. package/dist/translations/en.js +0 -5
  31. package/dist/translations/es-co.d.ts +0 -8
  32. package/dist/translations/es-co.js +0 -5
  33. package/dist/translations/es.d.ts +0 -8
  34. package/dist/translations/es.js +0 -5
  35. package/dist/translations/et.d.ts +0 -8
  36. package/dist/translations/et.js +0 -5
  37. package/dist/translations/fa.d.ts +0 -8
  38. package/dist/translations/fa.js +0 -5
  39. package/dist/translations/fi.d.ts +0 -8
  40. package/dist/translations/fi.js +0 -5
  41. package/dist/translations/fr.d.ts +0 -8
  42. package/dist/translations/fr.js +0 -5
  43. package/dist/translations/gl.d.ts +0 -8
  44. package/dist/translations/gl.js +0 -5
  45. package/dist/translations/he.d.ts +0 -8
  46. package/dist/translations/he.js +0 -5
  47. package/dist/translations/hi.d.ts +0 -8
  48. package/dist/translations/hi.js +0 -5
  49. package/dist/translations/hr.d.ts +0 -8
  50. package/dist/translations/hr.js +0 -5
  51. package/dist/translations/hu.d.ts +0 -8
  52. package/dist/translations/hu.js +0 -5
  53. package/dist/translations/id.d.ts +0 -8
  54. package/dist/translations/id.js +0 -5
  55. package/dist/translations/it.d.ts +0 -8
  56. package/dist/translations/it.js +0 -5
  57. package/dist/translations/ja.d.ts +0 -8
  58. package/dist/translations/ja.js +0 -5
  59. package/dist/translations/ko.d.ts +0 -8
  60. package/dist/translations/ko.js +0 -5
  61. package/dist/translations/lt.d.ts +0 -8
  62. package/dist/translations/lt.js +0 -5
  63. package/dist/translations/lv.d.ts +0 -8
  64. package/dist/translations/lv.js +0 -5
  65. package/dist/translations/ms.d.ts +0 -8
  66. package/dist/translations/ms.js +0 -5
  67. package/dist/translations/nl.d.ts +0 -8
  68. package/dist/translations/nl.js +0 -5
  69. package/dist/translations/no.d.ts +0 -8
  70. package/dist/translations/no.js +0 -5
  71. package/dist/translations/pl.d.ts +0 -8
  72. package/dist/translations/pl.js +0 -5
  73. package/dist/translations/pt-br.d.ts +0 -8
  74. package/dist/translations/pt-br.js +0 -5
  75. package/dist/translations/pt.d.ts +0 -8
  76. package/dist/translations/pt.js +0 -5
  77. package/dist/translations/ro.d.ts +0 -8
  78. package/dist/translations/ro.js +0 -5
  79. package/dist/translations/ru.d.ts +0 -8
  80. package/dist/translations/ru.js +0 -5
  81. package/dist/translations/sk.d.ts +0 -8
  82. package/dist/translations/sk.js +0 -5
  83. package/dist/translations/sq.d.ts +0 -8
  84. package/dist/translations/sq.js +0 -5
  85. package/dist/translations/sr-latn.d.ts +0 -8
  86. package/dist/translations/sr-latn.js +0 -5
  87. package/dist/translations/sr.d.ts +0 -8
  88. package/dist/translations/sr.js +0 -5
  89. package/dist/translations/sv.d.ts +0 -8
  90. package/dist/translations/sv.js +0 -5
  91. package/dist/translations/th.d.ts +0 -8
  92. package/dist/translations/th.js +0 -5
  93. package/dist/translations/tr.d.ts +0 -8
  94. package/dist/translations/tr.js +0 -5
  95. package/dist/translations/ug.d.ts +0 -8
  96. package/dist/translations/ug.js +0 -5
  97. package/dist/translations/uk.d.ts +0 -8
  98. package/dist/translations/uk.js +0 -5
  99. package/dist/translations/ur.d.ts +0 -8
  100. package/dist/translations/ur.js +0 -5
  101. package/dist/translations/uz.d.ts +0 -8
  102. package/dist/translations/uz.js +0 -5
  103. package/dist/translations/vi.d.ts +0 -8
  104. package/dist/translations/vi.js +0 -5
  105. package/dist/translations/zh-cn.d.ts +0 -8
  106. package/dist/translations/zh-cn.js +0 -5
  107. package/dist/translations/zh.d.ts +0 -8
  108. package/dist/translations/zh.js +0 -5
  109. package/dist/types/augmentation.d.ts +0 -36
  110. package/dist/types/ckbox.d.ts +0 -37
  111. package/dist/types/ckboxcommand.d.ts +0 -118
  112. package/dist/types/ckboxconfig.d.ts +0 -329
  113. package/dist/types/ckboxediting.d.ts +0 -58
  114. package/dist/types/ckboximageedit/ckboximageeditcommand.d.ts +0 -101
  115. package/dist/types/ckboximageedit/ckboximageeditediting.d.ts +0 -32
  116. package/dist/types/ckboximageedit/ckboximageeditui.d.ts +0 -28
  117. package/dist/types/ckboximageedit/utils.d.ts +0 -14
  118. package/dist/types/ckboximageedit.d.ts +0 -28
  119. package/dist/types/ckboxui.d.ts +0 -25
  120. package/dist/types/ckboxuploadadapter.d.ts +0 -37
  121. package/dist/types/ckboxutils.d.ts +0 -54
  122. package/dist/types/index.d.ts +0 -21
  123. package/dist/types/utils.d.ts +0 -67
@@ -1,5 +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
- export default {"ug":{"dictionary":{"Open file manager":"ھۆججەت باشقۇرغۇچنى ئاچ","Cannot determine a category for the uploaded file.":"يۈكلەيدىغان ھۆججەتنىڭ تۈرىنى جەزملىيەلمىدى.","Cannot access default workspace.":"كۆڭۈلدىكى خىزمەت بوشلۇقىنى زىيارەت قىلالمايدۇ","Edit image":"","Processing the edited image.":"","Server failed to process the image.":"","Failed to determine category of edited image.":""},getPluralForm(n){return (n != 1);}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"uk":{"dictionary":{"Open file manager":"Відкрити менеджер файлів","Cannot determine a category for the uploaded file.":"Не вдається визначити категорію для завантаженого файлу.","Cannot access default workspace.":"Немає доступу до робочого простору за замовчуванням.","Edit image":"Редагувати зображення","Processing the edited image.":"Обробка відредагованого зображення.","Server failed to process the image.":"Серверу не вдалося обробити зображення.","Failed to determine category of edited image.":"Не вдалося визначити категорію відредагованого зображення."},getPluralForm(n){return (n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"ur":{"dictionary":{"Open file manager":"فائل مینیجر کھولیں","Cannot determine a category for the uploaded file.":"اپلوڈ کی گئی فائل کا ذمرے کا تعین نہیں ہو سکا","Cannot access default workspace.":"","Edit image":"","Processing the edited image.":"","Server failed to process the image.":"","Failed to determine category of edited image.":""},getPluralForm(n){return (n != 1);}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"uz":{"dictionary":{"Open file manager":"Fayl menejerini ochish","Cannot determine a category for the uploaded file.":"Yuklangan fayl uchun toifani aniqlab bo‘lmadi.","Cannot access default workspace.":"","Edit image":"","Processing the edited image.":"","Server failed to process the image.":"","Failed to determine category of edited image.":""},getPluralForm(n){return 0;}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"vi":{"dictionary":{"Open file manager":"Mở trình quản lý tệp","Cannot determine a category for the uploaded file.":"Không thể xác định danh mục cho tệp được tải lên.","Cannot access default workspace.":"Không thể truy cập vào không gian làm việc mặc định.","Edit image":"Chỉnh sửa hình ảnh","Processing the edited image.":"Xử lý hình ảnh đã chỉnh sửa.","Server failed to process the image.":"Máy chủ không thể xử lý hình ảnh.","Failed to determine category of edited image.":"Không thể xác định danh mục hình ảnh đã chỉnh sửa."},getPluralForm(n){return 0;}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"zh-cn":{"dictionary":{"Open file manager":"打开文件管理器","Cannot determine a category for the uploaded file.":"无法确定上传文件的类别。","Cannot access default workspace.":"无法访问默认工作区","Edit image":"编辑图片","Processing the edited image.":"正在处理已编辑的图片。","Server failed to process the image.":"服务器未能处理图片。","Failed to determine category of edited image.":"未能确定已编辑图片的类别。"},getPluralForm(n){return 0;}}}
@@ -1,8 +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
- import type { Translations } from 'ckeditor5';
7
- declare const translations: Translations;
8
- export default translations;
@@ -1,5 +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
- export default {"zh":{"dictionary":{"Open file manager":"開啟檔案管理程式","Cannot determine a category for the uploaded file.":"無法確定上傳檔案的分類。","Cannot access default workspace.":"無法存取預設工作區。","Edit image":"編輯圖片","Processing the edited image.":"正在處理已編輯的圖片。","Server failed to process the image.":"伺服器無法處理該圖片。","Failed to determine category of edited image.":"無法判斷已編輯圖片的類別。"},getPluralForm(n){return 0;}}}
@@ -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-oss-license
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
- }
@@ -1,37 +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-oss-license
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 requires(): readonly [typeof CKBoxEditing, typeof CKBoxUI];
37
- }
@@ -1,118 +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-oss-license
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
- * - dialog.onClose The callback function invoked after closing the CKBox dialog.
82
- * - assets.onChoose The callback function invoked after choosing the assets.
83
- */
84
- private _prepareOptions;
85
- /**
86
- * Initializes various event listeners for the `ckbox:*` events, because all functionality of the `ckbox` command is event-based.
87
- */
88
- private _initListeners;
89
- /**
90
- * Inserts the asset into the model.
91
- *
92
- * @param asset The asset to be inserted.
93
- * @param isLastAsset Indicates if the current asset is the last one from the chosen set.
94
- * @param writer An instance of the model writer.
95
- * @param isSingleAsset It's true when only one asset is processed.
96
- */
97
- private _insertAsset;
98
- /**
99
- * Inserts the image by calling the `insertImage` command.
100
- *
101
- * @param asset The asset to be inserted.
102
- */
103
- private _insertImage;
104
- /**
105
- * Inserts the link to the asset by calling the `link` command.
106
- *
107
- * @param asset The asset to be inserted.
108
- * @param writer An instance of the model writer.
109
- * @param isSingleAsset It's true when only one asset is processed.
110
- */
111
- private _insertLink;
112
- }
113
- /**
114
- * Parses the assets attributes into the internal data format.
115
- *
116
- * @internal
117
- */
118
- export declare function prepareImageAssetAttributes(asset: CKBoxRawAssetDefinition): CKBoxAssetImageAttributesDefinition;
@@ -1,329 +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-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
- }