@wordpress/block-library 8.29.0 → 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/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 +65 -31
- 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/save.js +3 -1
- package/build/code/save.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 +2 -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/details/edit.js +1 -0
- package/build/details/edit.js.map +1 -1
- package/build/file/deprecated.js.map +1 -1
- package/build/file/edit.js +8 -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/index.js +4 -3
- package/build/heading/index.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/edit.js +33 -9
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +5 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.js +30 -11
- package/build/media-text/media-container.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/media-text/save.js +2 -2
- package/build/media-text/save.js.map +1 -1
- package/build/navigation/edit/index.js +23 -29
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +24 -23
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -4
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +15 -12
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +12 -10
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -0
- package/build/navigation-submenu/edit.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-author/edit.js +1 -0
- package/build/post-author/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -0
- 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 +12 -12
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +6 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/edit.js +1 -0
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-terms/edit.js +2 -0
- package/build/post-terms/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 +7 -7
- 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 +1 -0
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +3 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +2 -2
- 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 +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/icons/medium.js +1 -1
- package/build/social-link/icons/medium.js.map +1 -1
- package/build/social-link/icons/reddit.js +1 -1
- package/build/social-link/icons/reddit.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/deprecated.js +285 -175
- package/build/table/deprecated.js.map +1 -1
- package/build/table/index.js +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 +3 -8
- 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 +66 -32
- 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/save.js +3 -1
- package/build-module/code/save.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 +2 -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/details/edit.js +1 -0
- package/build-module/details/edit.js.map +1 -1
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/edit.js +9 -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/index.js +4 -3
- package/build-module/heading/index.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/edit.js +34 -10
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +5 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.js +31 -12
- package/build-module/media-text/media-container.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/media-text/save.js +2 -2
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/navigation/edit/index.js +24 -30
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -4
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +15 -12
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +13 -11
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -0
- package/build-module/navigation-submenu/edit.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-author/edit.js +1 -0
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -0
- 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 +13 -13
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +6 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -0
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +2 -0
- package/build-module/post-terms/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 +7 -7
- 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 +1 -0
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +3 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +2 -2
- 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 +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/icons/medium.js +1 -1
- package/build-module/social-link/icons/medium.js.map +1 -1
- package/build-module/social-link/icons/reddit.js +1 -1
- package/build-module/social-link/icons/reddit.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/deprecated.js +286 -176
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/index.js +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 +3 -8
- 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 +11 -2
- package/build-style/editor.css +11 -2
- package/build-style/file/editor-rtl.css +3 -0
- package/build-style/file/editor.css +3 -0
- package/build-style/group/editor-rtl.css +1 -1
- package/build-style/group/editor.css +1 -1
- package/build-style/media-text/editor-rtl.css +7 -1
- package/build-style/media-text/editor.css +7 -1
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +6 -3
- package/build-style/style.css +6 -3
- package/package.json +34 -34
- package/src/archives/index.php +4 -0
- package/src/audio/edit.js +9 -19
- package/src/audio/edit.native.js +3 -3
- package/src/avatar/edit.js +1 -1
- package/src/avatar/index.php +6 -0
- package/src/block/deprecated.js +76 -11
- package/src/block/edit.js +100 -32
- package/src/block/index.php +27 -12
- package/src/block/test/edit.native.js +67 -0
- 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 +17 -0
- package/src/categories/index.php +6 -0
- package/src/code/save.js +7 -1
- 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/comment-author-name/index.php +4 -0
- package/src/comment-content/index.php +4 -0
- package/src/comment-date/index.php +4 -0
- package/src/comment-edit-link/index.php +4 -0
- package/src/comment-reply-link/index.php +4 -0
- package/src/comment-template/index.php +4 -0
- package/src/comments/index.php +12 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-pagination-next/index.php +4 -0
- package/src/comments-pagination-numbers/index.php +4 -0
- package/src/comments-pagination-previous/index.php +4 -0
- package/src/comments-title/index.php +4 -0
- package/src/cover/edit/block-controls.js +16 -2
- package/src/cover/edit/index.js +6 -3
- 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/index.php +4 -0
- package/src/cover/style.scss +3 -2
- package/src/details/edit.js +1 -0
- package/src/file/deprecated.js +3 -3
- package/src/file/edit.js +10 -15
- package/src/file/edit.native.js +4 -4
- package/src/file/editor.scss +3 -0
- package/src/file/index.php +4 -0
- 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/index.php +6 -0
- 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/index.js +4 -3
- package/src/heading/index.php +4 -0
- package/src/heading/transforms.js +27 -8
- package/src/home-link/index.php +10 -0
- package/src/image/edit.js +13 -5
- package/src/image/edit.native.js +1 -1
- package/src/image/editor.scss +1 -0
- package/src/image/image.js +34 -22
- package/src/image/index.php +12 -1
- package/src/latest-comments/index.php +4 -0
- package/src/latest-posts/edit.native.js +1 -1
- package/src/latest-posts/index.php +8 -0
- 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/loginout/index.php +4 -0
- package/src/media-text/block.json +5 -0
- package/src/media-text/edit.js +70 -19
- package/src/media-text/editor.scss +7 -1
- package/src/media-text/index.php +70 -0
- package/src/media-text/media-container.js +49 -9
- package/src/media-text/media-container.native.js +5 -3
- package/src/media-text/save.js +2 -2
- 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 +68 -72
- package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
- package/src/navigation/edit/navigation-menu-selector.js +39 -21
- package/src/navigation/edit/placeholder/index.js +4 -4
- package/src/navigation/edit/test/navigation-menu-selector.js +77 -55
- package/src/navigation/index.php +118 -34
- package/src/navigation/test/use-navigation-menu.js +21 -21
- package/src/navigation/use-navigation-menu.js +23 -9
- package/src/navigation-link/edit.js +12 -13
- package/src/navigation-link/index.php +14 -0
- package/src/navigation-link/link-ui.js +2 -2
- package/src/navigation-submenu/edit.js +4 -0
- package/src/navigation-submenu/index.php +8 -0
- package/src/page-list/index.php +12 -0
- package/src/page-list-item/index.php +2 -0
- 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/pattern/index.php +2 -0
- package/src/post-author/edit.js +1 -0
- package/src/post-author/index.php +4 -0
- package/src/post-author-biography/index.php +4 -0
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/index.php +6 -0
- package/src/post-content/index.php +4 -0
- package/src/post-date/index.php +4 -0
- package/src/post-excerpt/edit.js +2 -1
- package/src/post-excerpt/index.php +4 -0
- package/src/post-featured-image/block.json +6 -0
- package/src/post-featured-image/dimension-controls.js +4 -4
- package/src/post-featured-image/edit.js +14 -12
- package/src/post-featured-image/index.php +15 -0
- package/src/post-navigation-link/edit.js +2 -1
- package/src/post-navigation-link/index.php +4 -0
- package/src/post-template/index.php +6 -0
- package/src/post-terms/edit.js +2 -0
- package/src/post-terms/index.php +6 -0
- package/src/post-title/edit.js +49 -43
- package/src/post-title/index.php +2 -0
- package/src/query/edit/pattern-selection-modal.js +1 -1
- package/src/query/index.php +2 -0
- package/src/query/utils.js +6 -4
- package/src/query-no-results/index.php +4 -0
- package/src/query-pagination/index.php +4 -0
- package/src/query-pagination-next/edit.js +1 -1
- package/src/query-pagination-next/index.php +4 -0
- package/src/query-pagination-numbers/index.php +4 -0
- package/src/query-pagination-previous/edit.js +1 -1
- package/src/query-pagination-previous/index.php +4 -0
- package/src/query-title/index.php +4 -0
- package/src/quote/block.json +1 -1
- package/src/quote/deprecated.js +110 -15
- package/src/quote/edit.js +16 -10
- package/src/quote/save.js +2 -2
- package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/read-more/edit.js +2 -1
- package/src/read-more/index.php +4 -0
- package/src/rss/index.php +4 -0
- package/src/search/edit.js +3 -1
- package/src/search/edit.native.js +6 -6
- package/src/search/index.php +20 -2
- package/src/search/style.scss +2 -0
- package/src/shortcode/index.php +4 -0
- package/src/site-logo/edit.js +11 -6
- package/src/site-logo/index.php +20 -0
- package/src/site-tagline/index.php +4 -0
- package/src/site-title/index.php +4 -0
- package/src/social-link/edit.js +2 -2
- package/src/social-link/icons/medium.js +1 -1
- package/src/social-link/icons/reddit.js +1 -1
- package/src/social-link/index.php +22 -9
- package/src/social-link/socials-with-bg.scss +1 -1
- package/src/social-link/socials-without-bg.scss +1 -1
- package/src/social-links/edit.native.js +1 -1
- package/src/spacer/edit.js +1 -1
- package/src/table/block.json +1 -1
- package/src/table/deprecated.js +308 -175
- package/src/table-of-contents/edit.js +1 -1
- package/src/tag-cloud/index.php +4 -0
- 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/template-part/index.php +10 -0
- package/src/term-description/index.php +4 -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 +7 -8
- package/src/video/test/edit.native.js +0 -14
- package/tsconfig.json +1 -0
- 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
package/src/block/edit.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
BlockControls,
|
|
29
29
|
} from '@wordpress/block-editor';
|
|
30
30
|
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
31
|
-
import { parse, cloneBlock } from '@wordpress/blocks';
|
|
31
|
+
import { parse, cloneBlock, store as blocksStore } from '@wordpress/blocks';
|
|
32
32
|
import { RichTextData } from '@wordpress/rich-text';
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -42,6 +42,25 @@ const { PARTIAL_SYNCING_SUPPORTED_BLOCKS } = unlock( patternsPrivateApis );
|
|
|
42
42
|
|
|
43
43
|
const fullAlignments = [ 'full', 'wide', 'left', 'right' ];
|
|
44
44
|
|
|
45
|
+
function getLegacyIdMap( blocks, content, nameCount = {} ) {
|
|
46
|
+
let idToClientIdMap = {};
|
|
47
|
+
for ( const block of blocks ) {
|
|
48
|
+
if ( block?.innerBlocks?.length ) {
|
|
49
|
+
idToClientIdMap = {
|
|
50
|
+
...idToClientIdMap,
|
|
51
|
+
...getLegacyIdMap( block.innerBlocks, content, nameCount ),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const id = block.attributes.metadata?.id;
|
|
56
|
+
const clientId = block.clientId;
|
|
57
|
+
if ( id && content?.[ id ] ) {
|
|
58
|
+
idToClientIdMap[ clientId ] = id;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return idToClientIdMap;
|
|
62
|
+
}
|
|
63
|
+
|
|
45
64
|
const useInferredLayout = ( blocks, parentLayout ) => {
|
|
46
65
|
const initialInferredAlignmentRef = useRef();
|
|
47
66
|
|
|
@@ -101,25 +120,31 @@ function getOverridableAttributes( block ) {
|
|
|
101
120
|
function applyInitialContentValuesToInnerBlocks(
|
|
102
121
|
blocks,
|
|
103
122
|
content = {},
|
|
104
|
-
defaultValues
|
|
123
|
+
defaultValues,
|
|
124
|
+
legacyIdMap
|
|
105
125
|
) {
|
|
106
126
|
return blocks.map( ( block ) => {
|
|
107
127
|
const innerBlocks = applyInitialContentValuesToInnerBlocks(
|
|
108
128
|
block.innerBlocks,
|
|
109
129
|
content,
|
|
110
|
-
defaultValues
|
|
130
|
+
defaultValues,
|
|
131
|
+
legacyIdMap
|
|
111
132
|
);
|
|
112
|
-
const
|
|
113
|
-
|
|
133
|
+
const metadataName =
|
|
134
|
+
legacyIdMap?.[ block.clientId ] ?? block.attributes.metadata?.name;
|
|
135
|
+
|
|
136
|
+
if ( ! metadataName || ! hasOverridableAttributes( block ) ) {
|
|
114
137
|
return { ...block, innerBlocks };
|
|
138
|
+
}
|
|
139
|
+
|
|
115
140
|
const attributes = getOverridableAttributes( block );
|
|
116
141
|
const newAttributes = { ...block.attributes };
|
|
117
142
|
for ( const attributeKey of attributes ) {
|
|
118
|
-
defaultValues[
|
|
119
|
-
defaultValues[
|
|
143
|
+
defaultValues[ metadataName ] ??= {};
|
|
144
|
+
defaultValues[ metadataName ][ attributeKey ] =
|
|
120
145
|
block.attributes[ attributeKey ];
|
|
121
146
|
|
|
122
|
-
const contentValues = content[
|
|
147
|
+
const contentValues = content[ metadataName ];
|
|
123
148
|
if ( contentValues?.[ attributeKey ] !== undefined ) {
|
|
124
149
|
newAttributes[ attributeKey ] = contentValues[ attributeKey ];
|
|
125
150
|
}
|
|
@@ -142,29 +167,40 @@ function isAttributeEqual( attribute1, attribute2 ) {
|
|
|
142
167
|
return attribute1 === attribute2;
|
|
143
168
|
}
|
|
144
169
|
|
|
145
|
-
function getContentValuesFromInnerBlocks( blocks, defaultValues ) {
|
|
170
|
+
function getContentValuesFromInnerBlocks( blocks, defaultValues, legacyIdMap ) {
|
|
146
171
|
/** @type {Record<string, { values: Record<string, unknown>}>} */
|
|
147
172
|
const content = {};
|
|
148
173
|
for ( const block of blocks ) {
|
|
149
174
|
if ( block.name === patternBlockName ) continue;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
175
|
+
if ( block.innerBlocks.length ) {
|
|
176
|
+
Object.assign(
|
|
177
|
+
content,
|
|
178
|
+
getContentValuesFromInnerBlocks(
|
|
179
|
+
block.innerBlocks,
|
|
180
|
+
defaultValues,
|
|
181
|
+
legacyIdMap
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const metadataName =
|
|
186
|
+
legacyIdMap?.[ block.clientId ] ?? block.attributes.metadata?.name;
|
|
187
|
+
if ( ! metadataName || ! hasOverridableAttributes( block ) ) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
|
|
156
191
|
const attributes = getOverridableAttributes( block );
|
|
192
|
+
|
|
157
193
|
for ( const attributeKey of attributes ) {
|
|
158
194
|
if (
|
|
159
195
|
! isAttributeEqual(
|
|
160
196
|
block.attributes[ attributeKey ],
|
|
161
|
-
defaultValues[
|
|
197
|
+
defaultValues?.[ metadataName ]?.[ attributeKey ]
|
|
162
198
|
)
|
|
163
199
|
) {
|
|
164
|
-
content[
|
|
200
|
+
content[ metadataName ] ??= {};
|
|
165
201
|
// TODO: We need a way to represent `undefined` in the serialized overrides.
|
|
166
202
|
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
|
|
167
|
-
content[
|
|
203
|
+
content[ metadataName ][ attributeKey ] =
|
|
168
204
|
block.attributes[ attributeKey ] === undefined
|
|
169
205
|
? // TODO: We use an empty string to represent undefined for now until
|
|
170
206
|
// we support a richer format for overrides and the block binding API.
|
|
@@ -229,6 +265,7 @@ export default function ReusableBlockEdit( {
|
|
|
229
265
|
getBlockEditingMode,
|
|
230
266
|
onNavigateToEntityRecord,
|
|
231
267
|
editingMode,
|
|
268
|
+
hasPatternOverridesSource,
|
|
232
269
|
} = useSelect(
|
|
233
270
|
( select ) => {
|
|
234
271
|
const { canUser } = select( coreStore );
|
|
@@ -237,6 +274,7 @@ export default function ReusableBlockEdit( {
|
|
|
237
274
|
getSettings,
|
|
238
275
|
getBlockEditingMode: _getBlockEditingMode,
|
|
239
276
|
} = select( blockEditorStore );
|
|
277
|
+
const { getBlockBindingsSource } = unlock( select( blocksStore ) );
|
|
240
278
|
const blocks = getBlocks( patternClientId );
|
|
241
279
|
const canEdit = canUser( 'update', 'blocks', ref );
|
|
242
280
|
|
|
@@ -248,6 +286,9 @@ export default function ReusableBlockEdit( {
|
|
|
248
286
|
onNavigateToEntityRecord:
|
|
249
287
|
getSettings().onNavigateToEntityRecord,
|
|
250
288
|
editingMode: _getBlockEditingMode( patternClientId ),
|
|
289
|
+
hasPatternOverridesSource: !! getBlockBindingsSource(
|
|
290
|
+
'core/pattern-overrides'
|
|
291
|
+
),
|
|
251
292
|
};
|
|
252
293
|
},
|
|
253
294
|
[ patternClientId, ref ]
|
|
@@ -259,13 +300,20 @@ export default function ReusableBlockEdit( {
|
|
|
259
300
|
setBlockEditingMode,
|
|
260
301
|
innerBlocks,
|
|
261
302
|
// Disable editing if the pattern itself is disabled.
|
|
262
|
-
editingMode === 'disabled'
|
|
303
|
+
editingMode === 'disabled' || ! hasPatternOverridesSource
|
|
304
|
+
? 'disabled'
|
|
305
|
+
: undefined
|
|
263
306
|
);
|
|
264
|
-
}, [
|
|
307
|
+
}, [
|
|
308
|
+
editingMode,
|
|
309
|
+
innerBlocks,
|
|
310
|
+
setBlockEditingMode,
|
|
311
|
+
hasPatternOverridesSource,
|
|
312
|
+
] );
|
|
265
313
|
|
|
266
314
|
const canOverrideBlocks = useMemo(
|
|
267
|
-
() => hasOverridableBlocks( innerBlocks ),
|
|
268
|
-
[ innerBlocks ]
|
|
315
|
+
() => hasPatternOverridesSource && hasOverridableBlocks( innerBlocks ),
|
|
316
|
+
[ hasPatternOverridesSource, innerBlocks ]
|
|
269
317
|
);
|
|
270
318
|
|
|
271
319
|
const initialBlocks = useMemo(
|
|
@@ -278,26 +326,36 @@ export default function ReusableBlockEdit( {
|
|
|
278
326
|
[ editedRecord.blocks, editedRecord.content ]
|
|
279
327
|
);
|
|
280
328
|
|
|
329
|
+
const legacyIdMap = useRef( {} );
|
|
330
|
+
|
|
281
331
|
// Apply the initial overrides from the pattern block to the inner blocks.
|
|
282
332
|
useEffect( () => {
|
|
333
|
+
// Build a map of clientIds to the old nano id system to provide back compat.
|
|
334
|
+
legacyIdMap.current = getLegacyIdMap(
|
|
335
|
+
initialBlocks,
|
|
336
|
+
initialContent.current
|
|
337
|
+
);
|
|
283
338
|
defaultContent.current = {};
|
|
284
339
|
const originalEditingMode = getBlockEditingMode( patternClientId );
|
|
285
340
|
// Replace the contents of the blocks with the overrides.
|
|
286
341
|
registry.batch( () => {
|
|
287
342
|
setBlockEditingMode( patternClientId, 'default' );
|
|
288
343
|
syncDerivedUpdates( () => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
344
|
+
const blocks = hasPatternOverridesSource
|
|
345
|
+
? applyInitialContentValuesToInnerBlocks(
|
|
346
|
+
initialBlocks,
|
|
347
|
+
initialContent.current,
|
|
348
|
+
defaultContent.current,
|
|
349
|
+
legacyIdMap.current
|
|
350
|
+
)
|
|
351
|
+
: initialBlocks;
|
|
352
|
+
|
|
353
|
+
replaceInnerBlocks( patternClientId, blocks );
|
|
297
354
|
} );
|
|
298
355
|
setBlockEditingMode( patternClientId, originalEditingMode );
|
|
299
356
|
} );
|
|
300
357
|
}, [
|
|
358
|
+
hasPatternOverridesSource,
|
|
301
359
|
__unstableMarkNextChangeAsNotPersistent,
|
|
302
360
|
patternClientId,
|
|
303
361
|
initialBlocks,
|
|
@@ -333,6 +391,9 @@ export default function ReusableBlockEdit( {
|
|
|
333
391
|
// Sync the `content` attribute from the updated blocks to the pattern block.
|
|
334
392
|
// `syncDerivedUpdates` is used here to avoid creating an additional undo level.
|
|
335
393
|
useEffect( () => {
|
|
394
|
+
if ( ! hasPatternOverridesSource ) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
336
397
|
const { getBlocks } = registry.select( blockEditorStore );
|
|
337
398
|
let prevBlocks = getBlocks( patternClientId );
|
|
338
399
|
return registry.subscribe( () => {
|
|
@@ -343,13 +404,20 @@ export default function ReusableBlockEdit( {
|
|
|
343
404
|
setAttributes( {
|
|
344
405
|
content: getContentValuesFromInnerBlocks(
|
|
345
406
|
blocks,
|
|
346
|
-
defaultContent.current
|
|
407
|
+
defaultContent.current,
|
|
408
|
+
legacyIdMap.current
|
|
347
409
|
),
|
|
348
410
|
} );
|
|
349
411
|
} );
|
|
350
412
|
}
|
|
351
413
|
}, blockEditorStore );
|
|
352
|
-
}, [
|
|
414
|
+
}, [
|
|
415
|
+
hasPatternOverridesSource,
|
|
416
|
+
syncDerivedUpdates,
|
|
417
|
+
patternClientId,
|
|
418
|
+
registry,
|
|
419
|
+
setAttributes,
|
|
420
|
+
] );
|
|
353
421
|
|
|
354
422
|
const handleEditOriginal = () => {
|
|
355
423
|
onNavigateToEntityRecord( {
|
package/src/block/index.php
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/block` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.0.0
|
|
12
|
+
*
|
|
13
|
+
* @global WP_Embed $wp_embed
|
|
14
|
+
*
|
|
11
15
|
* @param array $attributes The block attributes.
|
|
12
16
|
*
|
|
13
17
|
* @return string Rendered HTML of the referenced block.
|
|
@@ -46,26 +50,35 @@ function render_block_core_block( $attributes ) {
|
|
|
46
50
|
$content = $wp_embed->run_shortcode( $reusable_block->post_content );
|
|
47
51
|
$content = $wp_embed->autoembed( $content );
|
|
48
52
|
|
|
49
|
-
// Back compat
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
// Back compat.
|
|
54
|
+
// For blocks that have not been migrated in the editor, add some back compat
|
|
55
|
+
// so that front-end rendering continues to work.
|
|
56
|
+
|
|
57
|
+
// This matches the `v2` deprecation. Removes the inner `values` property
|
|
58
|
+
// from every item.
|
|
59
|
+
if ( isset( $attributes['content'] ) ) {
|
|
60
|
+
foreach ( $attributes['content'] as &$content_data ) {
|
|
61
|
+
if ( isset( $content_data['values'] ) ) {
|
|
62
|
+
$is_assoc_array = is_array( $content_data['values'] ) && ! wp_is_numeric_array( $content_data['values'] );
|
|
63
|
+
|
|
64
|
+
if ( $is_assoc_array ) {
|
|
65
|
+
$content_data = $content_data['values'];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
|
-
$attributes['content'] = $migrated_content;
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
|
|
71
|
+
// This matches the `v1` deprecation. Rename `overrides` to `content`.
|
|
72
|
+
if ( isset( $attributes['overrides'] ) && ! isset( $attributes['content'] ) ) {
|
|
73
|
+
$attributes['content'] = $attributes['overrides'];
|
|
74
|
+
}
|
|
63
75
|
|
|
64
76
|
/**
|
|
65
77
|
* We set the `pattern/overrides` context through the `render_block_context`
|
|
66
78
|
* filter so that it is available when a pattern's inner blocks are
|
|
67
79
|
* rendering via do_blocks given it only receives the inner content.
|
|
68
80
|
*/
|
|
81
|
+
$has_pattern_overrides = isset( $attributes['content'] );
|
|
69
82
|
if ( $has_pattern_overrides ) {
|
|
70
83
|
$filter_block_context = static function ( $context ) use ( $attributes ) {
|
|
71
84
|
$context['pattern/overrides'] = $attributes['content'];
|
|
@@ -86,6 +99,8 @@ function render_block_core_block( $attributes ) {
|
|
|
86
99
|
|
|
87
100
|
/**
|
|
88
101
|
* Registers the `core/block` block.
|
|
102
|
+
*
|
|
103
|
+
* @since 5.3.0
|
|
89
104
|
*/
|
|
90
105
|
function register_block_core_block() {
|
|
91
106
|
register_block_type_from_metadata(
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
initializeEditor,
|
|
7
7
|
fireEvent,
|
|
8
8
|
within,
|
|
9
|
+
setupApiFetch,
|
|
10
|
+
triggerBlockListLayout,
|
|
9
11
|
} from 'test/helpers';
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -42,6 +44,7 @@ const getMockedReusableBlock = ( id ) => ( {
|
|
|
42
44
|
id,
|
|
43
45
|
title: { raw: `Reusable block - ${ id }` },
|
|
44
46
|
type: 'wp_block',
|
|
47
|
+
meta: { footnotes: '' },
|
|
45
48
|
} );
|
|
46
49
|
|
|
47
50
|
beforeAll( () => {
|
|
@@ -187,4 +190,68 @@ describe( 'Synced patterns', () => {
|
|
|
187
190
|
expect( reusableBlock ).toBeDefined();
|
|
188
191
|
expect( headingInnerBlock ).toBeDefined();
|
|
189
192
|
} );
|
|
193
|
+
|
|
194
|
+
it( 'renders block after content is updated due to a side effect', async () => {
|
|
195
|
+
// We have to use different ids because entities are cached in memory.
|
|
196
|
+
const id = 5;
|
|
197
|
+
const initialHtml = `<!-- wp:block {"ref":${ id }} /-->`;
|
|
198
|
+
const endpoint = `/wp/v2/blocks/${ id }`;
|
|
199
|
+
const fetchMedia = {
|
|
200
|
+
request: {
|
|
201
|
+
path: `/wp/v2/media/1?context=edit`,
|
|
202
|
+
},
|
|
203
|
+
response: {
|
|
204
|
+
source_url: 'https://cldup.com/cXyG__fTLN.jpg',
|
|
205
|
+
id: 1,
|
|
206
|
+
// We need to include the sizes to trigger the side effect.
|
|
207
|
+
media_details: {
|
|
208
|
+
sizes: {
|
|
209
|
+
large: {
|
|
210
|
+
source_url:
|
|
211
|
+
'https://cldup.com/cXyG__fTLN.jpg?w=500',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// Return mocked response for the block endpoint.
|
|
219
|
+
fetchRequest.mockImplementation( ( { path } ) => {
|
|
220
|
+
let response = {};
|
|
221
|
+
if ( path.startsWith( endpoint ) ) {
|
|
222
|
+
response = getMockedReusableBlock( id );
|
|
223
|
+
}
|
|
224
|
+
// Replace content with an Image block to trigger a side effect.
|
|
225
|
+
// The side effect will be produced when the `source` attribute is replaced
|
|
226
|
+
// with an URL that includes the width query parameter:
|
|
227
|
+
// https://cldup.com/cXyG__fTLN.jpg => https://cldup.com/cXyG__fTLN.jpg?w=500
|
|
228
|
+
response.content.raw = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none"} -->
|
|
229
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></figure>
|
|
230
|
+
<!-- /wp:image -->`;
|
|
231
|
+
return Promise.resolve( response );
|
|
232
|
+
} );
|
|
233
|
+
|
|
234
|
+
const screen = await initializeEditor( {
|
|
235
|
+
initialHtml,
|
|
236
|
+
} );
|
|
237
|
+
|
|
238
|
+
const reusableBlock = await screen.findByLabelText(
|
|
239
|
+
/Pattern Block\. Row 1/
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
// Mock media fetch requests
|
|
243
|
+
setupApiFetch( [ fetchMedia ] );
|
|
244
|
+
|
|
245
|
+
await triggerBlockListLayout(
|
|
246
|
+
within( reusableBlock ).getByTestId( 'block-list-wrapper' )
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const imageBlock =
|
|
250
|
+
await within( reusableBlock ).getByLabelText(
|
|
251
|
+
'Image Block. Row 1'
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
expect( reusableBlock ).toBeDefined();
|
|
255
|
+
expect( imageBlock ).toBeDefined();
|
|
256
|
+
} );
|
|
190
257
|
} );
|
package/src/button/edit.js
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
createBlock,
|
|
46
46
|
cloneBlock,
|
|
47
47
|
getDefaultBlockName,
|
|
48
|
+
store as blocksStore,
|
|
48
49
|
} from '@wordpress/blocks';
|
|
49
50
|
import { useMergeRefs, useRefEffect } from '@wordpress/compose';
|
|
50
51
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -123,7 +124,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
|
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
return (
|
|
126
|
-
<PanelBody title={ __( '
|
|
127
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
127
128
|
<ButtonGroup aria-label={ __( 'Button width' ) }>
|
|
128
129
|
{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {
|
|
129
130
|
return (
|
|
@@ -239,7 +240,7 @@ function ButtonEdit( props ) {
|
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
const blockBindingsSource = unlock(
|
|
242
|
-
select(
|
|
243
|
+
select( blocksStore )
|
|
243
244
|
).getBlockBindingsSource( metadata?.bindings?.url?.source );
|
|
244
245
|
|
|
245
246
|
return {
|
|
@@ -328,7 +329,7 @@ function ButtonEdit( props ) {
|
|
|
328
329
|
title={ __( 'Unlink' ) }
|
|
329
330
|
shortcut={ displayShortcut.primaryShift( 'k' ) }
|
|
330
331
|
onClick={ unlink }
|
|
331
|
-
isActive
|
|
332
|
+
isActive
|
|
332
333
|
/>
|
|
333
334
|
) }
|
|
334
335
|
</BlockControls>
|
|
@@ -106,7 +106,7 @@ export default function ButtonsEdit( {
|
|
|
106
106
|
const renderFooterAppender = useRef( () => (
|
|
107
107
|
<View style={ styles.appenderContainer }>
|
|
108
108
|
<InnerBlocks.ButtonBlockAppender
|
|
109
|
-
isFloating
|
|
109
|
+
isFloating
|
|
110
110
|
onAddBlock={ onAddNextButton }
|
|
111
111
|
/>
|
|
112
112
|
</View>
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
5
|
import { __unstableCreateElement as createElement } from '@wordpress/rich-text';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { getTransformedMetadata } from '../utils/get-transformed-metadata';
|
|
11
|
+
|
|
7
12
|
const transforms = {
|
|
8
13
|
from: [
|
|
9
14
|
{
|
|
@@ -33,10 +38,8 @@ const transforms = {
|
|
|
33
38
|
{},
|
|
34
39
|
// Loop the selected buttons.
|
|
35
40
|
buttons.map( ( attributes ) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
attributes.content
|
|
39
|
-
);
|
|
41
|
+
const { content, metadata } = attributes;
|
|
42
|
+
const element = createElement( document, content );
|
|
40
43
|
// Remove any HTML tags.
|
|
41
44
|
const text = element.innerText || '';
|
|
42
45
|
// Get first url.
|
|
@@ -46,6 +49,13 @@ const transforms = {
|
|
|
46
49
|
return createBlock( 'core/button', {
|
|
47
50
|
text,
|
|
48
51
|
url,
|
|
52
|
+
metadata: getTransformedMetadata(
|
|
53
|
+
metadata,
|
|
54
|
+
'core/button',
|
|
55
|
+
( { content: contentBinding } ) => ( {
|
|
56
|
+
text: contentBinding,
|
|
57
|
+
} )
|
|
58
|
+
),
|
|
49
59
|
} );
|
|
50
60
|
} )
|
|
51
61
|
),
|
package/src/calendar/index.php
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/calendar` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.2.0
|
|
12
|
+
*
|
|
13
|
+
* @global int $monthnum.
|
|
14
|
+
* @global int $year.
|
|
15
|
+
*
|
|
11
16
|
* @param array $attributes The block attributes.
|
|
12
17
|
*
|
|
13
18
|
* @return string Returns the block content.
|
|
@@ -76,6 +81,8 @@ function render_block_core_calendar( $attributes ) {
|
|
|
76
81
|
|
|
77
82
|
/**
|
|
78
83
|
* Registers the `core/calendar` block on server.
|
|
84
|
+
*
|
|
85
|
+
* @since 5.2.0
|
|
79
86
|
*/
|
|
80
87
|
function register_block_core_calendar() {
|
|
81
88
|
register_block_type_from_metadata(
|
|
@@ -94,6 +101,8 @@ add_action( 'init', 'register_block_core_calendar' );
|
|
|
94
101
|
* Used to hide the calendar block when there are no published posts.
|
|
95
102
|
* This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
|
|
96
103
|
*
|
|
104
|
+
* @since 5.9.0
|
|
105
|
+
*
|
|
97
106
|
* @return bool Has any published posts or not.
|
|
98
107
|
*/
|
|
99
108
|
function block_core_calendar_has_published_posts() {
|
|
@@ -117,6 +126,10 @@ function block_core_calendar_has_published_posts() {
|
|
|
117
126
|
* Queries the database for any published post and saves
|
|
118
127
|
* a flag whether any published post exists or not.
|
|
119
128
|
*
|
|
129
|
+
* @since 5.9.0
|
|
130
|
+
*
|
|
131
|
+
* @global wpdb $wpdb WordPress database abstraction object.
|
|
132
|
+
*
|
|
120
133
|
* @return bool Has any published posts or not.
|
|
121
134
|
*/
|
|
122
135
|
function block_core_calendar_update_has_published_posts() {
|
|
@@ -132,6 +145,8 @@ if ( ! is_multisite() ) {
|
|
|
132
145
|
/**
|
|
133
146
|
* Handler for updating the has published posts flag when a post is deleted.
|
|
134
147
|
*
|
|
148
|
+
* @since 5.9.0
|
|
149
|
+
*
|
|
135
150
|
* @param int $post_id Deleted post ID.
|
|
136
151
|
*/
|
|
137
152
|
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
|
|
@@ -147,6 +162,8 @@ if ( ! is_multisite() ) {
|
|
|
147
162
|
/**
|
|
148
163
|
* Handler for updating the has published posts flag when a post status changes.
|
|
149
164
|
*
|
|
165
|
+
* @since 5.9.0
|
|
166
|
+
*
|
|
150
167
|
* @param string $new_status The status the post is changing to.
|
|
151
168
|
* @param string $old_status The status the post is changing from.
|
|
152
169
|
* @param WP_Post $post Post object.
|
package/src/categories/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/categories` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.0.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
*
|
|
13
15
|
* @return string Returns the categories list/dropdown markup.
|
|
@@ -63,6 +65,8 @@ function render_block_core_categories( $attributes ) {
|
|
|
63
65
|
/**
|
|
64
66
|
* Generates the inline script for a categories dropdown field.
|
|
65
67
|
*
|
|
68
|
+
* @since 5.0.0
|
|
69
|
+
*
|
|
66
70
|
* @param string $dropdown_id ID of the dropdown field.
|
|
67
71
|
*
|
|
68
72
|
* @return string Returns the dropdown onChange redirection script.
|
|
@@ -87,6 +91,8 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
|
|
|
87
91
|
|
|
88
92
|
/**
|
|
89
93
|
* Registers the `core/categories` block on server.
|
|
94
|
+
*
|
|
95
|
+
* @since 5.0.0
|
|
90
96
|
*/
|
|
91
97
|
function register_block_core_categories() {
|
|
92
98
|
register_block_type_from_metadata(
|
package/src/code/save.js
CHANGED
|
@@ -16,7 +16,13 @@ export default function save( { attributes } ) {
|
|
|
16
16
|
// To do: `escape` encodes characters in shortcodes and URLs to
|
|
17
17
|
// prevent embedding in PHP. Ideally checks for the code block,
|
|
18
18
|
// or pre/code tags, should be made on the PHP side?
|
|
19
|
-
value={ escape(
|
|
19
|
+
value={ escape(
|
|
20
|
+
typeof attributes.content === 'string'
|
|
21
|
+
? attributes.content
|
|
22
|
+
: attributes.content.toHTMLString( {
|
|
23
|
+
preserveWhiteSpace: true,
|
|
24
|
+
} )
|
|
25
|
+
) }
|
|
20
26
|
/>
|
|
21
27
|
</pre>
|
|
22
28
|
);
|
package/src/code/transforms.js
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
5
|
import { create, toHTMLString } from '@wordpress/rich-text';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { getTransformedMetadata } from '../utils/get-transformed-metadata';
|
|
11
|
+
|
|
7
12
|
const transforms = {
|
|
8
13
|
from: [
|
|
9
14
|
{
|
|
@@ -14,17 +19,21 @@ const transforms = {
|
|
|
14
19
|
{
|
|
15
20
|
type: 'block',
|
|
16
21
|
blocks: [ 'core/paragraph' ],
|
|
17
|
-
transform: ( { content } ) =>
|
|
18
|
-
createBlock( 'core/code', {
|
|
22
|
+
transform: ( { content, metadata } ) =>
|
|
23
|
+
createBlock( 'core/code', {
|
|
24
|
+
content,
|
|
25
|
+
metadata: getTransformedMetadata( metadata, 'core/code' ),
|
|
26
|
+
} ),
|
|
19
27
|
},
|
|
20
28
|
{
|
|
21
29
|
type: 'block',
|
|
22
30
|
blocks: [ 'core/html' ],
|
|
23
|
-
transform: ( { content: text } ) => {
|
|
31
|
+
transform: ( { content: text, metadata } ) => {
|
|
24
32
|
return createBlock( 'core/code', {
|
|
25
33
|
// The HTML is plain text (with plain line breaks), so
|
|
26
34
|
// convert it to rich text.
|
|
27
35
|
content: toHTMLString( { value: create( { text } ) } ),
|
|
36
|
+
metadata: getTransformedMetadata( metadata, 'core/code' ),
|
|
28
37
|
} );
|
|
29
38
|
},
|
|
30
39
|
},
|
|
@@ -51,8 +60,14 @@ const transforms = {
|
|
|
51
60
|
{
|
|
52
61
|
type: 'block',
|
|
53
62
|
blocks: [ 'core/paragraph' ],
|
|
54
|
-
transform: ( { content } ) =>
|
|
55
|
-
createBlock( 'core/paragraph', {
|
|
63
|
+
transform: ( { content, metadata } ) =>
|
|
64
|
+
createBlock( 'core/paragraph', {
|
|
65
|
+
content,
|
|
66
|
+
metadata: getTransformedMetadata(
|
|
67
|
+
metadata,
|
|
68
|
+
'core/paragraph'
|
|
69
|
+
),
|
|
70
|
+
} ),
|
|
56
71
|
},
|
|
57
72
|
],
|
|
58
73
|
};
|
package/src/columns/edit.js
CHANGED
|
@@ -139,18 +139,19 @@ function ColumnsEditContainer( { attributes, setAttributes, clientId } ) {
|
|
|
139
139
|
// If adding a new column, assign width to the new column equal to
|
|
140
140
|
// as if it were `1 / columns` of the total available space.
|
|
141
141
|
const newColumnWidth = toWidthPrecision( 100 / newColumns );
|
|
142
|
+
const newlyAddedColumns = newColumns - previousColumns;
|
|
142
143
|
|
|
143
144
|
// Redistribute in consideration of pending block insertion as
|
|
144
145
|
// constraining the available working width.
|
|
145
146
|
const widths = getRedistributedColumnWidths(
|
|
146
147
|
innerBlocks,
|
|
147
|
-
100 - newColumnWidth
|
|
148
|
+
100 - newColumnWidth * newlyAddedColumns
|
|
148
149
|
);
|
|
149
150
|
|
|
150
151
|
innerBlocks = [
|
|
151
152
|
...getMappedColumnWidths( innerBlocks, widths ),
|
|
152
153
|
...Array.from( {
|
|
153
|
-
length:
|
|
154
|
+
length: newlyAddedColumns,
|
|
154
155
|
} ).map( () => {
|
|
155
156
|
return createBlock( 'core/column', {
|
|
156
157
|
width: `${ newColumnWidth }%`,
|