@wordpress/block-library 7.2.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 +2 -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 +17 -11
- package/build/avatar/edit.js.map +1 -1
- package/build/block/edit.js +2 -1
- package/build/block/edit.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +3 -3
- 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/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 +7 -14
- 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 +35 -6
- 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/gallery/gap-styles.js +8 -2
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -0
- 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 +2 -4
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +31 -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/index.js +3 -3
- 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/v2/deprecated.js +117 -0
- package/build/list/v2/deprecated.js.map +1 -0
- package/build/list/v2/edit.js +106 -3
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/index.js +4 -1
- package/build/list/v2/index.js.map +1 -1
- package/build/list/v2/migrate.js +85 -0
- package/build/list/v2/migrate.js.map +1 -0
- package/build/list-item/edit.js +59 -10
- package/build/list-item/edit.js.map +1 -1
- 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 +1 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +16 -0
- package/build/list-item/utils.js.map +1 -0
- 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-menu.js +1 -0
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js +9 -5
- 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-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/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/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/index.js +1 -0
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/controls.native.js +1 -1
- package/build/spacer/controls.native.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 +16 -11
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/block/edit.js +4 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +3 -3
- 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/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 +7 -14
- 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 +36 -8
- 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/gallery/gap-styles.js +8 -2
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -0
- 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 +2 -4
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +30 -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/index.js +3 -3
- 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/v2/deprecated.js +104 -0
- package/build-module/list/v2/deprecated.js.map +1 -0
- package/build-module/list/v2/edit.js +104 -5
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/index.js +3 -1
- package/build-module/list/v2/index.js.map +1 -1
- package/build-module/list/v2/migrate.js +77 -0
- package/build-module/list/v2/migrate.js.map +1 -0
- package/build-module/list-item/edit.js +59 -13
- package/build-module/list-item/edit.js.map +1 -1
- 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 +1 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +8 -0
- package/build-module/list-item/utils.js.map +1 -0
- 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-menu.js +1 -0
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +9 -5
- 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-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/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/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/index.js +1 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.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 +4 -0
- package/build-style/avatar/editor.css +4 -0
- package/build-style/avatar/style-rtl.css +79 -0
- package/build-style/avatar/style.css +79 -0
- package/build-style/editor-rtl.css +30 -9
- package/build-style/editor.css +30 -9
- 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/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/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/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/style-rtl.css +20 -22
- package/build-style/style.css +20 -22
- package/build-style/template-part/editor-rtl.css +0 -9
- package/build-style/template-part/editor.css +0 -9
- 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/edit.js +21 -13
- package/src/avatar/editor.scss +6 -0
- package/src/avatar/index.php +2 -2
- package/src/avatar/style.scss +5 -0
- package/src/block/edit.js +21 -11
- package/src/column/block.json +1 -0
- package/src/comment-author-avatar/block.json +3 -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/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 +12 -20
- 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 +77 -29
- package/src/cover/index.php +85 -0
- package/src/cover/save.js +18 -14
- package/src/gallery/block.json +1 -0
- package/src/gallery/gap-styles.js +9 -4
- package/src/gallery/index.php +7 -6
- package/src/group/block.json +2 -4
- 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/index.js +15 -15
- package/src/list/deprecated.js +2 -2
- 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 +110 -1
- package/src/list/v2/index.js +2 -0
- package/src/list/v2/migrate.js +87 -0
- package/src/list-item/edit.js +69 -23
- 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 +1 -1
- package/src/list-item/utils.js +14 -0
- 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 +6 -1
- package/src/navigation/style.scss +15 -13
- package/src/navigation/use-navigation-menu.js +4 -0
- package/src/navigation-link/block.json +1 -0
- package/src/navigation-link/edit.js +43 -35
- 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-featured-image/block.json +1 -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/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/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +2 -1
- package/src/site-logo/index.php +0 -4
- package/src/social-link/index.php +1 -2
- package/src/social-links/block.json +1 -0
- package/src/spacer/controls.native.js +1 -1
- 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/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-module/navigation/edit/use-list-view-modal.js +0 -63
- package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
- package/src/navigation/edit/use-list-view-modal.js +0 -72
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import {
|
|
11
|
+
AlignmentControl,
|
|
12
|
+
BlockControls,
|
|
13
|
+
RichText,
|
|
14
|
+
useBlockProps,
|
|
15
|
+
useInnerBlocksProps,
|
|
16
|
+
store as blockEditorStore,
|
|
17
|
+
} from '@wordpress/block-editor';
|
|
18
|
+
import { BlockQuotation } from '@wordpress/components';
|
|
19
|
+
import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
|
|
20
|
+
import { createBlock } from '@wordpress/blocks';
|
|
21
|
+
import { Platform, useEffect } from '@wordpress/element';
|
|
22
|
+
import deprecated from '@wordpress/deprecated';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
import { migrateToQuoteV2 } from './deprecated';
|
|
28
|
+
|
|
29
|
+
const isWebPlatform = Platform.OS === 'web';
|
|
30
|
+
const TEMPLATE = [ [ 'core/paragraph', {} ] ];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* At the moment, deprecations don't handle create blocks from attributes
|
|
34
|
+
* (like when using CPT templates). For this reason, this hook is necessary
|
|
35
|
+
* to avoid breaking templates using the old quote block format.
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} attributes Block attributes.
|
|
38
|
+
* @param {string} clientId Block client ID.
|
|
39
|
+
*/
|
|
40
|
+
const useMigrateOnLoad = ( attributes, clientId ) => {
|
|
41
|
+
const registry = useRegistry();
|
|
42
|
+
const { updateBlockAttributes, replaceInnerBlocks } = useDispatch(
|
|
43
|
+
blockEditorStore
|
|
44
|
+
);
|
|
45
|
+
useEffect( () => {
|
|
46
|
+
// As soon as the block is loaded, migrate it to the new version.
|
|
47
|
+
|
|
48
|
+
if ( ! attributes.value ) {
|
|
49
|
+
// No need to migrate if it doesn't have the value attribute.
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const [ newAttributes, newInnerBlocks ] = migrateToQuoteV2(
|
|
54
|
+
attributes
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
deprecated( 'Value attribute on the quote block', {
|
|
58
|
+
since: '6.0',
|
|
59
|
+
version: '6.5',
|
|
60
|
+
alternative: 'inner blocks',
|
|
61
|
+
} );
|
|
62
|
+
|
|
63
|
+
registry.batch( () => {
|
|
64
|
+
updateBlockAttributes( clientId, newAttributes );
|
|
65
|
+
replaceInnerBlocks( clientId, newInnerBlocks );
|
|
66
|
+
} );
|
|
67
|
+
}, [ attributes.value ] );
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default function QuoteEdit( {
|
|
71
|
+
attributes,
|
|
72
|
+
setAttributes,
|
|
73
|
+
isSelected,
|
|
74
|
+
insertBlocksAfter,
|
|
75
|
+
clientId,
|
|
76
|
+
className,
|
|
77
|
+
} ) {
|
|
78
|
+
const { citation, align } = attributes;
|
|
79
|
+
|
|
80
|
+
useMigrateOnLoad( attributes, clientId );
|
|
81
|
+
|
|
82
|
+
const isAncestorOfSelectedBlock = useSelect( ( select ) =>
|
|
83
|
+
select( blockEditorStore ).hasSelectedInnerBlock( clientId )
|
|
84
|
+
);
|
|
85
|
+
const hasSelection = isSelected || isAncestorOfSelectedBlock;
|
|
86
|
+
|
|
87
|
+
const blockProps = useBlockProps( {
|
|
88
|
+
className: classNames( className, {
|
|
89
|
+
[ `has-text-align-${ align }` ]: align,
|
|
90
|
+
} ),
|
|
91
|
+
} );
|
|
92
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
93
|
+
template: TEMPLATE,
|
|
94
|
+
templateInsertUpdatesSelection: true,
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<BlockControls group="block">
|
|
100
|
+
<AlignmentControl
|
|
101
|
+
value={ align }
|
|
102
|
+
onChange={ ( nextAlign ) => {
|
|
103
|
+
setAttributes( { align: nextAlign } );
|
|
104
|
+
} }
|
|
105
|
+
/>
|
|
106
|
+
</BlockControls>
|
|
107
|
+
<BlockQuotation { ...innerBlocksProps }>
|
|
108
|
+
{ innerBlocksProps.children }
|
|
109
|
+
{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (
|
|
110
|
+
<RichText
|
|
111
|
+
identifier="citation"
|
|
112
|
+
tagName={ isWebPlatform ? 'cite' : undefined }
|
|
113
|
+
style={ { display: 'block' } }
|
|
114
|
+
value={ citation }
|
|
115
|
+
onChange={ ( nextCitation ) => {
|
|
116
|
+
setAttributes( {
|
|
117
|
+
citation: nextCitation,
|
|
118
|
+
} );
|
|
119
|
+
} }
|
|
120
|
+
__unstableMobileNoFocusOnMount
|
|
121
|
+
aria-label={ __( 'Quote citation' ) }
|
|
122
|
+
placeholder={
|
|
123
|
+
// translators: placeholder text used for the
|
|
124
|
+
// citation
|
|
125
|
+
__( 'Add citation' )
|
|
126
|
+
}
|
|
127
|
+
className="wp-block-quote__citation"
|
|
128
|
+
__unstableOnSplitAtEnd={ () =>
|
|
129
|
+
insertBlocksAfter( createBlock( 'core/paragraph' ) )
|
|
130
|
+
}
|
|
131
|
+
/>
|
|
132
|
+
) }
|
|
133
|
+
</BlockQuotation>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { quote as icon } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import edit from './edit';
|
|
11
|
+
import save from './save';
|
|
12
|
+
import transforms from './transforms';
|
|
13
|
+
import deprecated from './deprecated';
|
|
14
|
+
|
|
15
|
+
const settings = {
|
|
16
|
+
icon,
|
|
17
|
+
example: {
|
|
18
|
+
attributes: {
|
|
19
|
+
citation: 'Julio Cortázar',
|
|
20
|
+
},
|
|
21
|
+
innerBlocks: [
|
|
22
|
+
{
|
|
23
|
+
name: 'core/paragraph',
|
|
24
|
+
attributes: {
|
|
25
|
+
content: __( 'In quoting others, we cite ourselves.' ),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
transforms,
|
|
31
|
+
edit,
|
|
32
|
+
save,
|
|
33
|
+
deprecated,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default settings;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
|
+
|
|
11
|
+
export default function save( { attributes } ) {
|
|
12
|
+
const { align, citation } = attributes;
|
|
13
|
+
const blockProps = useBlockProps.save( {
|
|
14
|
+
className: classNames( {
|
|
15
|
+
[ `has-text-align-${ align }` ]: align,
|
|
16
|
+
} ),
|
|
17
|
+
} );
|
|
18
|
+
return (
|
|
19
|
+
<blockquote { ...blockProps }>
|
|
20
|
+
<InnerBlocks.Content />
|
|
21
|
+
{ ! RichText.isEmpty( citation ) && (
|
|
22
|
+
<RichText.Content tagName="cite" value={ citation } />
|
|
23
|
+
) }
|
|
24
|
+
</blockquote>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
registerBlockType,
|
|
6
|
+
serialize,
|
|
7
|
+
unregisterBlockType,
|
|
8
|
+
} from '@wordpress/blocks';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { migrateToQuoteV2 } from '../deprecated';
|
|
14
|
+
import * as paragraph from '../../../paragraph';
|
|
15
|
+
import * as quote from '../../../quote';
|
|
16
|
+
import * as quoteV2 from '../../../quote/v2';
|
|
17
|
+
|
|
18
|
+
describe( 'Migrate quote block', () => {
|
|
19
|
+
beforeAll( () => {
|
|
20
|
+
registerBlockType(
|
|
21
|
+
{ name: paragraph.name, ...paragraph.metadata },
|
|
22
|
+
paragraph.settings
|
|
23
|
+
);
|
|
24
|
+
registerBlockType(
|
|
25
|
+
{ name: quote.name, ...quote.metadata },
|
|
26
|
+
quoteV2.settings
|
|
27
|
+
);
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
afterAll( () => {
|
|
31
|
+
unregisterBlockType( paragraph.name );
|
|
32
|
+
unregisterBlockType( quote.name );
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
it( 'should migrate the value attribute to inner blocks', () => {
|
|
36
|
+
const [ attributes, innerBlocks ] = migrateToQuoteV2( {
|
|
37
|
+
value: '<p>First paragraph</p><p>Second paragraph</p>',
|
|
38
|
+
citation: 'Author',
|
|
39
|
+
} );
|
|
40
|
+
expect( attributes ).toEqual( {
|
|
41
|
+
citation: 'Author',
|
|
42
|
+
} );
|
|
43
|
+
expect( serialize( innerBlocks ) ).toEqual(
|
|
44
|
+
`<!-- wp:paragraph -->
|
|
45
|
+
<p>First paragraph</p>
|
|
46
|
+
<!-- /wp:paragraph -->
|
|
47
|
+
|
|
48
|
+
<!-- wp:paragraph -->
|
|
49
|
+
<p>Second paragraph</p>
|
|
50
|
+
<!-- /wp:paragraph -->`
|
|
51
|
+
);
|
|
52
|
+
} );
|
|
53
|
+
|
|
54
|
+
it( 'should create a paragraph if value is empty', () => {
|
|
55
|
+
const [ attributes, innerBlocks ] = migrateToQuoteV2( {
|
|
56
|
+
value: undefined,
|
|
57
|
+
citation: 'Author',
|
|
58
|
+
} );
|
|
59
|
+
expect( attributes ).toEqual( {
|
|
60
|
+
citation: 'Author',
|
|
61
|
+
} );
|
|
62
|
+
expect( serialize( innerBlocks ) ).toEqual(
|
|
63
|
+
`<!-- wp:paragraph -->
|
|
64
|
+
<p></p>
|
|
65
|
+
<!-- /wp:paragraph -->`
|
|
66
|
+
);
|
|
67
|
+
} );
|
|
68
|
+
|
|
69
|
+
it( 'should keep the formats of the value', () => {
|
|
70
|
+
const [ attributes, innerBlocks ] = migrateToQuoteV2( {
|
|
71
|
+
value:
|
|
72
|
+
'<p><strong>Bold</strong></p><p> and </p><p><em>italic</em></p>',
|
|
73
|
+
citation: 'Author',
|
|
74
|
+
} );
|
|
75
|
+
expect( attributes ).toEqual( {
|
|
76
|
+
citation: 'Author',
|
|
77
|
+
} );
|
|
78
|
+
expect( serialize( innerBlocks ) ).toEqual(
|
|
79
|
+
`<!-- wp:paragraph -->
|
|
80
|
+
<p><strong>Bold</strong></p>
|
|
81
|
+
<!-- /wp:paragraph -->
|
|
82
|
+
|
|
83
|
+
<!-- wp:paragraph -->
|
|
84
|
+
<p> and </p>
|
|
85
|
+
<!-- /wp:paragraph -->
|
|
86
|
+
|
|
87
|
+
<!-- wp:paragraph -->
|
|
88
|
+
<p><em>italic</em></p>
|
|
89
|
+
<!-- /wp:paragraph -->`
|
|
90
|
+
);
|
|
91
|
+
} );
|
|
92
|
+
} );
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
createBlock,
|
|
6
|
+
parseWithAttributeSchema,
|
|
7
|
+
rawHandler,
|
|
8
|
+
serialize,
|
|
9
|
+
} from '@wordpress/blocks';
|
|
10
|
+
|
|
11
|
+
const transforms = {
|
|
12
|
+
from: [
|
|
13
|
+
{
|
|
14
|
+
type: 'block',
|
|
15
|
+
blocks: [ 'core/pullquote' ],
|
|
16
|
+
transform: ( { value, citation, anchor, fontSize, style } ) => {
|
|
17
|
+
return createBlock(
|
|
18
|
+
'core/quote',
|
|
19
|
+
{
|
|
20
|
+
citation,
|
|
21
|
+
anchor,
|
|
22
|
+
fontSize,
|
|
23
|
+
style,
|
|
24
|
+
},
|
|
25
|
+
parseWithAttributeSchema( value, {
|
|
26
|
+
type: 'array',
|
|
27
|
+
source: 'query',
|
|
28
|
+
selector: 'p',
|
|
29
|
+
query: {
|
|
30
|
+
content: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
source: 'html',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} ).map( ( { content } ) =>
|
|
36
|
+
createBlock( 'core/paragraph', { content } )
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'block',
|
|
43
|
+
blocks: [ 'core/group' ],
|
|
44
|
+
transform: ( { anchor }, innerBlocks ) =>
|
|
45
|
+
createBlock( 'core/quote', { anchor }, innerBlocks ),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'prefix',
|
|
49
|
+
prefix: '>',
|
|
50
|
+
transform: ( content ) =>
|
|
51
|
+
createBlock( 'core/quote', {}, [
|
|
52
|
+
createBlock( 'core/paragraph', { content } ),
|
|
53
|
+
] ),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'raw',
|
|
57
|
+
schema: () => ( {
|
|
58
|
+
blockquote: {
|
|
59
|
+
children: '*',
|
|
60
|
+
},
|
|
61
|
+
} ),
|
|
62
|
+
selector: 'blockquote',
|
|
63
|
+
transform: ( node ) => {
|
|
64
|
+
return createBlock(
|
|
65
|
+
'core/quote',
|
|
66
|
+
// Don't try to parse any `cite` out of this content.
|
|
67
|
+
// * There may be more than one cite.
|
|
68
|
+
// * There may be more attribution text than just the cite.
|
|
69
|
+
// * If the cite is nested in the quoted text, it's wrong to
|
|
70
|
+
// remove it.
|
|
71
|
+
{},
|
|
72
|
+
rawHandler( {
|
|
73
|
+
HTML: node.innerHTML,
|
|
74
|
+
mode: 'BLOCKS',
|
|
75
|
+
} )
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'block',
|
|
81
|
+
isMultiBlock: true,
|
|
82
|
+
blocks: [ '*' ],
|
|
83
|
+
isMatch: ( {}, blocks ) => {
|
|
84
|
+
return ! blocks.some( ( { name } ) => name === 'core/quote' );
|
|
85
|
+
},
|
|
86
|
+
__experimentalConvert: ( blocks ) =>
|
|
87
|
+
createBlock(
|
|
88
|
+
'core/quote',
|
|
89
|
+
{},
|
|
90
|
+
blocks.map( ( block ) =>
|
|
91
|
+
createBlock(
|
|
92
|
+
block.name,
|
|
93
|
+
block.attributes,
|
|
94
|
+
block.innerBlocks
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
to: [
|
|
101
|
+
{
|
|
102
|
+
type: 'block',
|
|
103
|
+
blocks: [ 'core/pullquote' ],
|
|
104
|
+
isMatch: ( {}, block ) => {
|
|
105
|
+
return block.innerBlocks.every(
|
|
106
|
+
( { name } ) => name === 'core/paragraph'
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
transform: (
|
|
110
|
+
{ citation, anchor, fontSize, style },
|
|
111
|
+
innerBlocks
|
|
112
|
+
) => {
|
|
113
|
+
return createBlock( 'core/pullquote', {
|
|
114
|
+
value: serialize( innerBlocks ),
|
|
115
|
+
citation,
|
|
116
|
+
anchor,
|
|
117
|
+
fontSize,
|
|
118
|
+
style,
|
|
119
|
+
} );
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'block',
|
|
124
|
+
blocks: [ 'core/group' ],
|
|
125
|
+
transform: ( { citation, anchor }, innerBlocks ) =>
|
|
126
|
+
createBlock(
|
|
127
|
+
'core/group',
|
|
128
|
+
{ anchor },
|
|
129
|
+
citation
|
|
130
|
+
? [
|
|
131
|
+
...innerBlocks,
|
|
132
|
+
createBlock( 'core/paragraph', {
|
|
133
|
+
content: citation,
|
|
134
|
+
} ),
|
|
135
|
+
]
|
|
136
|
+
: innerBlocks
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: 'block',
|
|
141
|
+
blocks: [ '*' ],
|
|
142
|
+
transform: ( { citation }, innerBlocks ) =>
|
|
143
|
+
citation
|
|
144
|
+
? [
|
|
145
|
+
...innerBlocks,
|
|
146
|
+
createBlock( 'core/paragraph', {
|
|
147
|
+
content: citation,
|
|
148
|
+
} ),
|
|
149
|
+
]
|
|
150
|
+
: innerBlocks,
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export default transforms;
|
package/src/read-more/block.json
CHANGED
package/src/reset.scss
CHANGED
package/src/rss/edit.js
CHANGED
|
@@ -19,10 +19,11 @@ import {
|
|
|
19
19
|
import { useState } from '@wordpress/element';
|
|
20
20
|
import { grid, list, edit, rss } from '@wordpress/icons';
|
|
21
21
|
import { __ } from '@wordpress/i18n';
|
|
22
|
+
import { prependHTTP } from '@wordpress/url';
|
|
22
23
|
import ServerSideRender from '@wordpress/server-side-render';
|
|
23
24
|
|
|
24
25
|
const DEFAULT_MIN_ITEMS = 1;
|
|
25
|
-
const DEFAULT_MAX_ITEMS =
|
|
26
|
+
const DEFAULT_MAX_ITEMS = 20;
|
|
26
27
|
|
|
27
28
|
export default function RSSEdit( { attributes, setAttributes } ) {
|
|
28
29
|
const [ isEditing, setIsEditing ] = useState( ! attributes.feedURL );
|
|
@@ -50,6 +51,7 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
50
51
|
event.preventDefault();
|
|
51
52
|
|
|
52
53
|
if ( feedURL ) {
|
|
54
|
+
setAttributes( { feedURL: prependHTTP( feedURL ) } );
|
|
53
55
|
setIsEditing( false );
|
|
54
56
|
}
|
|
55
57
|
}
|
package/src/rss/index.php
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* @return string Returns the block content with received rss items.
|
|
14
14
|
*/
|
|
15
15
|
function render_block_core_rss( $attributes ) {
|
|
16
|
+
if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) {
|
|
17
|
+
return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the <strong>Latest Posts</strong> block, to list posts from the site.' ) . '</div></div>';
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
$rss = fetch_feed( $attributes['feedURL'] );
|
|
17
21
|
|
|
18
22
|
if ( is_wp_error( $rss ) ) {
|
|
@@ -83,10 +87,19 @@ function render_block_core_rss( $attributes ) {
|
|
|
83
87
|
if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) {
|
|
84
88
|
$classnames[] = 'is-grid';
|
|
85
89
|
}
|
|
86
|
-
|
|
87
90
|
if ( isset( $attributes['columns'] ) && 'grid' === $attributes['blockLayout'] ) {
|
|
88
91
|
$classnames[] = 'columns-' . $attributes['columns'];
|
|
89
92
|
}
|
|
93
|
+
if ( $attributes['displayDate'] ) {
|
|
94
|
+
$classnames[] = 'has-dates';
|
|
95
|
+
}
|
|
96
|
+
if ( $attributes['displayAuthor'] ) {
|
|
97
|
+
$classnames[] = 'has-authors';
|
|
98
|
+
}
|
|
99
|
+
if ( $attributes['displayExcerpt'] ) {
|
|
100
|
+
$classnames[] = 'has-excerpts';
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) );
|
|
91
104
|
|
|
92
105
|
return sprintf( '<ul %s>%s</ul>', $wrapper_attributes, $list_items );
|
package/src/site-logo/block.json
CHANGED
package/src/site-logo/edit.js
CHANGED
|
@@ -417,8 +417,9 @@ export default function LogoEdit( {
|
|
|
417
417
|
};
|
|
418
418
|
|
|
419
419
|
const setIcon = ( newValue ) =>
|
|
420
|
+
// The new value needs to be `null` to reset the Site Icon.
|
|
420
421
|
editEntityRecord( 'root', 'site', undefined, {
|
|
421
|
-
site_icon: newValue,
|
|
422
|
+
site_icon: newValue ?? null,
|
|
422
423
|
} );
|
|
423
424
|
|
|
424
425
|
let alt = null;
|
package/src/site-logo/index.php
CHANGED
|
@@ -44,10 +44,6 @@ function render_block_core_site_logo( $attributes ) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
$classnames = array();
|
|
47
|
-
if ( ! empty( $attributes['className'] ) ) {
|
|
48
|
-
$classnames[] = $attributes['className'];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
47
|
if ( empty( $attributes['width'] ) ) {
|
|
52
48
|
$classnames[] = 'is-default-size';
|
|
53
49
|
}
|
|
@@ -21,7 +21,6 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
21
21
|
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
|
|
22
22
|
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
|
|
23
23
|
$show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;
|
|
24
|
-
$class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;
|
|
25
24
|
|
|
26
25
|
// Don't render a link if there is no URL set.
|
|
27
26
|
if ( ! $url ) {
|
|
@@ -36,7 +35,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
36
35
|
$icon = block_core_social_link_get_icon( $service );
|
|
37
36
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
38
37
|
array(
|
|
39
|
-
'class' => 'wp-social-link wp-social-link-' . $service
|
|
38
|
+
'class' => 'wp-social-link wp-social-link-' . $service,
|
|
40
39
|
'style' => block_core_social_link_get_color_styles( $block->context ),
|
|
41
40
|
)
|
|
42
41
|
);
|
|
@@ -14,7 +14,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import { MIN_SPACER_SIZE } from './edit';
|
|
17
|
+
import { MIN_SPACER_SIZE } from './edit.js';
|
|
18
18
|
import styles from './style.scss';
|
|
19
19
|
|
|
20
20
|
const DEFAULT_VALUES = { px: 100, em: 10, rem: 10, vw: 10, vh: 25 };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Spacer block decrements height 1`] = `
|
|
4
|
+
"<!-- wp:spacer {\\"height\\":\\"99px\\"} -->
|
|
5
|
+
<div style=\\"height:99px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
6
|
+
<!-- /wp:spacer -->"
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`Spacer block increments height 1`] = `
|
|
10
|
+
"<!-- wp:spacer {\\"height\\":\\"101px\\"} -->
|
|
11
|
+
<div style=\\"height:101px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
12
|
+
<!-- /wp:spacer -->"
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Spacer block inserts block 1`] = `
|
|
16
|
+
"<!-- wp:spacer -->
|
|
17
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
18
|
+
<!-- /wp:spacer -->"
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Spacer block updates height to 25vh 1`] = `
|
|
22
|
+
"<!-- wp:spacer {\\"height\\":\\"25vh\\"} -->
|
|
23
|
+
<div style=\\"height:25vh\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
24
|
+
<!-- /wp:spacer -->"
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`Spacer block updates height to 50px 1`] = `
|
|
28
|
+
"<!-- wp:spacer {\\"height\\":\\"50px\\"} -->
|
|
29
|
+
<div style=\\"height:50px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
30
|
+
<!-- /wp:spacer -->"
|
|
31
|
+
`;
|