@wordpress/block-library 8.12.6 → 8.14.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/CHANGELOG.md +4 -0
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/index.js +5 -1
- package/build/audio/index.js.map +1 -1
- package/build/block/edit.native.js +2 -2
- package/build/block/edit.native.js.map +1 -1
- package/build/categories/index.js +5 -1
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +5 -1
- package/build/code/index.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/details/index.js +5 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/util.js +9 -8
- package/build/embed/util.js.map +1 -1
- package/build/file/index.js +2 -1
- package/build/file/index.js.map +1 -1
- package/build/file/view.js +15 -1
- package/build/file/view.js.map +1 -1
- package/build/gallery/index.js +3 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/index.js +5 -1
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +5 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.js +453 -175
- package/build/image/deprecated.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build/image/view-interactivity.js.map +1 -0
- package/build/index.js +12 -3
- package/build/index.js.map +1 -1
- package/build/list/index.js +5 -1
- package/build/list/index.js.map +1 -1
- package/build/list-item/utils.js +6 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/index.js +1 -0
- package/build/media-text/index.js.map +1 -1
- package/build/missing/edit.js +22 -8
- package/build/missing/edit.js.map +1 -1
- package/build/navigation/index.js +3 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +174 -50
- package/build/navigation/view.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +3 -3
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +34 -39
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/use-convert-to-navigation-links.js +2 -15
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build/paragraph/index.js +1 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +1 -0
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-time-to-read/index.js +5 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +5 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +5 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/index.js +3 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table/index.js +5 -1
- package/build/table/index.js.map +1 -1
- package/build/term-description/index.js +1 -0
- package/build/term-description/index.js.map +1 -1
- package/build/verse/index.js +5 -1
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +5 -1
- package/build/video/deprecated.js.map +1 -1
- package/build/video/index.js +5 -1
- package/build/video/index.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/index.js +5 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/block/edit.native.js +2 -2
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/categories/index.js +5 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +5 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/details/index.js +5 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/util.js +6 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/index.js +2 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/view.js +15 -2
- package/build-module/file/view.js.map +1 -1
- package/build-module/gallery/index.js +3 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/index.js +5 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +5 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +454 -176
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build-module/image/view-interactivity.js.map +1 -0
- package/build-module/index.js +12 -3
- package/build-module/index.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list-item/utils.js +6 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/index.js +1 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/missing/edit.js +22 -8
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/navigation/index.js +3 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +173 -50
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +3 -3
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +34 -39
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/use-convert-to-navigation-links.js +3 -16
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build-module/paragraph/index.js +1 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +1 -0
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-time-to-read/index.js +5 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/site-logo/index.js +5 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +5 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +5 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/index.js +3 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table/index.js +5 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/term-description/index.js +1 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/verse/index.js +5 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +5 -1
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/index.js +5 -1
- package/build-module/video/index.js.map +1 -1
- package/build-style/image/style-rtl.css +16 -2
- package/build-style/image/style.css +16 -2
- package/build-style/style-rtl.css +16 -2
- package/build-style/style.css +16 -2
- package/package.json +33 -38
- package/src/archives/block.json +5 -1
- package/src/audio/block.json +5 -1
- package/src/block/edit.native.js +2 -2
- package/src/block/test/edit.native.js +4 -4
- package/src/categories/block.json +5 -1
- package/src/code/block.json +5 -1
- package/src/column/block.json +1 -0
- package/src/comments/block.json +1 -0
- package/src/cover/block.json +1 -0
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/details/block.json +5 -1
- package/src/embed/util.js +4 -6
- package/src/file/block.json +2 -1
- package/src/file/index.php +0 -17
- package/src/file/view.js +14 -5
- package/src/gallery/block.json +3 -1
- package/src/group/block.json +1 -0
- package/src/heading/block.json +5 -1
- package/src/heading/test/index.native.js +18 -0
- package/src/image/deprecated.js +597 -320
- package/src/image/image.js +2 -1
- package/src/image/save.js +2 -0
- package/src/image/style.scss +15 -2
- package/src/image/{interactivity.js → view-interactivity.js} +99 -50
- package/src/index.js +18 -1
- package/src/list/block.json +5 -1
- package/src/media-text/block.json +1 -0
- package/src/missing/edit.js +31 -11
- package/src/navigation/block.json +3 -2
- package/src/navigation/index.php +15 -20
- package/src/navigation/view.js +189 -67
- package/src/navigation-submenu/index.php +0 -10
- package/src/page-list/convert-to-links-modal.js +3 -3
- package/src/page-list/edit.js +65 -62
- package/src/page-list/use-convert-to-navigation-links.js +3 -20
- package/src/paragraph/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-navigation-link/block.json +1 -0
- package/src/post-time-to-read/block.json +5 -1
- package/src/quote/block.json +1 -0
- package/src/site-logo/block.json +5 -1
- package/src/site-tagline/block.json +5 -1
- package/src/site-title/block.json +5 -1
- package/src/social-links/block.json +3 -1
- package/src/table/block.json +5 -1
- package/src/term-description/block.json +1 -0
- package/src/verse/block.json +5 -1
- package/src/video/block.json +5 -1
- package/build/file/interactivity.js +0 -19
- package/build/file/interactivity.js.map +0 -1
- package/build/heading/heading-level-icon.js +0 -61
- package/build/heading/heading-level-icon.js.map +0 -1
- package/build/image/interactivity.js.map +0 -1
- package/build/navigation/interactivity.js +0 -167
- package/build/navigation/interactivity.js.map +0 -1
- package/build/navigation/view-modal.js +0 -64
- package/build/navigation/view-modal.js.map +0 -1
- package/build/utils/interactivity/constants.js +0 -9
- package/build/utils/interactivity/constants.js.map +0 -1
- package/build/utils/interactivity/directives.js +0 -222
- package/build/utils/interactivity/directives.js.map +0 -1
- package/build/utils/interactivity/hooks.js +0 -159
- package/build/utils/interactivity/hooks.js.map +0 -1
- package/build/utils/interactivity/hydration.js +0 -34
- package/build/utils/interactivity/hydration.js.map +0 -1
- package/build/utils/interactivity/index.js +0 -32
- package/build/utils/interactivity/index.js.map +0 -1
- package/build/utils/interactivity/portals.js +0 -108
- package/build/utils/interactivity/portals.js.map +0 -1
- package/build/utils/interactivity/store.js +0 -66
- package/build/utils/interactivity/store.js.map +0 -1
- package/build/utils/interactivity/utils.js +0 -87
- package/build/utils/interactivity/utils.js.map +0 -1
- package/build/utils/interactivity/vdom.js +0 -119
- package/build/utils/interactivity/vdom.js.map +0 -1
- package/build-module/file/interactivity.js +0 -15
- package/build-module/file/interactivity.js.map +0 -1
- package/build-module/heading/heading-level-icon.js +0 -53
- package/build-module/heading/heading-level-icon.js.map +0 -1
- package/build-module/image/interactivity.js.map +0 -1
- package/build-module/navigation/interactivity.js +0 -164
- package/build-module/navigation/interactivity.js.map +0 -1
- package/build-module/navigation/view-modal.js +0 -58
- package/build-module/navigation/view-modal.js.map +0 -1
- package/build-module/utils/interactivity/constants.js +0 -2
- package/build-module/utils/interactivity/constants.js.map +0 -1
- package/build-module/utils/interactivity/directives.js +0 -209
- package/build-module/utils/interactivity/directives.js.map +0 -1
- package/build-module/utils/interactivity/hooks.js +0 -145
- package/build-module/utils/interactivity/hooks.js.map +0 -1
- package/build-module/utils/interactivity/hydration.js +0 -21
- package/build-module/utils/interactivity/hydration.js.map +0 -1
- package/build-module/utils/interactivity/index.js +0 -15
- package/build-module/utils/interactivity/index.js.map +0 -1
- package/build-module/utils/interactivity/portals.js +0 -100
- package/build-module/utils/interactivity/portals.js.map +0 -1
- package/build-module/utils/interactivity/store.js +0 -55
- package/build-module/utils/interactivity/store.js.map +0 -1
- package/build-module/utils/interactivity/utils.js +0 -75
- package/build-module/utils/interactivity/utils.js.map +0 -1
- package/build-module/utils/interactivity/vdom.js +0 -107
- package/build-module/utils/interactivity/vdom.js.map +0 -1
- package/src/file/interactivity.js +0 -15
- package/src/heading/heading-level-icon.js +0 -48
- package/src/navigation/interactivity.js +0 -169
- package/src/navigation/view-modal.js +0 -78
- package/src/utils/interactivity/constants.js +0 -1
- package/src/utils/interactivity/directives.js +0 -200
- package/src/utils/interactivity/hooks.js +0 -145
- package/src/utils/interactivity/hydration.js +0 -22
- package/src/utils/interactivity/index.js +0 -15
- package/src/utils/interactivity/portals.js +0 -98
- package/src/utils/interactivity/store.js +0 -45
- package/src/utils/interactivity/utils.js +0 -66
- package/src/utils/interactivity/vdom.js +0 -111
|
@@ -8,100 +8,226 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
id: {
|
|
59
|
-
type: 'number'
|
|
60
|
-
},
|
|
61
|
-
width: {
|
|
62
|
-
type: 'number'
|
|
63
|
-
},
|
|
64
|
-
height: {
|
|
65
|
-
type: 'number'
|
|
66
|
-
},
|
|
67
|
-
sizeSlug: {
|
|
68
|
-
type: 'string'
|
|
69
|
-
},
|
|
70
|
-
linkDestination: {
|
|
71
|
-
type: 'string'
|
|
11
|
+
import { RichText, useBlockProps, __experimentalGetElementClassName as getBorderClassesAndStyles } from '@wordpress/block-editor';
|
|
12
|
+
/**
|
|
13
|
+
* Deprecation for adding the `wp-image-${id}` class to the image block for
|
|
14
|
+
* responsive images.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/WordPress/gutenberg/pull/4898
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const v1 = {
|
|
20
|
+
attributes: {
|
|
21
|
+
url: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
source: 'attribute',
|
|
24
|
+
selector: 'img',
|
|
25
|
+
attribute: 'src'
|
|
26
|
+
},
|
|
27
|
+
alt: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
source: 'attribute',
|
|
30
|
+
selector: 'img',
|
|
31
|
+
attribute: 'alt',
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
caption: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
source: 'children',
|
|
37
|
+
selector: 'figcaption'
|
|
38
|
+
},
|
|
39
|
+
href: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
source: 'attribute',
|
|
42
|
+
selector: 'a',
|
|
43
|
+
attribute: 'href'
|
|
44
|
+
},
|
|
45
|
+
id: {
|
|
46
|
+
type: 'number'
|
|
47
|
+
},
|
|
48
|
+
align: {
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
width: {
|
|
52
|
+
type: 'number'
|
|
53
|
+
},
|
|
54
|
+
height: {
|
|
55
|
+
type: 'number'
|
|
56
|
+
}
|
|
72
57
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
|
|
59
|
+
save({
|
|
60
|
+
attributes
|
|
61
|
+
}) {
|
|
62
|
+
const {
|
|
63
|
+
url,
|
|
64
|
+
alt,
|
|
65
|
+
caption,
|
|
66
|
+
align,
|
|
67
|
+
href,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
} = attributes;
|
|
71
|
+
const extraImageProps = width || height ? {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
} : {};
|
|
75
|
+
const image = createElement("img", {
|
|
76
|
+
src: url,
|
|
77
|
+
alt: alt,
|
|
78
|
+
...extraImageProps
|
|
79
|
+
});
|
|
80
|
+
let figureStyle = {};
|
|
81
|
+
|
|
82
|
+
if (width) {
|
|
83
|
+
figureStyle = {
|
|
84
|
+
width
|
|
85
|
+
};
|
|
86
|
+
} else if (align === 'left' || align === 'right') {
|
|
87
|
+
figureStyle = {
|
|
88
|
+
maxWidth: '50%'
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return createElement("figure", {
|
|
93
|
+
className: align ? `align${align}` : null,
|
|
94
|
+
style: figureStyle
|
|
95
|
+
}, href ? createElement("a", {
|
|
96
|
+
href: href
|
|
97
|
+
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
98
|
+
tagName: "figcaption",
|
|
99
|
+
value: caption
|
|
100
|
+
}));
|
|
78
101
|
}
|
|
102
|
+
|
|
79
103
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Deprecation for adding the `is-resized` class to the image block to fix
|
|
106
|
+
* captions on resized images.
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/WordPress/gutenberg/pull/6496
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
const v2 = {
|
|
112
|
+
attributes: {
|
|
113
|
+
url: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
source: 'attribute',
|
|
116
|
+
selector: 'img',
|
|
117
|
+
attribute: 'src'
|
|
118
|
+
},
|
|
119
|
+
alt: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
source: 'attribute',
|
|
122
|
+
selector: 'img',
|
|
123
|
+
attribute: 'alt',
|
|
124
|
+
default: ''
|
|
125
|
+
},
|
|
126
|
+
caption: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
source: 'children',
|
|
129
|
+
selector: 'figcaption'
|
|
130
|
+
},
|
|
131
|
+
href: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
source: 'attribute',
|
|
134
|
+
selector: 'a',
|
|
135
|
+
attribute: 'href'
|
|
136
|
+
},
|
|
137
|
+
id: {
|
|
138
|
+
type: 'number'
|
|
139
|
+
},
|
|
140
|
+
align: {
|
|
141
|
+
type: 'string'
|
|
142
|
+
},
|
|
143
|
+
width: {
|
|
144
|
+
type: 'number'
|
|
145
|
+
},
|
|
146
|
+
height: {
|
|
147
|
+
type: 'number'
|
|
91
148
|
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
save({
|
|
152
|
+
attributes
|
|
153
|
+
}) {
|
|
154
|
+
const {
|
|
155
|
+
url,
|
|
156
|
+
alt,
|
|
157
|
+
caption,
|
|
158
|
+
align,
|
|
159
|
+
href,
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
id
|
|
163
|
+
} = attributes;
|
|
164
|
+
const image = createElement("img", {
|
|
165
|
+
src: url,
|
|
166
|
+
alt: alt,
|
|
167
|
+
className: id ? `wp-image-${id}` : null,
|
|
168
|
+
width: width,
|
|
169
|
+
height: height
|
|
170
|
+
});
|
|
171
|
+
return createElement("figure", {
|
|
172
|
+
className: align ? `align${align}` : null
|
|
173
|
+
}, href ? createElement("a", {
|
|
174
|
+
href: href
|
|
175
|
+
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
176
|
+
tagName: "figcaption",
|
|
177
|
+
value: caption
|
|
178
|
+
}));
|
|
92
179
|
}
|
|
180
|
+
|
|
93
181
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Deprecation for image floats including a wrapping div.
|
|
184
|
+
*
|
|
185
|
+
* @see https://github.com/WordPress/gutenberg/pull/7721
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
const v3 = {
|
|
189
|
+
attributes: {
|
|
190
|
+
url: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
source: 'attribute',
|
|
193
|
+
selector: 'img',
|
|
194
|
+
attribute: 'src'
|
|
195
|
+
},
|
|
196
|
+
alt: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
source: 'attribute',
|
|
199
|
+
selector: 'img',
|
|
200
|
+
attribute: 'alt',
|
|
201
|
+
default: ''
|
|
202
|
+
},
|
|
203
|
+
caption: {
|
|
204
|
+
type: 'array',
|
|
205
|
+
source: 'children',
|
|
206
|
+
selector: 'figcaption'
|
|
207
|
+
},
|
|
208
|
+
href: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
source: 'attribute',
|
|
211
|
+
selector: 'figure > a',
|
|
212
|
+
attribute: 'href'
|
|
213
|
+
},
|
|
214
|
+
id: {
|
|
215
|
+
type: 'number'
|
|
216
|
+
},
|
|
217
|
+
align: {
|
|
218
|
+
type: 'string'
|
|
219
|
+
},
|
|
220
|
+
width: {
|
|
221
|
+
type: 'number'
|
|
222
|
+
},
|
|
223
|
+
height: {
|
|
224
|
+
type: 'number'
|
|
225
|
+
},
|
|
226
|
+
linkDestination: {
|
|
227
|
+
type: 'string',
|
|
228
|
+
default: 'none'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
105
231
|
|
|
106
232
|
save({
|
|
107
233
|
attributes
|
|
@@ -112,19 +238,12 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
112
238
|
caption,
|
|
113
239
|
align,
|
|
114
240
|
href,
|
|
115
|
-
rel,
|
|
116
|
-
linkClass,
|
|
117
241
|
width,
|
|
118
242
|
height,
|
|
119
|
-
id
|
|
120
|
-
linkTarget,
|
|
121
|
-
sizeSlug,
|
|
122
|
-
title
|
|
243
|
+
id
|
|
123
244
|
} = attributes;
|
|
124
|
-
const newRel = !rel ? undefined : rel;
|
|
125
245
|
const classes = classnames({
|
|
126
246
|
[`align${align}`]: align,
|
|
127
|
-
[`size-${sizeSlug}`]: sizeSlug,
|
|
128
247
|
'is-resized': width || height
|
|
129
248
|
});
|
|
130
249
|
const image = createElement("img", {
|
|
@@ -132,37 +251,97 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
132
251
|
alt: alt,
|
|
133
252
|
className: id ? `wp-image-${id}` : null,
|
|
134
253
|
width: width,
|
|
135
|
-
height: height
|
|
136
|
-
title: title
|
|
254
|
+
height: height
|
|
137
255
|
});
|
|
138
|
-
|
|
139
|
-
className:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
rel: newRel
|
|
256
|
+
return createElement("figure", {
|
|
257
|
+
className: classes
|
|
258
|
+
}, href ? createElement("a", {
|
|
259
|
+
href: href
|
|
143
260
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
144
261
|
tagName: "figcaption",
|
|
145
262
|
value: caption
|
|
146
263
|
}));
|
|
147
|
-
return createElement("figure", { ...useBlockProps.save({
|
|
148
|
-
className: classes
|
|
149
|
-
})
|
|
150
|
-
}, figure);
|
|
151
264
|
}
|
|
152
265
|
|
|
153
|
-
}
|
|
154
|
-
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Deprecation for removing the outer div wrapper around aligned images.
|
|
269
|
+
*
|
|
270
|
+
* @see https://github.com/WordPress/gutenberg/pull/38657
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
const v4 = {
|
|
274
|
+
attributes: {
|
|
275
|
+
align: {
|
|
276
|
+
type: 'string'
|
|
277
|
+
},
|
|
278
|
+
url: {
|
|
279
|
+
type: 'string',
|
|
280
|
+
source: 'attribute',
|
|
281
|
+
selector: 'img',
|
|
282
|
+
attribute: 'src'
|
|
283
|
+
},
|
|
284
|
+
alt: {
|
|
285
|
+
type: 'string',
|
|
286
|
+
source: 'attribute',
|
|
287
|
+
selector: 'img',
|
|
288
|
+
attribute: 'alt',
|
|
289
|
+
default: ''
|
|
290
|
+
},
|
|
291
|
+
caption: {
|
|
292
|
+
type: 'string',
|
|
293
|
+
source: 'html',
|
|
294
|
+
selector: 'figcaption'
|
|
295
|
+
},
|
|
155
296
|
title: {
|
|
156
297
|
type: 'string',
|
|
157
298
|
source: 'attribute',
|
|
158
299
|
selector: 'img',
|
|
159
300
|
attribute: 'title'
|
|
160
301
|
},
|
|
302
|
+
href: {
|
|
303
|
+
type: 'string',
|
|
304
|
+
source: 'attribute',
|
|
305
|
+
selector: 'figure > a',
|
|
306
|
+
attribute: 'href'
|
|
307
|
+
},
|
|
308
|
+
rel: {
|
|
309
|
+
type: 'string',
|
|
310
|
+
source: 'attribute',
|
|
311
|
+
selector: 'figure > a',
|
|
312
|
+
attribute: 'rel'
|
|
313
|
+
},
|
|
314
|
+
linkClass: {
|
|
315
|
+
type: 'string',
|
|
316
|
+
source: 'attribute',
|
|
317
|
+
selector: 'figure > a',
|
|
318
|
+
attribute: 'class'
|
|
319
|
+
},
|
|
320
|
+
id: {
|
|
321
|
+
type: 'number'
|
|
322
|
+
},
|
|
323
|
+
width: {
|
|
324
|
+
type: 'number'
|
|
325
|
+
},
|
|
326
|
+
height: {
|
|
327
|
+
type: 'number'
|
|
328
|
+
},
|
|
161
329
|
sizeSlug: {
|
|
162
330
|
type: 'string'
|
|
331
|
+
},
|
|
332
|
+
linkDestination: {
|
|
333
|
+
type: 'string'
|
|
334
|
+
},
|
|
335
|
+
linkTarget: {
|
|
336
|
+
type: 'string',
|
|
337
|
+
source: 'attribute',
|
|
338
|
+
selector: 'figure > a',
|
|
339
|
+
attribute: 'target'
|
|
163
340
|
}
|
|
164
341
|
},
|
|
165
|
-
supports:
|
|
342
|
+
supports: {
|
|
343
|
+
anchor: true
|
|
344
|
+
},
|
|
166
345
|
|
|
167
346
|
save({
|
|
168
347
|
attributes
|
|
@@ -219,8 +398,106 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
219
398
|
}, figure);
|
|
220
399
|
}
|
|
221
400
|
|
|
222
|
-
}
|
|
223
|
-
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Deprecation for moving existing border radius styles onto the inner img
|
|
404
|
+
* element where new border block support styles must be applied.
|
|
405
|
+
* It will also add a new `.has-custom-border` class for existing blocks
|
|
406
|
+
* with border radii set. This class is required to improve caption position
|
|
407
|
+
* and styling when an image within a gallery has a custom border or
|
|
408
|
+
* rounded corners.
|
|
409
|
+
*
|
|
410
|
+
* @see https://github.com/WordPress/gutenberg/pull/31366
|
|
411
|
+
*/
|
|
412
|
+
|
|
413
|
+
const v5 = {
|
|
414
|
+
attributes: {
|
|
415
|
+
align: {
|
|
416
|
+
type: 'string'
|
|
417
|
+
},
|
|
418
|
+
url: {
|
|
419
|
+
type: 'string',
|
|
420
|
+
source: 'attribute',
|
|
421
|
+
selector: 'img',
|
|
422
|
+
attribute: 'src'
|
|
423
|
+
},
|
|
424
|
+
alt: {
|
|
425
|
+
type: 'string',
|
|
426
|
+
source: 'attribute',
|
|
427
|
+
selector: 'img',
|
|
428
|
+
attribute: 'alt',
|
|
429
|
+
default: ''
|
|
430
|
+
},
|
|
431
|
+
caption: {
|
|
432
|
+
type: 'string',
|
|
433
|
+
source: 'html',
|
|
434
|
+
selector: 'figcaption'
|
|
435
|
+
},
|
|
436
|
+
title: {
|
|
437
|
+
type: 'string',
|
|
438
|
+
source: 'attribute',
|
|
439
|
+
selector: 'img',
|
|
440
|
+
attribute: 'title'
|
|
441
|
+
},
|
|
442
|
+
href: {
|
|
443
|
+
type: 'string',
|
|
444
|
+
source: 'attribute',
|
|
445
|
+
selector: 'figure > a',
|
|
446
|
+
attribute: 'href'
|
|
447
|
+
},
|
|
448
|
+
rel: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
source: 'attribute',
|
|
451
|
+
selector: 'figure > a',
|
|
452
|
+
attribute: 'rel'
|
|
453
|
+
},
|
|
454
|
+
linkClass: {
|
|
455
|
+
type: 'string',
|
|
456
|
+
source: 'attribute',
|
|
457
|
+
selector: 'figure > a',
|
|
458
|
+
attribute: 'class'
|
|
459
|
+
},
|
|
460
|
+
id: {
|
|
461
|
+
type: 'number'
|
|
462
|
+
},
|
|
463
|
+
width: {
|
|
464
|
+
type: 'number'
|
|
465
|
+
},
|
|
466
|
+
height: {
|
|
467
|
+
type: 'number'
|
|
468
|
+
},
|
|
469
|
+
sizeSlug: {
|
|
470
|
+
type: 'string'
|
|
471
|
+
},
|
|
472
|
+
linkDestination: {
|
|
473
|
+
type: 'string'
|
|
474
|
+
},
|
|
475
|
+
linkTarget: {
|
|
476
|
+
type: 'string',
|
|
477
|
+
source: 'attribute',
|
|
478
|
+
selector: 'figure > a',
|
|
479
|
+
attribute: 'target'
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
supports: {
|
|
483
|
+
anchor: true,
|
|
484
|
+
color: {
|
|
485
|
+
__experimentalDuotone: 'img',
|
|
486
|
+
text: false,
|
|
487
|
+
background: false
|
|
488
|
+
},
|
|
489
|
+
__experimentalBorder: {
|
|
490
|
+
radius: true,
|
|
491
|
+
__experimentalDefaultControls: {
|
|
492
|
+
radius: true
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
__experimentalStyle: {
|
|
496
|
+
spacing: {
|
|
497
|
+
margin: '0 0 1em 0'
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
224
501
|
|
|
225
502
|
save({
|
|
226
503
|
attributes
|
|
@@ -231,12 +508,19 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
231
508
|
caption,
|
|
232
509
|
align,
|
|
233
510
|
href,
|
|
511
|
+
rel,
|
|
512
|
+
linkClass,
|
|
234
513
|
width,
|
|
235
514
|
height,
|
|
236
|
-
id
|
|
515
|
+
id,
|
|
516
|
+
linkTarget,
|
|
517
|
+
sizeSlug,
|
|
518
|
+
title
|
|
237
519
|
} = attributes;
|
|
520
|
+
const newRel = !rel ? undefined : rel;
|
|
238
521
|
const classes = classnames({
|
|
239
522
|
[`align${align}`]: align,
|
|
523
|
+
[`size-${sizeSlug}`]: sizeSlug,
|
|
240
524
|
'is-resized': width || height
|
|
241
525
|
});
|
|
242
526
|
const image = createElement("img", {
|
|
@@ -244,21 +528,33 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
244
528
|
alt: alt,
|
|
245
529
|
className: id ? `wp-image-${id}` : null,
|
|
246
530
|
width: width,
|
|
247
|
-
height: height
|
|
531
|
+
height: height,
|
|
532
|
+
title: title
|
|
248
533
|
});
|
|
249
|
-
|
|
250
|
-
className:
|
|
251
|
-
|
|
252
|
-
|
|
534
|
+
const figure = createElement(Fragment, null, href ? createElement("a", {
|
|
535
|
+
className: linkClass,
|
|
536
|
+
href: href,
|
|
537
|
+
target: linkTarget,
|
|
538
|
+
rel: newRel
|
|
253
539
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
254
540
|
tagName: "figcaption",
|
|
255
541
|
value: caption
|
|
256
542
|
}));
|
|
543
|
+
return createElement("figure", { ...useBlockProps.save({
|
|
544
|
+
className: classes
|
|
545
|
+
})
|
|
546
|
+
}, figure);
|
|
257
547
|
}
|
|
258
548
|
|
|
259
|
-
}
|
|
260
|
-
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* Deprecation for adding width and height as style rules on the inner img.
|
|
552
|
+
* It also updates the widht and height attributes to be strings instead of numbers.
|
|
553
|
+
*
|
|
554
|
+
* @see https://github.com/WordPress/gutenberg/pull/31366
|
|
555
|
+
*/
|
|
261
556
|
|
|
557
|
+
const v6 = {
|
|
262
558
|
save({
|
|
263
559
|
attributes
|
|
264
560
|
}) {
|
|
@@ -268,74 +564,56 @@ const deprecated = [// The following deprecation moves existing border radius st
|
|
|
268
564
|
caption,
|
|
269
565
|
align,
|
|
270
566
|
href,
|
|
567
|
+
rel,
|
|
568
|
+
linkClass,
|
|
271
569
|
width,
|
|
272
570
|
height,
|
|
273
|
-
|
|
571
|
+
aspectRatio,
|
|
572
|
+
scale,
|
|
573
|
+
id,
|
|
574
|
+
linkTarget,
|
|
575
|
+
sizeSlug,
|
|
576
|
+
title
|
|
274
577
|
} = attributes;
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
578
|
+
const newRel = !rel ? undefined : rel;
|
|
579
|
+
const borderProps = getBorderClassesAndStyles(attributes);
|
|
580
|
+
const classes = classnames({
|
|
581
|
+
[`align${align}`]: align,
|
|
582
|
+
[`size-${sizeSlug}`]: sizeSlug,
|
|
583
|
+
'is-resized': width || height,
|
|
584
|
+
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
|
|
585
|
+
});
|
|
586
|
+
const imageClasses = classnames(borderProps.className, {
|
|
587
|
+
[`wp-image-${id}`]: !!id
|
|
281
588
|
});
|
|
282
|
-
return createElement("figure", {
|
|
283
|
-
className: align ? `align${align}` : null
|
|
284
|
-
}, href ? createElement("a", {
|
|
285
|
-
href: href
|
|
286
|
-
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
287
|
-
tagName: "figcaption",
|
|
288
|
-
value: caption
|
|
289
|
-
}));
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
}, {
|
|
293
|
-
attributes: blockAttributes,
|
|
294
|
-
|
|
295
|
-
save({
|
|
296
|
-
attributes
|
|
297
|
-
}) {
|
|
298
|
-
const {
|
|
299
|
-
url,
|
|
300
|
-
alt,
|
|
301
|
-
caption,
|
|
302
|
-
align,
|
|
303
|
-
href,
|
|
304
|
-
width,
|
|
305
|
-
height
|
|
306
|
-
} = attributes;
|
|
307
|
-
const extraImageProps = width || height ? {
|
|
308
|
-
width,
|
|
309
|
-
height
|
|
310
|
-
} : {};
|
|
311
589
|
const image = createElement("img", {
|
|
312
590
|
src: url,
|
|
313
591
|
alt: alt,
|
|
314
|
-
|
|
592
|
+
className: imageClasses || undefined,
|
|
593
|
+
style: { ...borderProps.style,
|
|
594
|
+
aspectRatio,
|
|
595
|
+
objectFit: scale
|
|
596
|
+
},
|
|
597
|
+
width: width,
|
|
598
|
+
height: height,
|
|
599
|
+
title: title
|
|
315
600
|
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
};
|
|
322
|
-
} else if (align === 'left' || align === 'right') {
|
|
323
|
-
figureStyle = {
|
|
324
|
-
maxWidth: '50%'
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return createElement("figure", {
|
|
329
|
-
className: align ? `align${align}` : null,
|
|
330
|
-
style: figureStyle
|
|
331
|
-
}, href ? createElement("a", {
|
|
332
|
-
href: href
|
|
601
|
+
const figure = createElement(Fragment, null, href ? createElement("a", {
|
|
602
|
+
className: linkClass,
|
|
603
|
+
href: href,
|
|
604
|
+
target: linkTarget,
|
|
605
|
+
rel: newRel
|
|
333
606
|
}, image) : image, !RichText.isEmpty(caption) && createElement(RichText.Content, {
|
|
607
|
+
className: getBorderClassesAndStyles('caption'),
|
|
334
608
|
tagName: "figcaption",
|
|
335
609
|
value: caption
|
|
336
610
|
}));
|
|
611
|
+
return createElement("figure", { ...useBlockProps.save({
|
|
612
|
+
className: classes
|
|
613
|
+
})
|
|
614
|
+
}, figure);
|
|
337
615
|
}
|
|
338
616
|
|
|
339
|
-
}
|
|
340
|
-
export default
|
|
617
|
+
};
|
|
618
|
+
export default [v6, v5, v4, v3, v2, v1];
|
|
341
619
|
//# sourceMappingURL=deprecated.js.map
|