@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.
- 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,32 +5,90 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module image/imageresize/ui/imagecustomresizeformview
|
|
7
7
|
*/
|
|
8
|
-
import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, createLabeledInputNumber, submitHandler } from 'ckeditor5/src/ui.js';
|
|
8
|
+
import { ButtonView, FocusCycler, FormHeaderView, FormRowView, LabeledFieldView, View, ViewCollection, createLabeledInputNumber, 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/imagecustomresizeform.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 ImageCustomResizeFormView class.
|
|
17
19
|
*/
|
|
18
20
|
export default class ImageCustomResizeFormView 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
|
+
* Resize unit shortcut.
|
|
31
|
+
*/
|
|
32
|
+
unit;
|
|
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
|
+
* An input with a label.
|
|
43
|
+
*/
|
|
44
|
+
labeledInput;
|
|
45
|
+
/**
|
|
46
|
+
* A collection of child views.
|
|
47
|
+
*/
|
|
48
|
+
children;
|
|
49
|
+
/**
|
|
50
|
+
* A collection of views which can be focused in the form.
|
|
51
|
+
*/
|
|
52
|
+
_focusables;
|
|
53
|
+
/**
|
|
54
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
55
|
+
*/
|
|
56
|
+
_focusCycler;
|
|
57
|
+
/**
|
|
58
|
+
* An array of form validators used by {@link #isValid}.
|
|
59
|
+
*/
|
|
60
|
+
_validators;
|
|
19
61
|
/**
|
|
20
62
|
* @inheritDoc
|
|
21
63
|
*/
|
|
22
64
|
constructor(locale, unit, validators) {
|
|
23
65
|
super(locale);
|
|
24
|
-
const t = this.locale.t;
|
|
25
66
|
this.focusTracker = new FocusTracker();
|
|
26
67
|
this.keystrokes = new KeystrokeHandler();
|
|
27
68
|
this.unit = unit;
|
|
69
|
+
// Create buttons.
|
|
70
|
+
this.backButtonView = this._createBackButton();
|
|
71
|
+
this.saveButtonView = this._createSaveButton();
|
|
72
|
+
// Create input fields.
|
|
28
73
|
this.labeledInput = this._createLabeledInputView();
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
|
|
74
|
+
this.children = this.createCollection([this._createHeaderView()]);
|
|
75
|
+
this.children.add(new FormRowView(locale, {
|
|
76
|
+
children: [
|
|
77
|
+
this.labeledInput,
|
|
78
|
+
this.saveButtonView
|
|
79
|
+
],
|
|
80
|
+
class: [
|
|
81
|
+
'ck-form__row_with-submit',
|
|
82
|
+
'ck-form__row_large-top-padding'
|
|
83
|
+
]
|
|
84
|
+
}));
|
|
32
85
|
this._focusables = new ViewCollection();
|
|
33
86
|
this._validators = validators;
|
|
87
|
+
// Close the panel on esc key press when the **form has focus**.
|
|
88
|
+
this.keystrokes.set('Esc', (data, cancel) => {
|
|
89
|
+
this.fire('cancel');
|
|
90
|
+
cancel();
|
|
91
|
+
});
|
|
34
92
|
this._focusCycler = new FocusCycler({
|
|
35
93
|
focusables: this._focusables,
|
|
36
94
|
focusTracker: this.focusTracker,
|
|
@@ -47,17 +105,14 @@ export default class ImageCustomResizeFormView extends View {
|
|
|
47
105
|
attributes: {
|
|
48
106
|
class: [
|
|
49
107
|
'ck',
|
|
108
|
+
'ck-form',
|
|
50
109
|
'ck-image-custom-resize-form',
|
|
51
110
|
'ck-responsive-form'
|
|
52
111
|
],
|
|
53
112
|
// https://github.com/ckeditor/ckeditor5-image/issues/40
|
|
54
113
|
tabindex: '-1'
|
|
55
114
|
},
|
|
56
|
-
children:
|
|
57
|
-
this.labeledInput,
|
|
58
|
-
this.saveButtonView,
|
|
59
|
-
this.cancelButtonView
|
|
60
|
-
]
|
|
115
|
+
children: this.children
|
|
61
116
|
});
|
|
62
117
|
}
|
|
63
118
|
/**
|
|
@@ -65,15 +120,21 @@ export default class ImageCustomResizeFormView extends View {
|
|
|
65
120
|
*/
|
|
66
121
|
render() {
|
|
67
122
|
super.render();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
123
|
+
submitHandler({
|
|
124
|
+
view: this
|
|
125
|
+
});
|
|
126
|
+
const childViews = [
|
|
127
|
+
this.backButtonView,
|
|
128
|
+
this.labeledInput,
|
|
129
|
+
this.saveButtonView
|
|
130
|
+
];
|
|
131
|
+
childViews.forEach(v => {
|
|
72
132
|
// Register the view as focusable.
|
|
73
133
|
this._focusables.add(v);
|
|
74
134
|
// Register the view in the focus tracker.
|
|
75
135
|
this.focusTracker.add(v.element);
|
|
76
136
|
});
|
|
137
|
+
this.keystrokes.listenTo(this.element);
|
|
77
138
|
}
|
|
78
139
|
/**
|
|
79
140
|
* @inheritDoc
|
|
@@ -84,30 +145,44 @@ export default class ImageCustomResizeFormView extends View {
|
|
|
84
145
|
this.keystrokes.destroy();
|
|
85
146
|
}
|
|
86
147
|
/**
|
|
87
|
-
* Creates
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const button = new ButtonView(this.locale);
|
|
97
|
-
button.set({
|
|
98
|
-
label,
|
|
99
|
-
icon,
|
|
148
|
+
* Creates a back button view that cancels the form.
|
|
149
|
+
*/
|
|
150
|
+
_createBackButton() {
|
|
151
|
+
const t = this.locale.t;
|
|
152
|
+
const backButton = new ButtonView(this.locale);
|
|
153
|
+
backButton.set({
|
|
154
|
+
class: 'ck-button-back',
|
|
155
|
+
label: t('Back'),
|
|
156
|
+
icon: IconPreviousArrow,
|
|
100
157
|
tooltip: true
|
|
101
158
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
159
|
+
backButton.delegate('execute').to(this, 'cancel');
|
|
160
|
+
return backButton;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a save button view that resize the image.
|
|
164
|
+
*/
|
|
165
|
+
_createSaveButton() {
|
|
166
|
+
const t = this.locale.t;
|
|
167
|
+
const saveButton = new ButtonView(this.locale);
|
|
168
|
+
saveButton.set({
|
|
169
|
+
label: t('Save'),
|
|
170
|
+
withText: true,
|
|
171
|
+
type: 'submit',
|
|
172
|
+
class: 'ck-button-action ck-button-bold'
|
|
106
173
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
174
|
+
return saveButton;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Creates a header view for the form.
|
|
178
|
+
*/
|
|
179
|
+
_createHeaderView() {
|
|
180
|
+
const t = this.locale.t;
|
|
181
|
+
const header = new FormHeaderView(this.locale, {
|
|
182
|
+
label: t('Image Resize')
|
|
183
|
+
});
|
|
184
|
+
header.children.add(this.backButtonView, 0);
|
|
185
|
+
return header;
|
|
111
186
|
}
|
|
112
187
|
/**
|
|
113
188
|
* Creates an input with a label.
|
|
@@ -118,6 +193,7 @@ export default class ImageCustomResizeFormView extends View {
|
|
|
118
193
|
const t = this.locale.t;
|
|
119
194
|
const labeledInput = new LabeledFieldView(this.locale, createLabeledInputNumber);
|
|
120
195
|
labeledInput.label = t('Resize image (in %0)', this.unit);
|
|
196
|
+
labeledInput.class = 'ck-labeled-field-view_full-width';
|
|
121
197
|
labeledInput.fieldView.set({
|
|
122
198
|
step: 0.1
|
|
123
199
|
});
|
|
@@ -11,6 +11,16 @@ import { Command } from 'ckeditor5/src/core.js';
|
|
|
11
11
|
* type. See {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand#execute} to learn more.
|
|
12
12
|
*/
|
|
13
13
|
export default class ImageStyleCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* An object containing names of default style options for the inline and block images.
|
|
16
|
+
* If there is no default style option for the given image type in the configuration,
|
|
17
|
+
* the name will be `false`.
|
|
18
|
+
*/
|
|
19
|
+
_defaultStyles;
|
|
20
|
+
/**
|
|
21
|
+
* The styles handled by this command.
|
|
22
|
+
*/
|
|
23
|
+
_styles;
|
|
14
24
|
/**
|
|
15
25
|
* Creates an instance of the image style command. When executed, the command applies one of
|
|
16
26
|
* {@link module:image/imageconfig~ImageStyleConfig#options style options} to the currently selected image.
|
|
@@ -33,6 +33,18 @@ export default class ImageStyleEditing extends Plugin {
|
|
|
33
33
|
static get requires() {
|
|
34
34
|
return [ImageUtils];
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* It contains a list of the normalized and validated style options.
|
|
38
|
+
*
|
|
39
|
+
* * Each option contains a complete icon markup.
|
|
40
|
+
* * The style options not supported by any of the loaded image editing plugins (
|
|
41
|
+
* {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} or
|
|
42
|
+
* {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`}) are filtered out.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
normalizedStyles;
|
|
36
48
|
/**
|
|
37
49
|
* @inheritDoc
|
|
38
50
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ButtonView, createDropdown, addToolbarToDropdown, SplitButtonView } from 'ckeditor5/src/ui.js';
|
|
10
|
-
import { isObject, identity } from '
|
|
10
|
+
import { isObject, identity } from 'es-toolkit/compat';
|
|
11
11
|
import ImageStyleEditing from './imagestyleediting.js';
|
|
12
12
|
import utils from './utils.js';
|
|
13
13
|
import '../../theme/imagestyle.css';
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
* @license 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
|
-
* @module image/imagestyle/utils
|
|
7
|
-
*/
|
|
8
|
-
import { type Editor, type PluginCollection } from 'ckeditor5/src/core.js';
|
|
5
|
+
import type { Editor, PluginCollection } from 'ckeditor5/src/core.js';
|
|
9
6
|
import type { ImageStyleConfig, ImageStyleDropdownDefinition, ImageStyleOptionDefinition } from '../imageconfig.js';
|
|
10
7
|
/**
|
|
11
8
|
* Default image style options provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}
|
package/src/imagestyle/utils.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module image/imagestyle/utils
|
|
7
7
|
*/
|
|
8
|
-
import { icons } from 'ckeditor5/src/core.js';
|
|
9
8
|
import { logWarning } from 'ckeditor5/src/utils.js';
|
|
9
|
+
import { IconObjectCenter, IconObjectFullWidth, IconObjectInline, IconObjectInlineLeft, IconObjectInlineRight, IconObjectLeft, IconObjectRight } from 'ckeditor5/src/icons.js';
|
|
10
10
|
/**
|
|
11
11
|
* Default image style options provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}
|
|
12
12
|
* configuration.
|
|
@@ -31,7 +31,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
31
31
|
return {
|
|
32
32
|
name: 'inline',
|
|
33
33
|
title: 'In line',
|
|
34
|
-
icon:
|
|
34
|
+
icon: IconObjectInline,
|
|
35
35
|
modelElements: ['imageInline'],
|
|
36
36
|
isDefault: true
|
|
37
37
|
};
|
|
@@ -41,7 +41,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
41
41
|
return {
|
|
42
42
|
name: 'alignLeft',
|
|
43
43
|
title: 'Left aligned image',
|
|
44
|
-
icon:
|
|
44
|
+
icon: IconObjectInlineLeft,
|
|
45
45
|
modelElements: ['imageBlock', 'imageInline'],
|
|
46
46
|
className: 'image-style-align-left'
|
|
47
47
|
};
|
|
@@ -51,7 +51,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
51
51
|
return {
|
|
52
52
|
name: 'alignBlockLeft',
|
|
53
53
|
title: 'Left aligned image',
|
|
54
|
-
icon:
|
|
54
|
+
icon: IconObjectLeft,
|
|
55
55
|
modelElements: ['imageBlock'],
|
|
56
56
|
className: 'image-style-block-align-left'
|
|
57
57
|
};
|
|
@@ -61,7 +61,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
61
61
|
return {
|
|
62
62
|
name: 'alignCenter',
|
|
63
63
|
title: 'Centered image',
|
|
64
|
-
icon:
|
|
64
|
+
icon: IconObjectCenter,
|
|
65
65
|
modelElements: ['imageBlock'],
|
|
66
66
|
className: 'image-style-align-center'
|
|
67
67
|
};
|
|
@@ -71,7 +71,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
71
71
|
return {
|
|
72
72
|
name: 'alignRight',
|
|
73
73
|
title: 'Right aligned image',
|
|
74
|
-
icon:
|
|
74
|
+
icon: IconObjectInlineRight,
|
|
75
75
|
modelElements: ['imageBlock', 'imageInline'],
|
|
76
76
|
className: 'image-style-align-right'
|
|
77
77
|
};
|
|
@@ -81,7 +81,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
81
81
|
return {
|
|
82
82
|
name: 'alignBlockRight',
|
|
83
83
|
title: 'Right aligned image',
|
|
84
|
-
icon:
|
|
84
|
+
icon: IconObjectRight,
|
|
85
85
|
modelElements: ['imageBlock'],
|
|
86
86
|
className: 'image-style-block-align-right'
|
|
87
87
|
};
|
|
@@ -91,7 +91,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
91
91
|
return {
|
|
92
92
|
name: 'block',
|
|
93
93
|
title: 'Centered image',
|
|
94
|
-
icon:
|
|
94
|
+
icon: IconObjectCenter,
|
|
95
95
|
modelElements: ['imageBlock'],
|
|
96
96
|
isDefault: true
|
|
97
97
|
};
|
|
@@ -101,7 +101,7 @@ export const DEFAULT_OPTIONS = {
|
|
|
101
101
|
return {
|
|
102
102
|
name: 'side',
|
|
103
103
|
title: 'Side image',
|
|
104
|
-
icon:
|
|
104
|
+
icon: IconObjectInlineRight,
|
|
105
105
|
modelElements: ['imageBlock'],
|
|
106
106
|
className: 'image-style-side'
|
|
107
107
|
};
|
|
@@ -116,13 +116,13 @@ export const DEFAULT_OPTIONS = {
|
|
|
116
116
|
* There are 7 default icons available: `'full'`, `'left'`, `'inlineLeft'`, `'center'`, `'right'`, `'inlineRight'`, and `'inline'`.
|
|
117
117
|
*/
|
|
118
118
|
export const DEFAULT_ICONS = /* #__PURE__ */ (() => ({
|
|
119
|
-
full:
|
|
120
|
-
left:
|
|
121
|
-
right:
|
|
122
|
-
center:
|
|
123
|
-
inlineLeft:
|
|
124
|
-
inlineRight:
|
|
125
|
-
inline:
|
|
119
|
+
full: IconObjectFullWidth,
|
|
120
|
+
left: IconObjectLeft,
|
|
121
|
+
right: IconObjectRight,
|
|
122
|
+
center: IconObjectCenter,
|
|
123
|
+
inlineLeft: IconObjectInlineLeft,
|
|
124
|
+
inlineRight: IconObjectInlineRight,
|
|
125
|
+
inline: IconObjectInline
|
|
126
126
|
}))();
|
|
127
127
|
/**
|
|
128
128
|
* Default drop-downs provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#toolbar}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module image/imagetextalternative/imagetextalternativeui
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
9
|
import { ButtonView, ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';
|
|
10
|
+
import { IconTextAlternative } from 'ckeditor5/src/icons.js';
|
|
10
11
|
import TextAlternativeFormView from './ui/textalternativeformview.js';
|
|
11
12
|
import { repositionContextualBalloon, getBalloonPositionData } from '../image/ui/utils.js';
|
|
12
13
|
/**
|
|
@@ -15,6 +16,14 @@ import { repositionContextualBalloon, getBalloonPositionData } from '../image/ui
|
|
|
15
16
|
* The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
16
17
|
*/
|
|
17
18
|
export default class ImageTextAlternativeUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* The contextual balloon plugin instance.
|
|
21
|
+
*/
|
|
22
|
+
_balloon;
|
|
23
|
+
/**
|
|
24
|
+
* A form containing a textarea and buttons, used to change the `alt` text value.
|
|
25
|
+
*/
|
|
26
|
+
_form;
|
|
18
27
|
/**
|
|
19
28
|
* @inheritDoc
|
|
20
29
|
*/
|
|
@@ -61,7 +70,7 @@ export default class ImageTextAlternativeUI extends Plugin {
|
|
|
61
70
|
const view = new ButtonView(locale);
|
|
62
71
|
view.set({
|
|
63
72
|
label: t('Change image text alternative'),
|
|
64
|
-
icon:
|
|
73
|
+
icon: IconTextAlternative,
|
|
65
74
|
tooltip: true
|
|
66
75
|
});
|
|
67
76
|
view.bind('isEnabled').to(command, 'isEnabled');
|
|
@@ -94,11 +103,6 @@ export default class ImageTextAlternativeUI extends Plugin {
|
|
|
94
103
|
this.listenTo(this._form, 'cancel', () => {
|
|
95
104
|
this._hideForm(true);
|
|
96
105
|
});
|
|
97
|
-
// Close the form on Esc key press.
|
|
98
|
-
this._form.keystrokes.set('Esc', (data, cancel) => {
|
|
99
|
-
this._hideForm(true);
|
|
100
|
-
cancel();
|
|
101
|
-
});
|
|
102
106
|
// Reposition the balloon or hide the form if an image widget is no longer selected.
|
|
103
107
|
this.listenTo(editor.ui, 'update', () => {
|
|
104
108
|
if (!imageUtils.getClosestSelectedImageWidget(viewDocument.selection)) {
|
|
@@ -9,6 +9,7 @@ import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, type I
|
|
|
9
9
|
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import '../../../theme/textalternativeform.css';
|
|
11
11
|
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
12
|
+
import '@ckeditor/ckeditor5-ui/theme/components/form/form.css';
|
|
12
13
|
/**
|
|
13
14
|
* The TextAlternativeFormView class.
|
|
14
15
|
*/
|
|
@@ -25,14 +26,18 @@ export default class TextAlternativeFormView extends View {
|
|
|
25
26
|
* An input with a label.
|
|
26
27
|
*/
|
|
27
28
|
labeledInput: LabeledFieldView<InputView>;
|
|
29
|
+
/**
|
|
30
|
+
* The Back button view displayed in the header.
|
|
31
|
+
*/
|
|
32
|
+
backButtonView: ButtonView;
|
|
28
33
|
/**
|
|
29
34
|
* A button used to submit the form.
|
|
30
35
|
*/
|
|
31
36
|
saveButtonView: ButtonView;
|
|
32
37
|
/**
|
|
33
|
-
* A
|
|
38
|
+
* A collection of child views.
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
readonly children: ViewCollection;
|
|
36
41
|
/**
|
|
37
42
|
* A collection of views which can be focused in the form.
|
|
38
43
|
*/
|
|
@@ -54,15 +59,17 @@ export default class TextAlternativeFormView extends View {
|
|
|
54
59
|
*/
|
|
55
60
|
destroy(): void;
|
|
56
61
|
/**
|
|
57
|
-
* Creates
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
* Creates a back button view that cancels the form.
|
|
63
|
+
*/
|
|
64
|
+
private _createBackButton;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a save button view that text alternative the image.
|
|
67
|
+
*/
|
|
68
|
+
private _createSaveButton;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a header view for the form.
|
|
64
71
|
*/
|
|
65
|
-
private
|
|
72
|
+
private _createHeaderView;
|
|
66
73
|
/**
|
|
67
74
|
* Creates an input with a label.
|
|
68
75
|
*
|