@wordpress/block-library 7.1.0 → 7.3.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 +13 -0
- package/README.md +1 -1
- package/build/archives/edit.js +21 -1
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/edit.native.js +0 -5
- package/build/audio/edit.native.js.map +1 -1
- package/build/avatar/edit.js +211 -0
- package/build/avatar/edit.js.map +1 -0
- package/build/avatar/hooks.js +111 -0
- package/build/avatar/hooks.js.map +1 -0
- package/build/avatar/index.js +83 -0
- package/build/avatar/index.js.map +1 -0
- package/build/avatar/user-control.js +63 -0
- package/build/avatar/user-control.js.map +1 -0
- package/build/block/edit.js +2 -1
- package/build/block/edit.js.map +1 -1
- package/build/column/index.js +3 -1
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +4 -3
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/index.js +7 -3
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +1 -1
- package/build/comment-date/edit.js +10 -25
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +7 -3
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +5 -1
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +5 -1
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/edit.js +86 -66
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +7 -23
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comment-template/index.js +2 -2
- package/build/comments-pagination-next/index.js +2 -2
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +2 -69
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +22 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +1 -23
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +58 -39
- package/build/cover/edit.js.map +1 -1
- package/build/cover/index.js +5 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +3 -2
- package/build/cover/save.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/edit.js +18 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +35 -0
- package/build/gallery/gap-styles.js.map +1 -0
- package/build/gallery/index.js +18 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +1 -1
- package/build/group/variations.js +30 -9
- package/build/group/variations.js.map +1 -1
- package/build/heading/edit.js +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/html/edit.js +3 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.native.js +8 -10
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +10 -4
- package/build/index.js.map +1 -1
- package/build/list/deprecated.js +2 -2
- package/build/list/deprecated.js.map +1 -1
- package/build/list/index.js +5 -7
- package/build/list/index.js.map +1 -1
- package/build/list/v2/deprecated.js +117 -0
- package/build/list/v2/deprecated.js.map +1 -0
- package/build/list/v2/edit.js +188 -0
- package/build/list/v2/edit.js.map +1 -0
- package/build/list/v2/index.js +36 -0
- package/build/list/v2/index.js.map +1 -0
- package/build/list/v2/migrate.js +85 -0
- package/build/list/v2/migrate.js.map +1 -0
- package/build/list/v2/save.js +34 -0
- package/build/list/v2/save.js.map +1 -0
- package/build/list/v2/transforms.js +121 -0
- package/build/list/v2/transforms.js.map +1 -0
- package/build/list-item/edit.js +96 -0
- package/build/list-item/edit.js.map +1 -0
- package/build/list-item/hooks/index.js +32 -0
- package/build/list-item/hooks/index.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +93 -0
- package/build/list-item/hooks/use-enter.js.map +1 -0
- package/build/list-item/hooks/use-indent-list-item.js +74 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +77 -0
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build/list-item/index.js +67 -0
- package/build/list-item/index.js.map +1 -0
- package/build/list-item/save.js +23 -0
- package/build/list-item/save.js.map +1 -0
- package/build/list-item/utils.js +16 -0
- package/build/list-item/utils.js.map +1 -0
- package/build/media-text/edit.js +3 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/media-container.native.js +1 -16
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js +36 -17
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +34 -7
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +9 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +26 -54
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +1 -0
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +95 -37
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-submenu/edit.js +5 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +1 -1
- package/build/post-comment/edit.js +2 -2
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +3 -2
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-date/edit.js +31 -37
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-template/edit.js +7 -2
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/variations.js +1 -1
- package/build/post-terms/variations.js.map +1 -1
- package/build/pullquote/edit.js +5 -3
- package/build/pullquote/edit.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-no-results/edit.js +28 -0
- package/build/query-no-results/edit.js.map +1 -0
- package/build/query-no-results/index.js +54 -0
- package/build/query-no-results/index.js.map +1 -0
- package/build/query-no-results/save.js +18 -0
- package/build/query-no-results/save.js.map +1 -0
- package/build/query-pagination/edit.js +1 -1
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +19 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/quote/index.js +15 -8
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/deprecated.js +133 -0
- package/build/quote/v2/deprecated.js.map +1 -0
- package/build/quote/v2/edit.js +131 -0
- package/build/quote/v2/edit.js.map +1 -0
- package/build/quote/v2/index.js +49 -0
- package/build/quote/v2/index.js.map +1 -0
- package/build/quote/v2/save.js +43 -0
- package/build/quote/v2/save.js.map +1 -0
- package/build/quote/v2/transforms.js +156 -0
- package/build/quote/v2/transforms.js.map +1 -0
- package/build/read-more/index.js +1 -1
- package/build/rss/edit.js +6 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +2 -3
- package/build/search/edit.js.map +1 -1
- package/build/separator/deprecated.js +83 -0
- package/build/separator/deprecated.js.map +1 -0
- package/build/separator/edit.js +31 -23
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +17 -7
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +18 -13
- package/build/separator/save.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js +39 -0
- package/build/separator/use-deprecated-opacity.js.map +1 -0
- package/build/site-logo/edit.js +3 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/social-links/edit.js +14 -3
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/controls.js +6 -16
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +3 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +4 -5
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/tag-cloud/edit.js +58 -2
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +5 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/archives/edit.js +22 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/edit.native.js +0 -5
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/avatar/edit.js +195 -0
- package/build-module/avatar/edit.js.map +1 -0
- package/build-module/avatar/hooks.js +99 -0
- package/build-module/avatar/hooks.js.map +1 -0
- package/build-module/avatar/index.js +70 -0
- package/build-module/avatar/index.js.map +1 -0
- package/build-module/avatar/user-control.js +52 -0
- package/build-module/avatar/user-control.js.map +1 -0
- package/build-module/block/edit.js +4 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/column/index.js +3 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +4 -3
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +7 -3
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +1 -1
- package/build-module/comment-date/edit.js +13 -30
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +7 -3
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +5 -1
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +5 -1
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/edit.js +86 -66
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +7 -23
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comment-template/index.js +2 -2
- package/build-module/comments-pagination-next/index.js +2 -2
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +4 -70
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +22 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +1 -23
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +58 -41
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/index.js +5 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +3 -2
- package/build-module/cover/save.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/edit.js +17 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +28 -0
- package/build-module/gallery/gap-styles.js.map +1 -0
- package/build-module/gallery/index.js +18 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +1 -1
- package/build-module/group/variations.js +29 -9
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/edit.js +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/html/edit.js +4 -3
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.native.js +8 -10
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +7 -4
- package/build-module/index.js.map +1 -1
- package/build-module/list/deprecated.js +2 -2
- package/build-module/list/deprecated.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/deprecated.js +104 -0
- package/build-module/list/v2/deprecated.js.map +1 -0
- package/build-module/list/v2/edit.js +168 -0
- package/build-module/list/v2/edit.js.map +1 -0
- package/build-module/list/v2/index.js +21 -0
- package/build-module/list/v2/index.js.map +1 -0
- package/build-module/list/v2/migrate.js +77 -0
- package/build-module/list/v2/migrate.js.map +1 -0
- package/build-module/list/v2/save.js +23 -0
- package/build-module/list/v2/save.js.map +1 -0
- package/build-module/list/v2/transforms.js +111 -0
- package/build-module/list/v2/transforms.js.map +1 -0
- package/build-module/list-item/edit.js +83 -0
- package/build-module/list-item/edit.js.map +1 -0
- package/build-module/list-item/hooks/index.js +4 -0
- package/build-module/list-item/hooks/index.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +77 -0
- package/build-module/list-item/hooks/use-enter.js.map +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js +62 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +66 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -0
- package/build-module/list-item/index.js +53 -0
- package/build-module/list-item/index.js.map +1 -0
- package/build-module/list-item/save.js +15 -0
- package/build-module/list-item/save.js.map +1 -0
- package/build-module/list-item/utils.js +8 -0
- package/build-module/list-item/utils.js.map +1 -0
- package/build-module/media-text/edit.js +3 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -14
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +37 -17
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +35 -8
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +9 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +27 -54
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +1 -0
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +95 -36
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-submenu/edit.js +6 -10
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +1 -1
- package/build-module/post-comment/edit.js +2 -2
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +3 -2
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-date/edit.js +32 -43
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-template/edit.js +7 -2
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +4 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/variations.js +3 -3
- package/build-module/post-terms/variations.js.map +1 -1
- package/build-module/pullquote/edit.js +6 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-no-results/edit.js +18 -0
- package/build-module/query-no-results/edit.js.map +1 -0
- package/build-module/query-no-results/index.js +40 -0
- package/build-module/query-no-results/index.js.map +1 -0
- package/build-module/query-no-results/save.js +10 -0
- package/build-module/query-no-results/save.js.map +1 -0
- package/build-module/query-pagination/edit.js +1 -1
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +19 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/quote/index.js +13 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/deprecated.js +116 -0
- package/build-module/quote/v2/deprecated.js.map +1 -0
- package/build-module/quote/v2/edit.js +115 -0
- package/build-module/quote/v2/edit.js.map +1 -0
- package/build-module/quote/v2/index.js +33 -0
- package/build-module/quote/v2/index.js.map +1 -0
- package/build-module/quote/v2/save.js +30 -0
- package/build-module/quote/v2/save.js.map +1 -0
- package/build-module/quote/v2/transforms.js +147 -0
- package/build-module/quote/v2/transforms.js.map +1 -0
- package/build-module/read-more/index.js +1 -1
- package/build-module/rss/edit.js +5 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/deprecated.js +70 -0
- package/build-module/separator/deprecated.js.map +1 -0
- package/build-module/separator/edit.js +31 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +16 -7
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +19 -14
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js +30 -0
- package/build-module/separator/use-deprecated-opacity.js.map +1 -0
- package/build-module/site-logo/edit.js +3 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/social-links/edit.js +15 -4
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/controls.js +8 -19
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +2 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +3 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/tag-cloud/edit.js +60 -4
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +5 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +83 -0
- package/build-style/avatar/editor.css +83 -0
- package/build-style/avatar/style-rtl.css +79 -0
- package/build-style/avatar/style.css +79 -0
- package/build-style/editor-rtl.css +53 -11
- package/build-style/editor.css +53 -11
- package/build-style/gallery/editor-rtl.css +0 -1
- package/build-style/gallery/editor.css +0 -1
- package/build-style/gallery/style-rtl.css +102 -169
- package/build-style/gallery/style.css +102 -169
- package/build-style/group/editor-rtl.css +26 -0
- package/build-style/group/editor.css +26 -0
- package/build-style/heading/style-rtl.css +0 -8
- package/build-style/heading/style.css +0 -8
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/navigation/style-rtl.css +11 -9
- package/build-style/navigation/style.css +11 -9
- package/build-style/navigation-link/editor-rtl.css +13 -0
- package/build-style/navigation-link/editor.css +13 -0
- package/build-style/navigation-link/style-rtl.css +3 -0
- package/build-style/navigation-link/style.css +3 -0
- package/build-style/paragraph/style-rtl.css +0 -4
- package/build-style/paragraph/style.css +0 -4
- package/build-style/pullquote/style-rtl.css +0 -4
- package/build-style/pullquote/style.css +0 -4
- package/build-style/quote/style-rtl.css +1 -0
- package/build-style/quote/style.css +1 -0
- package/build-style/reset-rtl.css +1 -1
- package/build-style/reset.css +1 -1
- package/build-style/separator/editor-rtl.css +3 -0
- package/build-style/separator/editor.css +3 -0
- package/build-style/separator/theme-rtl.css +7 -1
- package/build-style/separator/theme.css +7 -1
- package/build-style/site-logo/editor-rtl.css +3 -1
- package/build-style/site-logo/editor.css +3 -1
- package/build-style/style-rtl.css +124 -195
- package/build-style/style.css +124 -195
- package/build-style/template-part/editor-rtl.css +0 -9
- package/build-style/template-part/editor.css +0 -9
- package/build-style/theme-rtl.css +7 -1
- package/build-style/theme.css +7 -1
- package/package.json +28 -28
- package/src/archives/block.json +5 -1
- package/src/archives/edit.js +20 -2
- package/src/archives/index.php +4 -4
- package/src/audio/edit.native.js +0 -5
- package/src/avatar/block.json +53 -0
- package/src/avatar/edit.js +230 -0
- package/src/avatar/editor.scss +9 -0
- package/src/avatar/hooks.js +96 -0
- package/src/avatar/index.js +18 -0
- package/src/avatar/index.php +146 -0
- package/src/avatar/style.scss +5 -0
- package/src/avatar/user-control.js +56 -0
- package/src/block/edit.js +21 -11
- package/src/column/block.json +3 -1
- package/src/comment-author-avatar/block.json +4 -3
- package/src/comment-author-name/block.json +7 -3
- package/src/comment-author-name/index.php +3 -0
- package/src/comment-content/block.json +1 -1
- package/src/comment-date/block.json +7 -3
- package/src/comment-date/edit.js +20 -30
- package/src/comment-date/index.php +6 -1
- package/src/comment-edit-link/block.json +5 -1
- package/src/comment-edit-link/index.php +3 -0
- package/src/comment-reply-link/block.json +5 -1
- package/src/comment-reply-link/index.php +4 -1
- package/src/comment-template/block.json +2 -8
- package/src/comment-template/edit.js +77 -64
- package/src/comment-template/hooks.js +8 -24
- package/src/comment-template/index.php +1 -3
- package/src/comments-pagination-next/block.json +2 -9
- package/src/comments-pagination-numbers/block.json +2 -8
- package/src/comments-pagination-previous/block.json +2 -2
- package/src/comments-query-loop/block.json +1 -23
- package/src/comments-query-loop/edit/comments-inspector-controls.js +2 -83
- package/src/comments-query-loop/edit.js +54 -1
- package/src/cover/block.json +5 -0
- package/src/cover/edit.js +103 -60
- package/src/cover/index.php +85 -0
- package/src/cover/save.js +18 -14
- package/src/editor.scss +1 -0
- package/src/embed/variations.js +2 -2
- package/src/gallery/block.json +18 -1
- package/src/gallery/deprecated.scss +2 -2
- package/src/gallery/edit.js +15 -8
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +8 -7
- package/src/gallery/gap-styles.js +26 -0
- package/src/gallery/index.php +43 -1
- package/src/gallery/style.scss +11 -44
- package/src/group/block.json +1 -1
- package/src/group/edit.js +4 -1
- package/src/group/editor.scss +31 -0
- package/src/group/variations.js +21 -4
- package/src/heading/edit.js +1 -1
- package/src/heading/style.scss +0 -3
- package/src/html/edit.js +22 -30
- package/src/image/edit.native.js +7 -11
- package/src/image/image.js +4 -1
- package/src/image/style.scss +3 -0
- package/src/index.js +19 -14
- package/src/list/deprecated.js +2 -2
- package/src/list/index.js +6 -1
- package/src/list/style.scss +1 -2
- package/src/list/test/migrate.js +159 -0
- package/src/list/v2/deprecated.js +89 -0
- package/src/list/v2/edit.js +186 -0
- package/src/list/v2/index.js +22 -0
- package/src/list/v2/migrate.js +87 -0
- package/src/list/v2/save.js +18 -0
- package/src/list/v2/transforms.js +116 -0
- package/src/list-item/block.json +26 -0
- package/src/list-item/edit.js +93 -0
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-enter.js +94 -0
- package/src/list-item/hooks/use-indent-list-item.js +89 -0
- package/src/list-item/hooks/use-outdent-list-item.js +95 -0
- package/src/list-item/index.js +27 -0
- package/src/list-item/save.js +13 -0
- package/src/list-item/utils.js +14 -0
- package/src/media-text/edit.js +1 -1
- package/src/media-text/media-container.native.js +1 -14
- package/src/navigation/block.json +9 -1
- package/src/navigation/edit/index.js +50 -14
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -1
- package/src/navigation/edit/unsaved-inner-blocks.js +57 -8
- package/src/navigation/index.php +28 -3
- package/src/navigation/style.scss +15 -13
- package/src/navigation/use-navigation-entities.js +37 -73
- package/src/navigation/use-navigation-menu.js +4 -0
- package/src/navigation-link/block.json +1 -0
- package/src/navigation-link/edit.js +156 -64
- package/src/navigation-link/editor.scss +11 -0
- package/src/navigation-link/index.php +8 -0
- package/src/navigation-link/style.scss +6 -0
- package/src/navigation-submenu/block.json +1 -0
- package/src/navigation-submenu/edit.js +7 -9
- package/src/paragraph/style.scss +0 -5
- package/src/post-author/index.php +0 -1
- package/src/post-comment/edit.js +2 -2
- package/src/post-comments-form/edit.js +6 -3
- package/src/post-date/edit.js +63 -52
- package/src/post-date/index.php +1 -1
- package/src/post-date/test/edit.js +17 -0
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/edit.js +9 -1
- package/src/post-featured-image/index.php +2 -1
- package/src/post-template/edit.js +7 -1
- package/src/post-terms/edit.js +4 -1
- package/src/post-terms/variations.js +3 -3
- package/src/pullquote/edit.js +4 -3
- package/src/pullquote/style.scss +0 -5
- package/src/query/variations.js +4 -0
- package/src/query-no-results/block.json +20 -0
- package/src/query-no-results/edit.js +28 -0
- package/src/query-no-results/index.js +20 -0
- package/src/query-no-results/index.php +59 -0
- package/src/query-no-results/save.js +8 -0
- package/src/query-pagination/edit.js +1 -1
- package/src/query-pagination/index.php +9 -2
- package/src/query-pagination-numbers/block.json +19 -1
- package/src/quote/block.json +8 -0
- package/src/quote/index.js +6 -1
- package/src/quote/style.scss +1 -0
- package/src/quote/v2/deprecated.js +107 -0
- package/src/quote/v2/edit.js +136 -0
- package/src/quote/v2/index.js +36 -0
- package/src/quote/v2/save.js +26 -0
- package/src/quote/v2/test/migrate.js +92 -0
- package/src/quote/v2/transforms.js +155 -0
- package/src/read-more/block.json +1 -1
- package/src/reset.scss +1 -1
- package/src/rss/edit.js +3 -1
- package/src/rss/index.php +14 -1
- package/src/search/edit.js +1 -2
- package/src/separator/block.json +13 -6
- package/src/separator/deprecated.js +57 -0
- package/src/separator/deprecated.scss +6 -0
- package/src/separator/edit.js +36 -14
- package/src/separator/editor.scss +6 -0
- package/src/separator/index.js +2 -0
- package/src/separator/save.js +22 -14
- package/src/separator/test/edit.js +113 -0
- package/src/separator/theme.scss +7 -1
- package/src/separator/use-deprecated-opacity.js +41 -0
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +2 -1
- package/src/site-logo/editor.scss +3 -1
- package/src/site-logo/index.php +0 -4
- package/src/social-link/index.php +1 -2
- package/src/social-links/block.json +2 -1
- package/src/social-links/edit.js +15 -5
- package/src/spacer/controls.js +12 -18
- package/src/spacer/controls.native.js +2 -1
- package/src/spacer/edit.js +3 -6
- package/src/spacer/test/__snapshots__/index.native.js.snap +31 -0
- package/src/spacer/test/index.native.js +180 -0
- package/src/style.scss +1 -0
- package/src/table/deprecated.js +5 -1
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +82 -2
- package/src/tag-cloud/index.php +6 -0
- package/src/template-part/edit/utils/hooks.js +6 -1
- package/src/template-part/editor.scss +0 -10
- package/build/navigation/edit/use-list-view-modal.js +0 -73
- package/build/navigation/edit/use-list-view-modal.js.map +0 -1
- package/build/separator/separator-settings.js +0 -36
- package/build/separator/separator-settings.js.map +0 -1
- package/build-module/navigation/edit/use-list-view-modal.js +0 -63
- package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
- package/build-module/separator/separator-settings.js +0 -27
- package/build-module/separator/separator-settings.js.map +0 -1
- package/src/navigation/edit/use-list-view-modal.js +0 -72
- package/src/separator/separator-settings.js +0 -24
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { registerBlockType, serialize } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { migrateToListV2 } from '../v2/migrate';
|
|
10
|
+
import * as listItem from '../../list-item';
|
|
11
|
+
import * as list from '../../list';
|
|
12
|
+
import listV2 from '../../list/v2';
|
|
13
|
+
|
|
14
|
+
describe( 'Migrate list block', () => {
|
|
15
|
+
beforeAll( () => {
|
|
16
|
+
const prev = window.__experimentalEnableListBlockV2;
|
|
17
|
+
|
|
18
|
+
// force list and list item block registration.
|
|
19
|
+
registerBlockType(
|
|
20
|
+
{ name: listItem.name, ...listItem.metadata },
|
|
21
|
+
listItem.settings
|
|
22
|
+
);
|
|
23
|
+
registerBlockType( { name: list.name, ...list.metadata }, listV2 );
|
|
24
|
+
|
|
25
|
+
window.__experimentalEnableListBlockV2 = prev;
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'should migrate the values attribute to inner blocks', () => {
|
|
29
|
+
const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( {
|
|
30
|
+
values:
|
|
31
|
+
'<li>test</li><li>test</li><li>test<ol><li>test test</li><li>test est eesssss</li></ol></li>',
|
|
32
|
+
ordered: false,
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
expect( updatedAttributes ).toEqual( {
|
|
36
|
+
ordered: false,
|
|
37
|
+
// Ideally the values attributes shouldn't be here
|
|
38
|
+
// but since we didn't enable v2 by default yet,
|
|
39
|
+
// we're keeping the old default value in block.json
|
|
40
|
+
values: '',
|
|
41
|
+
} );
|
|
42
|
+
expect( serialize( updatedInnerBlocks ) )
|
|
43
|
+
.toEqual( `<!-- wp:list-item -->
|
|
44
|
+
<li>test</li>
|
|
45
|
+
<!-- /wp:list-item -->
|
|
46
|
+
|
|
47
|
+
<!-- wp:list-item -->
|
|
48
|
+
<li>test</li>
|
|
49
|
+
<!-- /wp:list-item -->
|
|
50
|
+
|
|
51
|
+
<!-- wp:list-item -->
|
|
52
|
+
<li>test<!-- wp:list {\"ordered\":true} -->
|
|
53
|
+
<ol><!-- wp:list-item -->
|
|
54
|
+
<li>test test</li>
|
|
55
|
+
<!-- /wp:list-item -->
|
|
56
|
+
|
|
57
|
+
<!-- wp:list-item -->
|
|
58
|
+
<li>test est eesssss</li>
|
|
59
|
+
<!-- /wp:list-item --></ol>
|
|
60
|
+
<!-- /wp:list --></li>
|
|
61
|
+
<!-- /wp:list-item -->` );
|
|
62
|
+
} );
|
|
63
|
+
|
|
64
|
+
it( 'should handle empty space properly', () => {
|
|
65
|
+
const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( {
|
|
66
|
+
values: `<li>Europe</li>
|
|
67
|
+
<li>
|
|
68
|
+
\tAfrica
|
|
69
|
+
<ol>
|
|
70
|
+
<li>Algeria</li>
|
|
71
|
+
</ol>
|
|
72
|
+
\t
|
|
73
|
+
</li>`,
|
|
74
|
+
ordered: false,
|
|
75
|
+
} );
|
|
76
|
+
|
|
77
|
+
expect( updatedAttributes ).toEqual( {
|
|
78
|
+
ordered: false,
|
|
79
|
+
// Ideally the values attributes shouldn't be here
|
|
80
|
+
// but since we didn't enable v2 by default yet,
|
|
81
|
+
// we're keeping the old default value in block.json
|
|
82
|
+
values: '',
|
|
83
|
+
} );
|
|
84
|
+
expect( serialize( updatedInnerBlocks ) )
|
|
85
|
+
.toEqual( `<!-- wp:list-item -->
|
|
86
|
+
<li>Europe</li>
|
|
87
|
+
<!-- /wp:list-item -->
|
|
88
|
+
|
|
89
|
+
<!-- wp:list-item -->
|
|
90
|
+
<li>Africa<!-- wp:list {\"ordered\":true} -->
|
|
91
|
+
<ol><!-- wp:list-item -->
|
|
92
|
+
<li>Algeria</li>
|
|
93
|
+
<!-- /wp:list-item --></ol>
|
|
94
|
+
<!-- /wp:list --></li>
|
|
95
|
+
<!-- /wp:list-item -->` );
|
|
96
|
+
} );
|
|
97
|
+
|
|
98
|
+
it( 'should handle formats properly', () => {
|
|
99
|
+
const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( {
|
|
100
|
+
values: `<li>Europe<ul><li>France<ul><li>Lyon <strong>Rhone</strong>s</li><li>Paris <em>Ile de france</em><ul><li><em>1er</em></li></ul></li></ul></li></ul></li></ul></li>`,
|
|
101
|
+
ordered: false,
|
|
102
|
+
} );
|
|
103
|
+
|
|
104
|
+
expect( updatedAttributes ).toEqual( {
|
|
105
|
+
ordered: false,
|
|
106
|
+
// Ideally the values attributes shouldn't be here
|
|
107
|
+
// but since we didn't enable v2 by default yet,
|
|
108
|
+
// we're keeping the old default value in block.json
|
|
109
|
+
values: '',
|
|
110
|
+
} );
|
|
111
|
+
expect( serialize( updatedInnerBlocks ) )
|
|
112
|
+
.toEqual( `<!-- wp:list-item -->
|
|
113
|
+
<li>Europe<!-- wp:list -->
|
|
114
|
+
<ul><!-- wp:list-item -->
|
|
115
|
+
<li>France<!-- wp:list -->
|
|
116
|
+
<ul><!-- wp:list-item -->
|
|
117
|
+
<li>Lyon <strong>Rhone</strong>s</li>
|
|
118
|
+
<!-- /wp:list-item -->
|
|
119
|
+
|
|
120
|
+
<!-- wp:list-item -->
|
|
121
|
+
<li>Paris <em>Ile de france</em><!-- wp:list -->
|
|
122
|
+
<ul><!-- wp:list-item -->
|
|
123
|
+
<li><em>1er</em></li>
|
|
124
|
+
<!-- /wp:list-item --></ul>
|
|
125
|
+
<!-- /wp:list --></li>
|
|
126
|
+
<!-- /wp:list-item --></ul>
|
|
127
|
+
<!-- /wp:list --></li>
|
|
128
|
+
<!-- /wp:list-item --></ul>
|
|
129
|
+
<!-- /wp:list --></li>
|
|
130
|
+
<!-- /wp:list-item -->` );
|
|
131
|
+
} );
|
|
132
|
+
|
|
133
|
+
it( 'should not add random space', () => {
|
|
134
|
+
const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( {
|
|
135
|
+
values: `<li>Europe<ul><li>F<strong>ranc</strong>e<ul><li>Paris</li></ul></li></ul></li>`,
|
|
136
|
+
ordered: false,
|
|
137
|
+
} );
|
|
138
|
+
|
|
139
|
+
expect( updatedAttributes ).toEqual( {
|
|
140
|
+
ordered: false,
|
|
141
|
+
// Ideally the values attributes shouldn't be here
|
|
142
|
+
// but since we didn't enable v2 by default yet,
|
|
143
|
+
// we're keeping the old default value in block.json
|
|
144
|
+
values: '',
|
|
145
|
+
} );
|
|
146
|
+
expect( serialize( updatedInnerBlocks ) )
|
|
147
|
+
.toEqual( `<!-- wp:list-item -->
|
|
148
|
+
<li>Europe<!-- wp:list -->
|
|
149
|
+
<ul><!-- wp:list-item -->
|
|
150
|
+
<li>F<strong>ranc</strong>e<!-- wp:list -->
|
|
151
|
+
<ul><!-- wp:list-item -->
|
|
152
|
+
<li>Paris</li>
|
|
153
|
+
<!-- /wp:list-item --></ul>
|
|
154
|
+
<!-- /wp:list --></li>
|
|
155
|
+
<!-- /wp:list-item --></ul>
|
|
156
|
+
<!-- /wp:list --></li>
|
|
157
|
+
<!-- /wp:list-item -->` );
|
|
158
|
+
} );
|
|
159
|
+
} );
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import initialDeprecations from '../deprecated';
|
|
10
|
+
import { migrateToListV2 } from './migrate';
|
|
11
|
+
|
|
12
|
+
const v1 = {
|
|
13
|
+
attributes: {
|
|
14
|
+
ordered: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
default: false,
|
|
17
|
+
__experimentalRole: 'content',
|
|
18
|
+
},
|
|
19
|
+
values: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
source: 'html',
|
|
22
|
+
selector: 'ol,ul',
|
|
23
|
+
multiline: 'li',
|
|
24
|
+
__unstableMultilineWrapperTags: [ 'ol', 'ul' ],
|
|
25
|
+
default: '',
|
|
26
|
+
__experimentalRole: 'content',
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
start: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
},
|
|
34
|
+
reversed: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
},
|
|
37
|
+
placeholder: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
supports: {
|
|
42
|
+
anchor: true,
|
|
43
|
+
className: false,
|
|
44
|
+
typography: {
|
|
45
|
+
fontSize: true,
|
|
46
|
+
__experimentalFontFamily: true,
|
|
47
|
+
lineHeight: true,
|
|
48
|
+
__experimentalFontStyle: true,
|
|
49
|
+
__experimentalFontWeight: true,
|
|
50
|
+
__experimentalLetterSpacing: true,
|
|
51
|
+
__experimentalTextTransform: true,
|
|
52
|
+
__experimentalDefaultControls: {
|
|
53
|
+
fontSize: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
color: {
|
|
57
|
+
gradients: true,
|
|
58
|
+
link: true,
|
|
59
|
+
__experimentalDefaultControls: {
|
|
60
|
+
background: true,
|
|
61
|
+
text: true,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
__unstablePasteTextInline: true,
|
|
65
|
+
__experimentalSelector: 'ol,ul',
|
|
66
|
+
__experimentalSlashInserter: true,
|
|
67
|
+
},
|
|
68
|
+
save( { attributes } ) {
|
|
69
|
+
const { ordered, values, type, reversed, start } = attributes;
|
|
70
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<TagName { ...useBlockProps.save( { type, reversed, start } ) }>
|
|
74
|
+
<RichText.Content value={ values } multiline="li" />
|
|
75
|
+
</TagName>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
migrate: migrateToListV2,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* New deprecations need to be placed first
|
|
83
|
+
* for them to have higher priority.
|
|
84
|
+
*
|
|
85
|
+
* Old deprecations may need to be updated as well.
|
|
86
|
+
*
|
|
87
|
+
* See block-deprecation.md
|
|
88
|
+
*/
|
|
89
|
+
export default [ v1, ...initialDeprecations ];
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { last } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
BlockControls,
|
|
11
|
+
useBlockProps,
|
|
12
|
+
useInnerBlocksProps,
|
|
13
|
+
store as blockEditorStore,
|
|
14
|
+
} from '@wordpress/block-editor';
|
|
15
|
+
import { ToolbarButton } from '@wordpress/components';
|
|
16
|
+
import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
|
|
17
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
18
|
+
import {
|
|
19
|
+
formatListBullets,
|
|
20
|
+
formatListBulletsRTL,
|
|
21
|
+
formatListNumbered,
|
|
22
|
+
formatListNumberedRTL,
|
|
23
|
+
formatOutdent,
|
|
24
|
+
formatOutdentRTL,
|
|
25
|
+
} from '@wordpress/icons';
|
|
26
|
+
import { createBlock } from '@wordpress/blocks';
|
|
27
|
+
import { useCallback, useEffect } from '@wordpress/element';
|
|
28
|
+
import deprecated from '@wordpress/deprecated';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
33
|
+
import OrderedListSettings from '../ordered-list-settings';
|
|
34
|
+
import { migrateToListV2 } from './migrate';
|
|
35
|
+
|
|
36
|
+
const TEMPLATE = [ [ 'core/list-item' ] ];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* At the moment, deprecations don't handle create blocks from attributes
|
|
40
|
+
* (like when using CPT templates). For this reason, this hook is necessary
|
|
41
|
+
* to avoid breaking templates using the old list block format.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} attributes Block attributes.
|
|
44
|
+
* @param {string} clientId Block client ID.
|
|
45
|
+
*/
|
|
46
|
+
function useMigrateOnLoad( attributes, clientId ) {
|
|
47
|
+
const registry = useRegistry();
|
|
48
|
+
const { updateBlockAttributes, replaceInnerBlocks } = useDispatch(
|
|
49
|
+
blockEditorStore
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
useEffect( () => {
|
|
53
|
+
// As soon as the block is loaded, migrate it to the new version.
|
|
54
|
+
|
|
55
|
+
if ( ! attributes.values ) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );
|
|
60
|
+
|
|
61
|
+
deprecated( 'Value attribute on the list block', {
|
|
62
|
+
since: '6.0',
|
|
63
|
+
version: '6.5',
|
|
64
|
+
alternative: 'inner blocks',
|
|
65
|
+
} );
|
|
66
|
+
|
|
67
|
+
registry.batch( () => {
|
|
68
|
+
updateBlockAttributes( clientId, newAttributes );
|
|
69
|
+
replaceInnerBlocks( clientId, newInnerBlocks );
|
|
70
|
+
} );
|
|
71
|
+
}, [ attributes.values ] );
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function useOutdentList( clientId ) {
|
|
75
|
+
const { canOutdent } = useSelect(
|
|
76
|
+
( innerSelect ) => {
|
|
77
|
+
const { getBlockRootClientId, getBlock } = innerSelect(
|
|
78
|
+
blockEditorStore
|
|
79
|
+
);
|
|
80
|
+
const parentId = getBlockRootClientId( clientId );
|
|
81
|
+
return {
|
|
82
|
+
canOutdent:
|
|
83
|
+
!! parentId &&
|
|
84
|
+
getBlock( parentId ).name === 'core/list-item',
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
[ clientId ]
|
|
88
|
+
);
|
|
89
|
+
const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
|
|
90
|
+
const { getBlockRootClientId, getBlockAttributes, getBlock } = useSelect(
|
|
91
|
+
blockEditorStore
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return [
|
|
95
|
+
canOutdent,
|
|
96
|
+
useCallback( () => {
|
|
97
|
+
const parentBlockId = getBlockRootClientId( clientId );
|
|
98
|
+
const parentBlockAttributes = getBlockAttributes( parentBlockId );
|
|
99
|
+
// Create a new parent block without the inner blocks.
|
|
100
|
+
const newParentBlock = createBlock(
|
|
101
|
+
'core/list-item',
|
|
102
|
+
parentBlockAttributes
|
|
103
|
+
);
|
|
104
|
+
const { innerBlocks } = getBlock( clientId );
|
|
105
|
+
// Replace the parent block with a new parent block without inner blocks,
|
|
106
|
+
// and make the inner blocks siblings of the parent.
|
|
107
|
+
replaceBlocks(
|
|
108
|
+
[ parentBlockId ],
|
|
109
|
+
[ newParentBlock, ...innerBlocks ]
|
|
110
|
+
);
|
|
111
|
+
// Select the last child of the list being outdent.
|
|
112
|
+
selectionChange( last( innerBlocks ).clientId );
|
|
113
|
+
}, [ clientId ] ),
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function IndentUI( { clientId } ) {
|
|
118
|
+
const [ canOutdent, outdentList ] = useOutdentList( clientId );
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
<ToolbarButton
|
|
122
|
+
icon={ isRTL() ? formatOutdentRTL : formatOutdent }
|
|
123
|
+
title={ __( 'Outdent' ) }
|
|
124
|
+
describedBy={ __( 'Outdent list item' ) }
|
|
125
|
+
disabled={ ! canOutdent }
|
|
126
|
+
onClick={ outdentList }
|
|
127
|
+
/>
|
|
128
|
+
</>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function Edit( { attributes, setAttributes, clientId } ) {
|
|
133
|
+
const blockProps = useBlockProps();
|
|
134
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
135
|
+
allowedBlocks: [ 'core/list-item' ],
|
|
136
|
+
template: TEMPLATE,
|
|
137
|
+
} );
|
|
138
|
+
useMigrateOnLoad( attributes, clientId );
|
|
139
|
+
const { ordered, reversed, start } = attributes;
|
|
140
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
141
|
+
|
|
142
|
+
const controls = (
|
|
143
|
+
<BlockControls group="block">
|
|
144
|
+
<ToolbarButton
|
|
145
|
+
icon={ isRTL() ? formatListBulletsRTL : formatListBullets }
|
|
146
|
+
title={ __( 'Unordered' ) }
|
|
147
|
+
describedBy={ __( 'Convert to unordered list' ) }
|
|
148
|
+
isActive={ ordered === false }
|
|
149
|
+
onClick={ () => {
|
|
150
|
+
setAttributes( { ordered: false } );
|
|
151
|
+
} }
|
|
152
|
+
/>
|
|
153
|
+
<ToolbarButton
|
|
154
|
+
icon={ isRTL() ? formatListNumberedRTL : formatListNumbered }
|
|
155
|
+
title={ __( 'Ordered' ) }
|
|
156
|
+
describedBy={ __( 'Convert to ordered list' ) }
|
|
157
|
+
isActive={ ordered === true }
|
|
158
|
+
onClick={ () => {
|
|
159
|
+
setAttributes( { ordered: true } );
|
|
160
|
+
} }
|
|
161
|
+
/>
|
|
162
|
+
<IndentUI clientId={ clientId } />
|
|
163
|
+
</BlockControls>
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<>
|
|
168
|
+
<TagName
|
|
169
|
+
reversed={ reversed }
|
|
170
|
+
start={ start }
|
|
171
|
+
{ ...innerBlocksProps }
|
|
172
|
+
/>
|
|
173
|
+
{ controls }
|
|
174
|
+
{ ordered && (
|
|
175
|
+
<OrderedListSettings
|
|
176
|
+
setAttributes={ setAttributes }
|
|
177
|
+
ordered={ ordered }
|
|
178
|
+
reversed={ reversed }
|
|
179
|
+
start={ start }
|
|
180
|
+
/>
|
|
181
|
+
) }
|
|
182
|
+
</>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export default Edit;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { list as icon } from '@wordpress/icons';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import edit from './edit';
|
|
10
|
+
import save from './save';
|
|
11
|
+
import transforms from './transforms';
|
|
12
|
+
import deprecated from './deprecated';
|
|
13
|
+
|
|
14
|
+
const settings = {
|
|
15
|
+
icon,
|
|
16
|
+
edit,
|
|
17
|
+
save,
|
|
18
|
+
transforms,
|
|
19
|
+
deprecated,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default settings;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { omit } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { createBlock } from '@wordpress/blocks';
|
|
10
|
+
|
|
11
|
+
function createListBlockFromDOMElement( listElement ) {
|
|
12
|
+
const listAttributes = {
|
|
13
|
+
ordered: 'OL' === listElement.tagName,
|
|
14
|
+
start: listElement.getAttribute( 'start' )
|
|
15
|
+
? parseInt( listElement.getAttribute( 'start' ), 10 )
|
|
16
|
+
: undefined,
|
|
17
|
+
reversed:
|
|
18
|
+
listElement.getAttribute( 'reversed' ) === true ? true : undefined,
|
|
19
|
+
type: listElement.getAttribute( 'type' ) ?? undefined,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const innerBlocks = Array.from( listElement.children ).map(
|
|
23
|
+
( listItem ) => {
|
|
24
|
+
const children = Array.from( listItem.childNodes ).filter(
|
|
25
|
+
( node ) =>
|
|
26
|
+
node.nodeType !== node.TEXT_NODE ||
|
|
27
|
+
node.textContent.trim().length !== 0
|
|
28
|
+
);
|
|
29
|
+
children.reverse();
|
|
30
|
+
const [ nestedList, ...nodes ] = children;
|
|
31
|
+
|
|
32
|
+
const hasNestedList =
|
|
33
|
+
nestedList.tagName === 'UL' || nestedList.tagName === 'OL';
|
|
34
|
+
if ( ! hasNestedList ) {
|
|
35
|
+
return createBlock( 'core/list-item', {
|
|
36
|
+
content: listItem.innerHTML,
|
|
37
|
+
} );
|
|
38
|
+
}
|
|
39
|
+
const htmlNodes = nodes.map( ( node ) => {
|
|
40
|
+
if ( node.nodeType === node.TEXT_NODE ) {
|
|
41
|
+
return node.textContent;
|
|
42
|
+
}
|
|
43
|
+
return node.outerHTML;
|
|
44
|
+
} );
|
|
45
|
+
htmlNodes.reverse();
|
|
46
|
+
const childAttributes = {
|
|
47
|
+
content: htmlNodes.join( '' ).trim(),
|
|
48
|
+
};
|
|
49
|
+
const childInnerBlocks = [
|
|
50
|
+
createListBlockFromDOMElement( nestedList ),
|
|
51
|
+
];
|
|
52
|
+
return createBlock(
|
|
53
|
+
'core/list-item',
|
|
54
|
+
childAttributes,
|
|
55
|
+
childInnerBlocks
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return createBlock( 'core/list', listAttributes, innerBlocks );
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function migrateToListV2( attributes ) {
|
|
64
|
+
const { values, start, reversed, ordered, type } = attributes;
|
|
65
|
+
|
|
66
|
+
const list = document.createElement( ordered ? 'ol' : 'ul' );
|
|
67
|
+
list.innerHTML = values;
|
|
68
|
+
if ( start ) {
|
|
69
|
+
list.setAttribute( 'start', start );
|
|
70
|
+
}
|
|
71
|
+
if ( reversed ) {
|
|
72
|
+
list.setAttribute( 'reversed', true );
|
|
73
|
+
}
|
|
74
|
+
if ( type ) {
|
|
75
|
+
list.setAttribute( 'type', type );
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const listBlock = createListBlockFromDOMElement( list );
|
|
79
|
+
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
...omit( attributes, [ 'values' ] ),
|
|
83
|
+
...listBlock.attributes,
|
|
84
|
+
},
|
|
85
|
+
listBlock.innerBlocks,
|
|
86
|
+
];
|
|
87
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
export default function save( { attributes } ) {
|
|
7
|
+
const { ordered, reversed, start } = attributes;
|
|
8
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
9
|
+
return (
|
|
10
|
+
<TagName
|
|
11
|
+
reversed={ reversed }
|
|
12
|
+
start={ start }
|
|
13
|
+
{ ...useBlockProps.save() }
|
|
14
|
+
>
|
|
15
|
+
<InnerBlocks.Content />
|
|
16
|
+
</TagName>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock, switchToBlockType } from '@wordpress/blocks';
|
|
5
|
+
import {
|
|
6
|
+
__UNSTABLE_LINE_SEPARATOR,
|
|
7
|
+
create,
|
|
8
|
+
split,
|
|
9
|
+
toHTMLString,
|
|
10
|
+
} from '@wordpress/rich-text';
|
|
11
|
+
|
|
12
|
+
const transforms = {
|
|
13
|
+
from: [
|
|
14
|
+
{
|
|
15
|
+
type: 'block',
|
|
16
|
+
isMultiBlock: true,
|
|
17
|
+
blocks: [ 'core/paragraph', 'core/heading' ],
|
|
18
|
+
transform: ( blockAttributes ) => {
|
|
19
|
+
let childBlocks = [];
|
|
20
|
+
if ( blockAttributes.length > 1 ) {
|
|
21
|
+
childBlocks = blockAttributes.map( ( { content } ) => {
|
|
22
|
+
return createBlock( 'core/list-item', { content } );
|
|
23
|
+
} );
|
|
24
|
+
} else if ( blockAttributes.length === 1 ) {
|
|
25
|
+
const value = create( {
|
|
26
|
+
html: blockAttributes[ 0 ].content,
|
|
27
|
+
} );
|
|
28
|
+
childBlocks = split( value, '\n' ).map( ( result ) => {
|
|
29
|
+
return createBlock( 'core/list-item', {
|
|
30
|
+
content: toHTMLString( { value: result } ),
|
|
31
|
+
} );
|
|
32
|
+
} );
|
|
33
|
+
}
|
|
34
|
+
return createBlock(
|
|
35
|
+
'core/list',
|
|
36
|
+
{
|
|
37
|
+
anchor: blockAttributes.anchor,
|
|
38
|
+
},
|
|
39
|
+
childBlocks
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'block',
|
|
45
|
+
blocks: [ 'core/quote', 'core/pullquote' ],
|
|
46
|
+
transform: ( { value, anchor } ) => {
|
|
47
|
+
return createBlock(
|
|
48
|
+
'core/list',
|
|
49
|
+
{
|
|
50
|
+
anchor,
|
|
51
|
+
},
|
|
52
|
+
split(
|
|
53
|
+
create( { html: value, multilineTag: 'p' } ),
|
|
54
|
+
__UNSTABLE_LINE_SEPARATOR
|
|
55
|
+
).map( ( result ) => {
|
|
56
|
+
return createBlock( 'core/list-item', {
|
|
57
|
+
content: toHTMLString( { value: result } ),
|
|
58
|
+
} );
|
|
59
|
+
} )
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
...[ '*', '-' ].map( ( prefix ) => ( {
|
|
64
|
+
type: 'prefix',
|
|
65
|
+
prefix,
|
|
66
|
+
transform( content ) {
|
|
67
|
+
return createBlock( 'core/list', {}, [
|
|
68
|
+
createBlock( 'core/list-item', { content } ),
|
|
69
|
+
] );
|
|
70
|
+
},
|
|
71
|
+
} ) ),
|
|
72
|
+
...[ '1.', '1)' ].map( ( prefix ) => ( {
|
|
73
|
+
type: 'prefix',
|
|
74
|
+
prefix,
|
|
75
|
+
transform( content ) {
|
|
76
|
+
return createBlock(
|
|
77
|
+
'core/list',
|
|
78
|
+
{
|
|
79
|
+
ordered: true,
|
|
80
|
+
},
|
|
81
|
+
[ createBlock( 'core/list-item', { content } ) ]
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
} ) ),
|
|
85
|
+
],
|
|
86
|
+
to: [
|
|
87
|
+
...[ 'core/paragraph', 'core/heading' ].map( ( block ) => ( {
|
|
88
|
+
type: 'block',
|
|
89
|
+
blocks: [ block ],
|
|
90
|
+
transform: ( _attributes, childBlocks ) => {
|
|
91
|
+
return childBlocks
|
|
92
|
+
.filter( ( { name } ) => name === 'core/list-item' )
|
|
93
|
+
.map( ( { attributes } ) =>
|
|
94
|
+
createBlock( block, {
|
|
95
|
+
content: attributes.content,
|
|
96
|
+
} )
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
} ) ),
|
|
100
|
+
...[ 'core/quote', 'core/pullquote' ].map( ( block ) => ( {
|
|
101
|
+
type: 'block',
|
|
102
|
+
blocks: [ block ],
|
|
103
|
+
transform: ( attributes, innerBlocks ) => {
|
|
104
|
+
return switchToBlockType(
|
|
105
|
+
switchToBlockType(
|
|
106
|
+
createBlock( 'core/list', attributes, innerBlocks ),
|
|
107
|
+
'core/paragraph'
|
|
108
|
+
),
|
|
109
|
+
block
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
} ) ),
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default transforms;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
+
"apiVersion": 2,
|
|
4
|
+
"name": "core/list-item",
|
|
5
|
+
"title": "List item",
|
|
6
|
+
"category": "text",
|
|
7
|
+
"parent": [ "core/list" ],
|
|
8
|
+
"description": "Create a list item.",
|
|
9
|
+
"textdomain": "default",
|
|
10
|
+
"attributes": {
|
|
11
|
+
"placeholder": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"content": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"source": "html",
|
|
17
|
+
"selector": "li",
|
|
18
|
+
"default": "",
|
|
19
|
+
"__experimentalRole": "content"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"supports": {
|
|
23
|
+
"className": false,
|
|
24
|
+
"__experimentalSelector": "li"
|
|
25
|
+
}
|
|
26
|
+
}
|