@wordpress/block-library 7.18.0 → 8.0.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 +8 -0
- package/build/audio/edit.native.js +1 -3
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/index.js +2 -1
- package/build/audio/index.js.map +1 -1
- package/build/avatar/edit.js +1 -0
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +1 -0
- package/build/avatar/user-control.js.map +1 -1
- package/build/block/edit.js +14 -2
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +14 -6
- package/build/block/edit.native.js.map +1 -1
- package/build/block/index.js +1 -2
- package/build/block/index.js.map +1 -1
- package/build/button/deprecated.js +16 -2
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +13 -7
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +4 -1
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +2 -0
- package/build/button/save.js.map +1 -1
- package/build/code/transforms.js +1 -1
- package/build/code/transforms.js.map +1 -1
- package/build/columns/edit.js +1 -0
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +13 -30
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/transforms.js +5 -0
- package/build/columns/transforms.js.map +1 -1
- package/build/comment-author-avatar/edit.js +1 -0
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/cover/edit/index.js +3 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -0
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js +24 -16
- package/build/cover/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js +1 -0
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -3
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/file/inspector.js +1 -0
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +25 -13
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -3
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/shared.js +4 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +1 -7
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +1 -1
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +3 -1
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/gallery/v1/edit.js +26 -17
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery.native.js +1 -3
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/gallery/v1/shared.js +4 -1
- package/build/gallery/v1/shared.js.map +1 -1
- package/build/group/edit.js +97 -45
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +6 -1
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +147 -0
- package/build/group/placeholder.js.map +1 -0
- package/build/group/variations.js +3 -3
- package/build/group/variations.js.map +1 -1
- package/build/heading/deprecated.js +152 -69
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/index.js +1 -2
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +1 -2
- package/build/heading/transforms.js.map +1 -1
- package/build/html/index.js +1 -1
- package/build/image/edit.js +8 -5
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +3 -2
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +12 -8
- package/build/image/image.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js +3 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-comments/index.js +5 -1
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +13 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/edit.js +2 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/index.js +13 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/transforms.js +1 -9
- package/build/list/transforms.js.map +1 -1
- package/build/list/utils.js +5 -2
- package/build/list/utils.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/index.js +4 -1
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/transforms.js +22 -0
- package/build/list-item/transforms.js.map +1 -0
- package/build/list-item/utils.js +77 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/edit.js +4 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +52 -0
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -0
- package/build/navigation/edit/index.js +112 -143
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/manage-menus-button.js +36 -0
- package/build/navigation/edit/manage-menus-button.js.map +1 -0
- package/build/navigation/edit/menu-inspector-controls.js +72 -0
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build/navigation/edit/navigation-menu-selector.js +3 -1
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +2 -6
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +15 -25
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/view-modal.js +6 -2
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation-link/edit.js +52 -299
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +222 -0
- package/build/navigation-link/link-ui.js.map +1 -0
- package/build/navigation-link/transforms.js +12 -0
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-link/update-attributes.js +108 -0
- package/build/navigation-link/update-attributes.js.map +1 -0
- package/build/navigation-submenu/edit.js +42 -173
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/constants.js +15 -0
- package/build/page-list/constants.js.map +1 -0
- package/build/page-list/convert-to-links-modal.js +22 -86
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/convert-to-navigation-links.js +76 -0
- package/build/page-list/convert-to-navigation-links.js.map +1 -0
- package/build/page-list/edit.js +142 -78
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +6 -1
- package/build/page-list/index.js.map +1 -1
- package/build/page-list-item/edit.js +87 -0
- package/build/page-list-item/edit.js.map +1 -0
- package/build/page-list-item/index.js +85 -0
- package/build/page-list-item/index.js.map +1 -0
- package/build/page-list-item/init.js +16 -0
- package/build/page-list-item/init.js.map +1 -0
- package/build/paragraph/index.js +1 -7
- package/build/paragraph/index.js.map +1 -1
- package/build/post-author/edit.js +38 -22
- package/build/post-author/edit.js.map +1 -1
- package/build/post-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-featured-image/overlay.js +1 -0
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-template/index.js +8 -0
- package/build/post-template/index.js.map +1 -1
- package/build/preformatted/transforms.js +3 -1
- package/build/preformatted/transforms.js.map +1 -1
- package/build/query/deprecated.js +192 -21
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -0
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-placeholder.js +3 -19
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/index.js +0 -8
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +0 -8
- package/build/query/utils.js.map +1 -1
- package/build/rss/edit.js +3 -0
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.native.js +22 -22
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +9 -1
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +18 -10
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -0
- package/build/site-logo/index.js.map +1 -1
- package/build/site-title/index.js +1 -0
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/social-list.js +4 -12
- package/build/social-link/social-list.js.map +1 -1
- package/build/table/edit.js +3 -1
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +17 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +4 -2
- package/build/table/save.js.map +1 -1
- package/build/table/state.js +24 -12
- package/build/table/state.js.map +1 -1
- package/build/table/transforms.js +3 -2
- package/build/table/transforms.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -2
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +2 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +5 -2
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -6
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/variations.js +5 -0
- package/build/template-part/variations.js.map +1 -1
- package/build/text-columns/edit.js +1 -0
- package/build/text-columns/edit.js.map +1 -1
- package/build/utils/transformation-categories.native.js +1 -1
- package/build/utils/transformation-categories.native.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -2
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/index.js +2 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/avatar/edit.js +1 -0
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +1 -0
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/block/edit.js +14 -2
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +14 -6
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/block/index.js +1 -2
- package/build-module/block/index.js.map +1 -1
- package/build-module/button/deprecated.js +16 -2
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +15 -9
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +2 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +4 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -0
- package/build-module/button/save.js.map +1 -1
- package/build-module/code/transforms.js +1 -1
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/columns/edit.js +1 -0
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +13 -29
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/transforms.js +5 -0
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -0
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +3 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js +22 -14
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js +2 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -2
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/file/inspector.js +1 -0
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +25 -12
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.native.js +1 -2
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/shared.js +5 -11
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +1 -6
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +1 -1
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +3 -1
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/gallery/v1/edit.js +27 -18
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery.native.js +1 -2
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/gallery/v1/shared.js +5 -2
- package/build-module/gallery/v1/shared.js.map +1 -1
- package/build-module/group/edit.js +92 -45
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +6 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +133 -0
- package/build-module/group/placeholder.js.map +1 -0
- package/build-module/group/variations.js +3 -3
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/deprecated.js +152 -69
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/index.js +1 -2
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +1 -2
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/html/index.js +1 -1
- package/build-module/image/edit.js +9 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +2 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +13 -9
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js +3 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-comments/index.js +5 -1
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +13 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/index.js +13 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/transforms.js +1 -9
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/utils.js +5 -2
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/edit.js +2 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/index.js +3 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/transforms.js +13 -0
- package/build-module/list-item/transforms.js.map +1 -0
- package/build-module/list-item/utils.js +78 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/edit.js +5 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +44 -0
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -0
- package/build-module/navigation/edit/index.js +111 -143
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/manage-menus-button.js +26 -0
- package/build-module/navigation/edit/manage-menus-button.js.map +1 -0
- package/build-module/navigation/edit/menu-inspector-controls.js +59 -0
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-selector.js +3 -1
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +2 -6
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +16 -26
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/view-modal.js +6 -2
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation-link/edit.js +56 -300
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +206 -0
- package/build-module/navigation-link/link-ui.js.map +1 -0
- package/build-module/navigation-link/transforms.js +12 -0
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +97 -0
- package/build-module/navigation-link/update-attributes.js.map +1 -0
- package/build-module/navigation-submenu/edit.js +47 -175
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/constants.js +6 -0
- package/build-module/page-list/constants.js.map +1 -0
- package/build-module/page-list/convert-to-links-modal.js +20 -81
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/convert-to-navigation-links.js +66 -0
- package/build-module/page-list/convert-to-navigation-links.js.map +1 -0
- package/build-module/page-list/edit.js +144 -82
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +6 -1
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/page-list-item/edit.js +74 -0
- package/build-module/page-list-item/edit.js.map +1 -0
- package/build-module/page-list-item/index.js +68 -0
- package/build-module/page-list-item/index.js.map +1 -0
- package/build-module/page-list-item/init.js +6 -0
- package/build-module/page-list-item/init.js.map +1 -0
- package/build-module/paragraph/index.js +1 -7
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/post-author/edit.js +38 -23
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +1 -0
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-template/index.js +8 -0
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/preformatted/transforms.js +3 -1
- package/build-module/preformatted/transforms.js.map +1 -1
- package/build-module/query/deprecated.js +185 -21
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -0
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +3 -19
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/index.js +0 -8
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +0 -8
- package/build-module/query/utils.js.map +1 -1
- package/build-module/rss/edit.js +3 -0
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.native.js +20 -20
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +8 -1
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +18 -9
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -0
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-title/index.js +1 -0
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/social-list.js +2 -11
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/table/edit.js +3 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +17 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +4 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js +25 -13
- package/build-module/table/state.js.map +1 -1
- package/build-module/table/transforms.js +3 -2
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table-of-contents/edit.js +2 -2
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +3 -2
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +6 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +3 -7
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/variations.js +5 -0
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/text-columns/edit.js +1 -0
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/utils/transformation-categories.native.js +1 -1
- package/build-module/utils/transformation-categories.native.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -2
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/archives/editor-rtl.css +12 -0
- package/build-style/archives/editor.css +12 -0
- package/build-style/archives/style-rtl.css +12 -0
- package/build-style/archives/style.css +12 -0
- package/build-style/audio/editor-rtl.css +12 -0
- package/build-style/audio/editor.css +12 -0
- package/build-style/audio/style-rtl.css +12 -0
- package/build-style/audio/style.css +12 -0
- package/build-style/audio/theme-rtl.css +12 -0
- package/build-style/audio/theme.css +12 -0
- package/build-style/avatar/editor-rtl.css +12 -0
- package/build-style/avatar/editor.css +12 -0
- package/build-style/avatar/style-rtl.css +12 -0
- package/build-style/avatar/style.css +12 -0
- package/build-style/block/editor-rtl.css +22 -0
- package/build-style/block/editor.css +22 -0
- package/build-style/button/editor-rtl.css +12 -0
- package/build-style/button/editor.css +12 -0
- package/build-style/button/style-rtl.css +12 -0
- package/build-style/button/style.css +12 -0
- package/build-style/buttons/editor-rtl.css +12 -0
- package/build-style/buttons/editor.css +12 -0
- package/build-style/buttons/style-rtl.css +12 -0
- package/build-style/buttons/style.css +12 -0
- package/build-style/calendar/style-rtl.css +12 -0
- package/build-style/calendar/style.css +12 -0
- package/build-style/categories/editor-rtl.css +12 -0
- package/build-style/categories/editor.css +12 -0
- package/build-style/categories/style-rtl.css +12 -0
- package/build-style/categories/style.css +12 -0
- package/build-style/classic-rtl.css +12 -0
- package/build-style/classic.css +12 -0
- package/build-style/code/editor-rtl.css +12 -0
- package/build-style/code/editor.css +12 -0
- package/build-style/code/style-rtl.css +12 -0
- package/build-style/code/style.css +12 -0
- package/build-style/code/theme-rtl.css +12 -0
- package/build-style/code/theme.css +12 -0
- package/build-style/columns/editor-rtl.css +12 -0
- package/build-style/columns/editor.css +12 -0
- package/build-style/columns/style-rtl.css +12 -0
- package/build-style/columns/style.css +12 -0
- package/build-style/comment-author-avatar/editor-rtl.css +12 -0
- package/build-style/comment-author-avatar/editor.css +12 -0
- package/build-style/comment-content/style-rtl.css +12 -0
- package/build-style/comment-content/style.css +12 -0
- package/build-style/comment-template/style-rtl.css +12 -0
- package/build-style/comment-template/style.css +12 -0
- package/build-style/comments/editor-rtl.css +12 -0
- package/build-style/comments/editor.css +12 -0
- package/build-style/comments/style-rtl.css +12 -0
- package/build-style/comments/style.css +12 -0
- package/build-style/comments-pagination/editor-rtl.css +12 -0
- package/build-style/comments-pagination/editor.css +12 -0
- package/build-style/comments-pagination/style-rtl.css +12 -0
- package/build-style/comments-pagination/style.css +12 -0
- package/build-style/comments-pagination-numbers/editor-rtl.css +12 -0
- package/build-style/comments-pagination-numbers/editor.css +12 -0
- package/build-style/comments-title/editor-rtl.css +12 -0
- package/build-style/comments-title/editor.css +12 -0
- package/build-style/common-rtl.css +17 -1
- package/build-style/common.css +17 -1
- package/build-style/cover/editor-rtl.css +12 -0
- package/build-style/cover/editor.css +12 -0
- package/build-style/cover/style-rtl.css +14 -1
- package/build-style/cover/style.css +14 -1
- package/build-style/editor-elements-rtl.css +12 -0
- package/build-style/editor-elements.css +12 -0
- package/build-style/editor-rtl.css +115 -21
- package/build-style/editor.css +115 -21
- package/build-style/elements-rtl.css +12 -0
- package/build-style/elements.css +12 -0
- package/build-style/embed/editor-rtl.css +12 -0
- package/build-style/embed/editor.css +12 -0
- package/build-style/embed/style-rtl.css +12 -0
- package/build-style/embed/style.css +12 -0
- package/build-style/embed/theme-rtl.css +12 -0
- package/build-style/embed/theme.css +12 -0
- package/build-style/file/editor-rtl.css +12 -0
- package/build-style/file/editor.css +12 -0
- package/build-style/file/style-rtl.css +12 -0
- package/build-style/file/style.css +12 -0
- package/build-style/freeform/editor-rtl.css +12 -0
- package/build-style/freeform/editor.css +12 -0
- package/build-style/gallery/editor-rtl.css +13 -1
- package/build-style/gallery/editor.css +13 -1
- package/build-style/gallery/style-rtl.css +16 -2
- package/build-style/gallery/style.css +16 -2
- package/build-style/gallery/theme-rtl.css +12 -0
- package/build-style/gallery/theme.css +12 -0
- package/build-style/group/editor-rtl.css +56 -0
- package/build-style/group/editor.css +56 -0
- package/build-style/group/style-rtl.css +12 -0
- package/build-style/group/style.css +12 -0
- package/build-style/group/theme-rtl.css +12 -0
- package/build-style/group/theme.css +12 -0
- package/build-style/heading/style-rtl.css +12 -0
- package/build-style/heading/style.css +12 -0
- package/build-style/html/editor-rtl.css +12 -0
- package/build-style/html/editor.css +12 -0
- package/build-style/image/editor-rtl.css +12 -9
- package/build-style/image/editor.css +12 -9
- package/build-style/image/style-rtl.css +12 -0
- package/build-style/image/style.css +12 -0
- package/build-style/image/theme-rtl.css +12 -0
- package/build-style/image/theme.css +12 -0
- package/build-style/latest-comments/style-rtl.css +13 -0
- package/build-style/latest-comments/style.css +13 -0
- package/build-style/latest-posts/editor-rtl.css +12 -0
- package/build-style/latest-posts/editor.css +12 -0
- package/build-style/latest-posts/style-rtl.css +15 -0
- package/build-style/latest-posts/style.css +15 -0
- package/build-style/list/style-rtl.css +12 -0
- package/build-style/list/style.css +12 -0
- package/build-style/media-text/editor-rtl.css +12 -0
- package/build-style/media-text/editor.css +12 -0
- package/build-style/media-text/style-rtl.css +12 -0
- package/build-style/media-text/style.css +12 -0
- package/build-style/more/editor-rtl.css +12 -0
- package/build-style/more/editor.css +12 -0
- package/build-style/navigation/editor-rtl.css +35 -0
- package/build-style/navigation/editor.css +35 -0
- package/build-style/navigation/style-rtl.css +22 -0
- package/build-style/navigation/style.css +22 -0
- package/build-style/navigation-link/editor-rtl.css +20 -1
- package/build-style/navigation-link/editor.css +20 -1
- package/build-style/navigation-link/style-rtl.css +12 -0
- package/build-style/navigation-link/style.css +12 -0
- package/build-style/navigation-submenu/editor-rtl.css +12 -0
- package/build-style/navigation-submenu/editor.css +12 -0
- package/build-style/nextpage/editor-rtl.css +12 -0
- package/build-style/nextpage/editor.css +12 -0
- package/build-style/page-list/editor-rtl.css +12 -0
- package/build-style/page-list/editor.css +12 -0
- package/build-style/page-list/style-rtl.css +12 -0
- package/build-style/page-list/style.css +12 -0
- package/build-style/paragraph/editor-rtl.css +12 -0
- package/build-style/paragraph/editor.css +12 -0
- package/build-style/paragraph/style-rtl.css +12 -0
- package/build-style/paragraph/style.css +12 -0
- package/build-style/post-author/style-rtl.css +12 -0
- package/build-style/post-author/style.css +12 -0
- package/build-style/post-comments-form/editor-rtl.css +12 -0
- package/build-style/post-comments-form/editor.css +12 -0
- package/build-style/post-comments-form/style-rtl.css +12 -0
- package/build-style/post-comments-form/style.css +12 -0
- package/build-style/post-date/style-rtl.css +12 -0
- package/build-style/post-date/style.css +12 -0
- package/build-style/post-excerpt/editor-rtl.css +12 -0
- package/build-style/post-excerpt/editor.css +12 -0
- package/build-style/post-excerpt/style-rtl.css +12 -0
- package/build-style/post-excerpt/style.css +12 -0
- package/build-style/post-featured-image/editor-rtl.css +12 -0
- package/build-style/post-featured-image/editor.css +12 -0
- package/build-style/post-featured-image/style-rtl.css +12 -0
- package/build-style/post-featured-image/style.css +12 -0
- package/build-style/post-navigation-link/style-rtl.css +12 -0
- package/build-style/post-navigation-link/style.css +12 -0
- package/build-style/post-template/editor-rtl.css +12 -0
- package/build-style/post-template/editor.css +12 -0
- package/build-style/post-template/style-rtl.css +12 -0
- package/build-style/post-template/style.css +12 -0
- package/build-style/post-terms/style-rtl.css +12 -0
- package/build-style/post-terms/style.css +12 -0
- package/build-style/post-title/style-rtl.css +12 -0
- package/build-style/post-title/style.css +12 -0
- package/build-style/preformatted/style-rtl.css +12 -0
- package/build-style/preformatted/style.css +12 -0
- package/build-style/pullquote/editor-rtl.css +12 -0
- package/build-style/pullquote/editor.css +12 -0
- package/build-style/pullquote/style-rtl.css +12 -0
- package/build-style/pullquote/style.css +12 -0
- package/build-style/pullquote/theme-rtl.css +12 -0
- package/build-style/pullquote/theme.css +12 -0
- package/build-style/query/editor-rtl.css +13 -1
- package/build-style/query/editor.css +13 -1
- package/build-style/query-pagination/editor-rtl.css +12 -0
- package/build-style/query-pagination/editor.css +12 -0
- package/build-style/query-pagination/style-rtl.css +13 -1
- package/build-style/query-pagination/style.css +13 -1
- package/build-style/query-pagination-numbers/editor-rtl.css +12 -0
- package/build-style/query-pagination-numbers/editor.css +12 -0
- package/build-style/query-title/style-rtl.css +12 -0
- package/build-style/query-title/style.css +12 -0
- package/build-style/quote/style-rtl.css +12 -0
- package/build-style/quote/style.css +12 -0
- package/build-style/quote/theme-rtl.css +12 -0
- package/build-style/quote/theme.css +12 -0
- package/build-style/read-more/style-rtl.css +12 -0
- package/build-style/read-more/style.css +12 -0
- package/build-style/reset-rtl.css +12 -0
- package/build-style/reset.css +12 -0
- package/build-style/rss/editor-rtl.css +12 -0
- package/build-style/rss/editor.css +12 -0
- package/build-style/rss/style-rtl.css +12 -0
- package/build-style/rss/style.css +12 -0
- package/build-style/search/editor-rtl.css +12 -0
- package/build-style/search/editor.css +12 -0
- package/build-style/search/style-rtl.css +12 -0
- package/build-style/search/style.css +12 -0
- package/build-style/search/theme-rtl.css +12 -0
- package/build-style/search/theme.css +12 -0
- package/build-style/separator/editor-rtl.css +12 -0
- package/build-style/separator/editor.css +12 -0
- package/build-style/separator/style-rtl.css +12 -0
- package/build-style/separator/style.css +12 -0
- package/build-style/separator/theme-rtl.css +12 -0
- package/build-style/separator/theme.css +12 -0
- package/build-style/shortcode/editor-rtl.css +13 -1
- package/build-style/shortcode/editor.css +13 -1
- package/build-style/site-logo/editor-rtl.css +12 -0
- package/build-style/site-logo/editor.css +12 -0
- package/build-style/site-logo/style-rtl.css +12 -0
- package/build-style/site-logo/style.css +12 -0
- package/build-style/site-tagline/editor-rtl.css +12 -0
- package/build-style/site-tagline/editor.css +12 -0
- package/build-style/site-title/editor-rtl.css +12 -0
- package/build-style/site-title/editor.css +12 -0
- package/build-style/site-title/style-rtl.css +12 -0
- package/build-style/site-title/style.css +12 -0
- package/build-style/social-link/editor-rtl.css +12 -0
- package/build-style/social-link/editor.css +12 -0
- package/build-style/social-links/editor-rtl.css +12 -0
- package/build-style/social-links/editor.css +12 -0
- package/build-style/social-links/style-rtl.css +12 -0
- package/build-style/social-links/style.css +12 -0
- package/build-style/spacer/editor-rtl.css +12 -0
- package/build-style/spacer/editor.css +12 -0
- package/build-style/spacer/style-rtl.css +12 -0
- package/build-style/spacer/style.css +12 -0
- package/build-style/style-rtl.css +43 -6
- package/build-style/style.css +43 -6
- package/build-style/table/editor-rtl.css +13 -8
- package/build-style/table/editor.css +13 -8
- package/build-style/table/style-rtl.css +17 -0
- package/build-style/table/style.css +17 -0
- package/build-style/table/theme-rtl.css +13 -3
- package/build-style/table/theme.css +13 -3
- package/build-style/tag-cloud/style-rtl.css +12 -0
- package/build-style/tag-cloud/style.css +12 -0
- package/build-style/template-part/editor-rtl.css +27 -1
- package/build-style/template-part/editor.css +27 -1
- package/build-style/template-part/theme-rtl.css +12 -0
- package/build-style/template-part/theme.css +12 -0
- package/build-style/text-columns/editor-rtl.css +12 -0
- package/build-style/text-columns/editor.css +12 -0
- package/build-style/text-columns/style-rtl.css +12 -0
- package/build-style/text-columns/style.css +12 -0
- package/build-style/theme-rtl.css +13 -3
- package/build-style/theme.css +13 -3
- package/build-style/verse/style-rtl.css +12 -0
- package/build-style/verse/style.css +12 -0
- package/build-style/video/editor-rtl.css +12 -0
- package/build-style/video/editor.css +12 -0
- package/build-style/video/style-rtl.css +14 -1
- package/build-style/video/style.css +14 -1
- package/build-style/video/theme-rtl.css +12 -0
- package/build-style/video/theme.css +12 -0
- package/package.json +32 -30
- package/src/audio/edit.native.js +1 -2
- package/src/audio/index.js +1 -0
- package/src/avatar/edit.js +1 -0
- package/src/avatar/index.php +1 -1
- package/src/avatar/user-control.js +1 -0
- package/src/block/block.json +1 -2
- package/src/block/edit.js +14 -3
- package/src/block/edit.native.js +24 -12
- package/src/block/editor.scss +17 -0
- package/src/block/index.php +1 -2
- package/src/block/test/edit.native.js +28 -32
- package/src/button/block.json +4 -1
- package/src/button/deprecated.js +18 -2
- package/src/button/edit.js +11 -9
- package/src/button/edit.native.js +1 -0
- package/src/button/save.js +12 -2
- package/src/buttons/test/edit.native.js +41 -52
- package/src/code/transforms.js +3 -1
- package/src/columns/edit.js +1 -0
- package/src/columns/edit.native.js +18 -26
- package/src/columns/test/edit.native.js +32 -32
- package/src/columns/transforms.js +8 -0
- package/src/comment-author-avatar/edit.js +1 -0
- package/src/cover/edit/index.js +3 -1
- package/src/cover/edit/inspector-controls.js +2 -0
- package/src/cover/edit.native.js +32 -19
- package/src/cover/test/edit.native.js +77 -130
- package/src/embed/embed-controls.native.js +1 -0
- package/src/embed/embed-preview.native.js +1 -2
- package/src/embed/test/index.native.js +251 -245
- package/src/file/inspector.js +1 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +2 -6
- package/src/gallery/edit.js +15 -5
- package/src/gallery/gallery.native.js +1 -2
- package/src/gallery/shared.js +7 -11
- package/src/gallery/test/index.native.js +11 -11
- package/src/gallery/transforms.js +1 -6
- package/src/gallery/use-get-media.js +1 -1
- package/src/gallery/use-get-media.native.js +2 -1
- package/src/gallery/v1/edit.js +26 -30
- package/src/gallery/v1/gallery.native.js +1 -2
- package/src/gallery/v1/shared.js +7 -2
- package/src/group/block.json +6 -1
- package/src/group/edit.js +91 -44
- package/src/group/editor.scss +48 -0
- package/src/group/placeholder.js +168 -0
- package/src/group/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/group/test/edit.native.js +3 -3
- package/src/group/test/placeholder.js +78 -0
- package/src/group/variations.js +3 -3
- package/src/heading/block.json +1 -2
- package/src/heading/deprecated.js +209 -136
- package/src/heading/index.php +52 -0
- package/src/heading/test/__snapshots__/index.native.js.snap +7 -0
- package/src/heading/test/index.native.js +44 -0
- package/src/home-link/index.php +1 -1
- package/src/html/block.json +1 -1
- package/src/image/edit.js +7 -2
- package/src/image/edit.native.js +2 -1
- package/src/image/editor.scss +0 -11
- package/src/image/image.js +13 -8
- package/src/image/test/edit.native.js +24 -20
- package/src/index.js +2 -0
- package/src/latest-comments/block.json +5 -1
- package/src/latest-comments/edit.js +2 -0
- package/src/latest-comments/style.scss +3 -0
- package/src/latest-posts/block.json +13 -0
- package/src/latest-posts/edit.js +2 -0
- package/src/latest-posts/style.scss +3 -0
- package/src/list/test/edit.native.js +55 -47
- package/src/list/transforms.js +0 -11
- package/src/list/utils.js +6 -2
- package/src/list-item/edit.js +1 -0
- package/src/list-item/index.js +2 -0
- package/src/list-item/transforms.js +17 -0
- package/src/list-item/utils.js +10 -1
- package/src/media-text/edit.js +5 -3
- package/src/missing/test/edit-integration.native.js +10 -12
- package/src/navigation/edit/are-blocks-dirty.js +51 -0
- package/src/navigation/edit/index.js +269 -310
- package/src/navigation/edit/manage-menus-button.js +21 -0
- package/src/navigation/edit/menu-inspector-controls.js +78 -0
- package/src/navigation/edit/navigation-menu-selector.js +5 -1
- package/src/navigation/edit/responsive-wrapper.js +2 -10
- package/src/navigation/edit/test/are-blocks-dirty.js +121 -0
- package/src/navigation/edit/unsaved-inner-blocks.js +17 -36
- package/src/navigation/editor.scss +25 -0
- package/src/navigation/index.php +57 -10
- package/src/navigation/style.scss +16 -0
- package/src/navigation/view-modal.js +11 -1
- package/src/navigation-link/edit.js +66 -329
- package/src/navigation-link/editor.scss +8 -0
- package/src/navigation-link/index.php +32 -0
- package/src/navigation-link/link-ui.js +213 -0
- package/src/navigation-link/test/edit.js +23 -82
- package/src/navigation-link/transforms.js +14 -0
- package/src/navigation-link/update-attributes.js +99 -0
- package/src/navigation-submenu/edit.js +57 -177
- package/src/navigation-submenu/index.php +40 -0
- package/src/page-list/block.json +6 -1
- package/src/page-list/constants.js +8 -0
- package/src/page-list/convert-to-links-modal.js +19 -76
- package/src/page-list/convert-to-navigation-links.js +60 -0
- package/src/page-list/edit.js +179 -118
- package/src/page-list/index.php +9 -0
- package/src/page-list/test/convert-to-links-modal.js +28 -34
- package/src/page-list-item/block.json +51 -0
- package/src/page-list-item/edit.js +94 -0
- package/src/page-list-item/index.js +24 -0
- package/src/page-list-item/init.js +6 -0
- package/src/paragraph/index.js +0 -6
- package/src/post-author/edit.js +47 -22
- package/src/post-content/block.json +3 -0
- package/src/post-content/index.php +1 -2
- package/src/post-featured-image/index.php +7 -2
- package/src/post-featured-image/overlay.js +1 -0
- package/src/post-template/block.json +8 -0
- package/src/preformatted/transforms.js +4 -1
- package/src/query/block.json +0 -8
- package/src/query/deprecated.js +257 -86
- package/src/query/edit/inspector-controls/index.js +1 -0
- package/src/query/edit/query-placeholder.js +4 -16
- package/src/query/editor.scss +1 -1
- package/src/query-pagination/style.scss +1 -1
- package/src/read-more/index.php +9 -2
- package/src/rss/edit.js +3 -0
- package/src/search/edit.native.js +31 -27
- package/src/search/index.js +5 -1
- package/src/shortcode/test/edit.native.js +15 -18
- package/src/site-logo/edit.js +14 -6
- package/src/site-logo/index.js +1 -0
- package/src/site-title/index.js +1 -0
- package/src/social-link/social-list.js +2 -7
- package/src/social-link/test/index.native.js +16 -22
- package/src/social-links/test/edit.native.js +8 -7
- package/src/spacer/test/index.native.js +39 -36
- package/src/table/block.json +15 -0
- package/src/table/edit.js +2 -1
- package/src/table/editor.scss +1 -4
- package/src/table/index.js +1 -0
- package/src/table/save.js +5 -1
- package/src/table/state.js +22 -7
- package/src/table/style.scss +7 -0
- package/src/table/theme.scss +1 -3
- package/src/table/transforms.js +2 -1
- package/src/table-of-contents/edit.js +2 -2
- package/src/tag-cloud/edit.js +3 -2
- package/src/template-part/edit/selection-modal.js +4 -3
- package/src/template-part/edit/utils/hooks.js +7 -3
- package/src/template-part/editor.scss +20 -2
- package/src/template-part/index.php +6 -2
- package/src/template-part/variations.js +4 -0
- package/src/text-columns/edit.js +1 -0
- package/src/utils/transformation-categories.native.js +1 -0
- package/src/video/edit.js +1 -1
- package/src/video/edit.native.js +1 -2
- package/test/babel-plugin.js +35 -35
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -21,6 +21,9 @@ const metadata = {
|
|
|
21
21
|
keywords: ["link"],
|
|
22
22
|
textdomain: "default",
|
|
23
23
|
attributes: {
|
|
24
|
+
textAlign: {
|
|
25
|
+
type: "string"
|
|
26
|
+
},
|
|
24
27
|
url: {
|
|
25
28
|
type: "string",
|
|
26
29
|
source: "attribute",
|
|
@@ -68,7 +71,7 @@ const metadata = {
|
|
|
68
71
|
},
|
|
69
72
|
supports: {
|
|
70
73
|
anchor: true,
|
|
71
|
-
align:
|
|
74
|
+
align: false,
|
|
72
75
|
alignWide: false,
|
|
73
76
|
color: {
|
|
74
77
|
__experimentalSkipSerialization: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/button/index.js"],"names":["__","button","icon","initBlock","deprecated","edit","save","name","metadata","settings","example","attributes","className","text","merge","a","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAM,IAAIC,IAAnB,QAA+B,kBAA/B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,IAAP,MAAiB,QAAjB
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/button/index.js"],"names":["__","button","icon","initBlock","deprecated","edit","save","name","metadata","settings","example","attributes","className","text","merge","a","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAM,IAAIC,IAAnB,QAA+B,kBAA/B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBP,EAAAA,IADuB;AAEvBQ,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,SAAS,EAAE,eADA;AAEXC,MAAAA,IAAI,EAAEb,EAAE,CAAE,gBAAF;AAFG;AADJ,GAFc;AAQvBK,EAAAA,IARuB;AASvBC,EAAAA,IATuB;AAUvBF,EAAAA,UAVuB;AAWvBU,EAAAA,KAAK,EAAE,CAAEC,CAAF;AAAA,QAAK;AAAEF,MAAAA,IAAI,GAAG;AAAT,KAAL;AAAA,WAA0B,EAChC,GAAGE,CAD6B;AAEhCF,MAAAA,IAAI,EAAE,CAAEE,CAAC,CAACF,IAAF,IAAU,EAAZ,IAAmBA;AAFO,KAA1B;AAAA;AAXgB,CAAjB;AAiBP,OAAO,MAAMG,IAAI,GAAG,MAAMb,SAAS,CAAE;AAAEI,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to Action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -17,6 +17,7 @@ export default function save(_ref) {
|
|
|
17
17
|
className
|
|
18
18
|
} = _ref;
|
|
19
19
|
const {
|
|
20
|
+
textAlign,
|
|
20
21
|
fontSize,
|
|
21
22
|
linkTarget,
|
|
22
23
|
rel,
|
|
@@ -35,6 +36,7 @@ export default function save(_ref) {
|
|
|
35
36
|
const colorProps = getColorClassesAndStyles(attributes);
|
|
36
37
|
const spacingProps = getSpacingClassesAndStyles(attributes);
|
|
37
38
|
const buttonClasses = classnames('wp-block-button__link', colorProps.className, borderProps.className, {
|
|
39
|
+
[`has-text-align-${textAlign}`]: textAlign,
|
|
38
40
|
// For backwards compatibility add style that isn't provided via
|
|
39
41
|
// block support.
|
|
40
42
|
'no-border-radius': (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius) === 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/button/save.js"],"names":["classnames","RichText","useBlockProps","__experimentalGetBorderClassesAndStyles","getBorderClassesAndStyles","__experimentalGetColorClassesAndStyles","getColorClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getSpacingClassesAndStyles","__experimentalGetElementClassName","save","attributes","className","fontSize","linkTarget","rel","style","text","title","url","width","borderProps","colorProps","spacingProps","buttonClasses","border","radius","buttonStyle","wrapperClasses","typography"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,aAFD,EAGCC,uCAAuC,IAAIC,yBAH5C,EAICC,sCAAsC,IAAIC,wBAJ3C,EAKCC,wCAAwC,IAAIC,0BAL7C,EAMCC,iCAND,QAOO,yBAPP;AASA,eAAe,SAASC,IAAT,OAA2C;AAAA;;AAAA,MAA5B;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAA4B;AACzD,QAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/button/save.js"],"names":["classnames","RichText","useBlockProps","__experimentalGetBorderClassesAndStyles","getBorderClassesAndStyles","__experimentalGetColorClassesAndStyles","getColorClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getSpacingClassesAndStyles","__experimentalGetElementClassName","save","attributes","className","textAlign","fontSize","linkTarget","rel","style","text","title","url","width","borderProps","colorProps","spacingProps","buttonClasses","border","radius","buttonStyle","wrapperClasses","typography"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,aAFD,EAGCC,uCAAuC,IAAIC,yBAH5C,EAICC,sCAAsC,IAAIC,wBAJ3C,EAKCC,wCAAwC,IAAIC,0BAL7C,EAMCC,iCAND,QAOO,yBAPP;AASA,eAAe,SAASC,IAAT,OAA2C;AAAA;;AAAA,MAA5B;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAA4B;AACzD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,UAHK;AAILC,IAAAA,GAJK;AAKLC,IAAAA,KALK;AAMLC,IAAAA,IANK;AAOLC,IAAAA,KAPK;AAQLC,IAAAA,GARK;AASLC,IAAAA;AATK,MAUFV,UAVJ;;AAYA,MAAK,CAAEO,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,QAAMI,WAAW,GAAGlB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IADD,CADD;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst {\n\t\ttextAlign,\n\t\tfontSize,\n\t\tlinkTarget,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\ttitle,\n\t\turl,\n\t\twidth,\n\t} = attributes;\n\n\tif ( ! text ) {\n\t\treturn null;\n\t}\n\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\tconst buttonClasses = classnames(\n\t\t'wp-block-button__link',\n\t\tcolorProps.className,\n\t\tborderProps.className,\n\t\t{\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t// For backwards compatibility add style that isn't provided via\n\t\t\t// block support.\n\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t},\n\t\t__experimentalGetElementClassName( 'button' )\n\t);\n\tconst buttonStyle = {\n\t\t...borderProps.style,\n\t\t...colorProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\t// The use of a `title` attribute here is soft-deprecated, but still applied\n\t// if it had already been assigned, for the sake of backward-compatibility.\n\t// A title will no longer be assigned for new or updated button block links.\n\n\tconst wrapperClasses = classnames( className, {\n\t\t[ `has-custom-width wp-block-button__width-${ width }` ]: width,\n\t\t[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,\n\t} );\n\n\treturn (\n\t\t<div { ...useBlockProps.save( { className: wrapperClasses } ) }>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"a\"\n\t\t\t\tclassName={ buttonClasses }\n\t\t\t\thref={ url }\n\t\t\t\ttitle={ title }\n\t\t\t\tstyle={ buttonStyle }\n\t\t\t\tvalue={ text }\n\t\t\t\ttarget={ linkTarget }\n\t\t\t\trel={ rel }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/code/transforms.js"],"names":["createBlock","transforms","from","type","regExp","transform","blocks","content","isMatch","node","nodeName","children","length","firstChild","schema","pre","code","to"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,mBAA5B;AAEA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,OAFT;AAGCC,IAAAA,SAAS,EAAE,MAAML,WAAW,CAAE,WAAF;AAH7B,GADK,EAML;AACCG,IAAAA,IAAI,EAAE,OADP;AAECG,IAAAA,MAAM,EAAE,CAAE,WAAF,EAAe,gBAAf,CAFT;AAGCD,IAAAA,SAAS,EAAE,QAAmB;AAAA,UAAjB;AAAEE,QAAAA;AAAF,OAAiB;AAC7B,aAAOP,WAAW,CAAE,WAAF,EAAe;AAChCO,QAAAA;AADgC,OAAf,CAAlB;AAGA;AAPF,GANK,EAeL;AACCJ,IAAAA,IAAI,EAAE,KADP;AAECK,IAAAA,OAAO,EAAIC,IAAF,IACRA,IAAI,CAACC,QAAL,KAAkB,KAAlB,IACAD,IAAI,CAACE,QAAL,CAAcC,MAAd,KAAyB,CADzB,IAEAH,IAAI,CAACI,UAAL,CAAgBH,QAAhB,KAA6B,MAL/B;AAMCI,IAAAA,MAAM,EAAE;AACPC,MAAAA,GAAG,EAAE;AACJJ,QAAAA,QAAQ,EAAE;AACTK,UAAAA,IAAI,EAAE;AACLL,YAAAA,QAAQ,EAAE;AACT,uBAAS;AADA;AADL;AADG;AADN;AADE;AANT,GAfK,CADY;AAmClBM,EAAAA,EAAE,EAAE,CACH;AACCd,IAAAA,IAAI,EAAE,OADP;AAECG,IAAAA,MAAM,EAAE,CAAE,gBAAF,CAFT;AAGCD,IAAAA,SAAS,EAAE,SAAmB;AAAA,UAAjB;AAAEE,QAAAA;AAAF,OAAiB;AAC7B,aAAOP,WAAW,CAAE,gBAAF,EAAoB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/code/transforms.js"],"names":["createBlock","transforms","from","type","regExp","transform","blocks","content","isMatch","node","nodeName","children","length","firstChild","schema","pre","code","to","replace"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,mBAA5B;AAEA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,OAFT;AAGCC,IAAAA,SAAS,EAAE,MAAML,WAAW,CAAE,WAAF;AAH7B,GADK,EAML;AACCG,IAAAA,IAAI,EAAE,OADP;AAECG,IAAAA,MAAM,EAAE,CAAE,WAAF,EAAe,gBAAf,CAFT;AAGCD,IAAAA,SAAS,EAAE,QAAmB;AAAA,UAAjB;AAAEE,QAAAA;AAAF,OAAiB;AAC7B,aAAOP,WAAW,CAAE,WAAF,EAAe;AAChCO,QAAAA;AADgC,OAAf,CAAlB;AAGA;AAPF,GANK,EAeL;AACCJ,IAAAA,IAAI,EAAE,KADP;AAECK,IAAAA,OAAO,EAAIC,IAAF,IACRA,IAAI,CAACC,QAAL,KAAkB,KAAlB,IACAD,IAAI,CAACE,QAAL,CAAcC,MAAd,KAAyB,CADzB,IAEAH,IAAI,CAACI,UAAL,CAAgBH,QAAhB,KAA6B,MAL/B;AAMCI,IAAAA,MAAM,EAAE;AACPC,MAAAA,GAAG,EAAE;AACJJ,QAAAA,QAAQ,EAAE;AACTK,UAAAA,IAAI,EAAE;AACLL,YAAAA,QAAQ,EAAE;AACT,uBAAS;AADA;AADL;AADG;AADN;AADE;AANT,GAfK,CADY;AAmClBM,EAAAA,EAAE,EAAE,CACH;AACCd,IAAAA,IAAI,EAAE,OADP;AAECG,IAAAA,MAAM,EAAE,CAAE,gBAAF,CAFT;AAGCD,IAAAA,SAAS,EAAE,SAAmB;AAAA,UAAjB;AAAEE,QAAAA;AAAF,OAAiB;AAC7B,aAAOP,WAAW,CAAE,gBAAF,EAAoB;AACrCO,QAAAA,OAAO,EAAEA,OAAO,CAACW,OAAR,CAAiB,KAAjB,EAAwB,MAAxB;AAD4B,OAApB,CAAlB;AAGA;AAPF,GADG;AAnCc,CAAnB;AAgDA,eAAejB,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'enter',\n\t\t\tregExp: /^```$/,\n\t\t\ttransform: () => createBlock( 'core/code' ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/html', 'core/paragraph' ],\n\t\t\ttransform: ( { content } ) => {\n\t\t\t\treturn createBlock( 'core/code', {\n\t\t\t\t\tcontent,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tisMatch: ( node ) =>\n\t\t\t\tnode.nodeName === 'PRE' &&\n\t\t\t\tnode.children.length === 1 &&\n\t\t\t\tnode.firstChild.nodeName === 'CODE',\n\t\t\tschema: {\n\t\t\t\tpre: {\n\t\t\t\t\tchildren: {\n\t\t\t\t\t\tcode: {\n\t\t\t\t\t\t\tchildren: {\n\t\t\t\t\t\t\t\t'#text': {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { content } ) => {\n\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\tcontent: content.replace( /\\n/g, '<br>' ),\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
|
|
@@ -66,6 +66,7 @@ function ColumnsEditContainer(_ref) {
|
|
|
66
66
|
onChange: updateAlignment,
|
|
67
67
|
value: verticalAlignment
|
|
68
68
|
})), createElement(InspectorControls, null, createElement(PanelBody, null, createElement(RangeControl, {
|
|
69
|
+
__nextHasNoMarginBottom: true,
|
|
69
70
|
label: __('Columns'),
|
|
70
71
|
value: count,
|
|
71
72
|
onChange: value => updateColumns(count, value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/columns/edit.js"],"names":["classnames","get","__","Notice","PanelBody","RangeControl","ToggleControl","InspectorControls","useInnerBlocksProps","BlockControls","BlockVerticalAlignmentToolbar","__experimentalBlockVariationPicker","useBlockProps","store","blockEditorStore","withDispatch","useDispatch","useSelect","createBlock","createBlocksFromInnerBlocksTemplate","blocksStore","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","ALLOWED_BLOCKS","ColumnsEditContainer","attributes","setAttributes","updateAlignment","updateColumns","clientId","isStackedOnMobile","verticalAlignment","count","select","getBlockCount","classes","blockProps","className","innerBlocksProps","allowedBlocks","orientation","renderAppender","value","Math","max","ColumnsEditContainerWrapper","dispatch","ownProps","registry","updateBlockAttributes","getBlockOrder","innerBlockClientIds","forEach","innerBlockClientId","previousColumns","newColumns","replaceInnerBlocks","getBlocks","innerBlocks","hasExplicitWidths","isAddingColumn","newColumnWidth","widths","Array","from","length","map","width","slice","Placeholder","name","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","nextVariation","ColumnsEdit","props","hasInnerBlocks","Component"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,YAH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AAhC;AAKA,QAAMoD,SAAS,GAAGD,cAAc,GAC7BnC,2BAD6B,GAE7BwB,WAFH;AAIA,SAAO,cAAC,SAAD,EAAgBU,KAAhB,CAAP;AACA,CAZD;;AAcA,eAAeD,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { withDispatch, useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\n/**\n * Allowed blocks constant is passed to InnerBlocks precisely as specified here.\n * The contents of the array should never change.\n * The array should contain the name of each block that is allowed.\n * In columns block, the only block we allow is 'core/column'.\n *\n * @constant\n * @type {string[]}\n */\nconst ALLOWED_BLOCKS = [ 'core/column' ];\n\nfunction ColumnsEditContainer( {\n\tattributes,\n\tsetAttributes,\n\tupdateAlignment,\n\tupdateColumns,\n\tclientId,\n} ) {\n\tconst { isStackedOnMobile, verticalAlignment } = attributes;\n\n\tconst { count } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tcount: select( blockEditorStore ).getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) => updateColumns( count, value ) }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst ColumnsEditContainerWrapper = withDispatch(\n\t( dispatch, ownProps, registry ) => ( {\n\t\t/**\n\t\t * Update all child Column blocks with a new vertical alignment setting\n\t\t * based on whatever alignment is passed in. This allows change to parent\n\t\t * to overide anything set on a individual column basis.\n\t\t *\n\t\t * @param {string} verticalAlignment the vertical alignment setting\n\t\t */\n\t\tupdateAlignment( verticalAlignment ) {\n\t\t\tconst { clientId, setAttributes } = ownProps;\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\t\t\tconst { getBlockOrder } = registry.select( blockEditorStore );\n\n\t\t\t// Update own alignment.\n\t\t\tsetAttributes( { verticalAlignment } );\n\n\t\t\t// Update all child Column Blocks to match.\n\t\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\t\t\tinnerBlockClientIds.forEach( ( innerBlockClientId ) => {\n\t\t\t\tupdateBlockAttributes( innerBlockClientId, {\n\t\t\t\t\tverticalAlignment,\n\t\t\t\t} );\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Updates the column count, including necessary revisions to child Column\n\t\t * blocks to grant required or redistribute available space.\n\t\t *\n\t\t * @param {number} previousColumns Previous column count.\n\t\t * @param {number} newColumns New column count.\n\t\t */\n\t\tupdateColumns( previousColumns, newColumns ) {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks } = dispatch( blockEditorStore );\n\t\t\tconst { getBlocks } = registry.select( blockEditorStore );\n\n\t\t\tlet innerBlocks = getBlocks( clientId );\n\t\t\tconst hasExplicitWidths =\n\t\t\t\thasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t\t// Redistribute available width for existing inner blocks.\n\t\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t\t// constraining the available working width.\n\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t100 - newColumnWidth\n\t\t\t\t);\n\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else if ( isAddingColumn ) {\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\t-( previousColumns - newColumns )\n\t\t\t\t);\n\n\t\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t\t100\n\t\t\t\t\t);\n\n\t\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t\t},\n\t} )\n)( ColumnsEditContainer );\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ get( blockType, [ 'icon', 'src' ] ) }\n\t\t\t\tlabel={ get( blockType, [ 'title' ] ) }\n\t\t\t\tvariations={ variations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks\n\t\t? ColumnsEditContainerWrapper\n\t\t: Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/columns/edit.js"],"names":["classnames","get","__","Notice","PanelBody","RangeControl","ToggleControl","InspectorControls","useInnerBlocksProps","BlockControls","BlockVerticalAlignmentToolbar","__experimentalBlockVariationPicker","useBlockProps","store","blockEditorStore","withDispatch","useDispatch","useSelect","createBlock","createBlocksFromInnerBlocksTemplate","blocksStore","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","ALLOWED_BLOCKS","ColumnsEditContainer","attributes","setAttributes","updateAlignment","updateColumns","clientId","isStackedOnMobile","verticalAlignment","count","select","getBlockCount","classes","blockProps","className","innerBlocksProps","allowedBlocks","orientation","renderAppender","value","Math","max","ColumnsEditContainerWrapper","dispatch","ownProps","registry","updateBlockAttributes","getBlockOrder","innerBlockClientIds","forEach","innerBlockClientId","previousColumns","newColumns","replaceInnerBlocks","getBlocks","innerBlocks","hasExplicitWidths","isAddingColumn","newColumnWidth","widths","Array","from","length","map","width","slice","Placeholder","name","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","nextVariation","ColumnsEdit","props","hasInnerBlocks","Component"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,YAHD,EAICC,aAJD,QAKO,uBALP;AAOA,SACCC,iBADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,6BAJD,EAKCC,kCALD,EAMCC,aAND,EAOCC,KAAK,IAAIC,gBAPV,QAQO,yBARP;AASA,SAASC,YAAT,EAAuBC,WAAvB,EAAoCC,SAApC,QAAqD,iBAArD;AACA,SACCC,WADD,EAECC,mCAFD,EAGCN,KAAK,IAAIO,WAHV,QAIO,mBAJP;AAMA;AACA;AACA;;AACA,SACCC,8BADD,EAECC,qBAFD,EAGCC,4BAHD,EAICC,gBAJD,QAKO,SALP;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,cAAc,GAAG,CAAE,aAAF,CAAvB;;AAEA,SAASC,oBAAT,OAMI;AAAA,MAN2B;AAC9BC,IAAAA,UAD8B;AAE9BC,IAAA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AG,CAAEwE,SAAF,EAAa,CAAE,OAAF,CAAb,CAFZ;AAGC,IAAA,UAAU,EAAGE,UAHd;AAIC,IAAA,QAAQ,EAAG,YAAwC;AAAA,UAAtCI,aAAsC,uEAAtBL,gBAAsB;;AAClD,UAAKK,aAAa,CAACpD,UAAnB,EAAgC;AAC/BC,QAAAA,aAAa,CAAEmD,aAAa,CAACpD,UAAhB,CAAb;AACA;;AACD,UAAKoD,aAAa,CAACnB,WAAnB,EAAiC;AAChCF,QAAAA,kBAAkB,CACjB3B,QADiB,EAEjBZ,mCAAmC,CAClC4D,aAAa,CAACnB,WADoB,CAFlB,EAKjB,IALiB,CAAlB;AAOA;AACD,KAjBF;AAkBC,IAAA,SAAS;AAlBV,IADD,CADD;AAwBA;;AAED,MAAMoB,WAAW,GAAKC,KAAF,IAAa;AAChC,QAAM;AAAElD,IAAAA;AAAF,MAAekD,KAArB;AACA,QAAMC,cAAc,GAAGjE,SAAS,CAC7BkB,MAAF,IACCA,MAAM,CAAErB,gBAAF,CAAN,CAA2B6C,SAA3B,CAAsC5B,QAAtC,EAAiDoC,MAAjD,GAA0D,CAF5B,EAG/B,CAAEpC,QAAF,CAH+B,CAAhC;AAKA,QAAMoD,SAAS,GAAGD,cAAc,GAC7BnC,2BAD6B,GAE7BwB,WAFH;AAIA,SAAO,cAAC,SAAD,EAAgBU,KAAhB,CAAP;AACA,CAZD;;AAcA,eAAeD,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { withDispatch, useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\n/**\n * Allowed blocks constant is passed to InnerBlocks precisely as specified here.\n * The contents of the array should never change.\n * The array should contain the name of each block that is allowed.\n * In columns block, the only block we allow is 'core/column'.\n *\n * @constant\n * @type {string[]}\n */\nconst ALLOWED_BLOCKS = [ 'core/column' ];\n\nfunction ColumnsEditContainer( {\n\tattributes,\n\tsetAttributes,\n\tupdateAlignment,\n\tupdateColumns,\n\tclientId,\n} ) {\n\tconst { isStackedOnMobile, verticalAlignment } = attributes;\n\n\tconst { count } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tcount: select( blockEditorStore ).getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) => updateColumns( count, value ) }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst ColumnsEditContainerWrapper = withDispatch(\n\t( dispatch, ownProps, registry ) => ( {\n\t\t/**\n\t\t * Update all child Column blocks with a new vertical alignment setting\n\t\t * based on whatever alignment is passed in. This allows change to parent\n\t\t * to overide anything set on a individual column basis.\n\t\t *\n\t\t * @param {string} verticalAlignment the vertical alignment setting\n\t\t */\n\t\tupdateAlignment( verticalAlignment ) {\n\t\t\tconst { clientId, setAttributes } = ownProps;\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\t\t\tconst { getBlockOrder } = registry.select( blockEditorStore );\n\n\t\t\t// Update own alignment.\n\t\t\tsetAttributes( { verticalAlignment } );\n\n\t\t\t// Update all child Column Blocks to match.\n\t\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\t\t\tinnerBlockClientIds.forEach( ( innerBlockClientId ) => {\n\t\t\t\tupdateBlockAttributes( innerBlockClientId, {\n\t\t\t\t\tverticalAlignment,\n\t\t\t\t} );\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Updates the column count, including necessary revisions to child Column\n\t\t * blocks to grant required or redistribute available space.\n\t\t *\n\t\t * @param {number} previousColumns Previous column count.\n\t\t * @param {number} newColumns New column count.\n\t\t */\n\t\tupdateColumns( previousColumns, newColumns ) {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks } = dispatch( blockEditorStore );\n\t\t\tconst { getBlocks } = registry.select( blockEditorStore );\n\n\t\t\tlet innerBlocks = getBlocks( clientId );\n\t\t\tconst hasExplicitWidths =\n\t\t\t\thasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t\t// Redistribute available width for existing inner blocks.\n\t\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t\t// constraining the available working width.\n\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t100 - newColumnWidth\n\t\t\t\t);\n\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else if ( isAddingColumn ) {\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\t-( previousColumns - newColumns )\n\t\t\t\t);\n\n\t\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t\t100\n\t\t\t\t\t);\n\n\t\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t\t},\n\t} )\n)( ColumnsEditContainer );\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ get( blockType, [ 'icon', 'src' ] ) }\n\t\t\t\tlabel={ get( blockType, [ 'title' ] ) }\n\t\t\t\tvariations={ variations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks\n\t\t? ColumnsEditContainerWrapper\n\t\t: Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"]}
|
|
@@ -5,7 +5,6 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
* External dependencies
|
|
6
6
|
*/
|
|
7
7
|
import { View, Dimensions } from 'react-native';
|
|
8
|
-
import { map } from 'lodash';
|
|
9
8
|
/**
|
|
10
9
|
* WordPress dependencies
|
|
11
10
|
*/
|
|
@@ -243,16 +242,6 @@ const ColumnsEditContainerWrapper = withDispatch((dispatch, ownProps, registry)
|
|
|
243
242
|
});
|
|
244
243
|
},
|
|
245
244
|
|
|
246
|
-
updateBlockSettings(settings) {
|
|
247
|
-
const {
|
|
248
|
-
clientId
|
|
249
|
-
} = ownProps;
|
|
250
|
-
const {
|
|
251
|
-
updateBlockListSettings
|
|
252
|
-
} = dispatch(blockEditorStore);
|
|
253
|
-
updateBlockListSettings(clientId, settings);
|
|
254
|
-
},
|
|
255
|
-
|
|
256
245
|
/**
|
|
257
246
|
* Updates the column columnCount, including necessary revisions to child Column
|
|
258
247
|
* blocks to grant required or redistribute available space.
|
|
@@ -360,7 +349,7 @@ const ColumnsEdit = props => {
|
|
|
360
349
|
const {
|
|
361
350
|
columnCount,
|
|
362
351
|
isDefaultColumns,
|
|
363
|
-
|
|
352
|
+
innerBlocks,
|
|
364
353
|
hasParents,
|
|
365
354
|
parentBlockAlignment,
|
|
366
355
|
editorSidebarOpened
|
|
@@ -376,29 +365,24 @@ const ColumnsEdit = props => {
|
|
|
376
365
|
const {
|
|
377
366
|
isEditorSidebarOpened
|
|
378
367
|
} = select('core/edit-post');
|
|
379
|
-
const
|
|
380
|
-
const isContentEmpty =
|
|
381
|
-
const innerColumnsWidths = innerBlocks.map(inn => ({
|
|
382
|
-
clientId: inn.clientId,
|
|
383
|
-
attributes: {
|
|
384
|
-
width: inn.attributes.width
|
|
385
|
-
}
|
|
386
|
-
}));
|
|
368
|
+
const innerBlocksList = getBlocks(clientId);
|
|
369
|
+
const isContentEmpty = innerBlocksList.every(innerBlock => innerBlock.innerBlocks.length === 0);
|
|
387
370
|
const parents = getBlockParents(clientId, true);
|
|
388
371
|
return {
|
|
389
372
|
columnCount: getBlockCount(clientId),
|
|
390
|
-
isDefaultColumns:
|
|
391
|
-
|
|
392
|
-
hasParents:
|
|
373
|
+
isDefaultColumns: isContentEmpty,
|
|
374
|
+
innerBlocks: innerBlocksList,
|
|
375
|
+
hasParents: parents.length > 0,
|
|
393
376
|
parentBlockAlignment: (_getBlockAttributes = getBlockAttributes(parents[0])) === null || _getBlockAttributes === void 0 ? void 0 : _getBlockAttributes.align,
|
|
394
377
|
editorSidebarOpened: isSelected && isEditorSidebarOpened()
|
|
395
378
|
};
|
|
396
379
|
}, [clientId, isSelected]);
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
380
|
+
const innerWidths = useMemo(() => innerBlocks.map(inn => ({
|
|
381
|
+
clientId: inn.clientId,
|
|
382
|
+
attributes: {
|
|
383
|
+
width: inn.attributes.width
|
|
384
|
+
}
|
|
385
|
+
})), [innerBlocks]);
|
|
402
386
|
const [isVisible, setIsVisible] = useState(false);
|
|
403
387
|
useEffect(() => {
|
|
404
388
|
if (isSelected && isDefaultColumns) {
|
|
@@ -413,7 +397,7 @@ const ColumnsEdit = props => {
|
|
|
413
397
|
style: style
|
|
414
398
|
}, createElement(ColumnsEditContainerWrapper, _extends({
|
|
415
399
|
columnCount: columnCount,
|
|
416
|
-
innerWidths:
|
|
400
|
+
innerWidths: innerWidths,
|
|
417
401
|
hasParents: hasParents,
|
|
418
402
|
parentBlockAlignment: parentBlockAlignment,
|
|
419
403
|
editorSidebarOpened: editorSidebarOpened
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/columns/edit.native.js"],"names":["View","Dimensions","map","__","sprintf","PanelBody","RangeControl","FooterMessageControl","UnitControl","getValueAndUnit","GlobalStylesContext","alignmentHelpers","__experimentalUseCustomUnits","useCustomUnits","InspectorControls","InnerBlocks","BlockControls","BlockVerticalAlignmentToolbar","BlockVariationPicker","useSetting","store","blockEditorStore","withDispatch","useSelect","useEffect","useState","useContext","useMemo","useCallback","memo","useResizeObserver","createBlock","columns","variations","styles","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","getWidths","getWidthWithUnit","isPercentageUnit","getColumnsInRow","calculateContainerWidth","getContentWidths","ColumnsPreview","ALLOWED_BLOCKS","DEFAULT_COLUMNS_NUM","MIN_COLUMNS_NUM","isFullWidth","ColumnsEditContainer","attributes","updateAlignment","updateColumns","columnCount","isSelected","onDeleteBlock","innerWidths","updateInnerColumnWidth","editorSidebarOpened","resizeListener","sizes","columnsInRow","setColumnsInRow","screenWidth","Math","floor","get","width","globalStyles","verticalAlignment","align","units","availableUnits","newColumnCount","renderAppender","columnAppender","onAddBlock","contentWidths","onChangeWidth","nextWidth","valueUnit","columnId","widthWithUnit","onChangeUnit","nextUnit","index","widthWithoutUnit","parseFloat","onChange","getColumnsSliders","column","label","clientId","length","undefined","onChangeColumnsNum","value","innerBlocksSelected","ColumnsEditContainerWrapper","dispatch","ownProps","registry","setAttributes","updateBlockAttributes","getBlockOrder","select","innerBlockClientIds","forEach","innerBlockClientId","updateBlockSettings","settings","updateBlockListSettings","previousColumns","newColumns","replaceInnerBlocks","getBlocks","getBlockAttributes","innerBlocks","hasExplicitWidths","isAddingColumn","newColumnWidth","widths","Array","from","slice","onAddNextColumn","selectBlock","insertedBlock","removeBlock","ColumnsEdit","props","style","isDefaultColumns","hasParents","parentBlockAlignment","getBlockCount","getBlockParents","isEditorSidebarOpened","isContentEmpty","innerBlock","innerColumnsWidths","inn","parents","filter","Boolean","memoizedInnerWidths","JSON","stringify","isVisible","setIsVisible","revealTimeout","setTimeout","clearTimeout","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AACA,SAASC,GAAT,QAAoB,QAApB;AACA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,SADD,EAECC,YAFD,EAGCC,oBAHD,EAICC,WAJD,EAKCC,eALD,EAMCC,mBAND,EAOCC,gBAPD,EAQCC,4BAA4B,IAAIC,cARjC,QASO,uBATP;AAUA,SACCC,iBADD,EAECC,WAFD,EAGCC,aAHD,EAICC,6BAJD,EAKCC,oBALD,EAMCC,UAND,EAOCC,KAAK,IAAIC,gBAPV,QAQO,yBARP;AASA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,iBAAxC;AACA,SACCC,SADD,EAECC,QAFD,EAGCC,UAHD,EAICC,OAJD,EAKCC,WALD,EAMCC,IAND,QAOO,oBAPP;AAQA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,MAAP,MAAmB,eAAnB;AACA,SACCC,8BADD,EAECC,qBAFD,EAGCC,4BAHD,EAICC,gBAJD,EAKCC,SALD,EAM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C,IAAD;AAAM,IAAA,KAAK,EAAGlB;AAAd,KACC,cAAC,2BAAD;AACC,IAAA,WAAW,EAAG9E,WADf;AAEC,IAAA,WAAW,EAAG4F,mBAFf;AAGC,IAAA,UAAU,EAAGZ,UAHd;AAIC,IAAA,oBAAoB,EAAGC,oBAJxB;AAKC,IAAA,mBAAmB,EAAG5E;AALvB,KAMMwE,KANN,EADD,EASC,cAAC,oBAAD;AACC,IAAA,UAAU,EAAGlG,UADd;AAEC,IAAA,OAAO,EAAGyH,OAFX;AAGC,IAAA,QAAQ,EAAG7D,QAHZ;AAIC,IAAA,SAAS,EAAGwD;AAJb,IATD,CADD;AAkBA,CAnFD;;AAqFA,eAAenB,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\nimport { map } from 'lodash';\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\tRangeControl,\n\tFooterMessageControl,\n\tUnitControl,\n\tgetValueAndUnit,\n\tGlobalStylesContext,\n\talignmentHelpers,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tBlockVariationPicker,\n\tuseSetting,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { withDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { createBlock } from '@wordpress/blocks';\nimport { columns } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport variations from './variations';\nimport styles from './editor.scss';\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n\tgetWidths,\n\tgetWidthWithUnit,\n\tisPercentageUnit,\n} from './utils';\nimport {\n\tgetColumnsInRow,\n\tcalculateContainerWidth,\n\tgetContentWidths,\n} from './columnCalculations.native';\nimport ColumnsPreview from '../column/column-preview';\n\n/**\n * Allowed blocks constant is passed to InnerBlocks precisely as specified here.\n * The contents of the array should never change.\n * The array should contain the name of each block that is allowed.\n * In columns block, the only block we allow is 'core/column'.\n *\n * @constant\n * @type {string[]}\n */\nconst ALLOWED_BLOCKS = [ 'core/column' ];\n\n/**\n * Number of columns to assume for template in case the user opts to skip\n * template option selection.\n *\n * @type {number}\n */\nconst DEFAULT_COLUMNS_NUM = 2;\n\n/**\n * Minimum number of columns in a row\n *\n * @type {number}\n */\nconst MIN_COLUMNS_NUM = 1;\n\nconst { isFullWidth } = alignmentHelpers;\n\nfunction ColumnsEditContainer( {\n\tattributes,\n\tupdateAlignment,\n\tupdateColumns,\n\tcolumnCount,\n\tisSelected,\n\tonDeleteBlock,\n\tinnerWidths,\n\tupdateInnerColumnWidth,\n\teditorSidebarOpened,\n} ) {\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\tconst [ columnsInRow, setColumnsInRow ] = useState( MIN_COLUMNS_NUM );\n\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\tconst globalStyles = useContext( GlobalStylesContext );\n\n\tconst { verticalAlignment, align } = attributes;\n\tconst { width } = sizes || {};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( columnCount === 0 ) {\n\t\t\tconst newColumnCount = columnCount || DEFAULT_COLUMNS_NUM;\n\t\t\tupdateColumns( columnCount, newColumnCount );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( width ) {\n\t\t\tif ( getColumnsInRow( width, columnCount ) !== columnsInRow ) {\n\t\t\t\tsetColumnsInRow( getColumnsInRow( width, columnCount ) );\n\t\t\t}\n\t\t}\n\t}, [ width, columnCount ] );\n\n\tconst renderAppender = () => {\n\t\tif ( isSelected ) {\n\t\t\treturn (\n\t\t\t\t<View style={ isFullWidth( align ) && styles.columnAppender }>\n\t\t\t\t\t<InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst contentWidths = useMemo(\n\t\t() =>\n\t\t\tgetContentWidths(\n\t\t\t\tcolumnsInRow,\n\t\t\t\twidth,\n\t\t\t\tcolumnCount,\n\t\t\t\tinnerWidths,\n\t\t\t\tglobalStyles\n\t\t\t),\n\t\t[ width, columnsInRow, columnCount, innerWidths, globalStyles ]\n\t);\n\n\tconst onAddBlock = useCallback( () => {\n\t\tupdateColumns( columnCount, columnCount + 1 );\n\t}, [ columnCount ] );\n\n\tconst onChangeWidth = ( nextWidth, valueUnit, columnId ) => {\n\t\tconst widthWithUnit = getWidthWithUnit( nextWidth, valueUnit );\n\n\t\tupdateInnerColumnWidth( widthWithUnit, columnId );\n\t};\n\n\tconst onChangeUnit = ( nextUnit, index, columnId ) => {\n\t\tconst widthWithoutUnit = parseFloat(\n\t\t\tgetWidths( innerWidths )[ index ]\n\t\t);\n\t\tconst widthWithUnit = getWidthWithUnit( widthWithoutUnit, nextUnit );\n\n\t\tupdateInnerColumnWidth( widthWithUnit, columnId );\n\t};\n\n\tconst onChange = ( nextWidth, valueUnit, columnId ) => {\n\t\tif ( isPercentageUnit( valueUnit ) || ! valueUnit ) {\n\t\t\treturn;\n\t\t}\n\t\tonChangeWidth( nextWidth, valueUnit, columnId );\n\t};\n\n\tconst getColumnsSliders = useMemo( () => {\n\t\tif ( ! editorSidebarOpened || ! isSelected ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn innerWidths.map( ( column, index ) => {\n\t\t\tconst { valueUnit = '%' } =\n\t\t\t\tgetValueAndUnit( column.attributes.width ) || {};\n\t\t\tconst label = sprintf(\n\t\t\t\t/* translators: %d: column index. */\n\t\t\t\t__( 'Column %d' ),\n\t\t\t\tindex + 1\n\t\t\t);\n\t\t\treturn (\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tsettingLabel=\"Width\"\n\t\t\t\t\tkey={ `${ column.clientId }-${\n\t\t\t\t\t\tgetWidths( innerWidths ).length\n\t\t\t\t\t}` }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t\tmax={\n\t\t\t\t\t\tisPercentageUnit( valueUnit ) || ! valueUnit\n\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ getWidths( innerWidths )[ index ] }\n\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\tonChange( nextWidth, valueUnit, column.clientId );\n\t\t\t\t\t} }\n\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\tonChangeUnit( nextUnit, index, column.clientId )\n\t\t\t\t\t}\n\t\t\t\t\tonComplete={ ( nextWidth ) => {\n\t\t\t\t\t\tonChangeWidth( nextWidth, valueUnit, column.clientId );\n\t\t\t\t\t} }\n\t\t\t\t\tunit={ valueUnit }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<ColumnsPreview\n\t\t\t\t\t\t\tcolumnWidths={ getWidths( innerWidths, false ) }\n\t\t\t\t\t\t\tselectedColumnIndex={ index }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ editorSidebarOpened, isSelected, innerWidths ] );\n\n\tconst onChangeColumnsNum = useCallback(\n\t\t( value ) => {\n\t\t\tupdateColumns( columnCount, value );\n\t\t},\n\t\t[ columnCount ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<PanelBody title={ __( 'Columns Settings' ) }>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Number of columns' ) }\n\t\t\t\t\t\t\t\ticon={ columns }\n\t\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\t\tonChange={ onChangeColumnsNum }\n\t\t\t\t\t\t\t\tmin={ MIN_COLUMNS_NUM }\n\t\t\t\t\t\t\t\tmax={ columnCount + 1 }\n\t\t\t\t\t\t\t\ttype=\"stepper\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ getColumnsSliders }\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t<FooterMessageControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Note: Column layout may vary between themes and screen sizes'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View style={ isSelected && styles.innerBlocksSelected }>\n\t\t\t\t{ resizeListener }\n\t\t\t\t{ width && (\n\t\t\t\t\t<InnerBlocks\n\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\torientation={\n\t\t\t\t\t\t\tcolumnsInRow > 1 ? 'horizontal' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\thorizontal={ columnsInRow > 1 }\n\t\t\t\t\t\tallowedBlocks={ ALLOWED_BLOCKS }\n\t\t\t\t\t\tcontentResizeMode=\"stretch\"\n\t\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\t\tonDeleteBlock={\n\t\t\t\t\t\t\tcolumnCount === 1 ? onDeleteBlock : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockWidth={ width }\n\t\t\t\t\t\tcontentStyle={ contentWidths }\n\t\t\t\t\t\tparentWidth={\n\t\t\t\t\t\t\tisFullWidth( align ) && columnCount === 0\n\t\t\t\t\t\t\t\t? screenWidth\n\t\t\t\t\t\t\t\t: calculateContainerWidth( width, columnsInRow )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</>\n\t);\n}\n\nconst ColumnsEditContainerWrapper = withDispatch(\n\t( dispatch, ownProps, registry ) => ( {\n\t\t/**\n\t\t * Update all child Column blocks with a new vertical alignment setting\n\t\t * based on whatever alignment is passed in. This allows change to parent\n\t\t * to overide anything set on a individual column basis.\n\t\t *\n\t\t * @param {string} verticalAlignment the vertical alignment setting\n\t\t */\n\t\tupdateAlignment( verticalAlignment ) {\n\t\t\tconst { clientId, setAttributes } = ownProps;\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\t\t\tconst { getBlockOrder } = registry.select( blockEditorStore );\n\n\t\t\t// Update own alignment.\n\t\t\tsetAttributes( { verticalAlignment } );\n\n\t\t\t// Update all child Column Blocks to match.\n\t\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\t\t\tinnerBlockClientIds.forEach( ( innerBlockClientId ) => {\n\t\t\t\tupdateBlockAttributes( innerBlockClientId, {\n\t\t\t\t\tverticalAlignment,\n\t\t\t\t} );\n\t\t\t} );\n\t\t},\n\t\tupdateInnerColumnWidth( value, columnId ) {\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\n\t\t\tupdateBlockAttributes( columnId, {\n\t\t\t\twidth: value,\n\t\t\t} );\n\t\t},\n\t\tupdateBlockSettings( settings ) {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { updateBlockListSettings } = dispatch( blockEditorStore );\n\t\t\tupdateBlockListSettings( clientId, settings );\n\t\t},\n\t\t/**\n\t\t * Updates the column columnCount, including necessary revisions to child Column\n\t\t * blocks to grant required or redistribute available space.\n\t\t *\n\t\t * @param {number} previousColumns Previous column columnCount.\n\t\t * @param {number} newColumns New column columnCount.\n\t\t */\n\t\tupdateColumns( previousColumns, newColumns ) {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks } = dispatch( blockEditorStore );\n\t\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\n\t\t\tlet innerBlocks = getBlocks( clientId );\n\t\t\tconst hasExplicitWidths =\n\t\t\t\thasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t\t// Redistribute available width for existing inner blocks.\n\t\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\t\t// Get verticalAlignment from Columns block to set the same to new Column.\n\t\t\tconst { verticalAlignment } = getBlockAttributes( clientId ) || {};\n\n\t\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t\t// constraining the available working width.\n\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t100 - newColumnWidth\n\t\t\t\t);\n\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t\t\tverticalAlignment,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else if ( isAddingColumn ) {\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\tverticalAlignment,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\t-( previousColumns - newColumns )\n\t\t\t\t);\n\n\t\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t\t100\n\t\t\t\t\t);\n\n\t\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t\t},\n\t\tonAddNextColumn: () => {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks, selectBlock } =\n\t\t\t\tdispatch( blockEditorStore );\n\t\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\n\t\t\t// Get verticalAlignment from Columns block to set the same to new Column.\n\t\t\tconst { verticalAlignment } = getBlockAttributes( clientId );\n\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\tconst insertedBlock = createBlock( 'core/column', {\n\t\t\t\tverticalAlignment,\n\t\t\t} );\n\n\t\t\treplaceInnerBlocks(\n\t\t\t\tclientId,\n\t\t\t\t[ ...innerBlocks, insertedBlock ],\n\t\t\t\ttrue\n\t\t\t);\n\t\t\tselectBlock( insertedBlock.clientId );\n\t\t},\n\t\tonDeleteBlock: () => {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { removeBlock } = dispatch( blockEditorStore );\n\t\t\tremoveBlock( clientId );\n\t\t},\n\t} )\n)( memo( ColumnsEditContainer ) );\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId, isSelected, style } = props;\n\tconst {\n\t\tcolumnCount,\n\t\tisDefaultColumns,\n\t\tinnerWidths = [],\n\t\thasParents,\n\t\tparentBlockAlignment,\n\t\teditorSidebarOpened,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { isEditorSidebarOpened } = select( 'core/edit-post' );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\tconst isContentEmpty = map(\n\t\t\t\tinnerBlocks,\n\t\t\t\t( innerBlock ) => innerBlock.innerBlocks.length\n\t\t\t);\n\n\t\t\tconst innerColumnsWidths = innerBlocks.map( ( inn ) => ( {\n\t\t\t\tclientId: inn.clientId,\n\t\t\t\tattributes: { width: inn.attributes.width },\n\t\t\t} ) );\n\t\t\tconst parents = getBlockParents( clientId, true );\n\n\t\t\treturn {\n\t\t\t\tcolumnCount: getBlockCount( clientId ),\n\t\t\t\tisDefaultColumns: ! isContentEmpty.filter( Boolean ).length,\n\t\t\t\tinnerWidths: innerColumnsWidths,\n\t\t\t\thasParents: !! parents.length,\n\t\t\t\tparentBlockAlignment: getBlockAttributes( parents[ 0 ] )?.align,\n\t\t\t\teditorSidebarOpened: isSelected && isEditorSidebarOpened(),\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSelected ]\n\t);\n\n\tconst memoizedInnerWidths = useMemo( () => {\n\t\treturn innerWidths;\n\t}, [\n\t\t// The JSON.stringify is used because innerWidth is always a new reference.\n\t\t// The innerBlocks is a new reference after each attribute change of any nested block.\n\t\tJSON.stringify( innerWidths ),\n\t] );\n\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isSelected && isDefaultColumns ) {\n\t\t\tconst revealTimeout = setTimeout( () => setIsVisible( true ), 100 );\n\n\t\t\treturn () => clearTimeout( revealTimeout );\n\t\t}\n\t}, [] );\n\n\tconst onClose = useCallback( () => {\n\t\tsetIsVisible( false );\n\t}, [] );\n\n\treturn (\n\t\t<View style={ style }>\n\t\t\t<ColumnsEditContainerWrapper\n\t\t\t\tcolumnCount={ columnCount }\n\t\t\t\tinnerWidths={ memoizedInnerWidths }\n\t\t\t\thasParents={ hasParents }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t\teditorSidebarOpened={ editorSidebarOpened }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t<BlockVariationPicker\n\t\t\t\tvariations={ variations }\n\t\t\t\tonClose={ onClose }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisVisible={ isVisible }\n\t\t\t/>\n\t\t</View>\n\t);\n};\n\nexport default ColumnsEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/columns/edit.native.js"],"names":["View","Dimensions","__","sprintf","PanelBody","RangeControl","FooterMessageControl","UnitControl","getValueAndUnit","GlobalStylesContext","alignmentHelpers","__experimentalUseCustomUnits","useCustomUnits","InspectorControls","InnerBlocks","BlockControls","BlockVerticalAlignmentToolbar","BlockVariationPicker","useSetting","store","blockEditorStore","withDispatch","useSelect","useEffect","useState","useContext","useMemo","useCallback","memo","useResizeObserver","createBlock","columns","variations","styles","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","getWidths","getWidthWithUnit","isPercentageUnit","getColumnsInRow","calculateContainerWidth","getContentWidths","ColumnsPreview","ALLOWED_BLOCKS","DEFAULT_COLUMNS_NUM","MIN_COLUMNS_NUM","isFullWidth","ColumnsEditContainer","attributes","updateAlignment","updateColumns","columnCount","isSelected","onDeleteBlock","innerWidths","updateInnerColumnWidth","editorSidebarOpened","resizeListener","sizes","columnsInRow","setColumnsInRow","screenWidth","Math","floor","get","width","globalStyles","verticalAlignment","align","units","availableUnits","newColumnCount","renderAppender","columnAppender","onAddBlock","contentWidths","onChangeWidth","nextWidth","valueUnit","columnId","widthWithUnit","onChangeUnit","nextUnit","index","widthWithoutUnit","parseFloat","onChange","getColumnsSliders","map","column","label","clientId","length","undefined","onChangeColumnsNum","value","innerBlocksSelected","ColumnsEditContainerWrapper","dispatch","ownProps","registry","setAttributes","updateBlockAttributes","getBlockOrder","select","innerBlockClientIds","forEach","innerBlockClientId","previousColumns","newColumns","replaceInnerBlocks","getBlocks","getBlockAttributes","innerBlocks","hasExplicitWidths","isAddingColumn","newColumnWidth","widths","Array","from","slice","onAddNextColumn","selectBlock","insertedBlock","removeBlock","ColumnsEdit","props","style","isDefaultColumns","hasParents","parentBlockAlignment","getBlockCount","getBlockParents","isEditorSidebarOpened","innerBlocksList","isContentEmpty","every","innerBlock","parents","inn","isVisible","setIsVisible","revealTimeout","setTimeout","clearTimeout","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,SADD,EAECC,YAFD,EAGCC,oBAHD,EAICC,WAJD,EAKCC,eALD,EAMCC,mBAND,EAOCC,gBAPD,EAQCC,4BAA4B,IAAIC,cARjC,QASO,uBATP;AAUA,SACCC,iBADD,EAECC,WAFD,EAGCC,aAHD,EAICC,6BAJD,EAKCC,oBALD,EAMCC,UAND,EAOCC,KAAK,IAAIC,gBAPV,QAQO,yBARP;AASA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,iBAAxC;AACA,SACCC,SADD,EAECC,QAFD,EAGCC,UAHD,EAICC,OAJD,EAKCC,WALD,EAMCC,IAND,QAOO,oBAPP;AAQA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA;AACA;AACA;;A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,UAAU,EAAGhG,UADd;AAEC,IAAA,OAAO,EAAGmH,OAFX;AAGC,IAAA,QAAQ,EAAGtD,QAHZ;AAIC,IAAA,SAAS,EAAGiD;AAJb,IATD,CADD;AAkBA,CAhFD;;AAkFA,eAAef,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\tRangeControl,\n\tFooterMessageControl,\n\tUnitControl,\n\tgetValueAndUnit,\n\tGlobalStylesContext,\n\talignmentHelpers,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tBlockVariationPicker,\n\tuseSetting,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { withDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { createBlock } from '@wordpress/blocks';\nimport { columns } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport variations from './variations';\nimport styles from './editor.scss';\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n\tgetWidths,\n\tgetWidthWithUnit,\n\tisPercentageUnit,\n} from './utils';\nimport {\n\tgetColumnsInRow,\n\tcalculateContainerWidth,\n\tgetContentWidths,\n} from './columnCalculations.native';\nimport ColumnsPreview from '../column/column-preview';\n\n/**\n * Allowed blocks constant is passed to InnerBlocks precisely as specified here.\n * The contents of the array should never change.\n * The array should contain the name of each block that is allowed.\n * In columns block, the only block we allow is 'core/column'.\n *\n * @constant\n * @type {string[]}\n */\nconst ALLOWED_BLOCKS = [ 'core/column' ];\n\n/**\n * Number of columns to assume for template in case the user opts to skip\n * template option selection.\n *\n * @type {number}\n */\nconst DEFAULT_COLUMNS_NUM = 2;\n\n/**\n * Minimum number of columns in a row\n *\n * @type {number}\n */\nconst MIN_COLUMNS_NUM = 1;\n\nconst { isFullWidth } = alignmentHelpers;\n\nfunction ColumnsEditContainer( {\n\tattributes,\n\tupdateAlignment,\n\tupdateColumns,\n\tcolumnCount,\n\tisSelected,\n\tonDeleteBlock,\n\tinnerWidths,\n\tupdateInnerColumnWidth,\n\teditorSidebarOpened,\n} ) {\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\tconst [ columnsInRow, setColumnsInRow ] = useState( MIN_COLUMNS_NUM );\n\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\tconst globalStyles = useContext( GlobalStylesContext );\n\n\tconst { verticalAlignment, align } = attributes;\n\tconst { width } = sizes || {};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( columnCount === 0 ) {\n\t\t\tconst newColumnCount = columnCount || DEFAULT_COLUMNS_NUM;\n\t\t\tupdateColumns( columnCount, newColumnCount );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( width ) {\n\t\t\tif ( getColumnsInRow( width, columnCount ) !== columnsInRow ) {\n\t\t\t\tsetColumnsInRow( getColumnsInRow( width, columnCount ) );\n\t\t\t}\n\t\t}\n\t}, [ width, columnCount ] );\n\n\tconst renderAppender = () => {\n\t\tif ( isSelected ) {\n\t\t\treturn (\n\t\t\t\t<View style={ isFullWidth( align ) && styles.columnAppender }>\n\t\t\t\t\t<InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst contentWidths = useMemo(\n\t\t() =>\n\t\t\tgetContentWidths(\n\t\t\t\tcolumnsInRow,\n\t\t\t\twidth,\n\t\t\t\tcolumnCount,\n\t\t\t\tinnerWidths,\n\t\t\t\tglobalStyles\n\t\t\t),\n\t\t[ width, columnsInRow, columnCount, innerWidths, globalStyles ]\n\t);\n\n\tconst onAddBlock = useCallback( () => {\n\t\tupdateColumns( columnCount, columnCount + 1 );\n\t}, [ columnCount ] );\n\n\tconst onChangeWidth = ( nextWidth, valueUnit, columnId ) => {\n\t\tconst widthWithUnit = getWidthWithUnit( nextWidth, valueUnit );\n\n\t\tupdateInnerColumnWidth( widthWithUnit, columnId );\n\t};\n\n\tconst onChangeUnit = ( nextUnit, index, columnId ) => {\n\t\tconst widthWithoutUnit = parseFloat(\n\t\t\tgetWidths( innerWidths )[ index ]\n\t\t);\n\t\tconst widthWithUnit = getWidthWithUnit( widthWithoutUnit, nextUnit );\n\n\t\tupdateInnerColumnWidth( widthWithUnit, columnId );\n\t};\n\n\tconst onChange = ( nextWidth, valueUnit, columnId ) => {\n\t\tif ( isPercentageUnit( valueUnit ) || ! valueUnit ) {\n\t\t\treturn;\n\t\t}\n\t\tonChangeWidth( nextWidth, valueUnit, columnId );\n\t};\n\n\tconst getColumnsSliders = useMemo( () => {\n\t\tif ( ! editorSidebarOpened || ! isSelected ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn innerWidths.map( ( column, index ) => {\n\t\t\tconst { valueUnit = '%' } =\n\t\t\t\tgetValueAndUnit( column.attributes.width ) || {};\n\t\t\tconst label = sprintf(\n\t\t\t\t/* translators: %d: column index. */\n\t\t\t\t__( 'Column %d' ),\n\t\t\t\tindex + 1\n\t\t\t);\n\t\t\treturn (\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tsettingLabel=\"Width\"\n\t\t\t\t\tkey={ `${ column.clientId }-${\n\t\t\t\t\t\tgetWidths( innerWidths ).length\n\t\t\t\t\t}` }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t\tmax={\n\t\t\t\t\t\tisPercentageUnit( valueUnit ) || ! valueUnit\n\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ getWidths( innerWidths )[ index ] }\n\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\tonChange( nextWidth, valueUnit, column.clientId );\n\t\t\t\t\t} }\n\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\tonChangeUnit( nextUnit, index, column.clientId )\n\t\t\t\t\t}\n\t\t\t\t\tonComplete={ ( nextWidth ) => {\n\t\t\t\t\t\tonChangeWidth( nextWidth, valueUnit, column.clientId );\n\t\t\t\t\t} }\n\t\t\t\t\tunit={ valueUnit }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<ColumnsPreview\n\t\t\t\t\t\t\tcolumnWidths={ getWidths( innerWidths, false ) }\n\t\t\t\t\t\t\tselectedColumnIndex={ index }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ editorSidebarOpened, isSelected, innerWidths ] );\n\n\tconst onChangeColumnsNum = useCallback(\n\t\t( value ) => {\n\t\t\tupdateColumns( columnCount, value );\n\t\t},\n\t\t[ columnCount ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<PanelBody title={ __( 'Columns Settings' ) }>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Number of columns' ) }\n\t\t\t\t\t\t\t\ticon={ columns }\n\t\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\t\tonChange={ onChangeColumnsNum }\n\t\t\t\t\t\t\t\tmin={ MIN_COLUMNS_NUM }\n\t\t\t\t\t\t\t\tmax={ columnCount + 1 }\n\t\t\t\t\t\t\t\ttype=\"stepper\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ getColumnsSliders }\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t\t<FooterMessageControl\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Note: Column layout may vary between themes and screen sizes'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelBody>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<View style={ isSelected && styles.innerBlocksSelected }>\n\t\t\t\t{ resizeListener }\n\t\t\t\t{ width && (\n\t\t\t\t\t<InnerBlocks\n\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\torientation={\n\t\t\t\t\t\t\tcolumnsInRow > 1 ? 'horizontal' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\thorizontal={ columnsInRow > 1 }\n\t\t\t\t\t\tallowedBlocks={ ALLOWED_BLOCKS }\n\t\t\t\t\t\tcontentResizeMode=\"stretch\"\n\t\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\t\tonDeleteBlock={\n\t\t\t\t\t\t\tcolumnCount === 1 ? onDeleteBlock : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblockWidth={ width }\n\t\t\t\t\t\tcontentStyle={ contentWidths }\n\t\t\t\t\t\tparentWidth={\n\t\t\t\t\t\t\tisFullWidth( align ) && columnCount === 0\n\t\t\t\t\t\t\t\t? screenWidth\n\t\t\t\t\t\t\t\t: calculateContainerWidth( width, columnsInRow )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</>\n\t);\n}\n\nconst ColumnsEditContainerWrapper = withDispatch(\n\t( dispatch, ownProps, registry ) => ( {\n\t\t/**\n\t\t * Update all child Column blocks with a new vertical alignment setting\n\t\t * based on whatever alignment is passed in. This allows change to parent\n\t\t * to overide anything set on a individual column basis.\n\t\t *\n\t\t * @param {string} verticalAlignment the vertical alignment setting\n\t\t */\n\t\tupdateAlignment( verticalAlignment ) {\n\t\t\tconst { clientId, setAttributes } = ownProps;\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\t\t\tconst { getBlockOrder } = registry.select( blockEditorStore );\n\n\t\t\t// Update own alignment.\n\t\t\tsetAttributes( { verticalAlignment } );\n\n\t\t\t// Update all child Column Blocks to match.\n\t\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\t\t\tinnerBlockClientIds.forEach( ( innerBlockClientId ) => {\n\t\t\t\tupdateBlockAttributes( innerBlockClientId, {\n\t\t\t\t\tverticalAlignment,\n\t\t\t\t} );\n\t\t\t} );\n\t\t},\n\t\tupdateInnerColumnWidth( value, columnId ) {\n\t\t\tconst { updateBlockAttributes } = dispatch( blockEditorStore );\n\n\t\t\tupdateBlockAttributes( columnId, {\n\t\t\t\twidth: value,\n\t\t\t} );\n\t\t},\n\t\t/**\n\t\t * Updates the column columnCount, including necessary revisions to child Column\n\t\t * blocks to grant required or redistribute available space.\n\t\t *\n\t\t * @param {number} previousColumns Previous column columnCount.\n\t\t * @param {number} newColumns New column columnCount.\n\t\t */\n\t\tupdateColumns( previousColumns, newColumns ) {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks } = dispatch( blockEditorStore );\n\t\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\n\t\t\tlet innerBlocks = getBlocks( clientId );\n\t\t\tconst hasExplicitWidths =\n\t\t\t\thasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t\t// Redistribute available width for existing inner blocks.\n\t\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\t\t// Get verticalAlignment from Columns block to set the same to new Column.\n\t\t\tconst { verticalAlignment } = getBlockAttributes( clientId ) || {};\n\n\t\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t\t// constraining the available working width.\n\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t100 - newColumnWidth\n\t\t\t\t);\n\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t\t\tverticalAlignment,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else if ( isAddingColumn ) {\n\t\t\t\tinnerBlocks = [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t...Array.from( {\n\t\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t\t} ).map( () => {\n\t\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\t\tverticalAlignment,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\t-( previousColumns - newColumns )\n\t\t\t\t);\n\n\t\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t\t100\n\t\t\t\t\t);\n\n\t\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t\t},\n\t\tonAddNextColumn: () => {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { replaceInnerBlocks, selectBlock } =\n\t\t\t\tdispatch( blockEditorStore );\n\t\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\n\t\t\t// Get verticalAlignment from Columns block to set the same to new Column.\n\t\t\tconst { verticalAlignment } = getBlockAttributes( clientId );\n\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\tconst insertedBlock = createBlock( 'core/column', {\n\t\t\t\tverticalAlignment,\n\t\t\t} );\n\n\t\t\treplaceInnerBlocks(\n\t\t\t\tclientId,\n\t\t\t\t[ ...innerBlocks, insertedBlock ],\n\t\t\t\ttrue\n\t\t\t);\n\t\t\tselectBlock( insertedBlock.clientId );\n\t\t},\n\t\tonDeleteBlock: () => {\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst { removeBlock } = dispatch( blockEditorStore );\n\t\t\tremoveBlock( clientId );\n\t\t},\n\t} )\n)( memo( ColumnsEditContainer ) );\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId, isSelected, style } = props;\n\tconst {\n\t\tcolumnCount,\n\t\tisDefaultColumns,\n\t\tinnerBlocks,\n\t\thasParents,\n\t\tparentBlockAlignment,\n\t\teditorSidebarOpened,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { isEditorSidebarOpened } = select( 'core/edit-post' );\n\n\t\t\tconst innerBlocksList = getBlocks( clientId );\n\n\t\t\tconst isContentEmpty = innerBlocksList.every(\n\t\t\t\t( innerBlock ) => innerBlock.innerBlocks.length === 0\n\t\t\t);\n\n\t\t\tconst parents = getBlockParents( clientId, true );\n\n\t\t\treturn {\n\t\t\t\tcolumnCount: getBlockCount( clientId ),\n\t\t\t\tisDefaultColumns: isContentEmpty,\n\t\t\t\tinnerBlocks: innerBlocksList,\n\t\t\t\thasParents: parents.length > 0,\n\t\t\t\tparentBlockAlignment: getBlockAttributes( parents[ 0 ] )?.align,\n\t\t\t\teditorSidebarOpened: isSelected && isEditorSidebarOpened(),\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSelected ]\n\t);\n\n\tconst innerWidths = useMemo(\n\t\t() =>\n\t\t\tinnerBlocks.map( ( inn ) => ( {\n\t\t\t\tclientId: inn.clientId,\n\t\t\t\tattributes: { width: inn.attributes.width },\n\t\t\t} ) ),\n\t\t[ innerBlocks ]\n\t);\n\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isSelected && isDefaultColumns ) {\n\t\t\tconst revealTimeout = setTimeout( () => setIsVisible( true ), 100 );\n\n\t\t\treturn () => clearTimeout( revealTimeout );\n\t\t}\n\t}, [] );\n\n\tconst onClose = useCallback( () => {\n\t\tsetIsVisible( false );\n\t}, [] );\n\n\treturn (\n\t\t<View style={ style }>\n\t\t\t<ColumnsEditContainerWrapper\n\t\t\t\tcolumnCount={ columnCount }\n\t\t\t\tinnerWidths={ innerWidths }\n\t\t\t\thasParents={ hasParents }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t\teditorSidebarOpened={ editorSidebarOpened }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t<BlockVariationPicker\n\t\t\t\tvariations={ variations }\n\t\t\t\tonClose={ onClose }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisVisible={ isVisible }\n\t\t\t/>\n\t\t</View>\n\t);\n};\n\nexport default ColumnsEdit;\n"]}
|
|
@@ -101,6 +101,11 @@ const transforms = {
|
|
|
101
101
|
verticalAlignment
|
|
102
102
|
}, createBlocksFromInnerBlocksTemplate(innerBlocksTemplate));
|
|
103
103
|
}
|
|
104
|
+
}],
|
|
105
|
+
to: [{
|
|
106
|
+
type: 'block',
|
|
107
|
+
blocks: ['*'],
|
|
108
|
+
transform: (attributes, innerBlocks) => innerBlocks.flatMap(innerBlock => innerBlock.innerBlocks)
|
|
104
109
|
}]
|
|
105
110
|
};
|
|
106
111
|
export default transforms;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/columns/transforms.js"],"names":["createBlock","createBlocksFromInnerBlocksTemplate","MAXIMUM_SELECTED_BLOCKS","transforms","from","type","isMultiBlock","blocks","__experimentalConvert","columnWidth","length","toFixed","innerBlocksTemplate","map","name","attributes","innerBlocks","width","isMatch","selectedBlocksLength","priority","transform","align","backgroundColor","textColor","style","mediaAlt","alt","mediaId","id","mediaPosition","mediaSizeSlug","sizeSlug","mediaType","mediaUrl","url","mediaWidth","verticalAlignment","media","imageAttrs","linkAttrs","href","linkClass","linkDestination","linkTarget","rel","src","reverse"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,mCAFD,QAGO,mBAHP;AAKA,MAAMC,uBAAuB,GAAG,CAAhC;AAEA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,YAAY,EAAE,IAFf;AAGCC,IAAAA,MAAM,EAAE,CAAE,GAAF,CAHT;AAICC,IAAAA,qBAAqB,EAAID,MAAF,IAAc;AACpC,YAAME,WAAW,GAAG,CAAC,CAAE,MAAMF,MAAM,CAACG,MAAf,EAAwBC,OAAxB,CAAiC,CAAjC,CAArB;AACA,YAAMC,mBAAmB,GAAGL,MAAM,CAACM,GAAP,CAC3B;AAAA,YAAE;AAAEC,UAAAA,IAAF;AAAQC,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-library/src/columns/transforms.js"],"names":["createBlock","createBlocksFromInnerBlocksTemplate","MAXIMUM_SELECTED_BLOCKS","transforms","from","type","isMultiBlock","blocks","__experimentalConvert","columnWidth","length","toFixed","innerBlocksTemplate","map","name","attributes","innerBlocks","width","isMatch","selectedBlocksLength","priority","transform","align","backgroundColor","textColor","style","mediaAlt","alt","mediaId","id","mediaPosition","mediaSizeSlug","sizeSlug","mediaType","mediaUrl","url","mediaWidth","verticalAlignment","media","imageAttrs","linkAttrs","href","linkClass","linkDestination","linkTarget","rel","src","reverse","to","flatMap","innerBlock"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,mCAFD,QAGO,mBAHP;AAKA,MAAMC,uBAAuB,GAAG,CAAhC;AAEA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,YAAY,EAAE,IAFf;AAGCC,IAAAA,MAAM,EAAE,CAAE,GAAF,CAHT;AAICC,IAAAA,qBAAqB,EAAID,MAAF,IAAc;AACpC,YAAME,WAAW,GAAG,CAAC,CAAE,MAAMF,MAAM,CAACG,MAAf,EAAwBC,OAAxB,CAAiC,CAAjC,CAArB;AACA,YAAMC,mBAAmB,GAAGL,MAAM,CAACM,GAAP,CAC3B;AAAA,YAAE;AAAEC,UAAAA,IAAF;AAAQC,UAAAA,UAAR;AAAoBC,UAAAA;AAApB,SAAF;AAAA,eAAyC,CACxC,aADwC,EAExC;AAAEC,UAAAA,KAAK,EAAG,GAAGR,WAAa;AAA1B,SAFwC,EAGxC,CAAE,CAAEK,IAAF,EAAQ,EAAE,GAAGC;AAAL,SAAR,EAA2BC,WAA3B,CAAF,CAHwC,CAAzC;AAAA,OAD2B,CAA5B;AAOA,aAAOhB,WAAW,CACjB,cADiB,EAEjB,EAFiB,EAGjBC,mCAAmC,CAAEW,mBAAF,CAHlB,CAAlB;AAKA,KAlBF;AAmBCM,IAAAA,OAAO,EAAE,QAAoC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EAAE9B,UAAU,CAAC8B;AALC,SAAlB;AAOAP,QAAAA,KAAK,GAAG,CAAE,YAAF,EAAgB,EAAE,GAAGC,UAAL;AAAiB,aAAGC;AAApB,SAAhB,CAAR;AACA,OAVD,MAUO;AACNF,QAAAA,KAAK,GAAG,CAAE,YAAF,EAAgB;AAAET,UAAAA,EAAF;AAAMiB,UAAAA,GAAG,EAAEX;AAAX,SAAhB,CAAR;AACA;;AACD,YAAMvB,mBAAmB,GAAG,CAC3B,CAAE,aAAF,EAAiB;AAAEK,QAAAA,KAAK,EAAG,GAAGmB,UAAY;AAAzB,OAAjB,EAAgD,CAAEE,KAAF,CAAhD,CAD2B,EAE3B,CACC,aADD,EAEC;AAAErB,QAAAA,KAAK,EAAG,GAAG,MAAMmB,UAAY;AAA/B,OAFD,EAGCpB,WAHD,CAF2B,CAA5B;;AAQA,UAAKc,aAAa,KAAK,OAAvB,EAAiC;AAChClB,QAAAA,mBAAmB,CAACmC,OAApB;AACA;;AACD,aAAO/C,WAAW,CACjB,cADiB,EAEjB;AACCsB,QAAAA,KADD;AAECC,QAAAA,eAFD;AAGCC,QAAAA,SAHD;AAICC,QAAAA,KAJD;AAKCY,QAAAA;AALD,OAFiB,EASjBpC,mCAAmC,CAAEW,mBAAF,CATlB,CAAlB;AAWA;AAvDF,GAtCK,CADY;AAiGlBoC,EAAAA,EAAE,EAAE,CACH;AACC3C,IAAAA,IAAI,EAAE,OADP;AAECE,IAAAA,MAAM,EAAE,CAAE,GAAF,CAFT;AAGCc,IAAAA,SAAS,EAAE,CAAEN,UAAF,EAAcC,WAAd,KACVA,WAAW,CAACiC,OAAZ,CAAuBC,UAAF,IAAkBA,UAAU,CAAClC,WAAlD;AAJF,GADG;AAjGc,CAAnB;AA2GA,eAAeb,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n} from '@wordpress/blocks';\n\nconst MAXIMUM_SELECTED_BLOCKS = 6;\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\t__experimentalConvert: ( blocks ) => {\n\t\t\t\tconst columnWidth = +( 100 / blocks.length ).toFixed( 2 );\n\t\t\t\tconst innerBlocksTemplate = blocks.map(\n\t\t\t\t\t( { name, attributes, innerBlocks } ) => [\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{ width: `${ columnWidth }%` },\n\t\t\t\t\t\t[ [ name, { ...attributes }, innerBlocks ] ],\n\t\t\t\t\t]\n\t\t\t\t);\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/columns',\n\t\t\t\t\t{},\n\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocksTemplate )\n\t\t\t\t);\n\t\t\t},\n\t\t\tisMatch: ( { length: selectedBlocksLength }, blocks ) => {\n\t\t\t\t// If a user is trying to transform a single Columns block, skip\n\t\t\t\t// the transformation. Enabling this functiontionality creates\n\t\t\t\t// nested Columns blocks resulting in an unintuitive user experience.\n\t\t\t\t// Multiple Columns blocks can still be transformed.\n\t\t\t\tif (\n\t\t\t\t\tblocks.length === 1 &&\n\t\t\t\t\tblocks[ 0 ].name === 'core/columns'\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tselectedBlocksLength &&\n\t\t\t\t\tselectedBlocksLength <= MAXIMUM_SELECTED_BLOCKS\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/media-text' ],\n\t\t\tpriority: 1,\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\ttextColor,\n\t\t\t\t\tstyle,\n\t\t\t\t\tmediaAlt: alt,\n\t\t\t\t\tmediaId: id,\n\t\t\t\t\tmediaPosition,\n\t\t\t\t\tmediaSizeSlug: sizeSlug,\n\t\t\t\t\tmediaType,\n\t\t\t\t\tmediaUrl: url,\n\t\t\t\t\tmediaWidth,\n\t\t\t\t\tverticalAlignment,\n\t\t\t\t} = attributes;\n\t\t\t\tlet media;\n\t\t\t\tif ( mediaType === 'image' || ! mediaType ) {\n\t\t\t\t\tconst imageAttrs = { id, alt, url, sizeSlug };\n\t\t\t\t\tconst linkAttrs = {\n\t\t\t\t\t\thref: attributes.href,\n\t\t\t\t\t\tlinkClass: attributes.linkClass,\n\t\t\t\t\t\tlinkDestination: attributes.linkDestination,\n\t\t\t\t\t\tlinkTarget: attributes.linkTarget,\n\t\t\t\t\t\trel: attributes.rel,\n\t\t\t\t\t};\n\t\t\t\t\tmedia = [ 'core/image', { ...imageAttrs, ...linkAttrs } ];\n\t\t\t\t} else {\n\t\t\t\t\tmedia = [ 'core/video', { id, src: url } ];\n\t\t\t\t}\n\t\t\t\tconst innerBlocksTemplate = [\n\t\t\t\t\t[ 'core/column', { width: `${ mediaWidth }%` }, [ media ] ],\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{ width: `${ 100 - mediaWidth }%` },\n\t\t\t\t\t\tinnerBlocks,\n\t\t\t\t\t],\n\t\t\t\t];\n\t\t\t\tif ( mediaPosition === 'right' ) {\n\t\t\t\t\tinnerBlocksTemplate.reverse();\n\t\t\t\t}\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/columns',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tverticalAlignment,\n\t\t\t\t\t},\n\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocksTemplate )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ '*' ],\n\t\t\ttransform: ( attributes, innerBlocks ) =>\n\t\t\t\tinnerBlocks.flatMap( ( innerBlock ) => innerBlock.innerBlocks ),\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
|
|
@@ -45,6 +45,7 @@ export default function Edit(_ref) {
|
|
|
45
45
|
const inspectorControls = createElement(InspectorControls, null, createElement(PanelBody, {
|
|
46
46
|
title: __('Avatar Settings')
|
|
47
47
|
}, createElement(RangeControl, {
|
|
48
|
+
__nextHasNoMarginBottom: true,
|
|
48
49
|
label: __('Image size'),
|
|
49
50
|
onChange: newWidth => setAttributes({
|
|
50
51
|
width: newWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/comment-author-avatar/edit.js"],"names":["InspectorControls","useBlockProps","__experimentalGetSpacingClassesAndStyles","useSpacingProps","store","blockEditorStore","PanelBody","ResizableBox","RangeControl","useEntityProp","useSelect","__","isRTL","Edit","attributes","context","commentId","setAttributes","isSelected","height","width","avatars","authorName","avatarUrls","Object","values","sizes","keys","minSize","maxSize","length","blockProps","spacingProps","maxSizeBuffer","Math","floor","avatarURL","select","getSettings","__experimentalDiscussionSettings","inspectorControls","newWidth","resizableAvatar","event","direction","elt","delta","parseInt","top","right","bottom","left"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,aAFD,EAGCC,wCAAwC,IAAIC,eAH7C,EAICC,KAAK,IAAIC,gBAJV,QAKO,yBALP;AAMA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,YAAlC,QAAsD,uBAAtD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AAEA,eAAe,SAASC,IAAT,OAKX;AAAA,MAL0B;AAC7BC,IAAAA,UAD6B;AAE7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA;AAAF,KAFoB;AAG7BC,IAAAA,aAH6B;AAI7BC,IAAAA;AAJ6B,GAK1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":["@wordpress/block-library/src/comment-author-avatar/edit.js"],"names":["InspectorControls","useBlockProps","__experimentalGetSpacingClassesAndStyles","useSpacingProps","store","blockEditorStore","PanelBody","ResizableBox","RangeControl","useEntityProp","useSelect","__","isRTL","Edit","attributes","context","commentId","setAttributes","isSelected","height","width","avatars","authorName","avatarUrls","Object","values","sizes","keys","minSize","maxSize","length","blockProps","spacingProps","maxSizeBuffer","Math","floor","avatarURL","select","getSettings","__experimentalDiscussionSettings","inspectorControls","newWidth","resizableAvatar","event","direction","elt","delta","parseInt","top","right","bottom","left"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,aAFD,EAGCC,wCAAwC,IAAIC,eAH7C,EAICC,KAAK,IAAIC,gBAJV,QAKO,yBALP;AAMA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,YAAlC,QAAsD,uBAAtD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AAEA,eAAe,SAASC,IAAT,OAKX;AAAA,MAL0B;AAC7BC,IAAAA,UAD6B;AAE7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA;AAAF,KAFoB;AAG7BC,IAAAA,aAH6B;AAI7BC,IAAAA;AAJ6B,GAK1B;AACH,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAoBN,UAA1B;AAEA,QAAM,CAAEO,OAAF,IAAcZ,aAAa,CAChC,MADgC,EAEhC,SAFgC,EAGhC,oBAHgC,EAIhCO,SAJgC,CAAjC;AAOA,QAAM,CAAEM,UAAF,IAAiBb,aAAa,CACnC,MADmC,EAEnC,SAFmC,EAGnC,aAHmC,EAInCO,SAJmC,CAApC;AAMA,QAAMO,UAAU,GAAGF,OAAO,GAAGG,MAAM,CAACC,MAAP,CAAeJ,OAAf,CAAH,GAA8B,IAAxD;AACA,QAAMK,KAAK,GAAGL,OAAO,GAAGG,MAAM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UALd;AAMC,IAAA,YAAY,EAAG,CAAEyB,KAAF,EAASC,SAAT,EAAoBC,GAApB,EAAyBC,KAAzB,KAAoC;AAClD7B,MAAAA,aAAa,CAAE;AACdE,QAAAA,MAAM,EAAE4B,QAAQ,CAAE5B,MAAM,GAAG2B,KAAK,CAAC3B,MAAjB,EAAyB,EAAzB,CADF;AAEdC,QAAAA,KAAK,EAAE2B,QAAQ,CAAE3B,KAAK,GAAG0B,KAAK,CAAC1B,KAAhB,EAAuB,EAAvB;AAFD,OAAF,CAAb;AAIA,KAXF;AAYC,IAAA,eAAe,MAZhB;AAaC,IAAA,MAAM,EAAG;AACR4B,MAAAA,GAAG,EAAE,KADG;AAERC,MAAAA,KAAK,EAAE,CAAErC,KAAK,EAFN;AAGRsC,MAAAA,MAAM,EAAE,IAHA;AAIRC,MAAAA,IAAI,EAAEvC,KAAK;AAJH,KAbV;AAmBC,IAAA,QAAQ,EAAGgB,OAnBZ;AAoBC,IAAA,QAAQ,EAAGK;AApBZ,KAsBC;AACC,IAAA,GAAG,EACFV,UAAU,GAAGA,UAAU,CAAEA,UAAU,CAACO,MAAX,GAAoB,CAAtB,CAAb,GAAyCM,SAFrD;AAIC,IAAA,GAAG,EAAI,GAAGd,UAAY,IAAIX,EAAE,CAAE,QAAF,CAAc;AAJ3C,KAKMoB,UALN,EAtBD,CADD;AAiCA,SACC,8BACGS,iBADH,EAEC,qBAAUR,YAAV,EAA2BU,eAA3B,CAFD,CADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { PanelBody, ResizableBox, RangeControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\n\nexport default function Edit( {\n\tattributes,\n\tcontext: { commentId },\n\tsetAttributes,\n\tisSelected,\n} ) {\n\tconst { height, width } = attributes;\n\n\tconst [ avatars ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_avatar_urls',\n\t\tcommentId\n\t);\n\n\tconst [ authorName ] = useEntityProp(\n\t\t'root',\n\t\t'comment',\n\t\t'author_name',\n\t\tcommentId\n\t);\n\tconst avatarUrls = avatars ? Object.values( avatars ) : null;\n\tconst sizes = avatars ? Object.keys( avatars ) : null;\n\tconst minSize = sizes ? sizes[ 0 ] : 24;\n\tconst maxSize = sizes ? sizes[ sizes.length - 1 ] : 96;\n\tconst blockProps = useBlockProps();\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst maxSizeBuffer = Math.floor( maxSize * 2.5 );\n\tconst { avatarURL } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings;\n\t} );\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Avatar Settings' ) }>\n\t\t\t\t<RangeControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\tonChange={ ( newWidth ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\theight: newWidth,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tmin={ minSize }\n\t\t\t\t\tmax={ maxSizeBuffer }\n\t\t\t\t\tinitialPosition={ width }\n\t\t\t\t\tvalue={ width }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst resizableAvatar = (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: parseInt( height + delta.height, 10 ),\n\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tlockAspectRatio\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: ! isRTL(),\n\t\t\t\tbottom: true,\n\t\t\t\tleft: isRTL(),\n\t\t\t} }\n\t\t\tminWidth={ minSize }\n\t\t\tmaxWidth={ maxSizeBuffer }\n\t\t>\n\t\t\t<img\n\t\t\t\tsrc={\n\t\t\t\t\tavatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : avatarURL\n\t\t\t\t}\n\t\t\t\talt={ `${ authorName } ${ __( 'Avatar' ) }` }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...spacingProps }>{ resizableAvatar }</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -153,7 +153,9 @@ function CoverEdit(_ref) {
|
|
|
153
153
|
const innerBlocksProps = useInnerBlocksProps({
|
|
154
154
|
className: 'wp-block-cover__inner-container'
|
|
155
155
|
}, {
|
|
156
|
-
template
|
|
156
|
+
// Avoid template sync when the `templateLock` value is `all` or `contentOnly`.
|
|
157
|
+
// See: https://github.com/WordPress/gutenberg/pull/45632
|
|
158
|
+
template: !hasInnerBlocks ? innerBlocksTemplate : undefined,
|
|
157
159
|
templateInsertUpdatesSelection: true,
|
|
158
160
|
allowedBlocks,
|
|
159
161
|
templateLock
|