@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20230726.0 → 0.0.0-nightly-20230728.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/build/ckbox.js +2 -2
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/az.js +1 -1
  4. package/build/translations/bg.js +1 -1
  5. package/build/translations/bn.js +1 -1
  6. package/build/translations/ca.js +1 -1
  7. package/build/translations/cs.js +1 -1
  8. package/build/translations/da.js +1 -1
  9. package/build/translations/de.js +1 -1
  10. package/build/translations/el.js +1 -1
  11. package/build/translations/en-au.js +1 -1
  12. package/build/translations/es-co.js +1 -1
  13. package/build/translations/es.js +1 -1
  14. package/build/translations/et.js +1 -1
  15. package/build/translations/fa.js +1 -1
  16. package/build/translations/fi.js +1 -1
  17. package/build/translations/fr.js +1 -1
  18. package/build/translations/gl.js +1 -1
  19. package/build/translations/he.js +1 -1
  20. package/build/translations/hi.js +1 -1
  21. package/build/translations/hr.js +1 -1
  22. package/build/translations/hu.js +1 -1
  23. package/build/translations/id.js +1 -1
  24. package/build/translations/it.js +1 -1
  25. package/build/translations/ja.js +1 -1
  26. package/build/translations/ko.js +1 -1
  27. package/build/translations/lt.js +1 -1
  28. package/build/translations/lv.js +1 -1
  29. package/build/translations/ms.js +1 -1
  30. package/build/translations/nl.js +1 -1
  31. package/build/translations/no.js +1 -1
  32. package/build/translations/pl.js +1 -1
  33. package/build/translations/pt-br.js +1 -1
  34. package/build/translations/pt.js +1 -1
  35. package/build/translations/ro.js +1 -1
  36. package/build/translations/ru.js +1 -1
  37. package/build/translations/sk.js +1 -1
  38. package/build/translations/sq.js +1 -0
  39. package/build/translations/sr-latn.js +1 -1
  40. package/build/translations/sr.js +1 -1
  41. package/build/translations/sv.js +1 -1
  42. package/build/translations/th.js +1 -1
  43. package/build/translations/tr.js +1 -1
  44. package/build/translations/ug.js +1 -1
  45. package/build/translations/uk.js +1 -1
  46. package/build/translations/ur.js +1 -1
  47. package/build/translations/uz.js +1 -1
  48. package/build/translations/vi.js +1 -1
  49. package/build/translations/zh-cn.js +1 -1
  50. package/build/translations/zh.js +1 -1
  51. package/lang/contexts.json +2 -1
  52. package/lang/translations/ar.po +4 -0
  53. package/lang/translations/az.po +4 -0
  54. package/lang/translations/bg.po +4 -0
  55. package/lang/translations/bn.po +4 -0
  56. package/lang/translations/ca.po +4 -0
  57. package/lang/translations/cs.po +4 -0
  58. package/lang/translations/da.po +4 -0
  59. package/lang/translations/de.po +4 -0
  60. package/lang/translations/el.po +4 -0
  61. package/lang/translations/en-au.po +4 -0
  62. package/lang/translations/en.po +4 -0
  63. package/lang/translations/es-co.po +4 -0
  64. package/lang/translations/es.po +4 -0
  65. package/lang/translations/et.po +4 -0
  66. package/lang/translations/fa.po +4 -0
  67. package/lang/translations/fi.po +4 -0
  68. package/lang/translations/fr.po +4 -0
  69. package/lang/translations/gl.po +4 -0
  70. package/lang/translations/he.po +4 -0
  71. package/lang/translations/hi.po +4 -0
  72. package/lang/translations/hr.po +4 -0
  73. package/lang/translations/hu.po +4 -0
  74. package/lang/translations/id.po +4 -0
  75. package/lang/translations/it.po +4 -0
  76. package/lang/translations/ja.po +4 -0
  77. package/lang/translations/ko.po +4 -0
  78. package/lang/translations/lt.po +4 -0
  79. package/lang/translations/lv.po +4 -0
  80. package/lang/translations/ms.po +4 -0
  81. package/lang/translations/nl.po +4 -0
  82. package/lang/translations/no.po +4 -0
  83. package/lang/translations/pl.po +4 -0
  84. package/lang/translations/pt-br.po +4 -0
  85. package/lang/translations/pt.po +4 -0
  86. package/lang/translations/ro.po +4 -0
  87. package/lang/translations/ru.po +4 -0
  88. package/lang/translations/sk.po +4 -0
  89. package/lang/translations/sq.po +29 -0
  90. package/lang/translations/sr-latn.po +4 -0
  91. package/lang/translations/sr.po +4 -0
  92. package/lang/translations/sv.po +4 -0
  93. package/lang/translations/th.po +4 -0
  94. package/lang/translations/tr.po +4 -0
  95. package/lang/translations/ug.po +4 -0
  96. package/lang/translations/uk.po +4 -0
  97. package/lang/translations/ur.po +4 -0
  98. package/lang/translations/uz.po +4 -0
  99. package/lang/translations/vi.po +4 -0
  100. package/lang/translations/zh-cn.po +4 -0
  101. package/lang/translations/zh.po +4 -0
  102. package/package.json +2 -2
  103. package/src/ckboxcommand.d.ts +0 -1
  104. package/src/ckboxcommand.js +10 -23
  105. package/src/ckboxconfig.d.ts +26 -15
  106. package/src/ckboxediting.js +0 -1
  107. package/src/ckboxuploadadapter.js +24 -26
  108. package/src/utils.d.ts +7 -10
  109. package/src/utils.js +27 -68
