@ckeditor/ckeditor5-image 44.3.0 → 45.0.0-alpha.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 (331) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/image.js +2 -2
  3. package/build/translations/af.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/ast.js +1 -1
  6. package/build/translations/az.js +1 -1
  7. package/build/translations/be.js +1 -0
  8. package/build/translations/bg.js +1 -1
  9. package/build/translations/bn.js +1 -1
  10. package/build/translations/bs.js +1 -1
  11. package/build/translations/ca.js +1 -1
  12. package/build/translations/cs.js +1 -1
  13. package/build/translations/da.js +1 -1
  14. package/build/translations/de-ch.js +1 -1
  15. package/build/translations/de.js +1 -1
  16. package/build/translations/el.js +1 -1
  17. package/build/translations/en-au.js +1 -1
  18. package/build/translations/en-gb.js +1 -1
  19. package/build/translations/eo.js +1 -1
  20. package/build/translations/es-co.js +1 -1
  21. package/build/translations/es.js +1 -1
  22. package/build/translations/et.js +1 -1
  23. package/build/translations/eu.js +1 -1
  24. package/build/translations/fa.js +1 -1
  25. package/build/translations/fi.js +1 -1
  26. package/build/translations/fr.js +1 -1
  27. package/build/translations/gl.js +1 -1
  28. package/build/translations/gu.js +1 -1
  29. package/build/translations/he.js +1 -1
  30. package/build/translations/hi.js +1 -1
  31. package/build/translations/hr.js +1 -1
  32. package/build/translations/hu.js +1 -1
  33. package/build/translations/hy.js +1 -1
  34. package/build/translations/id.js +1 -1
  35. package/build/translations/it.js +1 -1
  36. package/build/translations/ja.js +1 -1
  37. package/build/translations/jv.js +1 -1
  38. package/build/translations/kk.js +1 -1
  39. package/build/translations/km.js +1 -1
  40. package/build/translations/kn.js +1 -1
  41. package/build/translations/ko.js +1 -1
  42. package/build/translations/ku.js +1 -1
  43. package/build/translations/lt.js +1 -1
  44. package/build/translations/lv.js +1 -1
  45. package/build/translations/ms.js +1 -1
  46. package/build/translations/nb.js +1 -1
  47. package/build/translations/ne.js +1 -1
  48. package/build/translations/nl.js +1 -1
  49. package/build/translations/no.js +1 -1
  50. package/build/translations/oc.js +1 -1
  51. package/build/translations/pl.js +1 -1
  52. package/build/translations/pt-br.js +1 -1
  53. package/build/translations/pt.js +1 -1
  54. package/build/translations/ro.js +1 -1
  55. package/build/translations/ru.js +1 -1
  56. package/build/translations/si.js +1 -1
  57. package/build/translations/sk.js +1 -1
  58. package/build/translations/sl.js +1 -1
  59. package/build/translations/sq.js +1 -1
  60. package/build/translations/sr-latn.js +1 -1
  61. package/build/translations/sr.js +1 -1
  62. package/build/translations/sv.js +1 -1
  63. package/build/translations/th.js +1 -1
  64. package/build/translations/ti.js +1 -1
  65. package/build/translations/tk.js +1 -1
  66. package/build/translations/tr.js +1 -1
  67. package/build/translations/tt.js +1 -1
  68. package/build/translations/ug.js +1 -1
  69. package/build/translations/uk.js +1 -1
  70. package/build/translations/ur.js +1 -1
  71. package/build/translations/uz.js +1 -1
  72. package/build/translations/vi.js +1 -1
  73. package/build/translations/zh-cn.js +1 -1
  74. package/build/translations/zh.js +1 -1
  75. package/ckeditor5-metadata.json +9 -9
  76. package/dist/index-editor.css +72 -59
  77. package/dist/index.css +90 -79
  78. package/dist/index.css.map +1 -1
  79. package/dist/index.js +178 -120
  80. package/dist/index.js.map +1 -1
  81. package/dist/translations/af.js +1 -1
  82. package/dist/translations/af.umd.js +1 -1
  83. package/dist/translations/ar.js +1 -1
  84. package/dist/translations/ar.umd.js +1 -1
  85. package/dist/translations/ast.js +1 -1
  86. package/dist/translations/ast.umd.js +1 -1
  87. package/dist/translations/az.js +1 -1
  88. package/dist/translations/az.umd.js +1 -1
  89. package/dist/translations/be.d.ts +8 -0
  90. package/dist/translations/be.js +5 -0
  91. package/dist/translations/be.umd.js +11 -0
  92. package/dist/translations/bg.js +1 -1
  93. package/dist/translations/bg.umd.js +1 -1
  94. package/dist/translations/bn.js +1 -1
  95. package/dist/translations/bn.umd.js +1 -1
  96. package/dist/translations/bs.js +1 -1
  97. package/dist/translations/bs.umd.js +1 -1
  98. package/dist/translations/ca.js +1 -1
  99. package/dist/translations/ca.umd.js +1 -1
  100. package/dist/translations/cs.js +1 -1
  101. package/dist/translations/cs.umd.js +1 -1
  102. package/dist/translations/da.js +1 -1
  103. package/dist/translations/da.umd.js +1 -1
  104. package/dist/translations/de-ch.js +1 -1
  105. package/dist/translations/de-ch.umd.js +1 -1
  106. package/dist/translations/de.js +1 -1
  107. package/dist/translations/de.umd.js +1 -1
  108. package/dist/translations/el.js +1 -1
  109. package/dist/translations/el.umd.js +1 -1
  110. package/dist/translations/en-au.js +1 -1
  111. package/dist/translations/en-au.umd.js +1 -1
  112. package/dist/translations/en-gb.js +1 -1
  113. package/dist/translations/en-gb.umd.js +1 -1
  114. package/dist/translations/en.js +1 -1
  115. package/dist/translations/en.umd.js +1 -1
  116. package/dist/translations/eo.js +1 -1
  117. package/dist/translations/eo.umd.js +1 -1
  118. package/dist/translations/es-co.js +1 -1
  119. package/dist/translations/es-co.umd.js +1 -1
  120. package/dist/translations/es.js +1 -1
  121. package/dist/translations/es.umd.js +1 -1
  122. package/dist/translations/et.js +1 -1
  123. package/dist/translations/et.umd.js +1 -1
  124. package/dist/translations/eu.js +1 -1
  125. package/dist/translations/eu.umd.js +1 -1
  126. package/dist/translations/fa.js +1 -1
  127. package/dist/translations/fa.umd.js +1 -1
  128. package/dist/translations/fi.js +1 -1
  129. package/dist/translations/fi.umd.js +1 -1
  130. package/dist/translations/fr.js +1 -1
  131. package/dist/translations/fr.umd.js +1 -1
  132. package/dist/translations/gl.js +1 -1
  133. package/dist/translations/gl.umd.js +1 -1
  134. package/dist/translations/gu.js +1 -1
  135. package/dist/translations/gu.umd.js +1 -1
  136. package/dist/translations/he.js +1 -1
  137. package/dist/translations/he.umd.js +1 -1
  138. package/dist/translations/hi.js +1 -1
  139. package/dist/translations/hi.umd.js +1 -1
  140. package/dist/translations/hr.js +1 -1
  141. package/dist/translations/hr.umd.js +1 -1
  142. package/dist/translations/hu.js +1 -1
  143. package/dist/translations/hu.umd.js +1 -1
  144. package/dist/translations/hy.js +1 -1
  145. package/dist/translations/hy.umd.js +1 -1
  146. package/dist/translations/id.js +1 -1
  147. package/dist/translations/id.umd.js +1 -1
  148. package/dist/translations/it.js +1 -1
  149. package/dist/translations/it.umd.js +1 -1
  150. package/dist/translations/ja.js +1 -1
  151. package/dist/translations/ja.umd.js +1 -1
  152. package/dist/translations/jv.js +1 -1
  153. package/dist/translations/jv.umd.js +1 -1
  154. package/dist/translations/kk.js +1 -1
  155. package/dist/translations/kk.umd.js +1 -1
  156. package/dist/translations/km.js +1 -1
  157. package/dist/translations/km.umd.js +1 -1
  158. package/dist/translations/kn.js +1 -1
  159. package/dist/translations/kn.umd.js +1 -1
  160. package/dist/translations/ko.js +1 -1
  161. package/dist/translations/ko.umd.js +1 -1
  162. package/dist/translations/ku.js +1 -1
  163. package/dist/translations/ku.umd.js +1 -1
  164. package/dist/translations/lt.js +1 -1
  165. package/dist/translations/lt.umd.js +1 -1
  166. package/dist/translations/lv.js +1 -1
  167. package/dist/translations/lv.umd.js +1 -1
  168. package/dist/translations/ms.js +1 -1
  169. package/dist/translations/ms.umd.js +1 -1
  170. package/dist/translations/nb.js +1 -1
  171. package/dist/translations/nb.umd.js +1 -1
  172. package/dist/translations/ne.js +1 -1
  173. package/dist/translations/ne.umd.js +1 -1
  174. package/dist/translations/nl.js +1 -1
  175. package/dist/translations/nl.umd.js +1 -1
  176. package/dist/translations/no.js +1 -1
  177. package/dist/translations/no.umd.js +1 -1
  178. package/dist/translations/oc.js +1 -1
  179. package/dist/translations/oc.umd.js +1 -1
  180. package/dist/translations/pl.js +1 -1
  181. package/dist/translations/pl.umd.js +1 -1
  182. package/dist/translations/pt-br.js +1 -1
  183. package/dist/translations/pt-br.umd.js +1 -1
  184. package/dist/translations/pt.js +1 -1
  185. package/dist/translations/pt.umd.js +1 -1
  186. package/dist/translations/ro.js +1 -1
  187. package/dist/translations/ro.umd.js +1 -1
  188. package/dist/translations/ru.js +1 -1
  189. package/dist/translations/ru.umd.js +1 -1
  190. package/dist/translations/si.js +1 -1
  191. package/dist/translations/si.umd.js +1 -1
  192. package/dist/translations/sk.js +1 -1
  193. package/dist/translations/sk.umd.js +1 -1
  194. package/dist/translations/sl.js +1 -1
  195. package/dist/translations/sl.umd.js +1 -1
  196. package/dist/translations/sq.js +1 -1
  197. package/dist/translations/sq.umd.js +1 -1
  198. package/dist/translations/sr-latn.js +1 -1
  199. package/dist/translations/sr-latn.umd.js +1 -1
  200. package/dist/translations/sr.js +1 -1
  201. package/dist/translations/sr.umd.js +1 -1
  202. package/dist/translations/sv.js +1 -1
  203. package/dist/translations/sv.umd.js +1 -1
  204. package/dist/translations/th.js +1 -1
  205. package/dist/translations/th.umd.js +1 -1
  206. package/dist/translations/ti.js +1 -1
  207. package/dist/translations/ti.umd.js +1 -1
  208. package/dist/translations/tk.js +1 -1
  209. package/dist/translations/tk.umd.js +1 -1
  210. package/dist/translations/tr.js +1 -1
  211. package/dist/translations/tr.umd.js +1 -1
  212. package/dist/translations/tt.js +1 -1
  213. package/dist/translations/tt.umd.js +1 -1
  214. package/dist/translations/ug.js +1 -1
  215. package/dist/translations/ug.umd.js +1 -1
  216. package/dist/translations/uk.js +1 -1
  217. package/dist/translations/uk.umd.js +1 -1
  218. package/dist/translations/ur.js +1 -1
  219. package/dist/translations/ur.umd.js +1 -1
  220. package/dist/translations/uz.js +1 -1
  221. package/dist/translations/uz.umd.js +1 -1
  222. package/dist/translations/vi.js +1 -1
  223. package/dist/translations/vi.umd.js +1 -1
  224. package/dist/translations/zh-cn.js +1 -1
  225. package/dist/translations/zh-cn.umd.js +1 -1
  226. package/dist/translations/zh.js +1 -1
  227. package/dist/translations/zh.umd.js +1 -1
  228. package/lang/contexts.json +4 -2
  229. package/lang/translations/af.po +8 -0
  230. package/lang/translations/ar.po +8 -0
  231. package/lang/translations/ast.po +8 -0
  232. package/lang/translations/az.po +8 -0
  233. package/lang/translations/be.po +196 -0
  234. package/lang/translations/bg.po +8 -0
  235. package/lang/translations/bn.po +8 -0
  236. package/lang/translations/bs.po +8 -0
  237. package/lang/translations/ca.po +8 -0
  238. package/lang/translations/cs.po +8 -0
  239. package/lang/translations/da.po +8 -0
  240. package/lang/translations/de-ch.po +8 -0
  241. package/lang/translations/de.po +8 -0
  242. package/lang/translations/el.po +8 -0
  243. package/lang/translations/en-au.po +8 -0
  244. package/lang/translations/en-gb.po +8 -0
  245. package/lang/translations/en.po +8 -0
  246. package/lang/translations/eo.po +8 -0
  247. package/lang/translations/es-co.po +8 -0
  248. package/lang/translations/es.po +8 -0
  249. package/lang/translations/et.po +8 -0
  250. package/lang/translations/eu.po +8 -0
  251. package/lang/translations/fa.po +8 -0
  252. package/lang/translations/fi.po +8 -0
  253. package/lang/translations/fr.po +8 -0
  254. package/lang/translations/gl.po +8 -0
  255. package/lang/translations/gu.po +8 -0
  256. package/lang/translations/he.po +8 -0
  257. package/lang/translations/hi.po +8 -0
  258. package/lang/translations/hr.po +8 -0
  259. package/lang/translations/hu.po +8 -0
  260. package/lang/translations/hy.po +8 -0
  261. package/lang/translations/id.po +8 -0
  262. package/lang/translations/it.po +8 -0
  263. package/lang/translations/ja.po +8 -0
  264. package/lang/translations/jv.po +8 -0
  265. package/lang/translations/kk.po +8 -0
  266. package/lang/translations/km.po +8 -0
  267. package/lang/translations/kn.po +8 -0
  268. package/lang/translations/ko.po +8 -0
  269. package/lang/translations/ku.po +8 -0
  270. package/lang/translations/lt.po +8 -0
  271. package/lang/translations/lv.po +8 -0
  272. package/lang/translations/ms.po +8 -0
  273. package/lang/translations/nb.po +8 -0
  274. package/lang/translations/ne.po +8 -0
  275. package/lang/translations/nl.po +8 -0
  276. package/lang/translations/no.po +8 -0
  277. package/lang/translations/oc.po +8 -0
  278. package/lang/translations/pl.po +8 -0
  279. package/lang/translations/pt-br.po +8 -0
  280. package/lang/translations/pt.po +8 -0
  281. package/lang/translations/ro.po +8 -0
  282. package/lang/translations/ru.po +8 -0
  283. package/lang/translations/si.po +8 -0
  284. package/lang/translations/sk.po +8 -0
  285. package/lang/translations/sl.po +8 -0
  286. package/lang/translations/sq.po +8 -0
  287. package/lang/translations/sr-latn.po +8 -0
  288. package/lang/translations/sr.po +8 -0
  289. package/lang/translations/sv.po +8 -0
  290. package/lang/translations/th.po +8 -0
  291. package/lang/translations/ti.po +8 -0
  292. package/lang/translations/tk.po +8 -0
  293. package/lang/translations/tr.po +8 -0
  294. package/lang/translations/tt.po +8 -0
  295. package/lang/translations/ug.po +8 -0
  296. package/lang/translations/uk.po +8 -0
  297. package/lang/translations/ur.po +8 -0
  298. package/lang/translations/uz.po +8 -0
  299. package/lang/translations/vi.po +8 -0
  300. package/lang/translations/zh-cn.po +8 -0
  301. package/lang/translations/zh.po +8 -0
  302. package/package.json +13 -12
  303. package/src/autoimage.js +10 -0
  304. package/src/image/imagetypecommand.js +4 -0
  305. package/src/imagecaption/imagecaptionediting.js +7 -0
  306. package/src/imagecaption/imagecaptionui.js +3 -2
  307. package/src/imageinsert/imageinsertui.js +11 -6
  308. package/src/imageinsert/imageinsertviaurlui.js +7 -6
  309. package/src/imageinsert/ui/imageinsertformview.js +20 -0
  310. package/src/imageinsert/ui/imageinserturlview.js +8 -0
  311. package/src/imageresize/imagecustomresizeui.js +8 -5
  312. package/src/imageresize/imageresizebuttons.d.ts +3 -0
  313. package/src/imageresize/imageresizebuttons.js +21 -13
  314. package/src/imageresize/resizeimagecommand.d.ts +1 -1
  315. package/src/imageresize/ui/imagecustomresizeformview.d.ts +19 -12
  316. package/src/imageresize/ui/imagecustomresizeformview.js +112 -36
  317. package/src/imagestyle/imagestylecommand.js +10 -0
  318. package/src/imagestyle/imagestyleediting.js +12 -0
  319. package/src/imagestyle/imagestyleui.js +1 -1
  320. package/src/imagestyle/utils.d.ts +1 -4
  321. package/src/imagestyle/utils.js +16 -16
  322. package/src/imagetextalternative/imagetextalternativeui.js +11 -7
  323. package/src/imagetextalternative/ui/textalternativeformview.d.ts +17 -10
  324. package/src/imagetextalternative/ui/textalternativeformview.js +105 -35
  325. package/src/imagetoolbar.js +1 -1
  326. package/src/imageupload/imageuploadediting.js +17 -7
  327. package/src/imageupload/imageuploadprogress.js +59 -53
  328. package/src/imageupload/imageuploadui.js +3 -2
  329. package/src/imageutils.js +4 -7
  330. package/theme/imagecustomresizeform.css +0 -29
  331. package/theme/textalternativeform.css +0 -28
