@ckeditor/ckeditor5-ckbox 0.0.0-internal-20241017.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.
Files changed (309) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +24 -0
  4. package/build/ckbox.js +5 -0
  5. package/build/translations/ar.js +1 -0
  6. package/build/translations/az.js +1 -0
  7. package/build/translations/bg.js +1 -0
  8. package/build/translations/bn.js +1 -0
  9. package/build/translations/ca.js +1 -0
  10. package/build/translations/cs.js +1 -0
  11. package/build/translations/da.js +1 -0
  12. package/build/translations/de.js +1 -0
  13. package/build/translations/el.js +1 -0
  14. package/build/translations/en-au.js +1 -0
  15. package/build/translations/es-co.js +1 -0
  16. package/build/translations/es.js +1 -0
  17. package/build/translations/et.js +1 -0
  18. package/build/translations/fa.js +1 -0
  19. package/build/translations/fi.js +1 -0
  20. package/build/translations/fr.js +1 -0
  21. package/build/translations/gl.js +1 -0
  22. package/build/translations/he.js +1 -0
  23. package/build/translations/hi.js +1 -0
  24. package/build/translations/hr.js +1 -0
  25. package/build/translations/hu.js +1 -0
  26. package/build/translations/id.js +1 -0
  27. package/build/translations/it.js +1 -0
  28. package/build/translations/ja.js +1 -0
  29. package/build/translations/ko.js +1 -0
  30. package/build/translations/lt.js +1 -0
  31. package/build/translations/lv.js +1 -0
  32. package/build/translations/ms.js +1 -0
  33. package/build/translations/nl.js +1 -0
  34. package/build/translations/no.js +1 -0
  35. package/build/translations/pl.js +1 -0
  36. package/build/translations/pt-br.js +1 -0
  37. package/build/translations/pt.js +1 -0
  38. package/build/translations/ro.js +1 -0
  39. package/build/translations/ru.js +1 -0
  40. package/build/translations/sk.js +1 -0
  41. package/build/translations/sq.js +1 -0
  42. package/build/translations/sr-latn.js +1 -0
  43. package/build/translations/sr.js +1 -0
  44. package/build/translations/sv.js +1 -0
  45. package/build/translations/th.js +1 -0
  46. package/build/translations/tr.js +1 -0
  47. package/build/translations/ug.js +1 -0
  48. package/build/translations/uk.js +1 -0
  49. package/build/translations/ur.js +1 -0
  50. package/build/translations/uz.js +1 -0
  51. package/build/translations/vi.js +1 -0
  52. package/build/translations/zh-cn.js +1 -0
  53. package/build/translations/zh.js +1 -0
  54. package/ckeditor5-metadata.json +58 -0
  55. package/dist/augmentation.d.ts +36 -0
  56. package/dist/ckbox.d.ts +41 -0
  57. package/dist/ckboxcommand.d.ts +130 -0
  58. package/dist/ckboxconfig.d.ts +434 -0
  59. package/dist/ckboxediting.d.ts +65 -0
  60. package/dist/ckboximageedit/ckboximageeditcommand.d.ts +109 -0
  61. package/dist/ckboximageedit/ckboximageeditediting.d.ts +36 -0
  62. package/dist/ckboximageedit/ckboximageeditui.d.ts +32 -0
  63. package/dist/ckboximageedit/utils.d.ts +14 -0
  64. package/dist/ckboximageedit.d.ts +32 -0
  65. package/dist/ckboxui.d.ts +60 -0
  66. package/dist/ckboxuploadadapter.d.ts +41 -0
  67. package/dist/ckboxutils.d.ts +58 -0
  68. package/dist/index-content.css +4 -0
  69. package/dist/index-editor.css +46 -0
  70. package/dist/index.css +55 -0
  71. package/dist/index.css.map +1 -0
  72. package/dist/index.d.ts +21 -0
  73. package/dist/index.js +1787 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/translations/ar.d.ts +8 -0
  76. package/dist/translations/ar.js +5 -0
  77. package/dist/translations/ar.umd.js +11 -0
  78. package/dist/translations/az.d.ts +8 -0
  79. package/dist/translations/az.js +5 -0
  80. package/dist/translations/az.umd.js +11 -0
  81. package/dist/translations/bg.d.ts +8 -0
  82. package/dist/translations/bg.js +5 -0
  83. package/dist/translations/bg.umd.js +11 -0
  84. package/dist/translations/bn.d.ts +8 -0
  85. package/dist/translations/bn.js +5 -0
  86. package/dist/translations/bn.umd.js +11 -0
  87. package/dist/translations/ca.d.ts +8 -0
  88. package/dist/translations/ca.js +5 -0
  89. package/dist/translations/ca.umd.js +11 -0
  90. package/dist/translations/cs.d.ts +8 -0
  91. package/dist/translations/cs.js +5 -0
  92. package/dist/translations/cs.umd.js +11 -0
  93. package/dist/translations/da.d.ts +8 -0
  94. package/dist/translations/da.js +5 -0
  95. package/dist/translations/da.umd.js +11 -0
  96. package/dist/translations/de.d.ts +8 -0
  97. package/dist/translations/de.js +5 -0
  98. package/dist/translations/de.umd.js +11 -0
  99. package/dist/translations/el.d.ts +8 -0
  100. package/dist/translations/el.js +5 -0
  101. package/dist/translations/el.umd.js +11 -0
  102. package/dist/translations/en-au.d.ts +8 -0
  103. package/dist/translations/en-au.js +5 -0
  104. package/dist/translations/en-au.umd.js +11 -0
  105. package/dist/translations/en.d.ts +8 -0
  106. package/dist/translations/en.js +5 -0
  107. package/dist/translations/en.umd.js +11 -0
  108. package/dist/translations/es-co.d.ts +8 -0
  109. package/dist/translations/es-co.js +5 -0
  110. package/dist/translations/es-co.umd.js +11 -0
  111. package/dist/translations/es.d.ts +8 -0
  112. package/dist/translations/es.js +5 -0
  113. package/dist/translations/es.umd.js +11 -0
  114. package/dist/translations/et.d.ts +8 -0
  115. package/dist/translations/et.js +5 -0
  116. package/dist/translations/et.umd.js +11 -0
  117. package/dist/translations/fa.d.ts +8 -0
  118. package/dist/translations/fa.js +5 -0
  119. package/dist/translations/fa.umd.js +11 -0
  120. package/dist/translations/fi.d.ts +8 -0
  121. package/dist/translations/fi.js +5 -0
  122. package/dist/translations/fi.umd.js +11 -0
  123. package/dist/translations/fr.d.ts +8 -0
  124. package/dist/translations/fr.js +5 -0
  125. package/dist/translations/fr.umd.js +11 -0
  126. package/dist/translations/gl.d.ts +8 -0
  127. package/dist/translations/gl.js +5 -0
  128. package/dist/translations/gl.umd.js +11 -0
  129. package/dist/translations/he.d.ts +8 -0
  130. package/dist/translations/he.js +5 -0
  131. package/dist/translations/he.umd.js +11 -0
  132. package/dist/translations/hi.d.ts +8 -0
  133. package/dist/translations/hi.js +5 -0
  134. package/dist/translations/hi.umd.js +11 -0
  135. package/dist/translations/hr.d.ts +8 -0
  136. package/dist/translations/hr.js +5 -0
  137. package/dist/translations/hr.umd.js +11 -0
  138. package/dist/translations/hu.d.ts +8 -0
  139. package/dist/translations/hu.js +5 -0
  140. package/dist/translations/hu.umd.js +11 -0
  141. package/dist/translations/id.d.ts +8 -0
  142. package/dist/translations/id.js +5 -0
  143. package/dist/translations/id.umd.js +11 -0
  144. package/dist/translations/it.d.ts +8 -0
  145. package/dist/translations/it.js +5 -0
  146. package/dist/translations/it.umd.js +11 -0
  147. package/dist/translations/ja.d.ts +8 -0
  148. package/dist/translations/ja.js +5 -0
  149. package/dist/translations/ja.umd.js +11 -0
  150. package/dist/translations/ko.d.ts +8 -0
  151. package/dist/translations/ko.js +5 -0
  152. package/dist/translations/ko.umd.js +11 -0
  153. package/dist/translations/lt.d.ts +8 -0
  154. package/dist/translations/lt.js +5 -0
  155. package/dist/translations/lt.umd.js +11 -0
  156. package/dist/translations/lv.d.ts +8 -0
  157. package/dist/translations/lv.js +5 -0
  158. package/dist/translations/lv.umd.js +11 -0
  159. package/dist/translations/ms.d.ts +8 -0
  160. package/dist/translations/ms.js +5 -0
  161. package/dist/translations/ms.umd.js +11 -0
  162. package/dist/translations/nl.d.ts +8 -0
  163. package/dist/translations/nl.js +5 -0
  164. package/dist/translations/nl.umd.js +11 -0
  165. package/dist/translations/no.d.ts +8 -0
  166. package/dist/translations/no.js +5 -0
  167. package/dist/translations/no.umd.js +11 -0
  168. package/dist/translations/pl.d.ts +8 -0
  169. package/dist/translations/pl.js +5 -0
  170. package/dist/translations/pl.umd.js +11 -0
  171. package/dist/translations/pt-br.d.ts +8 -0
  172. package/dist/translations/pt-br.js +5 -0
  173. package/dist/translations/pt-br.umd.js +11 -0
  174. package/dist/translations/pt.d.ts +8 -0
  175. package/dist/translations/pt.js +5 -0
  176. package/dist/translations/pt.umd.js +11 -0
  177. package/dist/translations/ro.d.ts +8 -0
  178. package/dist/translations/ro.js +5 -0
  179. package/dist/translations/ro.umd.js +11 -0
  180. package/dist/translations/ru.d.ts +8 -0
  181. package/dist/translations/ru.js +5 -0
  182. package/dist/translations/ru.umd.js +11 -0
  183. package/dist/translations/sk.d.ts +8 -0
  184. package/dist/translations/sk.js +5 -0
  185. package/dist/translations/sk.umd.js +11 -0
  186. package/dist/translations/sq.d.ts +8 -0
  187. package/dist/translations/sq.js +5 -0
  188. package/dist/translations/sq.umd.js +11 -0
  189. package/dist/translations/sr-latn.d.ts +8 -0
  190. package/dist/translations/sr-latn.js +5 -0
  191. package/dist/translations/sr-latn.umd.js +11 -0
  192. package/dist/translations/sr.d.ts +8 -0
  193. package/dist/translations/sr.js +5 -0
  194. package/dist/translations/sr.umd.js +11 -0
  195. package/dist/translations/sv.d.ts +8 -0
  196. package/dist/translations/sv.js +5 -0
  197. package/dist/translations/sv.umd.js +11 -0
  198. package/dist/translations/th.d.ts +8 -0
  199. package/dist/translations/th.js +5 -0
  200. package/dist/translations/th.umd.js +11 -0
  201. package/dist/translations/tr.d.ts +8 -0
  202. package/dist/translations/tr.js +5 -0
  203. package/dist/translations/tr.umd.js +11 -0
  204. package/dist/translations/ug.d.ts +8 -0
  205. package/dist/translations/ug.js +5 -0
  206. package/dist/translations/ug.umd.js +11 -0
  207. package/dist/translations/uk.d.ts +8 -0
  208. package/dist/translations/uk.js +5 -0
  209. package/dist/translations/uk.umd.js +11 -0
  210. package/dist/translations/ur.d.ts +8 -0
  211. package/dist/translations/ur.js +5 -0
  212. package/dist/translations/ur.umd.js +11 -0
  213. package/dist/translations/uz.d.ts +8 -0
  214. package/dist/translations/uz.js +5 -0
  215. package/dist/translations/uz.umd.js +11 -0
  216. package/dist/translations/vi.d.ts +8 -0
  217. package/dist/translations/vi.js +5 -0
  218. package/dist/translations/vi.umd.js +11 -0
  219. package/dist/translations/zh-cn.d.ts +8 -0
  220. package/dist/translations/zh-cn.js +5 -0
  221. package/dist/translations/zh-cn.umd.js +11 -0
  222. package/dist/translations/zh.d.ts +8 -0
  223. package/dist/translations/zh.js +5 -0
  224. package/dist/translations/zh.umd.js +11 -0
  225. package/dist/utils.d.ts +67 -0
  226. package/lang/contexts.json +10 -0
  227. package/lang/translations/ar.po +50 -0
  228. package/lang/translations/az.po +50 -0
  229. package/lang/translations/bg.po +50 -0
  230. package/lang/translations/bn.po +50 -0
  231. package/lang/translations/ca.po +50 -0
  232. package/lang/translations/cs.po +50 -0
  233. package/lang/translations/da.po +50 -0
  234. package/lang/translations/de.po +50 -0
  235. package/lang/translations/el.po +50 -0
  236. package/lang/translations/en-au.po +50 -0
  237. package/lang/translations/en.po +50 -0
  238. package/lang/translations/es-co.po +50 -0
  239. package/lang/translations/es.po +50 -0
  240. package/lang/translations/et.po +50 -0
  241. package/lang/translations/fa.po +50 -0
  242. package/lang/translations/fi.po +50 -0
  243. package/lang/translations/fr.po +50 -0
  244. package/lang/translations/gl.po +50 -0
  245. package/lang/translations/he.po +50 -0
  246. package/lang/translations/hi.po +50 -0
  247. package/lang/translations/hr.po +50 -0
  248. package/lang/translations/hu.po +50 -0
  249. package/lang/translations/id.po +50 -0
  250. package/lang/translations/it.po +50 -0
  251. package/lang/translations/ja.po +50 -0
  252. package/lang/translations/ko.po +50 -0
  253. package/lang/translations/lt.po +50 -0
  254. package/lang/translations/lv.po +50 -0
  255. package/lang/translations/ms.po +50 -0
  256. package/lang/translations/nl.po +50 -0
  257. package/lang/translations/no.po +50 -0
  258. package/lang/translations/pl.po +50 -0
  259. package/lang/translations/pt-br.po +50 -0
  260. package/lang/translations/pt.po +50 -0
  261. package/lang/translations/ro.po +50 -0
  262. package/lang/translations/ru.po +50 -0
  263. package/lang/translations/sk.po +50 -0
  264. package/lang/translations/sq.po +50 -0
  265. package/lang/translations/sr-latn.po +50 -0
  266. package/lang/translations/sr.po +50 -0
  267. package/lang/translations/sv.po +50 -0
  268. package/lang/translations/th.po +50 -0
  269. package/lang/translations/tr.po +50 -0
  270. package/lang/translations/ug.po +50 -0
  271. package/lang/translations/uk.po +50 -0
  272. package/lang/translations/ur.po +50 -0
  273. package/lang/translations/uz.po +50 -0
  274. package/lang/translations/vi.po +50 -0
  275. package/lang/translations/zh-cn.po +50 -0
  276. package/lang/translations/zh.po +50 -0
  277. package/package.json +45 -0
  278. package/src/augmentation.d.ts +32 -0
  279. package/src/augmentation.js +5 -0
  280. package/src/ckbox.d.ts +37 -0
  281. package/src/ckbox.js +43 -0
  282. package/src/ckboxcommand.d.ts +126 -0
  283. package/src/ckboxcommand.js +364 -0
  284. package/src/ckboxconfig.d.ts +430 -0
  285. package/src/ckboxconfig.js +5 -0
  286. package/src/ckboxediting.d.ts +61 -0
  287. package/src/ckboxediting.js +389 -0
  288. package/src/ckboximageedit/ckboximageeditcommand.d.ts +105 -0
  289. package/src/ckboximageedit/ckboximageeditcommand.js +310 -0
  290. package/src/ckboximageedit/ckboximageeditediting.d.ts +32 -0
  291. package/src/ckboximageedit/ckboximageeditediting.js +42 -0
  292. package/src/ckboximageedit/ckboximageeditui.d.ts +28 -0
  293. package/src/ckboximageedit/ckboximageeditui.js +57 -0
  294. package/src/ckboximageedit/utils.d.ts +10 -0
  295. package/src/ckboximageedit/utils.js +48 -0
  296. package/src/ckboximageedit.d.ts +28 -0
  297. package/src/ckboximageedit.js +34 -0
  298. package/src/ckboxui.d.ts +56 -0
  299. package/src/ckboxui.js +136 -0
  300. package/src/ckboxuploadadapter.d.ts +37 -0
  301. package/src/ckboxuploadadapter.js +136 -0
  302. package/src/ckboxutils.d.ts +54 -0
  303. package/src/ckboxutils.js +189 -0
  304. package/src/index.d.ts +17 -0
  305. package/src/index.js +14 -0
  306. package/src/utils.d.ts +63 -0
  307. package/src/utils.js +175 -0
  308. package/theme/ckboximageedit.css +53 -0
  309. package/theme/icons/ckbox-image-edit.svg +1 -0
