@wordpress/block-library 8.29.0 → 8.30.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/audio/edit.js +7 -17
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/avatar/edit.js.map +1 -1
- package/build/block/deprecated.js +71 -11
- package/build/block/deprecated.js.map +1 -1
- package/build/block/edit.js +49 -24
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +2 -2
- package/build/button/edit.js.map +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/buttons/transforms.js +16 -2
- package/build/buttons/transforms.js.map +1 -1
- package/build/code/transforms.js +17 -6
- package/build/code/transforms.js.map +1 -1
- package/build/columns/edit.js +3 -2
- package/build/columns/edit.js.map +1 -1
- package/build/comment-author-avatar/edit.js +1 -1
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/cover/edit/block-controls.js +14 -3
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit/resizable-cover-popover.js +0 -6
- package/build/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/file/deprecated.js.map +1 -1
- package/build/file/edit.js +6 -13
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.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.map +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/heading/transforms.js +17 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.js +8 -4
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +22 -8
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/ordered-list-settings.js +1 -1
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/list-item/edit.js +1 -3
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/hooks/index.js +0 -7
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +1 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +16 -7
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/list-item/index.js +4 -1
- package/build/list-item/index.js.map +1 -1
- package/build/media-text/media-container.native.js +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/pattern/edit.js +11 -0
- package/build/pattern/edit.js.map +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +8 -11
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-title/edit.js +2 -2
- package/build/post-title/edit.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/utils.js +7 -5
- package/build/query/utils.js.map +1 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/quote/deprecated.js +111 -12
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +5 -5
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -1
- package/build/quote/index.js.map +1 -1
- package/build/quote/save.js +2 -2
- package/build/quote/save.js.map +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +7 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/{edit/index.js → edit.js} +1 -1
- package/build/site-title/edit.js.map +1 -0
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/template-part/edit/index.js +53 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +2 -8
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
- package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
- package/build/utils/caption.js +15 -5
- package/build/utils/caption.js.map +1 -1
- package/build/utils/get-transformed-metadata.js +57 -0
- package/build/utils/get-transformed-metadata.js.map +1 -0
- package/build/utils/hooks.js +55 -4
- package/build/utils/hooks.js.map +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +7 -16
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +2 -7
- package/build/video/edit.native.js.map +1 -1
- package/build-module/audio/edit.js +10 -20
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/block/deprecated.js +71 -11
- package/build-module/block/deprecated.js.map +1 -1
- package/build-module/block/edit.js +49 -24
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +3 -3
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/buttons/transforms.js +16 -2
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/code/transforms.js +17 -6
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/columns/edit.js +3 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -1
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +15 -4
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit/resizable-cover-popover.js +1 -7
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/edit.js +7 -14
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/save.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.map +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/heading/transforms.js +17 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.js +9 -5
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +23 -9
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +1 -1
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/list-item/edit.js +2 -4
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/hooks/index.js +0 -1
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +17 -8
- package/build-module/list-item/hooks/use-space.js.map +1 -1
- package/build-module/list-item/index.js +4 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/pattern/edit.js +11 -0
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +9 -12
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-title/edit.js +2 -2
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/utils.js +7 -5
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/quote/deprecated.js +112 -13
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +5 -5
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/save.js +2 -2
- package/build-module/quote/save.js.map +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +7 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/{edit/index.js → edit.js} +1 -1
- package/build-module/site-title/edit.js.map +1 -0
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +57 -5
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +2 -8
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
- package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
- package/build-module/utils/caption.js +13 -3
- package/build-module/utils/caption.js.map +1 -1
- package/build-module/utils/get-transformed-metadata.js +51 -0
- package/build-module/utils/get-transformed-metadata.js.map +1 -0
- package/build-module/utils/hooks.js +54 -3
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +10 -19
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +2 -7
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/common-rtl.css +1 -0
- package/build-style/common.css +1 -0
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- package/build-style/editor-rtl.css +4 -1
- package/build-style/editor.css +4 -1
- package/build-style/group/editor-rtl.css +1 -1
- package/build-style/group/editor.css +1 -1
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/style-rtl.css +4 -1
- package/build-style/style.css +4 -1
- package/package.json +34 -34
- package/src/audio/edit.js +9 -19
- package/src/audio/edit.native.js +3 -3
- package/src/avatar/edit.js +1 -1
- package/src/block/deprecated.js +76 -11
- package/src/block/edit.js +64 -19
- package/src/block/index.php +23 -12
- package/src/button/edit.js +4 -3
- package/src/buttons/edit.native.js +1 -1
- package/src/buttons/transforms.js +14 -4
- package/src/calendar/index.php +5 -0
- package/src/code/transforms.js +20 -5
- package/src/columns/edit.js +3 -2
- package/src/comment-author-avatar/edit.js +1 -1
- package/src/comments/index.php +2 -0
- package/src/cover/edit/block-controls.js +16 -2
- package/src/cover/edit/index.js +2 -2
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/cover/edit/resizable-cover-popover.js +1 -6
- package/src/cover/edit.native.js +1 -1
- package/src/cover/style.scss +3 -2
- package/src/file/deprecated.js +3 -3
- package/src/file/edit.js +8 -15
- package/src/file/edit.native.js +4 -4
- package/src/file/save.js +1 -1
- package/src/footnotes/index.php +1 -1
- package/src/form-input/edit.js +1 -1
- package/src/gallery/edit.js +3 -3
- package/src/gallery/gallery.native.js +1 -1
- package/src/gallery/test/index.native.js +1 -1
- package/src/gallery/v1/edit.js +2 -2
- package/src/gallery/v1/gallery.native.js +1 -1
- package/src/group/editor.scss +1 -1
- package/src/heading/transforms.js +27 -8
- package/src/image/edit.js +13 -5
- package/src/image/edit.native.js +1 -1
- package/src/image/editor.scss +6 -0
- package/src/image/image.js +34 -22
- package/src/latest-posts/edit.native.js +1 -1
- package/src/list/ordered-list-settings.js +1 -1
- package/src/list-item/edit.js +1 -2
- package/src/list-item/edit.native.js +1 -1
- package/src/list-item/hooks/index.js +0 -1
- package/src/list-item/hooks/use-indent-list-item.js +2 -0
- package/src/list-item/hooks/use-outdent-list-item.js +2 -0
- package/src/list-item/hooks/use-space.js +16 -9
- package/src/list-item/index.js +3 -0
- package/src/media-text/media-container.native.js +5 -3
- package/src/media-text/test/edit.native.js +58 -0
- package/src/missing/test/edit-integration.native.js +2 -1
- package/src/navigation/edit/index.js +1 -1
- package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
- package/src/navigation/index.php +26 -17
- package/src/navigation-link/link-ui.js +2 -2
- package/src/paragraph/edit.native.js +1 -1
- package/src/paragraph/test/edit.native.js +36 -0
- package/src/pattern/edit.js +14 -0
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/dimension-controls.js +4 -4
- package/src/post-featured-image/edit.js +10 -12
- package/src/post-navigation-link/edit.js +1 -1
- package/src/post-template/index.php +2 -0
- package/src/post-title/edit.js +49 -43
- package/src/query/edit/pattern-selection-modal.js +1 -1
- package/src/query/utils.js +6 -4
- package/src/query-pagination-next/edit.js +1 -1
- package/src/query-pagination-previous/edit.js +1 -1
- package/src/quote/block.json +1 -1
- package/src/quote/deprecated.js +110 -15
- package/src/quote/edit.js +5 -5
- package/src/quote/save.js +2 -2
- package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/read-more/edit.js +1 -1
- package/src/search/edit.js +1 -1
- package/src/search/edit.native.js +4 -4
- package/src/search/index.php +1 -1
- package/src/search/style.scss +2 -0
- package/src/site-logo/edit.js +11 -6
- package/src/social-link/edit.js +1 -1
- package/src/social-links/edit.native.js +1 -1
- package/src/spacer/edit.js +1 -1
- package/src/table-of-contents/edit.js +1 -1
- package/src/template-part/edit/index.js +91 -4
- package/src/template-part/edit/selection-modal.js +4 -8
- package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
- package/src/utils/caption.js +10 -1
- package/src/utils/get-transformed-metadata.js +65 -0
- package/src/utils/hooks.js +53 -3
- package/src/video/edit-common-settings.js +1 -1
- package/src/video/edit.js +10 -18
- package/src/video/edit.native.js +5 -8
- package/src/video/test/edit.native.js +0 -14
- package/build/list-item/hooks/use-copy.js +0 -39
- package/build/list-item/hooks/use-copy.js.map +0 -1
- package/build/site-title/edit/index.js.map +0 -1
- package/build-module/list-item/hooks/use-copy.js +0 -32
- package/build-module/list-item/hooks/use-copy.js.map +0 -1
- package/build-module/site-title/edit/index.js.map +0 -1
- package/src/list-item/hooks/use-copy.js +0 -38
- /package/src/site-title/{edit/index.js → edit.js} +0 -0
|
@@ -288,7 +288,7 @@ describe( 'NavigationMenuSelector', () => {
|
|
|
288
288
|
rerender(
|
|
289
289
|
<NavigationMenuSelector
|
|
290
290
|
onCreateNew={ handler }
|
|
291
|
-
createNavigationMenuIsSuccess
|
|
291
|
+
createNavigationMenuIsSuccess
|
|
292
292
|
/>
|
|
293
293
|
);
|
|
294
294
|
|
|
@@ -475,7 +475,7 @@ describe( 'NavigationMenuSelector', () => {
|
|
|
475
475
|
// // Simulate the menu being created and component being re-rendered.
|
|
476
476
|
rerender(
|
|
477
477
|
<NavigationMenuSelector
|
|
478
|
-
createNavigationMenuIsSuccess
|
|
478
|
+
createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
|
|
479
479
|
/>
|
|
480
480
|
);
|
|
481
481
|
|
|
@@ -616,7 +616,7 @@ describe( 'NavigationMenuSelector', () => {
|
|
|
616
616
|
// Simulate the menu being created and component being re-rendered.
|
|
617
617
|
rerender(
|
|
618
618
|
<NavigationMenuSelector
|
|
619
|
-
createNavigationMenuIsSuccess
|
|
619
|
+
createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
|
|
620
620
|
/>
|
|
621
621
|
);
|
|
622
622
|
|
package/src/navigation/index.php
CHANGED
|
@@ -544,7 +544,6 @@ class WP_Navigation_Block_Renderer {
|
|
|
544
544
|
* Gets the nav element directives.
|
|
545
545
|
*
|
|
546
546
|
* @param bool $is_interactive Whether the block is interactive.
|
|
547
|
-
* @param array $attributes The block attributes.
|
|
548
547
|
* @return string the directives for the navigation element.
|
|
549
548
|
*/
|
|
550
549
|
private static function get_nav_element_directives( $is_interactive ) {
|
|
@@ -552,16 +551,20 @@ class WP_Navigation_Block_Renderer {
|
|
|
552
551
|
return '';
|
|
553
552
|
}
|
|
554
553
|
// When adding to this array be mindful of security concerns.
|
|
555
|
-
$nav_element_context =
|
|
554
|
+
$nav_element_context = wp_interactivity_data_wp_context(
|
|
556
555
|
array(
|
|
557
|
-
'overlayOpenedBy' => array(
|
|
556
|
+
'overlayOpenedBy' => array(
|
|
557
|
+
'click' => false,
|
|
558
|
+
'hover' => false,
|
|
559
|
+
'focus' => false,
|
|
560
|
+
),
|
|
558
561
|
'type' => 'overlay',
|
|
559
562
|
'roleAttribute' => '',
|
|
560
563
|
'ariaLabel' => __( 'Menu' ),
|
|
561
564
|
)
|
|
562
565
|
);
|
|
563
566
|
$nav_element_directives = '
|
|
564
|
-
data-wp-interactive="core/navigation"'
|
|
567
|
+
data-wp-interactive="core/navigation" '
|
|
565
568
|
. $nav_element_context;
|
|
566
569
|
|
|
567
570
|
return $nav_element_directives;
|
|
@@ -764,7 +767,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
|
|
|
764
767
|
) ) {
|
|
765
768
|
// Add directives to the parent `<li>`.
|
|
766
769
|
$tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
|
|
767
|
-
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": {}, "type": "submenu" }' );
|
|
770
|
+
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu" }' );
|
|
768
771
|
$tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
|
|
769
772
|
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
|
|
770
773
|
$tags->set_attribute( 'data-wp-on--keydown', 'actions.handleMenuKeydown' );
|
|
@@ -1454,13 +1457,18 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
|
|
|
1454
1457
|
/**
|
|
1455
1458
|
* Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API.
|
|
1456
1459
|
*
|
|
1457
|
-
* @param
|
|
1460
|
+
* @param stdClass $post Post object.
|
|
1458
1461
|
*/
|
|
1459
1462
|
function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
|
1460
1463
|
// We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
|
|
1461
1464
|
// all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
|
|
1462
1465
|
$blocks = parse_blocks( $post->post_content );
|
|
1463
|
-
|
|
1466
|
+
|
|
1467
|
+
// Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
|
|
1468
|
+
// we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
|
|
1469
|
+
// used as context for hooked blocks insertion).
|
|
1470
|
+
// We thus have to look it up from the DB,based on `$post->ID`.
|
|
1471
|
+
$markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, get_post( $post->ID ) );
|
|
1464
1472
|
|
|
1465
1473
|
$root_nav_block = parse_blocks( $markup )[0];
|
|
1466
1474
|
$ignored_hooked_blocks = isset( $root_nav_block['attrs']['metadata']['ignoredHookedBlocks'] )
|
|
@@ -1476,14 +1484,8 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
|
|
1476
1484
|
update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
|
|
1477
1485
|
}
|
|
1478
1486
|
|
|
1479
|
-
$
|
|
1480
|
-
|
|
1481
|
-
wp_update_post(
|
|
1482
|
-
array(
|
|
1483
|
-
'ID' => $post->ID,
|
|
1484
|
-
'post_content' => $serialized_inner_blocks,
|
|
1485
|
-
)
|
|
1486
|
-
);
|
|
1487
|
+
$post->post_content = block_core_navigation_remove_serialized_parent_block( $markup );
|
|
1488
|
+
return $post;
|
|
1487
1489
|
}
|
|
1488
1490
|
|
|
1489
1491
|
// Before adding our filter, we verify if it's already added in Core.
|
|
@@ -1493,8 +1495,15 @@ $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ig
|
|
|
1493
1495
|
|
|
1494
1496
|
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
|
1495
1497
|
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
|
1496
|
-
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( '
|
|
1497
|
-
|
|
1498
|
+
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
|
1499
|
+
add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10 );
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
// Previous versions of Gutenberg and WordPress 6.5 Betas were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
|
|
1503
|
+
// function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
|
|
1504
|
+
// To avoid collisions, we need to remove the filter from that action if it's present.
|
|
1505
|
+
if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
|
1506
|
+
remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback, 10 );
|
|
1498
1507
|
}
|
|
1499
1508
|
|
|
1500
1509
|
/**
|
|
@@ -137,7 +137,7 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
|
|
|
137
137
|
clientId={ clientId }
|
|
138
138
|
isAppender={ false }
|
|
139
139
|
prioritizePatterns={ false }
|
|
140
|
-
selectBlockOnInsert
|
|
140
|
+
selectBlockOnInsert
|
|
141
141
|
hasSearch={ false }
|
|
142
142
|
onSelect={ onSelectBlock }
|
|
143
143
|
/>
|
|
@@ -247,7 +247,7 @@ export function LinkUI( props ) {
|
|
|
247
247
|
hasTextControl
|
|
248
248
|
hasRichPreviews
|
|
249
249
|
value={ link }
|
|
250
|
-
showInitialSuggestions
|
|
250
|
+
showInitialSuggestions
|
|
251
251
|
withCreateSuggestion={ userCanCreate }
|
|
252
252
|
createSuggestion={ handleCreate }
|
|
253
253
|
createSuggestionButtonText={ ( searchTerm ) => {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
initializeEditor,
|
|
13
13
|
render,
|
|
14
14
|
setupCoreBlocks,
|
|
15
|
+
triggerBlockListLayout,
|
|
15
16
|
waitFor,
|
|
16
17
|
within,
|
|
17
18
|
withFakeTimers,
|
|
@@ -213,6 +214,41 @@ describe( 'Paragraph block', () => {
|
|
|
213
214
|
` );
|
|
214
215
|
} );
|
|
215
216
|
|
|
217
|
+
it( 'should inherit parent alignment', async () => {
|
|
218
|
+
// Arrange
|
|
219
|
+
const screen = await initializeEditor();
|
|
220
|
+
await addBlock( screen, 'Quote' );
|
|
221
|
+
await triggerBlockListLayout( getBlock( screen, 'Quote' ) );
|
|
222
|
+
|
|
223
|
+
// Act
|
|
224
|
+
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
225
|
+
fireEvent.press( paragraphBlock );
|
|
226
|
+
const paragraphTextInput =
|
|
227
|
+
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
228
|
+
typeInRichText(
|
|
229
|
+
paragraphTextInput,
|
|
230
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
231
|
+
);
|
|
232
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
233
|
+
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
234
|
+
fireEvent.press( screen.getByLabelText( 'Align text right' ) );
|
|
235
|
+
|
|
236
|
+
// Assert
|
|
237
|
+
// This not an ideal assertion, as it relies implementation details of the
|
|
238
|
+
// component: prop names. However, the only aspect we can assert is the prop
|
|
239
|
+
// passed to Aztec, the native module controlling visual alignment. A less
|
|
240
|
+
// brittle alternative might be snapshotting, but RNTL does not yet support
|
|
241
|
+
// focused snapshots, which means the snapshot would be huge.
|
|
242
|
+
// https://github.com/facebook/react/pull/25329
|
|
243
|
+
expect(
|
|
244
|
+
screen.UNSAFE_queryAllByProps( {
|
|
245
|
+
value: '<p>A quick brown fox jumps over the lazy dog.</p>',
|
|
246
|
+
placeholder: 'Start writing…',
|
|
247
|
+
textAlign: 'right',
|
|
248
|
+
} ).length
|
|
249
|
+
).toBe( 2 ); // One for Aztec mock, one for the TextInput.
|
|
250
|
+
} );
|
|
251
|
+
|
|
216
252
|
it( 'should preserve alignment when split', async () => {
|
|
217
253
|
// Arrange
|
|
218
254
|
const screen = await initializeEditor();
|
package/src/pattern/edit.js
CHANGED
|
@@ -97,6 +97,20 @@ const PatternEdit = ( { attributes, clientId } ) => {
|
|
|
97
97
|
injectThemeAttributeInBlockTemplateContent( block )
|
|
98
98
|
)
|
|
99
99
|
);
|
|
100
|
+
// If the pattern has a single block and categories, we should add the
|
|
101
|
+
// categories of the pattern to the block's metadata.
|
|
102
|
+
if (
|
|
103
|
+
clonedBlocks.length === 1 &&
|
|
104
|
+
selectedPattern.categories?.length > 0
|
|
105
|
+
) {
|
|
106
|
+
clonedBlocks[ 0 ].attributes = {
|
|
107
|
+
...clonedBlocks[ 0 ].attributes,
|
|
108
|
+
metadata: {
|
|
109
|
+
...clonedBlocks[ 0 ].attributes.metadata,
|
|
110
|
+
categories: selectedPattern.categories,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
100
114
|
const rootEditingMode = getBlockEditingMode( rootClientId );
|
|
101
115
|
registry.batch( () => {
|
|
102
116
|
// Temporarily set the root block to default mode to allow replacing the pattern.
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -135,7 +135,7 @@ export default function PostExcerptEditor( {
|
|
|
135
135
|
onChange={ ( newMoreText ) =>
|
|
136
136
|
setAttributes( { moreText: newMoreText } )
|
|
137
137
|
}
|
|
138
|
-
withoutInteractiveFormatting
|
|
138
|
+
withoutInteractiveFormatting
|
|
139
139
|
/>
|
|
140
140
|
);
|
|
141
141
|
const excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {
|
|
@@ -83,7 +83,7 @@ const DimensionControls = ( {
|
|
|
83
83
|
resetAllFilter={ () => ( {
|
|
84
84
|
aspectRatio: undefined,
|
|
85
85
|
} ) }
|
|
86
|
-
isShownByDefault
|
|
86
|
+
isShownByDefault
|
|
87
87
|
panelId={ clientId }
|
|
88
88
|
>
|
|
89
89
|
<SelectControl
|
|
@@ -138,7 +138,7 @@ const DimensionControls = ( {
|
|
|
138
138
|
resetAllFilter={ () => ( {
|
|
139
139
|
height: undefined,
|
|
140
140
|
} ) }
|
|
141
|
-
isShownByDefault
|
|
141
|
+
isShownByDefault
|
|
142
142
|
panelId={ clientId }
|
|
143
143
|
>
|
|
144
144
|
<UnitControl
|
|
@@ -160,7 +160,7 @@ const DimensionControls = ( {
|
|
|
160
160
|
resetAllFilter={ () => ( {
|
|
161
161
|
width: undefined,
|
|
162
162
|
} ) }
|
|
163
|
-
isShownByDefault
|
|
163
|
+
isShownByDefault
|
|
164
164
|
panelId={ clientId }
|
|
165
165
|
>
|
|
166
166
|
<UnitControl
|
|
@@ -186,7 +186,7 @@ const DimensionControls = ( {
|
|
|
186
186
|
resetAllFilter={ () => ( {
|
|
187
187
|
scale: DEFAULT_SCALE,
|
|
188
188
|
} ) }
|
|
189
|
-
isShownByDefault
|
|
189
|
+
isShownByDefault
|
|
190
190
|
panelId={ clientId }
|
|
191
191
|
>
|
|
192
192
|
<ToggleGroupControl
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
useBlockProps,
|
|
25
25
|
store as blockEditorStore,
|
|
26
26
|
__experimentalUseBorderProps as useBorderProps,
|
|
27
|
+
useBlockEditingMode,
|
|
27
28
|
} from '@wordpress/block-editor';
|
|
28
29
|
import { useMemo } from '@wordpress/element';
|
|
29
30
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -143,6 +144,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
143
144
|
style: { width, height, aspectRatio },
|
|
144
145
|
} );
|
|
145
146
|
const borderProps = useBorderProps( attributes );
|
|
147
|
+
const blockEditingMode = useBlockEditingMode();
|
|
146
148
|
|
|
147
149
|
const placeholder = ( content ) => {
|
|
148
150
|
return (
|
|
@@ -151,7 +153,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
151
153
|
'block-editor-media-placeholder',
|
|
152
154
|
borderProps.className
|
|
153
155
|
) }
|
|
154
|
-
withIllustration
|
|
156
|
+
withIllustration
|
|
155
157
|
style={ {
|
|
156
158
|
height: !! aspectRatio && '100%',
|
|
157
159
|
width: !! aspectRatio && '100%',
|
|
@@ -174,8 +176,13 @@ export default function PostFeaturedImageEdit( {
|
|
|
174
176
|
createErrorNotice( message, { type: 'snackbar' } );
|
|
175
177
|
};
|
|
176
178
|
|
|
177
|
-
const controls = (
|
|
179
|
+
const controls = blockEditingMode === 'default' && (
|
|
178
180
|
<>
|
|
181
|
+
<Overlay
|
|
182
|
+
attributes={ attributes }
|
|
183
|
+
setAttributes={ setAttributes }
|
|
184
|
+
clientId={ clientId }
|
|
185
|
+
/>
|
|
179
186
|
<DimensionControls
|
|
180
187
|
clientId={ clientId }
|
|
181
188
|
attributes={ attributes }
|
|
@@ -224,6 +231,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
224
231
|
</InspectorControls>
|
|
225
232
|
</>
|
|
226
233
|
);
|
|
234
|
+
|
|
227
235
|
let image;
|
|
228
236
|
|
|
229
237
|
/**
|
|
@@ -251,11 +259,6 @@ export default function PostFeaturedImageEdit( {
|
|
|
251
259
|
) : (
|
|
252
260
|
placeholder()
|
|
253
261
|
) }
|
|
254
|
-
<Overlay
|
|
255
|
-
attributes={ attributes }
|
|
256
|
-
setAttributes={ setAttributes }
|
|
257
|
-
clientId={ clientId }
|
|
258
|
-
/>
|
|
259
262
|
</div>
|
|
260
263
|
</>
|
|
261
264
|
);
|
|
@@ -360,11 +363,6 @@ export default function PostFeaturedImageEdit( {
|
|
|
360
363
|
) : (
|
|
361
364
|
image
|
|
362
365
|
) }
|
|
363
|
-
<Overlay
|
|
364
|
-
attributes={ attributes }
|
|
365
|
-
setAttributes={ setAttributes }
|
|
366
|
-
clientId={ clientId }
|
|
367
|
-
/>
|
|
368
366
|
</figure>
|
|
369
367
|
</>
|
|
370
368
|
);
|
|
@@ -207,7 +207,7 @@ export default function PostNavigationLinkEdit( {
|
|
|
207
207
|
{ isNext && displayArrow && (
|
|
208
208
|
<span
|
|
209
209
|
className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
|
|
210
|
-
aria-hidden
|
|
210
|
+
aria-hidden
|
|
211
211
|
>
|
|
212
212
|
{ displayArrow }
|
|
213
213
|
</span>
|
|
@@ -36,6 +36,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
|
|
|
36
36
|
*
|
|
37
37
|
* @since 6.3.0 Changed render_block_context priority to `1`.
|
|
38
38
|
*
|
|
39
|
+
* @global WP_Query $wp_query WordPress Query object.
|
|
40
|
+
*
|
|
39
41
|
* @param array $attributes Block attributes.
|
|
40
42
|
* @param string $content Block default content.
|
|
41
43
|
* @param WP_Block $block Block instance.
|
package/src/post-title/edit.js
CHANGED
|
@@ -115,53 +115,59 @@ export default function PostTitleEdit( {
|
|
|
115
115
|
return (
|
|
116
116
|
<>
|
|
117
117
|
{ blockEditingMode === 'default' && (
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<ToggleControl
|
|
136
|
-
__nextHasNoMarginBottom
|
|
137
|
-
label={ __( 'Make title a link' ) }
|
|
138
|
-
onChange={ () => setAttributes( { isLink: ! isLink } ) }
|
|
139
|
-
checked={ isLink }
|
|
140
|
-
/>
|
|
141
|
-
{ isLink && (
|
|
142
|
-
<>
|
|
118
|
+
<>
|
|
119
|
+
<BlockControls group="block">
|
|
120
|
+
<HeadingLevelDropdown
|
|
121
|
+
value={ level }
|
|
122
|
+
onChange={ ( newLevel ) =>
|
|
123
|
+
setAttributes( { level: newLevel } )
|
|
124
|
+
}
|
|
125
|
+
/>
|
|
126
|
+
<AlignmentControl
|
|
127
|
+
value={ textAlign }
|
|
128
|
+
onChange={ ( nextAlign ) => {
|
|
129
|
+
setAttributes( { textAlign: nextAlign } );
|
|
130
|
+
} }
|
|
131
|
+
/>
|
|
132
|
+
</BlockControls>
|
|
133
|
+
<InspectorControls>
|
|
134
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
143
135
|
<ToggleControl
|
|
144
136
|
__nextHasNoMarginBottom
|
|
145
|
-
label={ __( '
|
|
146
|
-
onChange={ (
|
|
147
|
-
setAttributes( {
|
|
148
|
-
linkTarget: value ? '_blank' : '_self',
|
|
149
|
-
} )
|
|
137
|
+
label={ __( 'Make title a link' ) }
|
|
138
|
+
onChange={ () =>
|
|
139
|
+
setAttributes( { isLink: ! isLink } )
|
|
150
140
|
}
|
|
151
|
-
checked={
|
|
141
|
+
checked={ isLink }
|
|
152
142
|
/>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
143
|
+
{ isLink && (
|
|
144
|
+
<>
|
|
145
|
+
<ToggleControl
|
|
146
|
+
__nextHasNoMarginBottom
|
|
147
|
+
label={ __( 'Open in new tab' ) }
|
|
148
|
+
onChange={ ( value ) =>
|
|
149
|
+
setAttributes( {
|
|
150
|
+
linkTarget: value
|
|
151
|
+
? '_blank'
|
|
152
|
+
: '_self',
|
|
153
|
+
} )
|
|
154
|
+
}
|
|
155
|
+
checked={ linkTarget === '_blank' }
|
|
156
|
+
/>
|
|
157
|
+
<TextControl
|
|
158
|
+
__nextHasNoMarginBottom
|
|
159
|
+
label={ __( 'Link rel' ) }
|
|
160
|
+
value={ rel }
|
|
161
|
+
onChange={ ( newRel ) =>
|
|
162
|
+
setAttributes( { rel: newRel } )
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
</>
|
|
166
|
+
) }
|
|
167
|
+
</PanelBody>
|
|
168
|
+
</InspectorControls>
|
|
169
|
+
</>
|
|
170
|
+
) }
|
|
165
171
|
{ titleElement }
|
|
166
172
|
</>
|
|
167
173
|
);
|
|
@@ -62,7 +62,7 @@ export default function PatternSelectionModal( {
|
|
|
62
62
|
overlayClassName="block-library-query-pattern__selection-modal"
|
|
63
63
|
title={ __( 'Choose a pattern' ) }
|
|
64
64
|
onRequestClose={ () => setIsPatternSelectionModalOpen( false ) }
|
|
65
|
-
isFullScreen
|
|
65
|
+
isFullScreen
|
|
66
66
|
>
|
|
67
67
|
<div className="block-library-query-pattern__selection-content">
|
|
68
68
|
<div className="block-library-query-pattern__selection-search">
|
package/src/query/utils.js
CHANGED
|
@@ -131,16 +131,18 @@ export const useTaxonomies = ( postType ) => {
|
|
|
131
131
|
const taxonomies = useSelect(
|
|
132
132
|
( select ) => {
|
|
133
133
|
const { getTaxonomies } = select( coreStore );
|
|
134
|
-
|
|
134
|
+
return getTaxonomies( {
|
|
135
135
|
type: postType,
|
|
136
136
|
per_page: -1,
|
|
137
|
-
context: 'view',
|
|
138
137
|
} );
|
|
139
|
-
return filteredTaxonomies;
|
|
140
138
|
},
|
|
141
139
|
[ postType ]
|
|
142
140
|
);
|
|
143
|
-
return
|
|
141
|
+
return useMemo( () => {
|
|
142
|
+
return taxonomies?.filter(
|
|
143
|
+
( { visibility } ) => !! visibility?.publicly_queryable
|
|
144
|
+
);
|
|
145
|
+
}, [ taxonomies ] );
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
/**
|