@wordpress/block-library 7.1.1 → 7.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/CHANGELOG.md +11 -0
- package/build/avatar/edit.js +205 -0
- package/build/avatar/edit.js.map +1 -0
- package/build/avatar/hooks.js +111 -0
- package/build/avatar/hooks.js.map +1 -0
- package/build/avatar/index.js +83 -0
- package/build/avatar/index.js.map +1 -0
- package/build/avatar/user-control.js +63 -0
- package/build/avatar/user-control.js.map +1 -0
- package/build/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-date/edit.js +10 -25
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-template/edit.js +79 -52
- package/build/comment-template/edit.js.map +1 -1
- package/build/cover/edit.js +23 -33
- package/build/cover/edit.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/edit.js +18 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +29 -0
- package/build/gallery/gap-styles.js.map +1 -0
- package/build/gallery/index.js +17 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +3 -1
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +1 -2
- package/build/group/variations.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/list/index.js +5 -7
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js +85 -0
- package/build/list/v2/edit.js.map +1 -0
- package/build/list/v2/index.js +33 -0
- package/build/list/v2/index.js.map +1 -0
- package/build/list/v2/save.js +34 -0
- package/build/list/v2/save.js.map +1 -0
- package/build/list/v2/transforms.js +121 -0
- package/build/list/v2/transforms.js.map +1 -0
- package/build/list-item/edit.js +47 -0
- package/build/list-item/edit.js.map +1 -0
- package/build/list-item/index.js +67 -0
- package/build/list-item/index.js.map +1 -0
- package/build/list-item/save.js +23 -0
- package/build/list-item/save.js.map +1 -0
- package/build/media-text/edit.js +3 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +26 -54
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation-link/edit.js +88 -34
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-date/edit.js +31 -37
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/pullquote/edit.js +5 -3
- package/build/pullquote/edit.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-no-results/edit.js +28 -0
- package/build/query-no-results/edit.js.map +1 -0
- package/build/query-no-results/index.js +54 -0
- package/build/query-no-results/index.js.map +1 -0
- package/build/query-no-results/save.js +18 -0
- package/build/query-no-results/save.js.map +1 -0
- package/build/search/edit.js +2 -3
- package/build/search/edit.js.map +1 -1
- package/build/separator/deprecated.js +83 -0
- package/build/separator/deprecated.js.map +1 -0
- package/build/separator/edit.js +31 -23
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +17 -7
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +18 -13
- package/build/separator/save.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js +39 -0
- package/build/separator/use-deprecated-opacity.js.map +1 -0
- package/build/social-links/edit.js +14 -3
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +1 -1
- package/build/spacer/controls.js +6 -16
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +3 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +4 -5
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/tag-cloud/edit.js +58 -2
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build-module/avatar/edit.js +190 -0
- package/build-module/avatar/edit.js.map +1 -0
- package/build-module/avatar/hooks.js +99 -0
- package/build-module/avatar/hooks.js.map +1 -0
- package/build-module/avatar/index.js +70 -0
- package/build-module/avatar/index.js.map +1 -0
- package/build-module/avatar/user-control.js +52 -0
- package/build-module/avatar/user-control.js.map +1 -0
- package/build-module/column/index.js +2 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-date/edit.js +13 -30
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +79 -52
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/cover/edit.js +23 -34
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/edit.js +17 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +22 -0
- package/build-module/gallery/gap-styles.js.map +1 -0
- package/build-module/gallery/index.js +17 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +3 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +1 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +5 -2
- 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/v2/edit.js +69 -0
- package/build-module/list/v2/edit.js.map +1 -0
- package/build-module/list/v2/index.js +19 -0
- package/build-module/list/v2/index.js.map +1 -0
- package/build-module/list/v2/save.js +23 -0
- package/build-module/list/v2/save.js.map +1 -0
- package/build-module/list/v2/transforms.js +111 -0
- package/build-module/list/v2/transforms.js.map +1 -0
- package/build-module/list-item/edit.js +37 -0
- package/build-module/list-item/edit.js.map +1 -0
- package/build-module/list-item/index.js +53 -0
- package/build-module/list-item/index.js.map +1 -0
- package/build-module/list-item/save.js +15 -0
- package/build-module/list-item/save.js.map +1 -0
- package/build-module/media-text/edit.js +3 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +27 -54
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation-link/edit.js +88 -33
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-date/edit.js +32 -43
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/pullquote/edit.js +6 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-no-results/edit.js +18 -0
- package/build-module/query-no-results/edit.js.map +1 -0
- package/build-module/query-no-results/index.js +40 -0
- package/build-module/query-no-results/index.js.map +1 -0
- package/build-module/query-no-results/save.js +10 -0
- package/build-module/query-no-results/save.js.map +1 -0
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/deprecated.js +70 -0
- package/build-module/separator/deprecated.js.map +1 -0
- package/build-module/separator/edit.js +31 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +16 -7
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +19 -14
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js +30 -0
- package/build-module/separator/use-deprecated-opacity.js.map +1 -0
- package/build-module/social-links/edit.js +15 -4
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +1 -1
- package/build-module/spacer/controls.js +8 -19
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +2 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +3 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/tag-cloud/edit.js +60 -4
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +79 -0
- package/build-style/avatar/editor.css +79 -0
- package/build-style/editor-rtl.css +23 -2
- package/build-style/editor.css +23 -2
- package/build-style/gallery/editor-rtl.css +0 -1
- package/build-style/gallery/editor.css +0 -1
- package/build-style/gallery/style-rtl.css +102 -169
- package/build-style/gallery/style.css +102 -169
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation-link/editor-rtl.css +13 -0
- package/build-style/navigation-link/editor.css +13 -0
- package/build-style/pullquote/style-rtl.css +0 -4
- package/build-style/pullquote/style.css +0 -4
- package/build-style/separator/editor-rtl.css +3 -0
- package/build-style/separator/editor.css +3 -0
- package/build-style/separator/theme-rtl.css +7 -1
- package/build-style/separator/theme.css +7 -1
- package/build-style/site-logo/editor-rtl.css +3 -1
- package/build-style/site-logo/editor.css +3 -1
- package/build-style/style-rtl.css +104 -173
- package/build-style/style.css +104 -173
- package/build-style/theme-rtl.css +7 -1
- package/build-style/theme.css +7 -1
- package/package.json +28 -28
- package/src/avatar/block.json +53 -0
- package/src/avatar/edit.js +222 -0
- package/src/avatar/editor.scss +3 -0
- package/src/avatar/hooks.js +96 -0
- package/src/avatar/index.js +18 -0
- package/src/avatar/index.php +146 -0
- package/src/avatar/user-control.js +56 -0
- package/src/column/block.json +2 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-date/edit.js +20 -30
- package/src/comment-template/edit.js +65 -44
- package/src/cover/edit.js +26 -31
- package/src/editor.scss +1 -0
- package/src/embed/variations.js +2 -2
- package/src/gallery/block.json +17 -1
- package/src/gallery/deprecated.scss +2 -2
- package/src/gallery/edit.js +15 -8
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +8 -7
- package/src/gallery/gap-styles.js +21 -0
- package/src/gallery/index.php +42 -1
- package/src/gallery/style.scss +11 -44
- package/src/group/block.json +3 -1
- package/src/group/variations.js +1 -1
- package/src/image/image.js +4 -1
- package/src/image/style.scss +3 -0
- package/src/index.js +6 -1
- package/src/list/index.js +6 -1
- package/src/list/v2/edit.js +77 -0
- package/src/list/v2/index.js +20 -0
- package/src/list/v2/save.js +18 -0
- package/src/list/v2/transforms.js +116 -0
- package/src/list-item/block.json +26 -0
- package/src/list-item/edit.js +47 -0
- package/src/list-item/index.js +27 -0
- package/src/list-item/save.js +13 -0
- package/src/media-text/edit.js +1 -1
- package/src/navigation/index.php +22 -2
- package/src/navigation/use-navigation-entities.js +37 -73
- package/src/navigation-link/edit.js +145 -61
- package/src/navigation-link/editor.scss +11 -0
- package/src/post-date/edit.js +63 -52
- package/src/post-date/index.php +1 -1
- package/src/post-date/test/edit.js +17 -0
- package/src/post-featured-image/edit.js +9 -1
- package/src/post-featured-image/index.php +2 -1
- package/src/pullquote/edit.js +4 -3
- package/src/pullquote/style.scss +0 -5
- package/src/query/variations.js +4 -0
- package/src/query-no-results/block.json +20 -0
- package/src/query-no-results/edit.js +28 -0
- package/src/query-no-results/index.js +20 -0
- package/src/query-no-results/index.php +59 -0
- package/src/query-no-results/save.js +8 -0
- package/src/search/edit.js +1 -2
- package/src/separator/block.json +13 -6
- package/src/separator/deprecated.js +57 -0
- package/src/separator/deprecated.scss +6 -0
- package/src/separator/edit.js +36 -14
- package/src/separator/editor.scss +6 -0
- package/src/separator/index.js +2 -0
- package/src/separator/save.js +22 -14
- package/src/separator/test/edit.js +113 -0
- package/src/separator/theme.scss +7 -1
- package/src/separator/use-deprecated-opacity.js +41 -0
- package/src/site-logo/editor.scss +3 -1
- package/src/social-links/block.json +1 -1
- package/src/social-links/edit.js +15 -5
- package/src/spacer/controls.js +12 -18
- package/src/spacer/controls.native.js +2 -1
- package/src/spacer/edit.js +3 -6
- package/src/table/deprecated.js +5 -1
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +82 -2
- package/src/tag-cloud/index.php +6 -0
- package/build/separator/separator-settings.js +0 -36
- package/build/separator/separator-settings.js.map +0 -1
- package/build-module/separator/separator-settings.js +0 -27
- package/build-module/separator/separator-settings.js.map +0 -1
- package/src/separator/separator-settings.js +0 -24
package/src/gallery/style.scss
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
// Import styles for rendering the static content of deprecated gallery versions.
|
|
2
2
|
@import "./deprecated.scss";
|
|
3
3
|
|
|
4
|
+
// The following is a temporary override until flex layout supports
|
|
5
|
+
// an align items setting of normal.
|
|
6
|
+
figure.wp-block-gallery.has-nested-images {
|
|
7
|
+
align-items: normal;
|
|
8
|
+
}
|
|
4
9
|
// Styles for current version of gallery block.
|
|
5
10
|
.wp-block-gallery.has-nested-images {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-wrap: wrap;
|
|
8
11
|
// Need bogus :not(#individual-image) to override long :not()
|
|
9
12
|
// specificity chain on default image block on front end.
|
|
10
13
|
figure.wp-block-image:not(#individual-image) {
|
|
11
|
-
|
|
12
|
-
margin: 0
|
|
13
|
-
|
|
14
|
-
&:last-of-type:not(#individual-image) {
|
|
15
|
-
margin-right: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
width: calc(50% - (var(--gallery-block--gutter-size, #{$grid-unit-20}) / 2));
|
|
19
|
-
|
|
20
|
-
&:nth-of-type(even) {
|
|
21
|
-
margin-right: 0;
|
|
22
|
-
}
|
|
14
|
+
width: calc(50% - (var(--wp--style--unstable-gallery-gap, #{$grid-unit-20}) / 2));
|
|
15
|
+
margin: 0;
|
|
23
16
|
}
|
|
24
17
|
|
|
25
18
|
figure.wp-block-image {
|
|
@@ -27,8 +20,6 @@
|
|
|
27
20
|
flex-grow: 1;
|
|
28
21
|
justify-content: center;
|
|
29
22
|
position: relative;
|
|
30
|
-
margin-top: auto;
|
|
31
|
-
margin-bottom: auto;
|
|
32
23
|
flex-direction: column;
|
|
33
24
|
max-width: 100%;
|
|
34
25
|
|
|
@@ -96,17 +87,9 @@
|
|
|
96
87
|
|
|
97
88
|
// Non cropped images.
|
|
98
89
|
&:not(.is-cropped) {
|
|
99
|
-
|
|
100
90
|
figure.wp-block-image:not(#individual-image) {
|
|
101
91
|
margin-top: 0;
|
|
102
92
|
margin-bottom: auto;
|
|
103
|
-
img {
|
|
104
|
-
margin-bottom: var(--gallery-block--gutter-size, #{$grid-unit-20});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
figcaption {
|
|
108
|
-
bottom: var(--gallery-block--gutter-size, #{$grid-unit-20});
|
|
109
|
-
}
|
|
110
93
|
}
|
|
111
94
|
}
|
|
112
95
|
|
|
@@ -128,7 +111,6 @@
|
|
|
128
111
|
}
|
|
129
112
|
|
|
130
113
|
&.columns-1 figure.wp-block-image:not(#individual-image) {
|
|
131
|
-
margin-right: 0;
|
|
132
114
|
width: 100%;
|
|
133
115
|
}
|
|
134
116
|
|
|
@@ -136,35 +118,20 @@
|
|
|
136
118
|
@include break-small {
|
|
137
119
|
@for $i from 3 through 8 {
|
|
138
120
|
&.columns-#{ $i } figure.wp-block-image:not(#individual-image) {
|
|
139
|
-
|
|
140
|
-
width: calc(#{math.div(100%, $i)} - (var(--gallery-block--gutter-size, #{$grid-unit-20}) * #{math.div($i - 1, $i)}));
|
|
141
|
-
|
|
142
|
-
}
|
|
121
|
+
width: calc(#{math.div(100%, $i)} - (var(--wp--style--unstable-gallery-gap, #{$grid-unit-20}) * #{math.div($i - 1, $i)}));
|
|
143
122
|
|
|
144
|
-
// Prevent collapsing margin while sibling is being dragged.
|
|
145
|
-
&.columns-#{$i} figure.wp-block-image:not(#individual-image).is-dragging ~ figure.wp-block-image:not(#individual-image) {
|
|
146
|
-
margin-right: var(--gallery-block--gutter-size, #{$grid-unit-20});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Unset the right margin on every rightmost gallery item to ensure center balance.
|
|
150
|
-
@for $column-count from 1 through 8 {
|
|
151
|
-
&.columns-#{$column-count} figure.wp-block-image:not(#individual-image):nth-of-type(#{ $column-count }n) {
|
|
152
|
-
margin-right: 0;
|
|
153
123
|
}
|
|
154
124
|
}
|
|
155
125
|
// If number of columns not explicitly set default to 3 columns if 3 or more images.
|
|
156
126
|
&.columns-default {
|
|
157
127
|
figure.wp-block-image:not(#individual-image) {
|
|
158
|
-
|
|
159
|
-
width: calc(33.33% - (var(--gallery-
|
|
160
|
-
}
|
|
161
|
-
figure.wp-block-image:not(#individual-image):nth-of-type(3n+3) {
|
|
162
|
-
margin-right: 0;
|
|
128
|
+
|
|
129
|
+
width: calc(33.33% - (var(--wp--style--unstable-gallery-gap, 16px) * #{math.div(2, 3)}));
|
|
163
130
|
}
|
|
164
131
|
// If only 2 child images use 2 columns.
|
|
165
132
|
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2),
|
|
166
133
|
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(2) ~ figure.wp-block-image:not(#individual-image) {
|
|
167
|
-
width: calc(50% - (var(--gallery-
|
|
134
|
+
width: calc(50% - (var(--wp--style--unstable-gallery-gap, 16px) * 0.5));
|
|
168
135
|
}
|
|
169
136
|
// For a single image set to 100%.
|
|
170
137
|
figure.wp-block-image:not(#individual-image):first-child:nth-last-child(1) {
|
package/src/group/block.json
CHANGED
package/src/group/variations.js
CHANGED
|
@@ -18,7 +18,7 @@ const variations = [
|
|
|
18
18
|
name: 'group-row',
|
|
19
19
|
title: __( 'Row' ),
|
|
20
20
|
description: __( 'Blocks shown in a row.' ),
|
|
21
|
-
attributes: { layout: { type: 'flex'
|
|
21
|
+
attributes: { layout: { type: 'flex' } },
|
|
22
22
|
scope: [ 'inserter', 'transform' ],
|
|
23
23
|
isActive: ( blockAttributes ) =>
|
|
24
24
|
blockAttributes.layout?.type === 'flex',
|
package/src/image/image.js
CHANGED
|
@@ -95,7 +95,10 @@ export default function Image( {
|
|
|
95
95
|
);
|
|
96
96
|
const multiSelectedClientIds = getMultiSelectedBlockClientIds();
|
|
97
97
|
return {
|
|
98
|
-
image:
|
|
98
|
+
image:
|
|
99
|
+
id && isSelected
|
|
100
|
+
? getMedia( id, { context: 'view' } )
|
|
101
|
+
: null,
|
|
99
102
|
multiImageSelection:
|
|
100
103
|
multiSelectedClientIds.length &&
|
|
101
104
|
multiSelectedClientIds.every(
|
package/src/image/style.scss
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
margin: 0 0 1em 0;
|
|
3
3
|
|
|
4
4
|
img {
|
|
5
|
+
height: auto;
|
|
6
|
+
max-width: 100%;
|
|
5
7
|
vertical-align: bottom;
|
|
6
8
|
}
|
|
7
9
|
|
|
@@ -56,6 +58,7 @@
|
|
|
56
58
|
margin-bottom: 0.5em;
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
// This is needed for classic themes where the align class is not on the container.
|
|
59
62
|
.aligncenter {
|
|
60
63
|
margin-left: auto;
|
|
61
64
|
margin-right: auto;
|
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import * as archives from './archives';
|
|
16
|
+
import * as avatar from './avatar';
|
|
16
17
|
import * as audio from './audio';
|
|
17
18
|
import * as button from './button';
|
|
18
19
|
import * as buttons from './buttons';
|
|
@@ -46,6 +47,7 @@ import * as image from './image';
|
|
|
46
47
|
import * as latestComments from './latest-comments';
|
|
47
48
|
import * as latestPosts from './latest-posts';
|
|
48
49
|
import * as list from './list';
|
|
50
|
+
import * as listItem from './list-item';
|
|
49
51
|
import * as logInOut from './loginout';
|
|
50
52
|
import * as mediaText from './media-text';
|
|
51
53
|
import * as missing from './missing';
|
|
@@ -77,6 +79,7 @@ import * as postTitle from './post-title';
|
|
|
77
79
|
import * as preformatted from './preformatted';
|
|
78
80
|
import * as pullquote from './pullquote';
|
|
79
81
|
import * as query from './query';
|
|
82
|
+
import * as queryNoResults from './query-no-results';
|
|
80
83
|
import * as queryPagination from './query-pagination';
|
|
81
84
|
import * as queryPaginationNext from './query-pagination-next';
|
|
82
85
|
import * as queryPaginationNumbers from './query-pagination-numbers';
|
|
@@ -135,6 +138,7 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
135
138
|
heading,
|
|
136
139
|
gallery,
|
|
137
140
|
list,
|
|
141
|
+
listItem,
|
|
138
142
|
quote,
|
|
139
143
|
|
|
140
144
|
// Register all remaining core blocks.
|
|
@@ -248,9 +252,10 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
|
|
|
248
252
|
? ( { enableFSEBlocks } = {} ) => {
|
|
249
253
|
[
|
|
250
254
|
// Experimental blocks.
|
|
255
|
+
avatar,
|
|
251
256
|
homeLink,
|
|
252
257
|
postAuthorName,
|
|
253
|
-
|
|
258
|
+
queryNoResults,
|
|
254
259
|
// Full Site Editing blocks.
|
|
255
260
|
...( enableFSEBlocks
|
|
256
261
|
? [
|
package/src/list/index.js
CHANGED
|
@@ -11,12 +11,13 @@ import edit from './edit';
|
|
|
11
11
|
import metadata from './block.json';
|
|
12
12
|
import save from './save';
|
|
13
13
|
import transforms from './transforms';
|
|
14
|
+
import settingsV2 from './v2';
|
|
14
15
|
|
|
15
16
|
const { name } = metadata;
|
|
16
17
|
|
|
17
18
|
export { metadata, name };
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
const settingsV1 = {
|
|
20
21
|
icon,
|
|
21
22
|
example: {
|
|
22
23
|
attributes: {
|
|
@@ -41,3 +42,7 @@ export const settings = {
|
|
|
41
42
|
save,
|
|
42
43
|
deprecated,
|
|
43
44
|
};
|
|
45
|
+
|
|
46
|
+
export const settings = window?.__experimentalEnableListBlockV2
|
|
47
|
+
? settingsV2
|
|
48
|
+
: settingsV1;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
BlockControls,
|
|
6
|
+
useBlockProps,
|
|
7
|
+
useInnerBlocksProps,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { ToolbarButton } from '@wordpress/components';
|
|
10
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
|
+
import {
|
|
12
|
+
formatListBullets,
|
|
13
|
+
formatListBulletsRTL,
|
|
14
|
+
formatListNumbered,
|
|
15
|
+
formatListNumberedRTL,
|
|
16
|
+
} from '@wordpress/icons';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import OrderedListSettings from '../ordered-list-settings';
|
|
22
|
+
|
|
23
|
+
const TEMPLATE = [ [ 'core/list-item' ] ];
|
|
24
|
+
|
|
25
|
+
function Edit( { attributes, setAttributes } ) {
|
|
26
|
+
const blockProps = useBlockProps();
|
|
27
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
28
|
+
allowedBlocks: [ 'core/list-item' ],
|
|
29
|
+
template: TEMPLATE,
|
|
30
|
+
} );
|
|
31
|
+
const { ordered, reversed, start } = attributes;
|
|
32
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
33
|
+
|
|
34
|
+
const controls = (
|
|
35
|
+
<BlockControls group="block">
|
|
36
|
+
<ToolbarButton
|
|
37
|
+
icon={ isRTL() ? formatListBulletsRTL : formatListBullets }
|
|
38
|
+
title={ __( 'Unordered' ) }
|
|
39
|
+
describedBy={ __( 'Convert to unordered list' ) }
|
|
40
|
+
isActive={ ordered === false }
|
|
41
|
+
onClick={ () => {
|
|
42
|
+
setAttributes( { ordered: false } );
|
|
43
|
+
} }
|
|
44
|
+
/>
|
|
45
|
+
<ToolbarButton
|
|
46
|
+
icon={ isRTL() ? formatListNumberedRTL : formatListNumbered }
|
|
47
|
+
title={ __( 'Ordered' ) }
|
|
48
|
+
describedBy={ __( 'Convert to ordered list' ) }
|
|
49
|
+
isActive={ ordered === true }
|
|
50
|
+
onClick={ () => {
|
|
51
|
+
setAttributes( { ordered: true } );
|
|
52
|
+
} }
|
|
53
|
+
/>
|
|
54
|
+
</BlockControls>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<TagName
|
|
60
|
+
reversed={ reversed }
|
|
61
|
+
start={ start }
|
|
62
|
+
{ ...innerBlocksProps }
|
|
63
|
+
/>
|
|
64
|
+
{ controls }
|
|
65
|
+
{ ordered && (
|
|
66
|
+
<OrderedListSettings
|
|
67
|
+
setAttributes={ setAttributes }
|
|
68
|
+
ordered={ ordered }
|
|
69
|
+
reversed={ reversed }
|
|
70
|
+
start={ start }
|
|
71
|
+
/>
|
|
72
|
+
) }
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default Edit;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { list as icon } from '@wordpress/icons';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import edit from './edit';
|
|
10
|
+
import save from './save';
|
|
11
|
+
import transforms from './transforms';
|
|
12
|
+
|
|
13
|
+
const settings = {
|
|
14
|
+
icon,
|
|
15
|
+
edit,
|
|
16
|
+
save,
|
|
17
|
+
transforms,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default settings;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
export default function save( { attributes } ) {
|
|
7
|
+
const { ordered, reversed, start } = attributes;
|
|
8
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
9
|
+
return (
|
|
10
|
+
<TagName
|
|
11
|
+
reversed={ reversed }
|
|
12
|
+
start={ start }
|
|
13
|
+
{ ...useBlockProps.save() }
|
|
14
|
+
>
|
|
15
|
+
<InnerBlocks.Content />
|
|
16
|
+
</TagName>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock, switchToBlockType } from '@wordpress/blocks';
|
|
5
|
+
import {
|
|
6
|
+
__UNSTABLE_LINE_SEPARATOR,
|
|
7
|
+
create,
|
|
8
|
+
split,
|
|
9
|
+
toHTMLString,
|
|
10
|
+
} from '@wordpress/rich-text';
|
|
11
|
+
|
|
12
|
+
const transforms = {
|
|
13
|
+
from: [
|
|
14
|
+
{
|
|
15
|
+
type: 'block',
|
|
16
|
+
isMultiBlock: true,
|
|
17
|
+
blocks: [ 'core/paragraph', 'core/heading' ],
|
|
18
|
+
transform: ( blockAttributes ) => {
|
|
19
|
+
let childBlocks = [];
|
|
20
|
+
if ( blockAttributes.length > 1 ) {
|
|
21
|
+
childBlocks = blockAttributes.map( ( { content } ) => {
|
|
22
|
+
return createBlock( 'core/list-item', { content } );
|
|
23
|
+
} );
|
|
24
|
+
} else if ( blockAttributes.length === 1 ) {
|
|
25
|
+
const value = create( {
|
|
26
|
+
html: blockAttributes[ 0 ].content,
|
|
27
|
+
} );
|
|
28
|
+
childBlocks = split( value, '\n' ).map( ( result ) => {
|
|
29
|
+
return createBlock( 'core/list-item', {
|
|
30
|
+
content: toHTMLString( { value: result } ),
|
|
31
|
+
} );
|
|
32
|
+
} );
|
|
33
|
+
}
|
|
34
|
+
return createBlock(
|
|
35
|
+
'core/list',
|
|
36
|
+
{
|
|
37
|
+
anchor: blockAttributes.anchor,
|
|
38
|
+
},
|
|
39
|
+
childBlocks
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'block',
|
|
45
|
+
blocks: [ 'core/quote', 'core/pullquote' ],
|
|
46
|
+
transform: ( { value, anchor } ) => {
|
|
47
|
+
return createBlock(
|
|
48
|
+
'core/list',
|
|
49
|
+
{
|
|
50
|
+
anchor,
|
|
51
|
+
},
|
|
52
|
+
split(
|
|
53
|
+
create( { html: value, multilineTag: 'p' } ),
|
|
54
|
+
__UNSTABLE_LINE_SEPARATOR
|
|
55
|
+
).map( ( result ) => {
|
|
56
|
+
return createBlock( 'core/list-item', {
|
|
57
|
+
content: toHTMLString( { value: result } ),
|
|
58
|
+
} );
|
|
59
|
+
} )
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
...[ '*', '-' ].map( ( prefix ) => ( {
|
|
64
|
+
type: 'prefix',
|
|
65
|
+
prefix,
|
|
66
|
+
transform( content ) {
|
|
67
|
+
return createBlock( 'core/list', {}, [
|
|
68
|
+
createBlock( 'core/list-item', { content } ),
|
|
69
|
+
] );
|
|
70
|
+
},
|
|
71
|
+
} ) ),
|
|
72
|
+
...[ '1.', '1)' ].map( ( prefix ) => ( {
|
|
73
|
+
type: 'prefix',
|
|
74
|
+
prefix,
|
|
75
|
+
transform( content ) {
|
|
76
|
+
return createBlock(
|
|
77
|
+
'core/list',
|
|
78
|
+
{
|
|
79
|
+
ordered: true,
|
|
80
|
+
},
|
|
81
|
+
[ createBlock( 'core/list-item', { content } ) ]
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
} ) ),
|
|
85
|
+
],
|
|
86
|
+
to: [
|
|
87
|
+
...[ 'core/paragraph', 'core/heading' ].map( ( block ) => ( {
|
|
88
|
+
type: 'block',
|
|
89
|
+
blocks: [ block ],
|
|
90
|
+
transform: ( _attributes, childBlocks ) => {
|
|
91
|
+
return childBlocks
|
|
92
|
+
.filter( ( { name } ) => name === 'core/list-item' )
|
|
93
|
+
.map( ( { attributes } ) =>
|
|
94
|
+
createBlock( block, {
|
|
95
|
+
content: attributes.content,
|
|
96
|
+
} )
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
} ) ),
|
|
100
|
+
...[ 'core/quote', 'core/pullquote' ].map( ( block ) => ( {
|
|
101
|
+
type: 'block',
|
|
102
|
+
blocks: [ block ],
|
|
103
|
+
transform: ( attributes, innerBlocks ) => {
|
|
104
|
+
return switchToBlockType(
|
|
105
|
+
switchToBlockType(
|
|
106
|
+
createBlock( 'core/list', attributes, innerBlocks ),
|
|
107
|
+
'core/paragraph'
|
|
108
|
+
),
|
|
109
|
+
block
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
} ) ),
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default transforms;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 2,
|
|
4
|
+
"name": "core/list-item",
|
|
5
|
+
"title": "List item",
|
|
6
|
+
"category": "text",
|
|
7
|
+
"parent": [ "core/list" ],
|
|
8
|
+
"description": "Create a list item.",
|
|
9
|
+
"textdomain": "default",
|
|
10
|
+
"attributes": {
|
|
11
|
+
"placeholder": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"content": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"source": "html",
|
|
17
|
+
"selector": "li",
|
|
18
|
+
"default": "",
|
|
19
|
+
"__experimentalRole": "content"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"supports": {
|
|
23
|
+
"className": false,
|
|
24
|
+
"__experimentalSelector": "li"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
RichText,
|
|
6
|
+
useBlockProps,
|
|
7
|
+
useInnerBlocksProps,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { createBlock } from '@wordpress/blocks';
|
|
11
|
+
|
|
12
|
+
export default function ListItemEdit( {
|
|
13
|
+
name,
|
|
14
|
+
attributes,
|
|
15
|
+
setAttributes,
|
|
16
|
+
mergeBlocks,
|
|
17
|
+
onReplace,
|
|
18
|
+
} ) {
|
|
19
|
+
const blockProps = useBlockProps();
|
|
20
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
21
|
+
allowedBlocks: [ 'core/list' ],
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<li { ...innerBlocksProps }>
|
|
26
|
+
<RichText
|
|
27
|
+
identifier="content"
|
|
28
|
+
tagName="div"
|
|
29
|
+
onChange={ ( nextContent ) =>
|
|
30
|
+
setAttributes( { content: nextContent } )
|
|
31
|
+
}
|
|
32
|
+
value={ attributes.content }
|
|
33
|
+
aria-label={ __( 'List text' ) }
|
|
34
|
+
placeholder={ attributes.placeholder || __( 'List' ) }
|
|
35
|
+
onSplit={ ( value ) =>
|
|
36
|
+
createBlock( name, {
|
|
37
|
+
...attributes,
|
|
38
|
+
content: value,
|
|
39
|
+
} )
|
|
40
|
+
}
|
|
41
|
+
onMerge={ mergeBlocks }
|
|
42
|
+
onReplace={ onReplace }
|
|
43
|
+
/>
|
|
44
|
+
{ innerBlocksProps.children }
|
|
45
|
+
</li>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { list as icon } from '@wordpress/icons';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import metadata from './block.json';
|
|
10
|
+
import edit from './edit';
|
|
11
|
+
import save from './save';
|
|
12
|
+
|
|
13
|
+
const { name } = metadata;
|
|
14
|
+
|
|
15
|
+
export { metadata, name };
|
|
16
|
+
|
|
17
|
+
export const settings = {
|
|
18
|
+
icon,
|
|
19
|
+
edit,
|
|
20
|
+
save,
|
|
21
|
+
merge( attributes, attributesToMerge ) {
|
|
22
|
+
return {
|
|
23
|
+
...attributes,
|
|
24
|
+
content: attributes.content + attributesToMerge.content,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
export default function save( { attributes } ) {
|
|
7
|
+
return (
|
|
8
|
+
<li { ...useBlockProps.save() }>
|
|
9
|
+
<RichText.Content value={ attributes.content } />
|
|
10
|
+
<InnerBlocks.Content />
|
|
11
|
+
</li>
|
|
12
|
+
);
|
|
13
|
+
}
|
package/src/media-text/edit.js
CHANGED
|
@@ -161,7 +161,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
161
161
|
const image = useSelect(
|
|
162
162
|
( select ) =>
|
|
163
163
|
mediaId && isSelected
|
|
164
|
-
? select( coreStore ).getMedia( mediaId )
|
|
164
|
+
? select( coreStore ).getMedia( mediaId, { context: 'view' } )
|
|
165
165
|
: null,
|
|
166
166
|
[ isSelected, mediaId ]
|
|
167
167
|
);
|
package/src/navigation/index.php
CHANGED
|
@@ -361,10 +361,14 @@ function block_core_navigation_get_fallback_blocks() {
|
|
|
361
361
|
*/
|
|
362
362
|
function render_block_core_navigation( $attributes, $content, $block ) {
|
|
363
363
|
|
|
364
|
+
static $seen_menu_names = array();
|
|
365
|
+
|
|
364
366
|
// Flag used to indicate whether the rendered output is considered to be
|
|
365
367
|
// a fallback (i.e. the block has no menu associated with it).
|
|
366
368
|
$is_fallback = false;
|
|
367
369
|
|
|
370
|
+
$nav_menu_name = '';
|
|
371
|
+
|
|
368
372
|
/**
|
|
369
373
|
* Deprecated:
|
|
370
374
|
* The rgbTextColor and rgbBackgroundColor attributes
|
|
@@ -428,6 +432,14 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
428
432
|
return '';
|
|
429
433
|
}
|
|
430
434
|
|
|
435
|
+
$nav_menu_name = $navigation_post->post_title;
|
|
436
|
+
|
|
437
|
+
if ( isset( $seen_menu_names[ $nav_menu_name ] ) ) {
|
|
438
|
+
++$seen_menu_names[ $nav_menu_name ];
|
|
439
|
+
} else {
|
|
440
|
+
$seen_menu_names[ $nav_menu_name ] = 1;
|
|
441
|
+
}
|
|
442
|
+
|
|
431
443
|
$parsed_blocks = parse_blocks( $navigation_post->post_content );
|
|
432
444
|
|
|
433
445
|
// 'parse_blocks' includes a null block with '\n\n' as the content when
|
|
@@ -508,10 +520,18 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
508
520
|
|
|
509
521
|
$block_styles = isset( $attributes['styles'] ) ? $attributes['styles'] : '';
|
|
510
522
|
|
|
523
|
+
// If the menu name has been used previously then append an ID
|
|
524
|
+
// to the name to ensure uniqueness across a given post.
|
|
525
|
+
if ( isset( $seen_menu_names[ $nav_menu_name ] ) && $seen_menu_names[ $nav_menu_name ] > 1 ) {
|
|
526
|
+
$count = $seen_menu_names[ $nav_menu_name ];
|
|
527
|
+
$nav_menu_name = $nav_menu_name . ' ' . ( $count );
|
|
528
|
+
}
|
|
529
|
+
|
|
511
530
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
512
531
|
array(
|
|
513
|
-
'class'
|
|
514
|
-
'style'
|
|
532
|
+
'class' => implode( ' ', $classes ),
|
|
533
|
+
'style' => $block_styles . $colors['inline_styles'] . $font_sizes['inline_styles'],
|
|
534
|
+
'aria-label' => $nav_menu_name,
|
|
515
535
|
)
|
|
516
536
|
);
|
|
517
537
|
|