@@ -5,30 +5,82 @@
5
5
  /**
6
6
  * @module image/imagetextalternative/ui/textalternativeformview
7
7
  */
8
- import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';
8
+ import { ButtonView, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';
9
9
  import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
- import { icons } from 'ckeditor5/src/core.js';
10
+ import { IconPreviousArrow } from 'ckeditor5/src/icons.js';
11
11
  import '../../../theme/textalternativeform.css';
12
12
  // See: #8833.
13
13
  // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
14
14
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
15
+ // eslint-disable-next-line ckeditor5-rules/ckeditor-imports
16
+ import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
15
17
  /**
16
18
  * The TextAlternativeFormView class.
17
19
  */
18
20
  export default class TextAlternativeFormView extends View {
21
+ /**
22
+ * Tracks information about the DOM focus in the form.
23
+ */
24
+ focusTracker;
25
+ /**
26
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
27
+ */
28
+ keystrokes;
29
+ /**
30
+ * An input with a label.
31
+ */
32
+ labeledInput;
33
+ /**
34
+ * The Back button view displayed in the header.
35
+ */
36
+ backButtonView;
37
+ /**
38
+ * A button used to submit the form.
39
+ */
40
+ saveButtonView;
41
+ /**
42
+ * A collection of child views.
43
+ */
44
+ children;
45
+ /**
46
+ * A collection of views which can be focused in the form.
47
+ */
48
+ _focusables;
49
+ /**
50
+ * Helps cycling over {@link #_focusables} in the form.
51
+ */
52
+ _focusCycler;
19
53
  /**
20
54
  * @inheritDoc
21
55
  */
22
56
  constructor(locale) {
23
57
  super(locale);
24
- const t = this.locale.t;
25
58
  this.focusTracker = new FocusTracker();
26
59
  this.keystrokes = new KeystrokeHandler();
60
+ // Create buttons.
61
+ this.backButtonView = this._createBackButton();
62
+ this.saveButtonView = this._createSaveButton();
63
+ // Create input fields.
27
64
  this.labeledInput = this._createLabeledInputView();
28
- this.saveButtonView = this._createButton(t('Save'), icons.check, 'ck-button-save');
29
- this.saveButtonView.type = 'submit';
30
- this.cancelButtonView = this._createButton(t('Cancel'), icons.cancel, 'ck-button-cancel', 'cancel');
65
+ this.children = this.createCollection([
66
+ this._createHeaderView()
67
+ ]);
68
+ this.children.add(new FormRowView(locale, {
69
+ children: [
70
+ this.labeledInput,
71
+ this.saveButtonView
72
+ ],
73
+ class: [
74
+ 'ck-form__row_with-submit',
75
+ 'ck-form__row_large-top-padding'
76
+ ]
77
+ }));
31
78
  this._focusables = new ViewCollection();
79
+ // Close the panel on esc key press when the **form has focus**.
80
+ this.keystrokes.set('Esc', (data, cancel) => {
81
+ this.fire('cancel');
82
+ cancel();
83
+ });
32
84
  this._focusCycler = new FocusCycler({
33
85
  focusables: this._focusables,
34
86
  focusTracker: this.focusTracker,
@@ -45,17 +97,14 @@ export default class TextAlternativeFormView extends View {
45
97
  attributes: {
46
98
  class: [
47
99
  'ck',
100
+ 'ck-form',
48
101
  'ck-text-alternative-form',
49
102
  'ck-responsive-form'
50
103
  ],
51
104
  // https://github.com/ckeditor/ckeditor5-image/issues/40
52
105
  tabindex: '-1'
53
106
  },
54
- children: [
55
- this.labeledInput,
56
- this.saveButtonView,
57
- this.cancelButtonView
58
- ]
107
+ children: this.children
59
108
  });
60
109
  }
61
110
  /**
@@ -63,15 +112,21 @@ export default class TextAlternativeFormView extends View {
63
112
  */
64
113
  render() {
65
114
  super.render();
66
- this.keystrokes.listenTo(this.element);
67
- submitHandler({ view: this });
68
- [this.labeledInput, this.saveButtonView, this.cancelButtonView]
69
- .forEach(v => {
115
+ submitHandler({
116
+ view: this
117
+ });
118
+ const childViews = [
119
+ this.backButtonView,
120
+ this.labeledInput,
121
+ this.saveButtonView
122
+ ];
123
+ childViews.forEach(v => {
70
124
  // Register the view as focusable.
71
125
  this._focusables.add(v);
72
126
  // Register the view in the focus tracker.
73
127
  this.focusTracker.add(v.element);
74
128
  });
129
+ this.keystrokes.listenTo(this.element);
75
130
  }
76
131
  /**
77
132
  * @inheritDoc
@@ -82,30 +137,44 @@ export default class TextAlternativeFormView extends View {
82
137
  this.keystrokes.destroy();
83
138
  }
84
139
  /**
85
- * Creates the button view.
86
- *
87
- * @param label The button label
88
- * @param icon The button's icon.
89
- * @param className The additional button CSS class name.
90
- * @param eventName The event name that the ButtonView#execute event will be delegated to.
91
- * @returns The button view instance.
140
+ * Creates a back button view that cancels the form.
92
141
  */
93
- _createButton(label, icon, className, eventName) {
94
- const button = new ButtonView(this.locale);
95
- button.set({
96
- label,
97
- icon,
142
+ _createBackButton() {
143
+ const t = this.locale.t;
144
+ const backButton = new ButtonView(this.locale);
145
+ backButton.set({
146
+ class: 'ck-button-back',
147
+ label: t('Back'),
148
+ icon: IconPreviousArrow,
98
149
  tooltip: true
99
150
  });
100
- button.extendTemplate({
101
- attributes: {
102
- class: className
103
- }
151
+ backButton.delegate('execute').to(this, 'cancel');
152
+ return backButton;
153
+ }
154
+ /**
155
+ * Creates a save button view that text alternative the image.
156
+ */
157
+ _createSaveButton() {
158
+ const t = this.locale.t;
159
+ const saveButton = new ButtonView(this.locale);
160
+ saveButton.set({
161
+ label: t('Save'),
162
+ withText: true,
163
+ type: 'submit',
164
+ class: 'ck-button-action ck-button-bold'
165
+ });
166
+ return saveButton;
167
+ }
168
+ /**
169
+ * Creates a header view for the form.
170
+ */
171
+ _createHeaderView() {
172
+ const t = this.locale.t;
173
+ const header = new FormHeaderView(this.locale, {
174
+ label: t('Text Alternative')
104
175
  });
105
- if (eventName) {
106
- button.delegate('execute').to(this, eventName);
107
- }
108
- return button;
176
+ header.children.add(this.backButtonView, 0);
177
+ return header;
109
178
  }
110
179
  /**
111
180
  * Creates an input with a label.
@@ -116,6 +185,7 @@ export default class TextAlternativeFormView extends View {
116
185
  const t = this.locale.t;
117
186
  const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);
118
187
  labeledInput.label = t('Text alternative');
188
+ labeledInput.class = 'ck-labeled-field-view_full-width';
119
189
  return labeledInput;
120
190
  }
121
191
  }
@@ -8,7 +8,7 @@
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
10
10
  import ImageUtils from './imageutils.js';
11
- import { isObject } from 'lodash-es';
11
+ import { isObject } from 'es-toolkit/compat';
12
12
  /**
13
13
  * The image toolbar plugin. It creates and manages the image toolbar (the toolbar displayed when an image is selected).
14
14
  *
@@ -38,18 +38,28 @@ export default class ImageUploadEditing extends Plugin {
38
38
  static get isOfficialPlugin() {
39
39
  return true;
40
40
  }
41
+ /**
42
+ * An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and
43
+ * model elements during the upload.
44
+ *
45
+ * Model element of the uploaded image can change, for instance, when {@link module:image/image/imagetypecommand~ImageTypeCommand}
46
+ * is executed as a result of adding caption or changing image style. As a result, the upload logic must keep track of the model
47
+ * element (reference) and resolve the upload for the correct model element (instead of the one that landed in the `$graveyard`
48
+ * after image type changed).
49
+ */
50
+ _uploadImageElements;
51
+ /**
52
+ * An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and
53
+ * upload responses for handling images dragged during their upload process. When such images are later
54
+ * dropped, their original upload IDs no longer exist in the registry (as the original upload completed).
55
+ * This map preserves the upload responses to properly handle such cases.
56
+ */
57
+ _uploadedImages = new Map();
41
58
  /**
42
59
  * @inheritDoc
43
60
  */
44
61
  constructor(editor) {
45
62
  super(editor);
46
- /**
47
- * An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and
48
- * upload responses for handling images dragged during their upload process. When such images are later
49
- * dropped, their original upload IDs no longer exist in the registry (as the original upload completed).
50
- * This map preserves the upload responses to properly handle such cases.
51
- */
52
- this._uploadedImages = new Map();
53
63
  editor.config.define('image', {
54
64
  upload: {
55
65
  types: ['jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff']
@@ -28,64 +28,17 @@ export default class ImageUploadProgress extends Plugin {
28
28
  static get isOfficialPlugin() {
29
29
  return true;
30
30
  }
31
+ /**
32
+ * The image placeholder that is displayed before real image data can be accessed.
33
+ *
34
+ * For the record, this image is a 1x1 px GIF with an aspect ratio set by CSS.
35
+ */
36
+ placeholder;
31
37
  /**
32
38
  * @inheritDoc
33
39
  */
34
40
  constructor(editor) {
35
41
  super(editor);
36
- /**
37
- * This method is called each time the image `uploadStatus` attribute is changed.
38
- *
39
- * @param evt An object containing information about the fired event.
40
- * @param data Additional information about the change.
41
- */
42
- this.uploadStatusChange = (evt, data, conversionApi) => {
43
- const editor = this.editor;
44
- const modelImage = data.item;
45
- const uploadId = modelImage.getAttribute('uploadId');
46
- if (!conversionApi.consumable.consume(data.item, evt.name)) {
47
- return;
48
- }
49
- const imageUtils = editor.plugins.get('ImageUtils');
50
- const fileRepository = editor.plugins.get(FileRepository);
51
- const status = uploadId ? data.attributeNewValue : null;
52
- const placeholder = this.placeholder;
53
- const viewFigure = editor.editing.mapper.toViewElement(modelImage);
54
- const viewWriter = conversionApi.writer;
55
- if (status == 'reading') {
56
- // Start "appearing" effect and show placeholder with infinite progress bar on the top
57
- // while image is read from disk.
58
- _startAppearEffect(viewFigure, viewWriter);
59
- _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);
60
- return;
61
- }
62
- // Show progress bar on the top of the image when image is uploading.
63
- if (status == 'uploading') {
64
- const loader = fileRepository.loaders.get(uploadId);
65
- // Start appear effect if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.
66
- _startAppearEffect(viewFigure, viewWriter);
67
- if (!loader) {
68
- // There is no loader associated with uploadId - this means that image came from external changes.
69
- // In such cases we still want to show the placeholder until image is fully uploaded.
70
- // Show placeholder if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.
71
- _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);
72
- }
73
- else {
74
- // Hide placeholder and initialize progress bar showing upload progress.
75
- _hidePlaceholder(viewFigure, viewWriter);
76
- _showProgressBar(viewFigure, viewWriter, loader, editor.editing.view);
77
- _displayLocalImage(imageUtils, viewFigure, viewWriter, loader);
78
- }
79
- return;
80
- }
81
- if (status == 'complete' && fileRepository.loaders.get(uploadId)) {
82
- _showCompleteIcon(viewFigure, viewWriter, editor.editing.view);
83
- }
84
- // Clean up.
85
- _hideProgressBar(viewFigure, viewWriter);
86
- _hidePlaceholder(viewFigure, viewWriter);
87
- _stopAppearEffect(viewFigure, viewWriter);
88
- };
89
42
  this.placeholder = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
90
43
  }
91
44
  /**
@@ -101,6 +54,59 @@ export default class ImageUploadProgress extends Plugin {
101
54
  editor.editing.downcastDispatcher.on('attribute:uploadStatus:imageInline', this.uploadStatusChange);
102
55
  }
103
56
  }
57
+ /**
58
+ * This method is called each time the image `uploadStatus` attribute is changed.
59
+ *
60
+ * @param evt An object containing information about the fired event.
61
+ * @param data Additional information about the change.
62
+ */
63
+ uploadStatusChange = (evt, data, conversionApi) => {
64
+ const editor = this.editor;
65
+ const modelImage = data.item;
66
+ const uploadId = modelImage.getAttribute('uploadId');
67
+ if (!conversionApi.consumable.consume(data.item, evt.name)) {
68
+ return;
69
+ }
70
+ const imageUtils = editor.plugins.get('ImageUtils');
71
+ const fileRepository = editor.plugins.get(FileRepository);
72
+ const status = uploadId ? data.attributeNewValue : null;
73
+ const placeholder = this.placeholder;
74
+ const viewFigure = editor.editing.mapper.toViewElement(modelImage);
75
+ const viewWriter = conversionApi.writer;
76
+ if (status == 'reading') {
77
+ // Start "appearing" effect and show placeholder with infinite progress bar on the top
78
+ // while image is read from disk.
79
+ _startAppearEffect(viewFigure, viewWriter);
80
+ _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);
81
+ return;
82
+ }
83
+ // Show progress bar on the top of the image when image is uploading.
84
+ if (status == 'uploading') {
85
+ const loader = fileRepository.loaders.get(uploadId);
86
+ // Start appear effect if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.
87
+ _startAppearEffect(viewFigure, viewWriter);
88
+ if (!loader) {
89
+ // There is no loader associated with uploadId - this means that image came from external changes.
90
+ // In such cases we still want to show the placeholder until image is fully uploaded.
91
+ // Show placeholder if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.
92
+ _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);
93
+ }
94
+ else {
95
+ // Hide placeholder and initialize progress bar showing upload progress.
96
+ _hidePlaceholder(viewFigure, viewWriter);
97
+ _showProgressBar(viewFigure, viewWriter, loader, editor.editing.view);
98
+ _displayLocalImage(imageUtils, viewFigure, viewWriter, loader);
99
+ }
100
+ return;
101
+ }
102
+ if (status == 'complete' && fileRepository.loaders.get(uploadId)) {
103
+ _showCompleteIcon(viewFigure, viewWriter, editor.editing.view);
104
+ }
105
+ // Clean up.
106
+ _hideProgressBar(viewFigure, viewWriter);
107
+ _hidePlaceholder(viewFigure, viewWriter);
108
+ _stopAppearEffect(viewFigure, viewWriter);
109
+ };
104
110
  }
105
111
  /**
106
112
  * Adds ck-appear class to the image figure if one is not already applied.
@@ -5,8 +5,9 @@
5
5
  /**
6
6
  * @module image/imageupload/imageuploadui
7
7
  */
8
- import { Plugin, icons } from 'ckeditor5/src/core.js';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { FileDialogButtonView, MenuBarMenuListItemFileDialogButtonView } from 'ckeditor5/src/ui.js';
10
+ import { IconImageUpload } from 'ckeditor5/src/icons.js';
10
11
  import { createImageTypeRegExp } from './utils.js';
11
12
  /**
12
13
  * The image upload button plugin.
@@ -68,7 +69,7 @@ export default class ImageUploadUI extends Plugin {
68
69
  acceptedType: imageTypes.map(type => `image/${type}`).join(','),
69
70
  allowMultipleFiles: true,
70
71
  label: t('Upload from computer'),
71
- icon: icons.imageUpload
72
+ icon: IconImageUpload
72
73
  });
73
74
  view.bind('isEnabled').to(command);
74
75
  view.on('done', (evt, files) => {
package/src/imageutils.js CHANGED
@@ -11,13 +11,10 @@ const IMAGE_WIDGETS_CLASSES_MATCH_REGEXP = /^(image|image-inline)$/;
11
11
  * A set of helpers related to images.
12
12
  */
13
13
  export default class ImageUtils extends Plugin {
14
- constructor() {
15
- super(...arguments);
16
- /**
17
- * DOM Emitter.
18
- */
19
- this._domEmitter = new (DomEmitterMixin())();
20
- }
14
+ /**
15
+ * DOM Emitter.
16
+ */
17
+ _domEmitter = new (DomEmitterMixin())();
21
18
  /**
22
19
  * @inheritDoc
23
20
  */
@@ -2,32 +2,3 @@
2
2
  * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
-
6
- @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
7
-
8
- .ck.ck-image-custom-resize-form {
9
- display: flex;
10
- flex-direction: row;
11
- flex-wrap: nowrap;
12
- align-items: flex-start;
13
-
14
- & .ck-labeled-field-view {
15
- display: inline-block;
16
- }
17
-
18
- & .ck-label {
19
- display: none;
20
- }
21
-
22
- @mixin ck-media-phone {
23
- flex-wrap: wrap;
24
-
25
- & .ck-labeled-field-view {
26
- flex-basis: 100%;
27
- }
28
-
29
- & .ck-button {
30
- flex-basis: 50%;
31
- }
32
- }
33
- }
@@ -2,31 +2,3 @@
2
2
  * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
-
6
- @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
7
-
8
- .ck.ck-text-alternative-form {
9
- display: flex;
10
- flex-direction: row;
11
- flex-wrap: nowrap;
12
-
13
- & .ck-labeled-field-view {
14
- display: inline-block;
15
- }
16
-
17
- & .ck-label {
18
- display: none;
19
- }
20
-
21
- @mixin ck-media-phone {
22
- flex-wrap: wrap;
23
-
24
- & .ck-labeled-field-view {
25
- flex-basis: 100%;
26
- }
27
-
28
- & .ck-button {
29
- flex-basis: 50%;
30
- }
31
- }
32
- }