@ckeditor/ckeditor5-image 27.1.0 → 29.2.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/README.md +3 -3
- package/build/image.js +1 -1
- package/build/translations/ar.js +1 -0
- package/build/translations/ast.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/si.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +233 -0
- package/lang/contexts.json +3 -0
- package/lang/translations/ar.po +12 -0
- package/lang/translations/ast.po +12 -0
- package/lang/translations/az.po +12 -0
- package/lang/translations/bg.po +12 -0
- package/lang/translations/cs.po +12 -0
- package/lang/translations/da.po +12 -0
- package/lang/translations/de-ch.po +113 -0
- package/lang/translations/de.po +15 -3
- package/lang/translations/el.po +12 -0
- package/lang/translations/en-au.po +12 -0
- package/lang/translations/en-gb.po +12 -0
- package/lang/translations/en.po +12 -0
- package/lang/translations/eo.po +12 -0
- package/lang/translations/es.po +12 -0
- package/lang/translations/et.po +12 -0
- package/lang/translations/eu.po +12 -0
- package/lang/translations/fa.po +12 -0
- package/lang/translations/fi.po +12 -0
- package/lang/translations/fr.po +12 -0
- package/lang/translations/gl.po +12 -0
- package/lang/translations/he.po +12 -0
- package/lang/translations/hi.po +12 -0
- package/lang/translations/hr.po +12 -0
- package/lang/translations/hu.po +13 -1
- package/lang/translations/id.po +21 -9
- package/lang/translations/it.po +12 -0
- package/lang/translations/ja.po +12 -0
- package/lang/translations/km.po +12 -0
- package/lang/translations/kn.po +12 -0
- package/lang/translations/ko.po +12 -0
- package/lang/translations/ku.po +12 -0
- package/lang/translations/lt.po +12 -0
- package/lang/translations/lv.po +12 -0
- package/lang/translations/nb.po +12 -0
- package/lang/translations/ne.po +12 -0
- package/lang/translations/nl.po +12 -0
- package/lang/translations/no.po +12 -0
- package/lang/translations/pl.po +20 -8
- package/lang/translations/pt-br.po +12 -0
- package/lang/translations/pt.po +12 -0
- package/lang/translations/ro.po +21 -9
- package/lang/translations/ru.po +12 -0
- package/lang/translations/si.po +12 -0
- package/lang/translations/sk.po +12 -0
- package/lang/translations/sq.po +12 -0
- package/lang/translations/sr-latn.po +12 -0
- package/lang/translations/sr.po +12 -0
- package/lang/translations/sv.po +12 -0
- package/lang/translations/th.po +12 -0
- package/lang/translations/tk.po +12 -0
- package/lang/translations/tr.po +12 -0
- package/lang/translations/ug.po +12 -0
- package/lang/translations/uk.po +12 -0
- package/lang/translations/vi.po +12 -0
- package/lang/translations/zh-cn.po +12 -0
- package/lang/translations/zh.po +12 -0
- package/package.json +36 -29
- package/src/autoimage.js +6 -4
- package/src/image/converters.js +192 -13
- package/src/image/imageblockediting.js +179 -0
- package/src/image/imageediting.js +13 -70
- package/src/image/imageinlineediting.js +204 -0
- package/src/image/imagetypecommand.js +105 -0
- package/src/image/insertimagecommand.js +77 -10
- package/src/image/ui/utils.js +3 -3
- package/src/image/utils.js +70 -121
- package/src/image.js +7 -19
- package/src/imageblock.js +46 -0
- package/src/imagecaption/imagecaptionediting.js +202 -230
- package/src/imagecaption/imagecaptionui.js +78 -0
- package/src/imagecaption/toggleimagecaptioncommand.js +165 -0
- package/src/imagecaption/utils.js +25 -40
- package/src/imagecaption.js +3 -2
- package/src/imageinline.js +46 -0
- package/src/imageinsert/imageinsertui.js +5 -6
- package/src/imageinsert.js +16 -4
- package/src/imageresize/imageresizebuttons.js +1 -1
- package/src/imageresize/imageresizeediting.js +21 -8
- package/src/imageresize/imageresizehandles.js +30 -8
- package/src/imageresize/resizeimagecommand.js +8 -5
- package/src/imagestyle/converters.js +25 -17
- package/src/imagestyle/imagestylecommand.js +73 -33
- package/src/imagestyle/imagestyleediting.js +113 -52
- package/src/imagestyle/imagestyleui.js +197 -31
- package/src/imagestyle/utils.js +300 -85
- package/src/imagestyle.js +218 -47
- package/src/imagetextalternative/imagetextalternativecommand.js +10 -7
- package/src/imagetextalternative/imagetextalternativeediting.js +9 -1
- package/src/imagetextalternative/imagetextalternativeui.js +2 -2
- package/src/imagetextalternative.js +1 -1
- package/src/imagetoolbar.js +33 -11
- package/src/imageupload/imageuploadediting.js +91 -31
- package/src/imageupload/imageuploadprogress.js +17 -9
- package/src/imageupload/imageuploadui.js +1 -1
- package/src/imageupload/uploadimagecommand.js +50 -24
- package/src/imageupload/utils.js +3 -2
- package/src/imageupload.js +1 -1
- package/src/imageutils.js +342 -0
- package/src/index.js +22 -47
- package/src/pictureediting.js +149 -0
- package/theme/image.css +101 -21
- package/theme/imagecaption.css +24 -2
- package/theme/imageresize.css +11 -0
- package/theme/imagestyle.css +76 -0
- package/theme/imageuploadicon.css +8 -2
- package/theme/imageuploadprogress.css +12 -8
- package/build/image.js.map +0 -1
package/theme/image.css
CHANGED
|
@@ -3,34 +3,114 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
.ck-content
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
.ck-content {
|
|
7
|
+
& .image {
|
|
8
|
+
display: table;
|
|
9
|
+
clear: both;
|
|
10
|
+
text-align: center;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/* Make sure there is some space between the content and the image. Center image by default. */
|
|
13
|
+
/* The first value should be equal to --ck-spacing-large variable if used in the editor context
|
|
14
|
+
to avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */
|
|
15
|
+
margin: 0.9em auto;
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
/* Make sure the caption will be displayed properly (See: https://github.com/ckeditor/ckeditor5/issues/1870). */
|
|
18
|
+
min-width: 50px;
|
|
19
|
+
|
|
20
|
+
& img {
|
|
21
|
+
/* Prevent unnecessary margins caused by line-height (see #44). */
|
|
22
|
+
display: block;
|
|
23
|
+
|
|
24
|
+
/* Center the image if its width is smaller than the content's width. */
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
|
|
27
|
+
/* Make sure the image never exceeds the size of the parent container (ckeditor/ckeditor5-ui#67). */
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
|
|
30
|
+
/* Make sure the image is never smaller than the parent container (See: https://github.com/ckeditor/ckeditor5/issues/9300). */
|
|
31
|
+
min-width: 100%
|
|
32
|
+
}
|
|
33
|
+
}
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
& .image-inline {
|
|
36
|
+
/*
|
|
37
|
+
* Normally, the .image-inline would have "display: inline-block" and "img { width: 100% }" (to follow the wrapper while resizing).
|
|
38
|
+
* Unfortunately, together with "srcset", it gets automatically stretched up to the width of the editing root.
|
|
39
|
+
* This strange behavior does not happen with inline-flex.
|
|
40
|
+
*/
|
|
41
|
+
display: inline-flex;
|
|
20
42
|
|
|
21
|
-
/*
|
|
43
|
+
/* While being resized, don't allow the image to exceed the width of the editing root. */
|
|
22
44
|
max-width: 100%;
|
|
23
45
|
|
|
24
|
-
/*
|
|
25
|
-
|
|
46
|
+
/* This is required by Safari to resize images in a sensible way. Without this, the browser breaks the ratio. */
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
|
|
49
|
+
/* When the picture is present it must act as a flex container to let the img resize properly */
|
|
50
|
+
& picture {
|
|
51
|
+
display: flex;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* When the picture is present, it must act like a resizable img. */
|
|
55
|
+
& picture,
|
|
56
|
+
& img {
|
|
57
|
+
/* This is necessary for the img to span the entire .image-inline wrapper and to resize properly. */
|
|
58
|
+
flex-grow: 1;
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
|
|
61
|
+
/* Prevents overflowing the editing root boundaries when an inline image is very wide. */
|
|
62
|
+
max-width: 100%;
|
|
63
|
+
}
|
|
26
64
|
}
|
|
27
65
|
}
|
|
28
66
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
.ck.ck-editor__editable {
|
|
68
|
+
/*
|
|
69
|
+
* Inhertit the content styles padding of the <figcaption> in case the integration overrides `text-align: center`
|
|
70
|
+
* of `.image` (e.g. to the left/right). This ensures the placeholder stays at the padding just like the native
|
|
71
|
+
* caret does, and not at the edge of <figcaption>.
|
|
72
|
+
*/
|
|
73
|
+
& .image > figcaption.ck-placeholder::before {
|
|
74
|
+
padding-left: inherit;
|
|
75
|
+
padding-right: inherit;
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* Make sure the image caption placeholder doesn't overflow the placeholder area.
|
|
79
|
+
* See https://github.com/ckeditor/ckeditor5/issues/9162.
|
|
80
|
+
*/
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
text-overflow: ellipsis;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
* Make sure the selected inline image always stays on top of its siblings.
|
|
89
|
+
* See https://github.com/ckeditor/ckeditor5/issues/9108.
|
|
90
|
+
*/
|
|
91
|
+
& .image.ck-widget_selected {
|
|
92
|
+
z-index: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
& .image-inline.ck-widget_selected {
|
|
96
|
+
z-index: 1;
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* Make sure the native browser selection style is not displayed.
|
|
100
|
+
* Inline image widgets have their own styles for the selected state and
|
|
101
|
+
* leaving this up to the browser is asking for a visual collision.
|
|
102
|
+
*/
|
|
103
|
+
& ::selection {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* The inline image nested in the table should have its original size if not resized.
|
|
109
|
+
See https://github.com/ckeditor/ckeditor5/issues/9117. */
|
|
110
|
+
& td,
|
|
111
|
+
& th {
|
|
112
|
+
& .image-inline img {
|
|
113
|
+
max-width: none;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
36
116
|
}
|
package/theme/imagecaption.css
CHANGED
|
@@ -3,13 +3,35 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
:root {
|
|
7
|
+
--ck-color-image-caption-background: hsl(0, 0%, 97%);
|
|
8
|
+
--ck-color-image-caption-text: hsl(0, 0%, 20%);
|
|
9
|
+
--ck-color-image-caption-highligted-background: hsl(52deg 100% 50%);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Content styles */
|
|
6
13
|
.ck-content .image > figcaption {
|
|
7
14
|
display: table-caption;
|
|
8
15
|
caption-side: bottom;
|
|
9
16
|
word-break: break-word;
|
|
10
|
-
color:
|
|
11
|
-
background-color:
|
|
17
|
+
color: var(--ck-color-image-caption-text);
|
|
18
|
+
background-color: var(--ck-color-image-caption-background);
|
|
12
19
|
padding: .6em;
|
|
13
20
|
font-size: .75em;
|
|
14
21
|
outline-offset: -1px;
|
|
15
22
|
}
|
|
23
|
+
|
|
24
|
+
/* Editing styles */
|
|
25
|
+
.ck.ck-editor__editable .image > figcaption.image__caption_highlighted {
|
|
26
|
+
animation: ck-image-caption-highlight .6s ease-out;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes ck-image-caption-highlight {
|
|
30
|
+
0% {
|
|
31
|
+
background-color: var(--ck-color-image-caption-highligted-background);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
100% {
|
|
35
|
+
background-color: var(--ck-color-image-caption-background);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/theme/imageresize.css
CHANGED
|
@@ -24,6 +24,17 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
.ck.ck-editor__editable {
|
|
28
|
+
/* The resized inline image nested in the table should respect its parent size.
|
|
29
|
+
See https://github.com/ckeditor/ckeditor5/issues/9117. */
|
|
30
|
+
& td,
|
|
31
|
+
& th {
|
|
32
|
+
& .image-inline.image_resized img {
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
[dir="ltr"] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon {
|
|
28
39
|
margin-right: var(--ck-spacing-standard);
|
|
29
40
|
}
|
package/theme/imagestyle.css
CHANGED
|
@@ -5,9 +5,25 @@
|
|
|
5
5
|
|
|
6
6
|
:root {
|
|
7
7
|
--ck-image-style-spacing: 1.5em;
|
|
8
|
+
--ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.ck-content {
|
|
12
|
+
/* Provides a minimal side margin for the left and right aligned images, so that the user has a visual feedback
|
|
13
|
+
confirming successful application of the style if image width exceeds the editor's size.
|
|
14
|
+
See https://github.com/ckeditor/ckeditor5/issues/9342 */
|
|
15
|
+
& .image-style-block-align-left,
|
|
16
|
+
& .image-style-block-align-right {
|
|
17
|
+
max-width: calc(100% - var(--ck-image-style-spacing));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Allows displaying multiple floating images in the same line.
|
|
21
|
+
See https://github.com/ckeditor/ckeditor5/issues/9183#issuecomment-804988132 */
|
|
22
|
+
& .image-style-align-left,
|
|
23
|
+
& .image-style-align-right {
|
|
24
|
+
clear: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
& .image-style-side {
|
|
12
28
|
float: right;
|
|
13
29
|
margin-left: var(--ck-image-style-spacing);
|
|
@@ -28,4 +44,64 @@
|
|
|
28
44
|
float: right;
|
|
29
45
|
margin-left: var(--ck-image-style-spacing);
|
|
30
46
|
}
|
|
47
|
+
|
|
48
|
+
& .image-style-block-align-right {
|
|
49
|
+
margin-right: 0;
|
|
50
|
+
margin-left: auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
& .image-style-block-align-left {
|
|
54
|
+
margin-left: 0;
|
|
55
|
+
margin-right: auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Simulates margin collapsing with the preceding paragraph, which does not work for the floating elements. */
|
|
59
|
+
& p + .image-style-align-left,
|
|
60
|
+
& p + .image-style-align-right,
|
|
61
|
+
& p + .image-style-side {
|
|
62
|
+
margin-top: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
& .image-inline {
|
|
66
|
+
&.image-style-align-left,
|
|
67
|
+
&.image-style-align-right {
|
|
68
|
+
margin-top: var(--ck-inline-image-style-spacing);
|
|
69
|
+
margin-bottom: var(--ck-inline-image-style-spacing);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.image-style-align-left {
|
|
73
|
+
margin-right: var(--ck-inline-image-style-spacing);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.image-style-align-right {
|
|
77
|
+
margin-left: var(--ck-inline-image-style-spacing);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ck.ck-splitbutton {
|
|
83
|
+
/* The button should display as a regular drop-down if the action button
|
|
84
|
+
is forced to fire the same action as the arrow button. */
|
|
85
|
+
&.ck-splitbutton_flatten {
|
|
86
|
+
&:hover,
|
|
87
|
+
&.ck-splitbutton_open {
|
|
88
|
+
& > .ck-splitbutton__action:not(.ck-disabled),
|
|
89
|
+
& > .ck-splitbutton__arrow:not(.ck-disabled),
|
|
90
|
+
& > .ck-splitbutton__arrow:not(.ck-disabled):not(:hover) {
|
|
91
|
+
background-color: var(--ck-color-button-on-background);
|
|
92
|
+
|
|
93
|
+
&::after {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.ck-splitbutton_open:hover {
|
|
100
|
+
& > .ck-splitbutton__action:not(.ck-disabled),
|
|
101
|
+
& > .ck-splitbutton__arrow:not(.ck-disabled),
|
|
102
|
+
& > .ck-splitbutton__arrow:not(.ck-disabled):not(:hover) {
|
|
103
|
+
background-color: var(--ck-color-button-on-hover-background);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
31
107
|
}
|
|
@@ -6,9 +6,15 @@
|
|
|
6
6
|
.ck-image-upload-complete-icon {
|
|
7
7
|
display: block;
|
|
8
8
|
position: absolute;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Smaller images should have the icon closer to the border.
|
|
12
|
+
* Match the icon position with the linked image indicator brought by the link image feature.
|
|
13
|
+
*/
|
|
14
|
+
top: min(var(--ck-spacing-medium), 6%);
|
|
15
|
+
right: min(var(--ck-spacing-medium), 6%);
|
|
11
16
|
border-radius: 50%;
|
|
17
|
+
z-index: 1;
|
|
12
18
|
|
|
13
19
|
&::after {
|
|
14
20
|
content: "";
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
.ck.ck-editor__editable
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
.ck.ck-editor__editable {
|
|
7
|
+
& .image,
|
|
8
|
+
& .image-inline {
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
9
11
|
|
|
10
|
-
/* Upload progress bar. */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/* Upload progress bar. */
|
|
13
|
+
& .image .ck-progress-bar,
|
|
14
|
+
& .image-inline .ck-progress-bar {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
}
|
|
15
19
|
}
|