@@ -23,3 +23,7 @@ msgstr "Buka manajer berkas"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Tak dapat menentukan kategori untuk berkas yang terunggah."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Apri il gestore dei file"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Impossibile determinare la categoria del file caricato."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "ファイルマネージャーを開く"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "アップロードされたファイルのカテゴリを特定することができません。"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "파일 관리자 열기"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "업로드된 파일의 카테고리를 확인할 수 없습니다."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Atidaryti failų tvarkyklę"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Negalima apibrėžti įkelto failo kategorijos."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Atvērt failu pārvaldnieku"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Nav iespējams noteikt augšupielādētā faila kategoriju"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Buka pengurus fail"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Gagal menentukan kategori bagi fail yang dimuat naik."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Open bestandsmanager"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Kan geen categorie bepalen voor het geüploade bestand."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Åpne filutforsker"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Kunne ikke avgjøre kategori for den opplastede filen."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Otwórz menedżer plików"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Nie można ustalić kategorii przesłanego pliku."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Abrir gerenciador de arquivos"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Não foi possível determinar a categoria para o arquivo enviado."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Abrir gestor de ficheiros"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Não é possível determinar a categoria do ficheiro carregado."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Deschidere manager fișiere"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Categoria fișierului încărcat nu poate fi stabilită."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Открыть менеджер файлов"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Не удаётся определить категорию для загруженного файла."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Otvoriť manažér súborov"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Neznáma kategória pre nahratý súbor."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Albanian (https://app.transifex.com/ckeditor/teams/11143/sq/)\n"
16
+ "Language: sq\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
+ msgid "Open file manager"
21
+ msgstr "Hap menaxhuesin e skedarëve"
22
+
23
+ msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
+ msgid "Cannot determine a category for the uploaded file."
25
+ msgstr "Nuk mund të përcaktohet kategori për skedarin e ngarkuar."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Otvori upravljač datotekama"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Nije moguće odrediti kategoriju za otpremljenu datoteku."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Oтвори управљач датотекама."
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Није могуће одредити категорију за отпремлјену датотеку."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Öppna filhanterare"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Kan inte avgöra kategorin på den uppladdade filen."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "เปิดเครื่องมือจัดการไฟล์
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "ไม่สามารถกำหนดหมวดหมู่สำหรับไฟล์ที่อัปโหลด"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Dosya yöneticisini aç"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Yüklenen dosya için bir kategori belirlenemiyor."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "ھۆججەت باشقۇرغۇچنى ئاچ"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "يۈكلەيدىغان ھۆججەتنىڭ تۈرىنى جەزملىيەلمىدى."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Відкрити менеджер файлів"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Не вдається визначити категорію для завантаженого файлу."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "فائل مینیجر کھولیں"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "اپلوڈ کی گئی فائل کا ذمرے کا تعین نہیں ہو سکا"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Fayl menejerini ochish"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Yuklangan fayl uchun toifani aniqlab bo‘lmadi."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "Mở trình quản lý tệp"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "Không thể xác định danh mục cho tệp được tải lên."
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "打开文件管理器"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "无法确定上传文件的类别。"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
@@ -23,3 +23,7 @@ msgstr "開啟檔案管理程式"
23
23
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
24
  msgid "Cannot determine a category for the uploaded file."
