@ckeditor/ckeditor5-image 44.3.0-alpha.7 → 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.
- package/LICENSE.md +1 -1
- package/build/image.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -0
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +9 -9
- package/dist/index-editor.css +72 -59
- package/dist/index.css +90 -79
- package/dist/index.css.map +1 -1
- package/dist/index.js +178 -120
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +4 -2
- package/lang/translations/af.po +8 -0
- package/lang/translations/ar.po +8 -0
- package/lang/translations/ast.po +8 -0
- package/lang/translations/az.po +8 -0
- package/lang/translations/be.po +196 -0
- package/lang/translations/bg.po +8 -0
- package/lang/translations/bn.po +8 -0
- package/lang/translations/bs.po +8 -0
- package/lang/translations/ca.po +8 -0
- package/lang/translations/cs.po +8 -0
- package/lang/translations/da.po +8 -0
- package/lang/translations/de-ch.po +8 -0
- package/lang/translations/de.po +8 -0
- package/lang/translations/el.po +8 -0
- package/lang/translations/en-au.po +8 -0
- package/lang/translations/en-gb.po +8 -0
- package/lang/translations/en.po +8 -0
- package/lang/translations/eo.po +8 -0
- package/lang/translations/es-co.po +8 -0
- package/lang/translations/es.po +8 -0
- package/lang/translations/et.po +8 -0
- package/lang/translations/eu.po +8 -0
- package/lang/translations/fa.po +8 -0
- package/lang/translations/fi.po +8 -0
- package/lang/translations/fr.po +8 -0
- package/lang/translations/gl.po +8 -0
- package/lang/translations/gu.po +8 -0
- package/lang/translations/he.po +8 -0
- package/lang/translations/hi.po +8 -0
- package/lang/translations/hr.po +8 -0
- package/lang/translations/hu.po +8 -0
- package/lang/translations/hy.po +8 -0
- package/lang/translations/id.po +8 -0
- package/lang/translations/it.po +8 -0
- package/lang/translations/ja.po +8 -0
- package/lang/translations/jv.po +8 -0
- package/lang/translations/kk.po +8 -0
- package/lang/translations/km.po +8 -0
- package/lang/translations/kn.po +8 -0
- package/lang/translations/ko.po +8 -0
- package/lang/translations/ku.po +8 -0
- package/lang/translations/lt.po +8 -0
- package/lang/translations/lv.po +8 -0
- package/lang/translations/ms.po +8 -0
- package/lang/translations/nb.po +8 -0
- package/lang/translations/ne.po +8 -0
- package/lang/translations/nl.po +8 -0
- package/lang/translations/no.po +8 -0
- package/lang/translations/oc.po +8 -0
- package/lang/translations/pl.po +8 -0
- package/lang/translations/pt-br.po +8 -0
- package/lang/translations/pt.po +8 -0
- package/lang/translations/ro.po +8 -0
- package/lang/translations/ru.po +8 -0
- package/lang/translations/si.po +8 -0
- package/lang/translations/sk.po +8 -0
- package/lang/translations/sl.po +8 -0
- package/lang/translations/sq.po +8 -0
- package/lang/translations/sr-latn.po +8 -0
- package/lang/translations/sr.po +8 -0
- package/lang/translations/sv.po +8 -0
- package/lang/translations/th.po +8 -0
- package/lang/translations/ti.po +8 -0
- package/lang/translations/tk.po +8 -0
- package/lang/translations/tr.po +8 -0
- package/lang/translations/tt.po +8 -0
- package/lang/translations/ug.po +8 -0
- package/lang/translations/uk.po +8 -0
- package/lang/translations/ur.po +8 -0
- package/lang/translations/uz.po +8 -0
- package/lang/translations/vi.po +8 -0
- package/lang/translations/zh-cn.po +8 -0
- package/lang/translations/zh.po +8 -0
- package/package.json +13 -12
- package/src/autoimage.js +10 -0
- package/src/image/imagetypecommand.js +4 -0
- package/src/imagecaption/imagecaptionediting.js +7 -0
- package/src/imagecaption/imagecaptionui.js +3 -2
- package/src/imageinsert/imageinsertui.js +11 -6
- package/src/imageinsert/imageinsertviaurlui.js +7 -6
- package/src/imageinsert/ui/imageinsertformview.js +20 -0
- package/src/imageinsert/ui/imageinserturlview.js +8 -0
- package/src/imageresize/imagecustomresizeui.js +8 -5
- package/src/imageresize/imageresizebuttons.d.ts +3 -0
- package/src/imageresize/imageresizebuttons.js +21 -13
- package/src/imageresize/resizeimagecommand.d.ts +1 -1
- package/src/imageresize/ui/imagecustomresizeformview.d.ts +19 -12
- package/src/imageresize/ui/imagecustomresizeformview.js +112 -36
- package/src/imagestyle/imagestylecommand.js +10 -0
- package/src/imagestyle/imagestyleediting.js +12 -0
- package/src/imagestyle/imagestyleui.js +1 -1
- package/src/imagestyle/utils.d.ts +1 -4
- package/src/imagestyle/utils.js +16 -16
- package/src/imagetextalternative/imagetextalternativeui.js +11 -7
- package/src/imagetextalternative/ui/textalternativeformview.d.ts +17 -10
- package/src/imagetextalternative/ui/textalternativeformview.js +105 -35
- package/src/imagetoolbar.js +1 -1
- package/src/imageupload/imageuploadediting.js +17 -7
- package/src/imageupload/imageuploadprogress.js +59 -53
- package/src/imageupload/imageuploadui.js +3 -2
- package/src/imageutils.js +4 -7
- package/theme/imagecustomresizeform.css +0 -29
- 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 {
|
|
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.
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
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
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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
|
}
|
package/src/imagetoolbar.js
CHANGED
|
@@ -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 '
|
|
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
|
|
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:
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
}
|