@wordpress/block-library 9.15.1 → 9.16.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 +2 -0
- package/build/button/edit.js +2 -1
- package/build/button/edit.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/comment-template/edit.js +2 -2
- package/build/comment-template/edit.js.map +1 -1
- package/build/comments-pagination-next/index.js +7 -6
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +7 -6
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/cover/deprecated.js +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/details/edit.js +12 -17
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +3 -0
- package/build/details/index.js.map +1 -1
- package/build/embed/util.js +1 -1
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.js +7 -4
- package/build/file/edit.js.map +1 -1
- package/build/file/transforms.js +1 -1
- package/build/file/transforms.js.map +1 -1
- package/build/file/utils/index.js +1 -1
- package/build/file/utils/index.js.map +1 -1
- package/build/form-input/edit.js +1 -1
- package/build/form-input/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/transforms.js +2 -2
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-new-images.js +1 -1
- package/build/gallery/use-get-new-images.js.map +1 -1
- package/build/list-item/edit.native.js +2 -2
- package/build/list-item/edit.native.js.map +1 -1
- package/build/media-text/edit.native.js +2 -2
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +4 -4
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js +8 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/index.js +15 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +9 -18
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/index.js +11 -0
- package/build/page-list/index.js.map +1 -1
- package/build/post-author-name/edit.js +41 -12
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-comments-link/index.js +7 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-featured-image/overlay-controls.js +2 -1
- package/build/post-featured-image/overlay-controls.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +1 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +110 -61
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/edit.js +39 -14
- package/build/query-title/edit.js.map +1 -1
- package/build/query-total/index.js +7 -1
- package/build/query-total/index.js.map +1 -1
- package/build/quote/transforms.js +1 -1
- package/build/quote/transforms.js.map +1 -1
- package/build/rss/edit.js +1 -0
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +6 -0
- package/build/rss/index.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +26 -35
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +24 -8
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/video/edit.native.js +3 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/button/edit.js +3 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/columns/edit.js +1 -1
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +1 -1
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/comment-template/edit.js +2 -2
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +7 -6
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +7 -6
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/cover/deprecated.js +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/details/edit.js +13 -18
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +3 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/util.js +1 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.js +7 -4
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/transforms.js +1 -1
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/file/utils/index.js +1 -1
- package/build-module/file/utils/index.js.map +1 -1
- package/build-module/form-input/edit.js +1 -1
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/transforms.js +2 -2
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-new-images.js +1 -1
- package/build-module/gallery/use-get-new-images.js.map +1 -1
- package/build-module/list-item/edit.native.js +2 -2
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/media-text/edit.native.js +2 -2
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +4 -4
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +8 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/index.js +15 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +9 -18
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/index.js +11 -0
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +42 -13
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-comments-link/index.js +7 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +2 -1
- package/build-module/post-featured-image/overlay-controls.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +111 -62
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/edit.js +40 -15
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-total/index.js +7 -1
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/quote/transforms.js +1 -1
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/rss/edit.js +1 -0
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +6 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +27 -36
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/edit.js +2 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +25 -9
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/video/edit.native.js +3 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/editor-rtl.css +6 -43
- package/build-style/editor.css +6 -43
- package/build-style/freeform/editor-rtl.css +2 -4
- package/build-style/freeform/editor.css +2 -4
- package/build-style/gallery/editor-rtl.css +2 -4
- package/build-style/gallery/editor.css +2 -4
- package/build-style/image/style-rtl.css +24 -10
- package/build-style/image/style.css +24 -10
- package/build-style/navigation/style-rtl.css +8 -6
- package/build-style/navigation/style.css +8 -6
- package/build-style/query/editor-rtl.css +0 -27
- package/build-style/query/editor.css +0 -27
- package/build-style/site-logo/editor-rtl.css +2 -8
- package/build-style/site-logo/editor.css +2 -8
- package/build-style/social-links/style-rtl.css +2 -5
- package/build-style/social-links/style.css +2 -5
- package/build-style/style-rtl.css +34 -21
- package/build-style/style.css +34 -21
- package/package.json +35 -35
- package/src/audio/test/transforms.native.js +4 -3
- package/src/button/edit.js +6 -2
- package/src/columns/edit.js +1 -1
- package/src/columns/edit.native.js +1 -1
- package/src/comment-template/edit.js +2 -2
- package/src/comments-pagination-next/block.json +0 -5
- package/src/comments-pagination-next/index.js +6 -0
- package/src/comments-pagination-previous/block.json +0 -5
- package/src/comments-pagination-previous/index.js +6 -0
- package/src/cover/deprecated.js +1 -1
- package/src/cover/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/cover/test/edit.js +7 -7
- package/src/cover/test/edit.native.js +2 -2
- package/src/cover/test/transforms.native.js +9 -5
- package/src/details/block.json +3 -0
- package/src/details/edit.js +12 -23
- package/src/editor.scss +1 -1
- package/src/embed/test/index.js +1 -1
- package/src/embed/util.js +1 -1
- package/src/file/edit.js +4 -3
- package/src/file/test/transforms.native.js +4 -3
- package/src/file/transforms.js +1 -1
- package/src/file/utils/index.js +1 -1
- package/src/form-input/edit.js +1 -1
- package/src/freeform/editor.scss +4 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/editor.scss +4 -2
- package/src/gallery/test/transforms.native.js +4 -3
- package/src/gallery/transforms.js +2 -2
- package/src/gallery/use-get-new-images.js +1 -1
- package/src/image/block.json +8 -1
- package/src/image/editor.scss +1 -1
- package/src/image/index.php +9 -13
- package/src/image/style.scss +17 -7
- package/src/image/test/edit.native.js +1 -1
- package/src/image/test/transforms.native.js +4 -3
- package/src/list/test/edit.native.js +1 -1
- package/src/list-item/edit.native.js +2 -2
- package/src/media-text/edit.native.js +2 -2
- package/src/media-text/media-container.native.js +4 -4
- package/src/media-text/test/transforms.native.js +9 -5
- package/src/navigation/edit/index.js +4 -0
- package/src/navigation/index.js +20 -0
- package/src/navigation/style.scss +7 -4
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-link/link-ui.js +7 -13
- package/src/navigation-submenu/edit.js +1 -1
- package/src/page-list/block.json +11 -0
- package/src/paragraph/style.scss +1 -1
- package/src/post-author-name/edit.js +53 -15
- package/src/post-comments-link/block.json +7 -1
- package/src/post-content/block.json +1 -1
- package/src/post-featured-image/overlay-controls.js +1 -0
- package/src/query/edit/inspector-controls/author-control.js +1 -1
- package/src/query/edit/inspector-controls/index.js +148 -88
- package/src/query/editor.scss +0 -31
- package/src/query/utils.js +1 -1
- package/src/query-title/edit.js +60 -19
- package/src/query-total/block.json +7 -1
- package/src/quote/transforms.js +1 -1
- package/src/rss/block.json +6 -0
- package/src/rss/edit.js +1 -0
- package/src/search/edit.js +6 -2
- package/src/separator/deprecated.scss +1 -1
- package/src/site-logo/edit.js +34 -47
- package/src/site-logo/editor.scss +3 -6
- package/src/social-link/index.php +2 -2
- package/src/social-links/edit.js +1 -0
- package/src/social-links/style.scss +3 -3
- package/src/table-of-contents/edit.js +38 -19
- package/src/video/edit.native.js +3 -3
- package/src/video/test/transforms.native.js +4 -3
|
@@ -56,7 +56,7 @@ export default function useGetNewImages( images, imageData ) {
|
|
|
56
56
|
currentImage.clientId === image.clientId
|
|
57
57
|
) &&
|
|
58
58
|
imageData?.find( ( img ) => img.id === image.id ) &&
|
|
59
|
-
! image.
|
|
59
|
+
! image.fromSavedContent
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
if ( imagesUpdated || newImages?.length > 0 ) {
|
package/src/image/block.json
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
"name": "core/image",
|
|
5
5
|
"title": "Image",
|
|
6
6
|
"category": "media",
|
|
7
|
-
"usesContext": [
|
|
7
|
+
"usesContext": [
|
|
8
|
+
"allowResize",
|
|
9
|
+
"imageCrop",
|
|
10
|
+
"fixedHeight",
|
|
11
|
+
"postId",
|
|
12
|
+
"postType",
|
|
13
|
+
"queryId"
|
|
14
|
+
],
|
|
8
15
|
"description": "Insert an image to make a visual statement.",
|
|
9
16
|
"keywords": [ "img", "photo", "picture" ],
|
|
10
17
|
"textdomain": "default",
|
package/src/image/editor.scss
CHANGED
package/src/image/index.php
CHANGED
|
@@ -149,18 +149,14 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
149
149
|
return $block_content;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
$alt
|
|
153
|
-
$img_uploaded_src
|
|
154
|
-
$img_class_names
|
|
155
|
-
$img_styles
|
|
156
|
-
$img_width
|
|
157
|
-
$img_height
|
|
158
|
-
$aria_label
|
|
159
|
-
|
|
160
|
-
if ( $alt ) {
|
|
161
|
-
/* translators: %s: Image alt text. */
|
|
162
|
-
$aria_label = sprintf( __( 'Enlarge image: %s' ), $alt );
|
|
163
|
-
}
|
|
152
|
+
$alt = $p->get_attribute( 'alt' );
|
|
153
|
+
$img_uploaded_src = $p->get_attribute( 'src' );
|
|
154
|
+
$img_class_names = $p->get_attribute( 'class' );
|
|
155
|
+
$img_styles = $p->get_attribute( 'style' );
|
|
156
|
+
$img_width = 'none';
|
|
157
|
+
$img_height = 'none';
|
|
158
|
+
$aria_label = __( 'Enlarge' );
|
|
159
|
+
$dialog_aria_label = __( 'Enlarged image' );
|
|
164
160
|
|
|
165
161
|
if ( isset( $block['attrs']['id'] ) ) {
|
|
166
162
|
$img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] );
|
|
@@ -190,7 +186,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
190
186
|
'targetWidth' => $img_width,
|
|
191
187
|
'targetHeight' => $img_height,
|
|
192
188
|
'scaleAttr' => $block['attrs']['scale'] ?? false,
|
|
193
|
-
'ariaLabel' => $
|
|
189
|
+
'ariaLabel' => $dialog_aria_label,
|
|
194
190
|
'alt' => $alt,
|
|
195
191
|
),
|
|
196
192
|
),
|
package/src/image/style.scss
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
vertical-align: bottom;
|
|
12
12
|
box-sizing: border-box;
|
|
13
13
|
|
|
14
|
-
@media (prefers-reduced-motion
|
|
14
|
+
@media not (prefers-reduced-motion) {
|
|
15
15
|
&.hide {
|
|
16
16
|
visibility: hidden;
|
|
17
17
|
}
|
|
@@ -167,7 +167,9 @@
|
|
|
167
167
|
text-align: center;
|
|
168
168
|
padding: 0;
|
|
169
169
|
border-radius: 4px;
|
|
170
|
-
|
|
170
|
+
@media not (prefers-reduced-motion) {
|
|
171
|
+
transition: opacity 0.2s ease;
|
|
172
|
+
}
|
|
171
173
|
|
|
172
174
|
&:focus-visible {
|
|
173
175
|
outline: 3px auto rgb(90 90 90 / 25%);
|
|
@@ -280,21 +282,29 @@
|
|
|
280
282
|
// or faster than the scrim to give a sense of depth.
|
|
281
283
|
&.active {
|
|
282
284
|
visibility: visible;
|
|
283
|
-
|
|
285
|
+
@media not (prefers-reduced-motion) {
|
|
286
|
+
animation: both turn-on-visibility 0.25s;
|
|
287
|
+
}
|
|
284
288
|
img {
|
|
285
|
-
|
|
289
|
+
@media not (prefers-reduced-motion) {
|
|
290
|
+
animation: both turn-on-visibility 0.35s;
|
|
291
|
+
}
|
|
286
292
|
}
|
|
287
293
|
}
|
|
288
294
|
&.show-closing-animation {
|
|
289
295
|
&:not(.active) {
|
|
290
|
-
|
|
296
|
+
@media not (prefers-reduced-motion) {
|
|
297
|
+
animation: both turn-off-visibility 0.35s;
|
|
298
|
+
}
|
|
291
299
|
img {
|
|
292
|
-
|
|
300
|
+
@media not (prefers-reduced-motion) {
|
|
301
|
+
animation: both turn-off-visibility 0.25s;
|
|
302
|
+
}
|
|
293
303
|
}
|
|
294
304
|
}
|
|
295
305
|
}
|
|
296
306
|
|
|
297
|
-
@media (prefers-reduced-motion
|
|
307
|
+
@media not (prefers-reduced-motion) {
|
|
298
308
|
&.zoom {
|
|
299
309
|
&.active {
|
|
300
310
|
opacity: 1;
|
|
@@ -62,7 +62,7 @@ Clipboard.getString.mockImplementation( () => clipboardPromise );
|
|
|
62
62
|
beforeAll( () => {
|
|
63
63
|
registerCoreBlocks();
|
|
64
64
|
|
|
65
|
-
// Mock Image.getSize to avoid failed attempt to size non-
|
|
65
|
+
// Mock Image.getSize to avoid failed attempt to size non-existent image
|
|
66
66
|
const getSizeSpy = jest.spyOn( Image, 'getSize' );
|
|
67
67
|
getSizeSpy.mockImplementation( ( _url, callback ) => callback( 300, 200 ) );
|
|
68
68
|
} );
|
|
@@ -15,12 +15,12 @@ const initialHtml = `
|
|
|
15
15
|
<figure class="wp-block-image size-large is-style-default"><a href="https://cldup.com/cXyG__fTLN.jpg"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></a><figcaption class="wp-element-caption">Mountain</figcaption></figure>
|
|
16
16
|
<!-- /wp:image -->`;
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const transformsWithInnerBlocks = [ 'Gallery', 'Columns', 'Group' ];
|
|
19
19
|
const nonMediaTransforms = [ 'File' ];
|
|
20
20
|
const blockTransforms = [
|
|
21
21
|
'Cover',
|
|
22
22
|
'Media & Text',
|
|
23
|
-
...
|
|
23
|
+
...transformsWithInnerBlocks,
|
|
24
24
|
...nonMediaTransforms,
|
|
25
25
|
];
|
|
26
26
|
|
|
@@ -31,7 +31,8 @@ describe( `${ block } block transformations`, () => {
|
|
|
31
31
|
const screen = await initializeEditor( { initialHtml } );
|
|
32
32
|
const newBlock = await transformBlock( screen, block, blockTransform, {
|
|
33
33
|
isMediaBlock: ! nonMediaTransforms.includes( blockTransform ),
|
|
34
|
-
hasInnerBlocks:
|
|
34
|
+
hasInnerBlocks:
|
|
35
|
+
transformsWithInnerBlocks.includes( blockTransform ),
|
|
35
36
|
} );
|
|
36
37
|
expect( newBlock ).toBeVisible();
|
|
37
38
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -157,7 +157,7 @@ describe( 'List block', () => {
|
|
|
157
157
|
fireEvent.press( listBlock );
|
|
158
158
|
await triggerBlockListLayout( listBlock );
|
|
159
159
|
|
|
160
|
-
// Select
|
|
160
|
+
// Select Second List Item block
|
|
161
161
|
const [ listItemBlock ] = screen.getAllByLabelText(
|
|
162
162
|
/List item Block\. Row 2/
|
|
163
163
|
);
|
|
@@ -54,7 +54,7 @@ export default function ListItemEdit( {
|
|
|
54
54
|
getBlockParentsByBlockName,
|
|
55
55
|
getBlockRootClientId,
|
|
56
56
|
} = select( blockEditorStore );
|
|
57
|
-
const
|
|
57
|
+
const currentIndentationLevel = getBlockParentsByBlockName(
|
|
58
58
|
clientId,
|
|
59
59
|
'core/list-item',
|
|
60
60
|
true
|
|
@@ -73,7 +73,7 @@ export default function ListItemEdit( {
|
|
|
73
73
|
return {
|
|
74
74
|
blockIndex: currentBlockIndex,
|
|
75
75
|
hasInnerBlocks: blockWithInnerBlocks,
|
|
76
|
-
indentationLevel:
|
|
76
|
+
indentationLevel: currentIndentationLevel,
|
|
77
77
|
numberOfListItems: totalListItems,
|
|
78
78
|
ordered: isOrdered,
|
|
79
79
|
reversed: isReversed,
|
|
@@ -218,7 +218,7 @@ class MediaTextEdit extends Component {
|
|
|
218
218
|
? ( containerWidth * mediaWidth ) / 100 -
|
|
219
219
|
styles.mediaAreaPadding.width
|
|
220
220
|
: containerWidth;
|
|
221
|
-
const
|
|
221
|
+
const alignmentStyles =
|
|
222
222
|
styles[
|
|
223
223
|
`is-vertically-aligned-${ verticalAlignment || 'center' }`
|
|
224
224
|
];
|
|
@@ -244,7 +244,7 @@ class MediaTextEdit extends Component {
|
|
|
244
244
|
imageFill,
|
|
245
245
|
focalPoint,
|
|
246
246
|
isSelected,
|
|
247
|
-
|
|
247
|
+
alignmentStyles,
|
|
248
248
|
shouldStack,
|
|
249
249
|
} }
|
|
250
250
|
/>
|
|
@@ -171,7 +171,7 @@ class MediaContainer extends Component {
|
|
|
171
171
|
renderImage( params, openMediaOptions ) {
|
|
172
172
|
const { isUploadInProgress } = this.state;
|
|
173
173
|
const {
|
|
174
|
-
|
|
174
|
+
alignmentStyles,
|
|
175
175
|
focalPoint,
|
|
176
176
|
imageFill,
|
|
177
177
|
isMediaSelected,
|
|
@@ -205,7 +205,7 @@ class MediaContainer extends Component {
|
|
|
205
205
|
style={ [
|
|
206
206
|
imageFill && styles.imageCropped,
|
|
207
207
|
styles.mediaImageContainer,
|
|
208
|
-
! isUploadInProgress &&
|
|
208
|
+
! isUploadInProgress && alignmentStyles,
|
|
209
209
|
] }
|
|
210
210
|
>
|
|
211
211
|
<Image
|
|
@@ -232,7 +232,7 @@ class MediaContainer extends Component {
|
|
|
232
232
|
|
|
233
233
|
renderVideo( params ) {
|
|
234
234
|
const {
|
|
235
|
-
|
|
235
|
+
alignmentStyles,
|
|
236
236
|
mediaUrl,
|
|
237
237
|
isSelected,
|
|
238
238
|
getStylesFromColorScheme,
|
|
@@ -261,7 +261,7 @@ class MediaContainer extends Component {
|
|
|
261
261
|
onPress={ this.onMediaPressed }
|
|
262
262
|
disabled={ ! isSelected }
|
|
263
263
|
>
|
|
264
|
-
<View style={ [ styles.videoContainer,
|
|
264
|
+
<View style={ [ styles.videoContainer, alignmentStyles ] }>
|
|
265
265
|
<View
|
|
266
266
|
style={ [
|
|
267
267
|
styles.videoContent,
|
|
@@ -23,16 +23,16 @@ const initialHtmlWithVideo = `
|
|
|
23
23
|
<!-- /wp:paragraph --></div></div>
|
|
24
24
|
<!-- /wp:media-text -->`;
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
27
27
|
const blockTransformsWithImage = [
|
|
28
28
|
'Image',
|
|
29
29
|
'Cover',
|
|
30
|
-
...
|
|
30
|
+
...transformsWithInnerBlocks,
|
|
31
31
|
];
|
|
32
32
|
const blockTransformsWithVideo = [
|
|
33
33
|
'Video',
|
|
34
34
|
'Cover',
|
|
35
|
-
...
|
|
35
|
+
...transformsWithInnerBlocks,
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
setupCoreBlocks();
|
|
@@ -52,7 +52,9 @@ describe( `${ block } block transformations`, () => {
|
|
|
52
52
|
{
|
|
53
53
|
isMediaBlock: true,
|
|
54
54
|
hasInnerBlocks:
|
|
55
|
-
|
|
55
|
+
transformsWithInnerBlocks.includes(
|
|
56
|
+
blockTransform
|
|
57
|
+
),
|
|
56
58
|
}
|
|
57
59
|
);
|
|
58
60
|
expect( newBlock ).toBeVisible();
|
|
@@ -88,7 +90,9 @@ describe( `${ block } block transformations`, () => {
|
|
|
88
90
|
{
|
|
89
91
|
isMediaBlock: true,
|
|
90
92
|
hasInnerBlocks:
|
|
91
|
-
|
|
93
|
+
transformsWithInnerBlocks.includes(
|
|
94
|
+
blockTransform
|
|
95
|
+
),
|
|
92
96
|
}
|
|
93
97
|
);
|
|
94
98
|
expect( newBlock ).toBeVisible();
|
|
@@ -142,24 +142,28 @@ function ColorTools( {
|
|
|
142
142
|
label: __( 'Text' ),
|
|
143
143
|
onColorChange: setTextColor,
|
|
144
144
|
resetAllFilter: () => setTextColor(),
|
|
145
|
+
clearable: true,
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
148
|
colorValue: backgroundColor.color,
|
|
148
149
|
label: __( 'Background' ),
|
|
149
150
|
onColorChange: setBackgroundColor,
|
|
150
151
|
resetAllFilter: () => setBackgroundColor(),
|
|
152
|
+
clearable: true,
|
|
151
153
|
},
|
|
152
154
|
{
|
|
153
155
|
colorValue: overlayTextColor.color,
|
|
154
156
|
label: __( 'Submenu & overlay text' ),
|
|
155
157
|
onColorChange: setOverlayTextColor,
|
|
156
158
|
resetAllFilter: () => setOverlayTextColor(),
|
|
159
|
+
clearable: true,
|
|
157
160
|
},
|
|
158
161
|
{
|
|
159
162
|
colorValue: overlayBackgroundColor.color,
|
|
160
163
|
label: __( 'Submenu & overlay background' ),
|
|
161
164
|
onColorChange: setOverlayBackgroundColor,
|
|
162
165
|
resetAllFilter: () => setOverlayBackgroundColor(),
|
|
166
|
+
clearable: true,
|
|
163
167
|
},
|
|
164
168
|
] }
|
|
165
169
|
panelId={ clientId }
|
package/src/navigation/index.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { navigation as icon } from '@wordpress/icons';
|
|
6
|
+
import { select } from '@wordpress/data';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Internal dependencies
|
|
@@ -52,6 +55,23 @@ export const settings = {
|
|
|
52
55
|
},
|
|
53
56
|
edit,
|
|
54
57
|
save,
|
|
58
|
+
__experimentalLabel: ( { ref } ) => {
|
|
59
|
+
if ( ! ref ) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const navigation = select( coreStore ).getEditedEntityRecord(
|
|
64
|
+
'postType',
|
|
65
|
+
'wp_navigation',
|
|
66
|
+
ref
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
if ( ! navigation?.title ) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return decodeEntities( navigation.title );
|
|
74
|
+
},
|
|
55
75
|
deprecated,
|
|
56
76
|
};
|
|
57
77
|
|
|
@@ -166,7 +166,9 @@ $navigation-icon-size: 24px;
|
|
|
166
166
|
|
|
167
167
|
// Hide until hover or focus within.
|
|
168
168
|
opacity: 0;
|
|
169
|
-
|
|
169
|
+
@media not (prefers-reduced-motion) {
|
|
170
|
+
transition: opacity 0.1s linear;
|
|
171
|
+
}
|
|
170
172
|
visibility: hidden;
|
|
171
173
|
|
|
172
174
|
// Don't take up space when the menu is collapsed.
|
|
@@ -502,9 +504,10 @@ button.wp-block-navigation-item__content {
|
|
|
502
504
|
background-color: inherit;
|
|
503
505
|
|
|
504
506
|
// Animation.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
@media not (prefers-reduced-motion) {
|
|
508
|
+
animation: overlay-menu__fade-in-animation 0.1s ease-out;
|
|
509
|
+
animation-fill-mode: forwards;
|
|
510
|
+
}
|
|
508
511
|
|
|
509
512
|
// Try to inherit any root paddings set, so the X can align to a top-right aligned menu.
|
|
510
513
|
padding-top: clamp(1rem, var(--wp--style--root--padding-top), 20rem);
|
|
@@ -157,7 +157,7 @@ function getMissingText( type ) {
|
|
|
157
157
|
/*
|
|
158
158
|
* Warning, this duplicated in
|
|
159
159
|
* packages/block-library/src/navigation-submenu/edit.js
|
|
160
|
-
* Consider
|
|
160
|
+
* Consider reusing this components for both blocks.
|
|
161
161
|
*/
|
|
162
162
|
function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
|
|
163
163
|
const { label, url, description, title, rel } = attributes;
|
|
@@ -78,7 +78,7 @@ export function getSuggestionsQuery( type, kind ) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function LinkUIBlockInserter( { clientId, onBack
|
|
81
|
+
function LinkUIBlockInserter( { clientId, onBack } ) {
|
|
82
82
|
const { rootBlockClientId } = useSelect(
|
|
83
83
|
( select ) => {
|
|
84
84
|
const { getBlockRootClientId } = select( blockEditorStore );
|
|
@@ -96,7 +96,7 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
96
96
|
LinkControl,
|
|
97
97
|
`link-ui-block-inserter__title`
|
|
98
98
|
);
|
|
99
|
-
const
|
|
99
|
+
const dialogDescriptionId = useInstanceId(
|
|
100
100
|
LinkControl,
|
|
101
101
|
`link-ui-block-inserter__description`
|
|
102
102
|
);
|
|
@@ -110,13 +110,13 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
110
110
|
className="link-ui-block-inserter"
|
|
111
111
|
role="dialog"
|
|
112
112
|
aria-labelledby={ dialogTitleId }
|
|
113
|
-
aria-describedby={
|
|
113
|
+
aria-describedby={ dialogDescriptionId }
|
|
114
114
|
ref={ focusOnMountRef }
|
|
115
115
|
>
|
|
116
116
|
<VisuallyHidden>
|
|
117
117
|
<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>
|
|
118
118
|
|
|
119
|
-
<p id={
|
|
119
|
+
<p id={ dialogDescriptionId }>
|
|
120
120
|
{ __( 'Choose a block to add to your Navigation.' ) }
|
|
121
121
|
</p>
|
|
122
122
|
</VisuallyHidden>
|
|
@@ -140,7 +140,6 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
140
140
|
prioritizePatterns={ false }
|
|
141
141
|
selectBlockOnInsert
|
|
142
142
|
hasSearch={ false }
|
|
143
|
-
onSelect={ onSelectBlock }
|
|
144
143
|
/>
|
|
145
144
|
</div>
|
|
146
145
|
);
|
|
@@ -198,15 +197,11 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
198
197
|
LinkUI,
|
|
199
198
|
`link-ui-link-control__title`
|
|
200
199
|
);
|
|
201
|
-
const
|
|
200
|
+
const dialogDescriptionId = useInstanceId(
|
|
202
201
|
LinkUI,
|
|
203
202
|
`link-ui-link-control__description`
|
|
204
203
|
);
|
|
205
204
|
|
|
206
|
-
// Selecting a block should close the popover and also remove the (previously) automatically inserted
|
|
207
|
-
// link block so that the newly selected block can be inserted in its place.
|
|
208
|
-
const { onClose: onSelectBlock } = props;
|
|
209
|
-
|
|
210
205
|
return (
|
|
211
206
|
<Popover
|
|
212
207
|
ref={ ref }
|
|
@@ -219,12 +214,12 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
219
214
|
<div
|
|
220
215
|
role="dialog"
|
|
221
216
|
aria-labelledby={ dialogTitleId }
|
|
222
|
-
aria-describedby={
|
|
217
|
+
aria-describedby={ dialogDescriptionId }
|
|
223
218
|
>
|
|
224
219
|
<VisuallyHidden>
|
|
225
220
|
<h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>
|
|
226
221
|
|
|
227
|
-
<p id={
|
|
222
|
+
<p id={ dialogDescriptionId }>
|
|
228
223
|
{ __(
|
|
229
224
|
'Search for and add a link to your Navigation.'
|
|
230
225
|
) }
|
|
@@ -287,7 +282,6 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
287
282
|
setAddingBlock( false );
|
|
288
283
|
setFocusAddBlockButton( true );
|
|
289
284
|
} }
|
|
290
|
-
onSelectBlock={ onSelectBlock }
|
|
291
285
|
/>
|
|
292
286
|
) }
|
|
293
287
|
</Popover>
|
|
@@ -276,7 +276,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
276
276
|
// as it shares the CMD+K shortcut.
|
|
277
277
|
// See https://github.com/WordPress/gutenberg/pull/59845.
|
|
278
278
|
event.preventDefault();
|
|
279
|
-
// If we don't stop
|
|
279
|
+
// If we don't stop propagation, this event bubbles up to the parent submenu item
|
|
280
280
|
event.stopPropagation();
|
|
281
281
|
setIsLinkOpen( true );
|
|
282
282
|
setOpenedBy( ref.current );
|
package/src/page-list/block.json
CHANGED
|
@@ -52,6 +52,17 @@
|
|
|
52
52
|
"interactivity": {
|
|
53
53
|
"clientNavigation": true
|
|
54
54
|
},
|
|
55
|
+
"color": {
|
|
56
|
+
"text": true,
|
|
57
|
+
"background": true,
|
|
58
|
+
"link": true,
|
|
59
|
+
"gradients": true,
|
|
60
|
+
"__experimentalDefaultControls": {
|
|
61
|
+
"background": true,
|
|
62
|
+
"text": true,
|
|
63
|
+
"link": true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
55
66
|
"__experimentalBorder": {
|
|
56
67
|
"radius": true,
|
|
57
68
|
"color": true,
|
package/src/paragraph/style.scss
CHANGED
|
@@ -44,7 +44,7 @@ p.has-drop-cap.has-background {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Use :where to contain the specificity of this rule
|
|
47
|
-
// so it's easily
|
|
47
|
+
// so it's easily overridable by any theme that targets
|
|
48
48
|
// links using the a element.
|
|
49
49
|
// For example, this is what global styles does.
|
|
50
50
|
:where(p.has-text-color:not(.has-link-color)) a {
|
|
@@ -15,7 +15,16 @@ import {
|
|
|
15
15
|
import { useSelect } from '@wordpress/data';
|
|
16
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
17
|
import { store as coreStore } from '@wordpress/core-data';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ToggleControl,
|
|
20
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
21
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
22
|
+
} from '@wordpress/components';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
19
28
|
|
|
20
29
|
function PostAuthorNameEdit( {
|
|
21
30
|
context: { postType, postId },
|
|
@@ -61,6 +70,8 @@ function PostAuthorNameEdit( {
|
|
|
61
70
|
displayName
|
|
62
71
|
);
|
|
63
72
|
|
|
73
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
74
|
+
|
|
64
75
|
return (
|
|
65
76
|
<>
|
|
66
77
|
<BlockControls group="block">
|
|
@@ -72,26 +83,53 @@ function PostAuthorNameEdit( {
|
|
|
72
83
|
/>
|
|
73
84
|
</BlockControls>
|
|
74
85
|
<InspectorControls>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
<ToolsPanel
|
|
87
|
+
label={ __( 'Settings' ) }
|
|
88
|
+
resetAll={ () => {
|
|
89
|
+
setAttributes( {
|
|
90
|
+
isLink: false,
|
|
91
|
+
linkTarget: '_self',
|
|
92
|
+
} );
|
|
93
|
+
} }
|
|
94
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
95
|
+
>
|
|
96
|
+
<ToolsPanelItem
|
|
78
97
|
label={ __( 'Link to author archive' ) }
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
isShownByDefault
|
|
99
|
+
hasValue={ () => isLink }
|
|
100
|
+
onDeselect={ () => setAttributes( { isLink: false } ) }
|
|
101
|
+
>
|
|
83
102
|
<ToggleControl
|
|
84
103
|
__nextHasNoMarginBottom
|
|
85
|
-
label={ __( '
|
|
86
|
-
onChange={ (
|
|
87
|
-
setAttributes( {
|
|
88
|
-
linkTarget: value ? '_blank' : '_self',
|
|
89
|
-
} )
|
|
104
|
+
label={ __( 'Link to author archive' ) }
|
|
105
|
+
onChange={ () =>
|
|
106
|
+
setAttributes( { isLink: ! isLink } )
|
|
90
107
|
}
|
|
91
|
-
checked={
|
|
108
|
+
checked={ isLink }
|
|
92
109
|
/>
|
|
110
|
+
</ToolsPanelItem>
|
|
111
|
+
{ isLink && (
|
|
112
|
+
<ToolsPanelItem
|
|
113
|
+
label={ __( 'Open in new tab' ) }
|
|
114
|
+
isShownByDefault
|
|
115
|
+
hasValue={ () => linkTarget !== '_self' }
|
|
116
|
+
onDeselect={ () =>
|
|
117
|
+
setAttributes( { linkTarget: '_self' } )
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
<ToggleControl
|
|
121
|
+
__nextHasNoMarginBottom
|
|
122
|
+
label={ __( 'Open in new tab' ) }
|
|
123
|
+
onChange={ ( value ) =>
|
|
124
|
+
setAttributes( {
|
|
125
|
+
linkTarget: value ? '_blank' : '_self',
|
|
126
|
+
} )
|
|
127
|
+
}
|
|
128
|
+
checked={ linkTarget === '_blank' }
|
|
129
|
+
/>
|
|
130
|
+
</ToolsPanelItem>
|
|
93
131
|
) }
|
|
94
|
-
</
|
|
132
|
+
</ToolsPanel>
|
|
95
133
|
</InspectorControls>
|
|
96
134
|
<div { ...blockProps }>
|
|
97
135
|
{ supportsAuthor
|
|
@@ -47,7 +47,13 @@
|
|
|
47
47
|
"radius": true,
|
|
48
48
|
"color": true,
|
|
49
49
|
"width": true,
|
|
50
|
-
"style": true
|
|
50
|
+
"style": true,
|
|
51
|
+
"__experimentalDefaultControls": {
|
|
52
|
+
"radius": true,
|
|
53
|
+
"color": true,
|
|
54
|
+
"width": true,
|
|
55
|
+
"style": true
|
|
56
|
+
}
|
|
51
57
|
}
|
|
52
58
|
},
|
|
53
59
|
"style": "wp-block-post-comments-link"
|
|
@@ -30,7 +30,7 @@ function AuthorControl( { value, onChange } ) {
|
|
|
30
30
|
const authorsInfo = getEntitiesInfo( authorsList );
|
|
31
31
|
/**
|
|
32
32
|
* We need to normalize the value because the block operates on a
|
|
33
|
-
* comma(`,`) separated string value and `
|
|
33
|
+
* comma(`,`) separated string value and `FormTokenField` needs an
|
|
34
34
|
* array.
|
|
35
35
|
*/
|
|
36
36
|
const normalizedValue = ! value ? [] : value.toString().split( ',' );
|