@@ -0,0 +1,430 @@
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
+ * @module ckbox/ckboxconfig
7
+ */
8
+ import type { TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
9
+ import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
10
+ /**
11
+ * The configuration of the {@link module:ckbox/ckbox~CKBox CKBox feature}.
12
+ *
13
+ * The minimal configuration for the CKBox feature requires providing the
14
+ * {@link module:ckbox/ckboxconfig~CKBoxConfig#tokenUrl `config.ckbox.tokenUrl`}:
15
+ *
16
+ * ```ts
17
+ * ClassicEditor
18
+ * .create( editorElement, {
19
+ * ckbox: {
20
+ * tokenUrl: 'https://example.com/cs-token-endpoint'
21
+ * }
22
+ * } )
23
+ * .then( ... )
24
+ * .catch( ... );
25
+ * ```
26
+ *
27
+ * Hovewer, you can also adjust the feature to fit your needs:
28
+ *
29
+ * ```ts
30
+ * ClassicEditor
31
+ * .create( editorElement, {
32
+ * ckbox: {
33
+ * defaultUploadCategories: {
34
+ * Bitmaps: [ 'bmp' ],
35
+ * Pictures: [ 'jpg', 'jpeg' ],
36
+ * Scans: [ 'png', 'tiff' ]
37
+ * },
38
+ * ignoreDataId: true,
39
+ * serviceOrigin: 'https://example.com/',
40
+ * tokenUrl: 'https://example.com/cs-token-endpoint'
41
+ * }
42
+ * } )
43
+ * .then( ... )
44
+ * .catch( ... );
45
+ * ```
46
+ *
47
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
48
+ */
49
+ export interface CKBoxConfig {
50
+ /**
51
+ * The authentication token URL for CKBox feature.
52
+ *
53
+ * Defaults to {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl `config.cloudServices.tokenUrl`}
54
+ */
55
+ tokenUrl?: TokenUrl;
56
+ /**
57
+ * The theme for CKBox dialog.
58
+ */
59
+ theme?: string;
60
+ /**
61
+ * Defines the categories to which the uploaded images will be assigned.
62
+ * If configured, it overrides the category mappings defined on the cloud service.
63
+ * The value of this option should be an object, where the keys define categories and their values are the types of images
64
+ * that will be uploaded to these categories. The categories might be referenced by their name or ID.
65
+ *
66
+ * Example:
67
+ *
68
+ * ```ts
69
+ * const ckboxConfig = {
70
+ * defaultUploadCategories: {
71
+ * Bitmaps: [ 'bmp' ],
72
+ * Pictures: [ 'jpg', 'jpeg' ],
73
+ * Scans: [ 'png', 'tiff' ],
74
+ * // The category below is referenced by its ID.
75
+ * 'fdf2a647-b67f-4a6c-b692-5ba1dc1ed87b': [ 'gif' ]
76
+ * }
77
+ * };
78
+ * ```
79
+ *
80
+ * @default null
81
+ */
82
+ defaultUploadCategories?: Record<string, Array<string>> | null;
83
+ /**
84
+ * Defines the workspace id to use during upload when the user has access to more than one workspace.
85
+ *
86
+ * If defined, it is an error, when the user has no access to the specified workspace.
87
+ */
88
+ defaultUploadWorkspaceId?: string;
89
+ /**
90
+ * Enforces displaying the "Powered by CKBox" link regardless of the CKBox plan used.
91
+ */
92
+ forceDemoLabel?: boolean;
93
+ /**
94
+ * Allows editing images that are not hosted in CKBox service.
95
+ *
96
+ * This configuration option should whitelist URL(s) of images that should be editable.
97
+ * Make sure that allowed image resources have CORS enabled.
98
+ *
99
+ * The image is editable if this option is:
100
+ * * a regular expression and it matches the image URL, or
101
+ * * a custom function that returns `true` for the image URL, or
102
+ * * `'origin'` literal and the image URL is from the same origin, or
103
+ * * an array of the above and the image URL matches one of the array elements.
104
+ *
105
+ * Images hosted in CKBox are always editable.
106
+ *
107
+ * @default []
108
+ */
109
+ allowExternalImagesEditing?: ArrayOrItem<RegExp | 'origin' | ((src: string) => boolean)>;
110
+ /**
111
+ * Inserts the unique asset ID as the `data-ckbox-resource-id` attribute. To disable this behavior, set it to `true`.
112
+ *
113
+ * @default false
114
+ */
115
+ ignoreDataId?: boolean;
116
+ /**
117
+ * Configures the base URL of the API service. Required only in on-premises installations.
118
+ *
119
+ * @default 'https://api.ckbox.io'
120
+ */
121
+ serviceOrigin?: string;
122
+ /**
123
+ * Configures the language for the CKBox dialog.
124
+ *
125
+ * Defaults to {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`}
126
+ */
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;
233
+ }
234
+ /**
235
+ * Asset definition.
236
+ *
237
+ * The definition contains the unique `id`, asset `type` and an `attributes` definition.
238
+ */
239
+ export type CKBoxAssetDefinition = CKBoxAssetImageDefinition | CKBoxAssetLinkDefinition;
240
+ /**
241
+ * Image asset definition.
242
+ *
243
+ * The definition contains the unique `id`, asset `type` and an `attributes` definition.
244
+ */
245
+ export interface CKBoxAssetImageDefinition {
246
+ /**
247
+ * An unique asset id.
248
+ */
249
+ id: string;
250
+ /**
251
+ * Asset type.
252
+ */
253
+ type: 'image';
254
+ /**
255
+ * Asset attributes.
256
+ */
257
+ attributes: CKBoxAssetImageAttributesDefinition;
258
+ }
259
+ /**
260
+ * Link asset definition.
261
+ *
262
+ * The definition contains the unique `id`, asset `type` and an `attributes` definition.
263
+ */
264
+ export interface CKBoxAssetLinkDefinition {
265
+ /**
266
+ * An unique asset id.
267
+ */
268
+ id: string;
269
+ /**
270
+ * Asset type.
271
+ */
272
+ type: 'link';
273
+ /**
274
+ * Asset attributes.
275
+ */
276
+ attributes: CKBoxAssetLinkAttributesDefinition;
277
+ }
278
+ /**
279
+ * Asset attributes definition for an image.
280
+ *
281
+ * The definition contains the `imageFallbackUrl`, an `imageSources` array with one image source definition object and the
282
+ * `imageTextAlternative`.
283
+ *
284
+ * ```ts
285
+ * {
286
+ * imageFallbackUrl: 'https://example.com/assets/asset-id/images/1000.png',
287
+ * imageSources: [
288
+ * {
289
+ * sizes: '1000px',
290
+ * srcset:
291
+ * 'https://example.com/assets/asset-id/images/100.webp 100w,' +
292
+ * 'https://example.com/assets/asset-id/images/200.webp 200w,' +
293
+ * 'https://example.com/assets/asset-id/images/300.webp 300w,' +
294
+ * 'https://example.com/assets/asset-id/images/400.webp 400w,' +
295
+ * 'https://example.com/assets/asset-id/images/500.webp 500w,' +
296
+ * 'https://example.com/assets/asset-id/images/600.webp 600w,' +
297
+ * 'https://example.com/assets/asset-id/images/700.webp 700w,' +
298
+ * 'https://example.com/assets/asset-id/images/800.webp 800w,' +
299
+ * 'https://example.com/assets/asset-id/images/900.webp 900w,' +
300
+ * 'https://example.com/assets/asset-id/images/1000.webp 1000w',
301
+ * type: 'image/webp'
302
+ * }
303
+ * ],
304
+ * imageTextAlternative: 'An alternative text for the image'
305
+ * }
306
+ * ```
307
+ */
308
+ export interface CKBoxAssetImageAttributesDefinition {
309
+ /**
310
+ * A fallback URL for browsers that do not support the "webp" format.
311
+ */
312
+ imageFallbackUrl: string;
313
+ /**
314
+ * An array containing one image source definition object.
315
+ */
316
+ imageSources: Array<{
317
+ srcset: string;
318
+ sizes: string;
319
+ type: string;
320
+ }>;
321
+ /**
322
+ * An alternative text for an image.
323
+ */
324
+ imageTextAlternative: string;
325
+ /**
326
+ * Image width.
327
+ */
328
+ imageWidth?: number;
329
+ /**
330
+ * Image height.
331
+ */
332
+ imageHeight?: number;
333
+ /**
334
+ * Image placeholder image.
335
+ */
336
+ imagePlaceholder?: string;
337
+ }
338
+ /**
339
+ * Asset attributes definition for a link.
340
+ *
341
+ * The definition contains the `linkName` and `linkHref` strings.
342
+ *
343
+ * ```ts
344
+ * {
345
+ * linkName: 'File name',
346
+ * linkHref: 'https://example.com/assets/asset-id/file.pdf'
347
+ * }
348
+ * ```
349
+ */
350
+ export interface CKBoxAssetLinkAttributesDefinition {
351
+ /**
352
+ * A link name.
353
+ */
354
+ linkName: string;
355
+ /**
356
+ * An URL for the asset.
357
+ */
358
+ linkHref: string;
359
+ }
360
+ /**
361
+ * The source set of the responsive image provided by the CKBox backend.
362
+ *
363
+ * Each numeric key corresponds to display width of the image.
364
+ */
365
+ export interface CKBoxImageUrls {
366
+ [width: number]: string;
367
+ /**
368
+ * A fallback URL for browsers that do not support the "webp" format.
369
+ */
370
+ default: string;
371
+ }
372
+ /**
373
+ * Raw asset definition that is received from the CKBox feature.
374
+ */
375
+ export interface CKBoxRawAssetDefinition {
376
+ /**
377
+ * A raw asset data definition.
378
+ */
379
+ data: CKBoxRawAssetDataDefinition;
380
+ }
381
+ /**
382
+ * Part of raw asset data that is received from the CKBox feature.
383
+ */
384
+ export interface CKBoxRawAssetDataDefinition {
385
+ /**
386
+ * An unique asset id.
387
+ */
388
+ id: string;
389
+ /**
390
+ * An asset name.
391
+ */
392
+ name: string;
393
+ /**
394
+ * A raw asset metadata definition.
395
+ */
396
+ metadata?: CKBoxRawAssetMetadataDefinition;
397
+ /**
398
+ * The source set of the responsive image.
399
+ */
400
+ imageUrls?: CKBoxImageUrls;
401
+ /**
402
+ * The asset location.
403
+ */
404
+ url: string;
405
+ }
406
+ /**
407
+ * Part of raw asset data that is received from the CKBox feature. Properties are set only if the chosen asset is an image.
408
+ */
409
+ export interface CKBoxRawAssetMetadataDefinition {
410
+ /**
411
+ * Image description.
412
+ */
413
+ description?: string;
414
+ /**
415
+ * Image width.
416
+ */
417
+ width?: number;
418
+ /**
419
+ * Image height.
420
+ */
421
+ height?: number;
422
+ /**
423
+ * The blurhash placeholder value.
424
+ */
425
+ blurHash?: string;
426
+ /**
427
+ * The processing status of the asset.
428
+ */
429
+ metadataProcessingStatus?: string;
430
+ }
@@ -0,0 +1,5 @@
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 {};
@@ -0,0 +1,61 @@
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
+ * @module ckbox/ckboxediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import CKBoxUploadAdapter from './ckboxuploadadapter.js';
10
+ import CKBoxUtils from './ckboxutils.js';
11
+ /**
12
+ * The CKBox editing feature. It introduces the {@link module:ckbox/ckboxcommand~CKBoxCommand CKBox command} and
13
+ * {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}.
14
+ */
15
+ export default class CKBoxEditing extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName(): "CKBoxEditing";
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get isOfficialPlugin(): true;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get requires(): readonly ["LinkEditing", "PictureEditing", typeof CKBoxUploadAdapter, typeof CKBoxUtils];
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init(): void;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ afterInit(): void;
36
+ /**
37
+ * Returns true only when the integrator intentionally wants to use the plugin, i.e. when the `config.ckbox` exists or
38
+ * the CKBox JavaScript library is loaded.
39
+ */
40
+ private _shouldBeInitialised;
41
+ /**
42
+ * Blocks `uploadImage` and `ckboxImageEdit` commands.
43
+ */
44
+ private _blockImageCommands;
45
+ /**
46
+ * Checks if at least one image plugin is loaded.
47
+ */
48
+ private _checkImagePlugins;
49
+ /**
50
+ * Extends the schema to allow the `ckboxImageId` and `ckboxLinkId` attributes for links and images.
51
+ */
52
+ private _initSchema;
53
+ /**
54
+ * Configures the upcast and downcast conversions for the `ckboxImageId` and `ckboxLinkId` attributes.
55
+ */
56
+ private _initConversion;
57
+ /**
58
+ * Registers post-fixers that add or remove the `ckboxLinkId` and `ckboxImageId` attributes.
59
+ */
60
+ private _initFixers;
61
+ }