25
25
  msgstr "無法確定上傳檔案的分類。"
26
+
27
+ msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
+ msgid "Cannot access default workspace."
29
+ msgstr ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ckbox",
3
- "version": "0.0.0-nightly-20230726.0",
3
+ "version": "0.0.0-nightly-20230728.0",
4
4
  "description": "CKBox integration for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "0.0.0-nightly-20230726.0"
15
+ "ckeditor5": "0.0.0-nightly-20230728.0"
16
16
  },
17
17
  "engines": {
18
18
  "node": ">=16.0.0",
@@ -78,7 +78,6 @@ export default class CKBoxCommand extends Command {
78
78
  * - language The language for CKBox dialog.
79
79
  * - tokenUrl The token endpoint URL.
80
80
  * - serviceOrigin The base URL of the API service.
81
- * - assetsOrigin The base URL for assets inserted into the editor.
82
81
  * - dialog.onClose The callback function invoked after closing the CKBox dialog.
83
82
  * - assets.onChoose The callback function invoked after choosing the assets.
84
83
  */
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { Command } from 'ckeditor5/src/core';
6
6
  import { createElement, toMap } from 'ckeditor5/src/utils';
7
- import { getEnvironmentId, getImageUrls } from './utils';
7
+ import { getImageUrls } from './utils';
8
8
  // Defines the waiting time (in milliseconds) for inserting the chosen asset into the model. The chosen asset is temporarily stored in the
9
9
  // `CKBoxCommand#_chosenAssets` and it is removed from there automatically after this time. See `CKBoxCommand#_chosenAssets` for more
10
10
  // details.
@@ -94,7 +94,6 @@ export default class CKBoxCommand extends Command {
94
94
  * - language The language for CKBox dialog.
95
95
  * - tokenUrl The token endpoint URL.
96
96
  * - serviceOrigin The base URL of the API service.
97
- * - assetsOrigin The base URL for assets inserted into the editor.
98
97
  * - dialog.onClose The callback function invoked after closing the CKBox dialog.
99
98
  * - assets.onChoose The callback function invoked after choosing the assets.
100
99
  */
@@ -106,7 +105,6 @@ export default class CKBoxCommand extends Command {
106
105
  language: ckboxConfig.language,
107
106
  tokenUrl: ckboxConfig.tokenUrl,
108
107
  serviceOrigin: ckboxConfig.serviceOrigin,
109
- assetsOrigin: ckboxConfig.assetsOrigin,
110
108
  dialog: {
111
109
  onClose: () => this.fire('ckbox:close')
112
110
  },
@@ -150,12 +148,8 @@ export default class CKBoxCommand extends Command {
150
148
  }
151
149
  const imageCommand = editor.commands.get('insertImage');
152
150
  const linkCommand = editor.commands.get('link');
153
- const ckboxEditing = editor.plugins.get('CKBoxEditing');
154
- const assetsOrigin = editor.config.get('ckbox.assetsOrigin');
155
151
  const assetsToProcess = prepareAssets({
156
152
  assets,
157
- origin: assetsOrigin,
158
- token: ckboxEditing.getToken(),
159
153
  isImageAllowed: imageCommand.isEnabled,
160
154
  isLinkAllowed: linkCommand.isEnabled
161
155
  });
@@ -247,18 +241,18 @@ export default class CKBoxCommand extends Command {
247
241
  /**
248
242
  * Parses the chosen assets into the internal data format. Filters out chosen assets that are not allowed.
249
243
  */
250
- function prepareAssets({ assets, origin, token, isImageAllowed, isLinkAllowed }) {
244
+ function prepareAssets({ assets, isImageAllowed, isLinkAllowed }) {
251
245
  return assets
252
246
  .map(asset => isImage(asset) ?
253
247
  {
254
248
  id: asset.data.id,
255
249
  type: 'image',
256
- attributes: prepareImageAssetAttributes(asset, token, origin)
250
+ attributes: prepareImageAssetAttributes(asset)
257
251
  } :
258
252
  {
259
253
  id: asset.data.id,
260
254
  type: 'link',
261
- attributes: prepareLinkAssetAttributes(asset, token, origin)
255
+ attributes: prepareLinkAssetAttributes(asset)
262
256
  })
263
257
  .filter(asset => asset.type === 'image' ? isImageAllowed : isLinkAllowed);
264
258
  }
@@ -267,14 +261,8 @@ function prepareAssets({ assets, origin, token, isImageAllowed, isLinkAllowed })
267
261
  *
268
262
  * @param origin The base URL for assets inserted into the editor.
269
263
  */
270
- function prepareImageAssetAttributes(asset, token, origin) {
271
- const { imageFallbackUrl, imageSources } = getImageUrls({
272
- token,
273
- origin,
274
- id: asset.data.id,
275
- width: asset.data.metadata.width,
276
- extension: asset.data.extension
277
- });
264
+ function prepareImageAssetAttributes(asset) {
265
+ const { imageFallbackUrl, imageSources } = getImageUrls(asset.data.imageUrls);
278
266
  return {
279
267
  imageFallbackUrl,
280
268
  imageSources,
@@ -286,10 +274,10 @@ function prepareImageAssetAttributes(asset, token, origin) {
286
274
  *
287
275
  * @param origin The base URL for assets inserted into the editor.
288
276
  */
289
- function prepareLinkAssetAttributes(asset, token, origin) {
277
+ function prepareLinkAssetAttributes(asset) {
290
278
  return {
291
279
  linkName: asset.data.name,
292
- linkHref: getAssetUrl(asset, token, origin)
280
+ linkHref: getAssetUrl(asset)
293
281
  };
294
282
  }
295
283
  /**
@@ -307,9 +295,8 @@ function isImage(asset) {
307
295
  *
308
296
  * @param origin The base URL for assets inserted into the editor.
309
297
  */
310
- function getAssetUrl(asset, token, origin) {
311
- const environmentId = getEnvironmentId(token);
312
- const url = new URL(`${environmentId}/assets/${asset.data.id}/file`, origin);
298
+ function getAssetUrl(asset) {
299
+ const url = new URL(asset.data.url);
313
300
  url.searchParams.set('download', 'true');
314
301
  return url.toString();
315
302
  }
@@ -36,7 +36,6 @@ import type { TokenUrl } from '@ckeditor/ckeditor5-cloud-services';
36
36
  * },
37
37
  * ignoreDataId: true,
38
38
  * serviceOrigin: 'https://example.com/',
39
- * assetsOrigin: 'https://example.cloud/',
40
39
  * tokenUrl: 'https://example.com/cs-token-endpoint'
41
40
  * }
42
41
  * } )
@@ -80,6 +79,12 @@ export interface CKBoxConfig {
80
79
  * @default null
81
80
  */
82
81
  defaultUploadCategories?: Record<string, Array<string>> | null;
82
+ /**
83
+ * Defines the workspace id to use during upload when the user has access to more than one workspace.
84
+ *
85
+ * If defined, it is an error, when the user has no access to the specified workspace.
86
+ */
87
+ defaultUploadWorkspaceId?: string;
83
88
  /**
84
89
  * Inserts the unique asset ID as the `data-ckbox-resource-id` attribute. To disable this behavior, set it to `true`.
85
90
  *
@@ -92,12 +97,6 @@ export interface CKBoxConfig {
92
97
  * @default 'https://api.ckbox.io'
93
98
  */
94
99
  serviceOrigin?: string;
95
- /**
96
- * Configures the base URL for assets inserted into the editor. Required only in on-premises installations.
97
- *
98
- * @default 'https://ckbox.cloud'
99
- */
100
- assetsOrigin?: string;
101
100
  /**
102
101
  * Configures the language for the CKBox dialog.
103
102
  *
@@ -219,6 +218,18 @@ export interface CKBoxAssetLinkAttributesDefinition {
219
218
  */
220
219
  linkHref: string;
221
220
  }
221
+ /**
222
+ * The source set of the responsive image provided by the CKBox backend.
223
+ *
224
+ * Each numeric key corresponds to display width of the image.
225
+ */
226
+ export interface CKBoxImageUrls {
227
+ [width: number]: string;
228
+ /**
229
+ * A fallback URL for browsers that do not support the "webp" format.
230
+ */
231
+ default: string;
232
+ }
222
233
  /**
223
234
  * Raw asset definition that is received from the CKBox feature.
224
235
  */
@@ -227,10 +238,6 @@ export interface CKBoxRawAssetDefinition {
227
238
  * A raw asset data definition.
228
239
  */
229
240
  data: CKBoxRawAssetDataDefinition;
230
- /**
231
- * An asset origin URL.
232
- */
233
- origin: string;
234
241
  }
235
242
  /**
236
243
  * Part of raw asset data that is received from the CKBox feature.
@@ -240,10 +247,6 @@ export interface CKBoxRawAssetDataDefinition {
240
247
  * An unique asset id.
241
248
  */
242
249
  id: string;
243
- /**
244
- * An asset extension.
245
- */
246
- extension: string;
247
250
  /**
248
251
  * An asset name.
249
252
  */
@@ -252,6 +255,14 @@ export interface CKBoxRawAssetDataDefinition {
252
255
  * A raw asset metadata definition.
253
256
  */
254
257
  metadata?: CKBoxRawAssetMetadataDefinition;
258
+ /**
259
+ * The source set of the responsive image.
260
+ */
261
+ imageUrls?: CKBoxImageUrls;
262
+ /**
263
+ * The asset location.
264
+ */
265
+ url: string;
255
266
  }
256
267
  /**
257
268
  * Part of raw asset data that is received from the CKBox feature. Properties are set only if the chosen asset is an image.
@@ -75,7 +75,6 @@ export default class CKBoxEditing extends Plugin {
75
75
  const editor = this.editor;
76
76
  editor.config.define('ckbox', {
77
77
  serviceOrigin: 'https://api.ckbox.io',
78
- assetsOrigin: 'https://ckbox.cloud',
79
78
  defaultUploadCategories: null,
80
79
  ignoreDataId: false,
81
80
  language: editor.locale.uiLanguage,
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- /* globals AbortController, FormData, URL, Image, XMLHttpRequest, window */
5
+ /* globals AbortController, FormData, URL, XMLHttpRequest, window */
6
6
  /**
7
7
  * @module ckbox/ckboxuploadadapter
8
8
  */
@@ -10,7 +10,7 @@ import { Plugin } from 'ckeditor5/src/core';
10
10
  import { FileRepository } from 'ckeditor5/src/upload';
11
11
  import { logError } from 'ckeditor5/src/utils';
12
12
  import CKBoxEditing from './ckboxediting';
13
- import { getImageUrls } from './utils';
13
+ import { getImageUrls, getWorkspaceId } from './utils';
14
14
  /**
15
15
  * A plugin that enables file uploads in CKEditor 5 using the CKBox server–side connector.
16
16
  * See the {@glink features/file-management/ckbox CKBox file manager integration} guide to learn how to configure
@@ -76,7 +76,25 @@ class Adapter {
76
76
  this.editor = editor;
77
77
  this.controller = new AbortController();
78
78
  this.serviceOrigin = editor.config.get('ckbox.serviceOrigin');
79
- this.assetsOrigin = editor.config.get('ckbox.assetsOrigin');
79
+ }
80
+ /**
81
+ * The ID of workspace to use.
82
+ */
83
+ getWorkspaceId() {
84
+ const t = this.editor.t;
85
+ const cannotAccessDefaultWorkspaceError = t('Cannot access default workspace.');
86
+ const defaultWorkspaceId = this.editor.config.get('ckbox.defaultUploadWorkspaceId');
87
+ const workspaceId = getWorkspaceId(this.token, defaultWorkspaceId);
88
+ if (workspaceId == null) {
89
+ /**
90
+ * The user is not authorized to access workspace defined in `ckbox.defaultUploadWorkspaceId` configuration.
91
+ *
92
+ * @error ckbox-access-default-workspace-error
93
+ */
94
+ logError('ckbox-access-default-workspace-error');
95
+ throw cannotAccessDefaultWorkspaceError;
96
+ }
97
+ return workspaceId;
80
98
  }
81
99
  /**
82
100
  * Resolves a promise with an array containing available categories with which the uploaded file can be associated.
@@ -88,6 +106,7 @@ class Adapter {
88
106
  const categoryUrl = new URL('categories', this.serviceOrigin);
89
107
  categoryUrl.searchParams.set('limit', ITEMS_PER_REQUEST.toString());
90
108
  categoryUrl.searchParams.set('offset', offset.toString());
109
+ categoryUrl.searchParams.set('workspaceId', this.getWorkspaceId());
91
110
  return this._sendHttpRequest({ url: categoryUrl })
92
111
  .then(async (data) => {
93
112
  const remainingItems = data.totalCount - (offset + ITEMS_PER_REQUEST);
@@ -158,6 +177,7 @@ class Adapter {
158
177
  }
159
178
  const uploadUrl = new URL('assets', this.serviceOrigin);
160
179
  const formData = new FormData();
180
+ uploadUrl.searchParams.set('workspaceId', this.getWorkspaceId());
161
181
  formData.append('categoryId', category);
162
182
  formData.append('file', file);
163
183
  const requestConfig = {
@@ -174,15 +194,7 @@ class Adapter {
174
194
  };
175
195
  return this._sendHttpRequest(requestConfig)
176
196
  .then(async (data) => {
177
- const width = await this._getImageWidth();
178
- const extension = getFileExtension(file.name);
179
- const imageUrls = getImageUrls({
180
- token: this.token,
181
- id: data.id,
182
- origin: this.assetsOrigin,
183
- width,
184
- extension
185
- });
197
+ const imageUrls = getImageUrls(data.imageUrls);
186
198
  return {
187
199
  ckboxImageId: data.id,
188
200
  default: imageUrls.imageFallbackUrl,
@@ -252,20 +264,6 @@ class Adapter {
252
264
  xhr.send(data);
253
265
  });
254
266
  }
255
- /**
256
- * Resolves a promise with a number representing the width of a given image file.
257
- */
258
- _getImageWidth() {
259
- return new Promise(resolve => {
260
- const image = new Image();
261
- image.onload = () => {
262
- // Let the browser know that it should not keep the reference any longer to avoid memory leeks.
263
- URL.revokeObjectURL(image.src);
264
- resolve(image.width);
265
- };
266
- image.src = this.loader.data;
267
- });
268
- }
269
267
  }
270
268
  /**
271
269
  * Returns an extension from the given value.
package/src/utils.d.ts CHANGED
@@ -6,18 +6,13 @@
6
6
  * @module ckbox/utils
7
7
  */
8
8
  import type { InitializedToken } from '@ckeditor/ckeditor5-cloud-services';
9
+ import type { CKBoxImageUrls } from './ckboxconfig';
9
10
  /**
10
- * Creates URLs for the image:
11
+ * Converts image source set provided by the CKBox into an object containing:
11
12
  * - responsive URLs for the "webp" image format,
12
13
  * - one fallback URL for browsers that do not support the "webp" format.
13
14
  */
14
- export declare function getImageUrls({ token, id, origin, width, extension }: {
15
- token: InitializedToken;
16
- id: string;
17
- origin: string;
18
- width: number;
19
- extension: string;
20
- }): {
15
+ export declare function getImageUrls(imageUrls: CKBoxImageUrls): {
21
16
  imageFallbackUrl: string;
22
17
  imageSources: Array<{
23
18
  srcset: string;
@@ -26,6 +21,8 @@ export declare function getImageUrls({ token, id, origin, width, extension }: {
26
21
  }>;
27
22
  };
28
23
  /**
29
- * Returns an environment id from a token used for communication with the CKBox service.
24
+ * Returns workspace id to use for communication with the CKBox service.
25
+ *
26
+ * @param defaultWorkspaceId The default workspace to use taken from editor config.
30
27
  */
31
- export declare function getEnvironmentId(token: InitializedToken): string;
28
+ export declare function getWorkspaceId(token: InitializedToken, defaultWorkspaceId?: string): string | null;