@wordpress/block-library 7.19.0 → 8.1.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/edit.native.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.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/comment-author-avatar/edit.js +1 -0
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +3 -1
- 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/freeform/edit.js +21 -6
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/modal.js +97 -0
- package/build/freeform/modal.js.map +1 -0
- package/build/gallery/edit.js +38 -15
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +2 -16
- package/build/gallery/gallery.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 +22 -15
- 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 +1 -2
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -1
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +5 -26
- package/build/group/placeholder.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 +13 -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 +1 -0
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +2 -0
- package/build/latest-posts/edit.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/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 +5 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/missing/edit.native.js +2 -2
- package/build/missing/edit.native.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 +95 -117
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +94 -0
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build/navigation/edit/navigation-menu-selector.js +2 -4
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +11 -7
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/utils.js +81 -0
- package/build/navigation/edit/utils.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 +46 -356
- 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 +49 -245
- 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 +143 -78
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +35 -3
- package/build/page-list/index.js.map +1 -1
- package/build/page-list-item/edit.js +91 -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 +3 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-featured-image/overlay.js +1 -1
- 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/index.js +2 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +11 -5
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +101 -37
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/query-content.js +2 -3
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +16 -27
- 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 +73 -9
- 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.js +2 -2
- package/build/search/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 +17 -9
- 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/edit.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/social-links/edit.js +0 -1
- package/build/social-links/edit.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 +3 -3
- 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/advanced-controls.js +11 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/import-controls.js +160 -0
- package/build/template-part/edit/import-controls.js.map +1 -0
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.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/edit/utils/transformers.js +48 -0
- package/build/template-part/edit/utils/transformers.js.map +1 -0
- 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/edit.native.js +2 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +1 -1
- package/build-module/categories/edit.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/comment-author-avatar/edit.js +1 -0
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +5 -3
- 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/freeform/edit.js +22 -8
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/modal.js +90 -0
- package/build-module/freeform/modal.js.map +1 -0
- package/build-module/gallery/edit.js +39 -15
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +3 -16
- package/build-module/gallery/gallery.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 +23 -16
- 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 +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +5 -26
- package/build-module/group/placeholder.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 +14 -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 +1 -0
- package/build-module/latest-comments/edit.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/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/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 +6 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +2 -2
- package/build-module/missing/edit.native.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 +95 -118
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +80 -0
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -4
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +9 -6
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/utils.js +75 -0
- package/build-module/navigation/edit/utils.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 +49 -357
- 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 +52 -246
- 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 +146 -82
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +36 -4
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/page-list-item/edit.js +77 -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 +3 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +1 -1
- 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/index.js +2 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +11 -5
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +99 -35
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -1
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +15 -27
- 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 +69 -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.js +2 -2
- package/build-module/search/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 +17 -8
- 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/edit.js +2 -2
- package/build-module/social-link/edit.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/social-links/edit.js +0 -1
- package/build-module/social-links/edit.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 +3 -3
- 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/advanced-controls.js +10 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +146 -0
- package/build-module/template-part/edit/import-controls.js.map +1 -0
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.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/edit/utils/transformers.js +40 -0
- package/build-module/template-part/edit/utils/transformers.js.map +1 -0
- 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 +15 -3
- package/build-style/archives/editor.css +15 -3
- package/build-style/archives/style-rtl.css +15 -3
- package/build-style/archives/style.css +15 -3
- package/build-style/audio/editor-rtl.css +15 -3
- package/build-style/audio/editor.css +15 -3
- package/build-style/audio/style-rtl.css +15 -3
- package/build-style/audio/style.css +15 -3
- package/build-style/audio/theme-rtl.css +15 -3
- package/build-style/audio/theme.css +15 -3
- package/build-style/avatar/editor-rtl.css +15 -3
- package/build-style/avatar/editor.css +15 -3
- package/build-style/avatar/style-rtl.css +15 -3
- package/build-style/avatar/style.css +15 -3
- package/build-style/block/editor-rtl.css +25 -3
- package/build-style/block/editor.css +25 -3
- package/build-style/button/editor-rtl.css +15 -3
- package/build-style/button/editor.css +15 -3
- package/build-style/button/style-rtl.css +15 -3
- package/build-style/button/style.css +15 -3
- package/build-style/buttons/editor-rtl.css +15 -3
- package/build-style/buttons/editor.css +15 -3
- package/build-style/buttons/style-rtl.css +15 -3
- package/build-style/buttons/style.css +15 -3
- package/build-style/calendar/style-rtl.css +15 -3
- package/build-style/calendar/style.css +15 -3
- package/build-style/categories/editor-rtl.css +15 -3
- package/build-style/categories/editor.css +15 -3
- package/build-style/categories/style-rtl.css +15 -3
- package/build-style/categories/style.css +15 -3
- package/build-style/classic-rtl.css +15 -3
- package/build-style/classic.css +15 -3
- package/build-style/code/editor-rtl.css +15 -3
- package/build-style/code/editor.css +15 -3
- package/build-style/code/style-rtl.css +15 -3
- package/build-style/code/style.css +15 -3
- package/build-style/code/theme-rtl.css +15 -3
- package/build-style/code/theme.css +15 -3
- package/build-style/columns/editor-rtl.css +15 -3
- package/build-style/columns/editor.css +15 -3
- package/build-style/columns/style-rtl.css +15 -3
- package/build-style/columns/style.css +15 -3
- package/build-style/comment-author-avatar/editor-rtl.css +15 -3
- package/build-style/comment-author-avatar/editor.css +15 -3
- package/build-style/comment-content/style-rtl.css +15 -3
- package/build-style/comment-content/style.css +15 -3
- package/build-style/comment-template/style-rtl.css +15 -3
- package/build-style/comment-template/style.css +15 -3
- package/build-style/comments/editor-rtl.css +15 -3
- package/build-style/comments/editor.css +15 -3
- package/build-style/comments/style-rtl.css +15 -3
- package/build-style/comments/style.css +15 -3
- package/build-style/comments-pagination/editor-rtl.css +15 -3
- package/build-style/comments-pagination/editor.css +15 -3
- package/build-style/comments-pagination/style-rtl.css +15 -3
- package/build-style/comments-pagination/style.css +15 -3
- package/build-style/comments-pagination-numbers/editor-rtl.css +15 -3
- package/build-style/comments-pagination-numbers/editor.css +15 -3
- package/build-style/comments-title/editor-rtl.css +15 -3
- package/build-style/comments-title/editor.css +15 -3
- package/build-style/common-rtl.css +20 -4
- package/build-style/common.css +20 -4
- package/build-style/cover/editor-rtl.css +15 -3
- package/build-style/cover/editor.css +15 -3
- package/build-style/cover/style-rtl.css +17 -4
- package/build-style/cover/style.css +17 -4
- package/build-style/editor-elements-rtl.css +15 -3
- package/build-style/editor-elements.css +15 -3
- package/build-style/editor-rtl.css +46 -29
- package/build-style/editor.css +46 -29
- package/build-style/elements-rtl.css +15 -3
- package/build-style/elements.css +15 -3
- package/build-style/embed/editor-rtl.css +15 -3
- package/build-style/embed/editor.css +15 -3
- package/build-style/embed/style-rtl.css +15 -3
- package/build-style/embed/style.css +15 -3
- package/build-style/embed/theme-rtl.css +15 -3
- package/build-style/embed/theme.css +15 -3
- package/build-style/file/editor-rtl.css +15 -3
- package/build-style/file/editor.css +15 -3
- package/build-style/file/style-rtl.css +15 -3
- package/build-style/file/style.css +15 -3
- package/build-style/freeform/editor-rtl.css +15 -3
- package/build-style/freeform/editor.css +15 -3
- package/build-style/gallery/editor-rtl.css +16 -4
- package/build-style/gallery/editor.css +16 -4
- package/build-style/gallery/style-rtl.css +19 -5
- package/build-style/gallery/style.css +19 -5
- package/build-style/gallery/theme-rtl.css +15 -3
- package/build-style/gallery/theme.css +15 -3
- package/build-style/group/editor-rtl.css +15 -3
- package/build-style/group/editor.css +15 -3
- package/build-style/group/style-rtl.css +15 -3
- package/build-style/group/style.css +15 -3
- package/build-style/group/theme-rtl.css +15 -3
- package/build-style/group/theme.css +15 -3
- package/build-style/heading/style-rtl.css +15 -3
- package/build-style/heading/style.css +15 -3
- package/build-style/html/editor-rtl.css +15 -3
- package/build-style/html/editor.css +15 -3
- package/build-style/image/editor-rtl.css +15 -12
- package/build-style/image/editor.css +15 -12
- package/build-style/image/style-rtl.css +15 -3
- package/build-style/image/style.css +15 -3
- package/build-style/image/theme-rtl.css +15 -3
- package/build-style/image/theme.css +15 -3
- package/build-style/latest-comments/style-rtl.css +15 -3
- package/build-style/latest-comments/style.css +15 -3
- package/build-style/latest-posts/editor-rtl.css +15 -3
- package/build-style/latest-posts/editor.css +15 -3
- package/build-style/latest-posts/style-rtl.css +15 -3
- package/build-style/latest-posts/style.css +15 -3
- package/build-style/list/style-rtl.css +15 -3
- package/build-style/list/style.css +15 -3
- package/build-style/media-text/editor-rtl.css +15 -3
- package/build-style/media-text/editor.css +15 -3
- package/build-style/media-text/style-rtl.css +15 -3
- package/build-style/media-text/style.css +15 -3
- package/build-style/more/editor-rtl.css +15 -3
- package/build-style/more/editor.css +15 -3
- package/build-style/navigation/editor-rtl.css +15 -9
- package/build-style/navigation/editor.css +15 -9
- package/build-style/navigation/style-rtl.css +15 -4
- package/build-style/navigation/style.css +15 -4
- package/build-style/navigation-link/editor-rtl.css +15 -3
- package/build-style/navigation-link/editor.css +15 -3
- package/build-style/navigation-link/style-rtl.css +15 -3
- package/build-style/navigation-link/style.css +15 -3
- package/build-style/navigation-submenu/editor-rtl.css +15 -3
- package/build-style/navigation-submenu/editor.css +15 -3
- package/build-style/nextpage/editor-rtl.css +15 -3
- package/build-style/nextpage/editor.css +15 -3
- package/build-style/page-list/editor-rtl.css +19 -3
- package/build-style/page-list/editor.css +19 -3
- package/build-style/page-list/style-rtl.css +15 -3
- package/build-style/page-list/style.css +15 -3
- package/build-style/paragraph/editor-rtl.css +15 -3
- package/build-style/paragraph/editor.css +15 -3
- package/build-style/paragraph/style-rtl.css +15 -3
- package/build-style/paragraph/style.css +15 -3
- package/build-style/post-author/style-rtl.css +15 -3
- package/build-style/post-author/style.css +15 -3
- package/build-style/post-comments-form/editor-rtl.css +15 -3
- package/build-style/post-comments-form/editor.css +15 -3
- package/build-style/post-comments-form/style-rtl.css +15 -3
- package/build-style/post-comments-form/style.css +15 -3
- package/build-style/post-date/style-rtl.css +15 -3
- package/build-style/post-date/style.css +15 -3
- package/build-style/post-excerpt/editor-rtl.css +15 -3
- package/build-style/post-excerpt/editor.css +15 -3
- package/build-style/post-excerpt/style-rtl.css +15 -3
- package/build-style/post-excerpt/style.css +15 -3
- package/build-style/post-featured-image/editor-rtl.css +15 -3
- package/build-style/post-featured-image/editor.css +15 -3
- package/build-style/post-featured-image/style-rtl.css +15 -3
- package/build-style/post-featured-image/style.css +15 -3
- package/build-style/post-navigation-link/style-rtl.css +15 -3
- package/build-style/post-navigation-link/style.css +15 -3
- package/build-style/post-template/editor-rtl.css +15 -3
- package/build-style/post-template/editor.css +15 -3
- package/build-style/post-template/style-rtl.css +15 -3
- package/build-style/post-template/style.css +15 -3
- package/build-style/post-terms/style-rtl.css +15 -3
- package/build-style/post-terms/style.css +15 -3
- package/build-style/post-title/style-rtl.css +15 -3
- package/build-style/post-title/style.css +15 -3
- package/build-style/preformatted/style-rtl.css +15 -3
- package/build-style/preformatted/style.css +15 -3
- package/build-style/pullquote/editor-rtl.css +15 -3
- package/build-style/pullquote/editor.css +15 -3
- package/build-style/pullquote/style-rtl.css +15 -3
- package/build-style/pullquote/style.css +15 -3
- package/build-style/pullquote/theme-rtl.css +15 -3
- package/build-style/pullquote/theme.css +15 -3
- package/build-style/query/editor-rtl.css +15 -3
- package/build-style/query/editor.css +15 -3
- package/build-style/query-pagination/editor-rtl.css +15 -3
- package/build-style/query-pagination/editor.css +15 -3
- package/build-style/query-pagination/style-rtl.css +15 -3
- package/build-style/query-pagination/style.css +15 -3
- package/build-style/query-pagination-numbers/editor-rtl.css +15 -3
- package/build-style/query-pagination-numbers/editor.css +15 -3
- package/build-style/query-title/style-rtl.css +15 -3
- package/build-style/query-title/style.css +15 -3
- package/build-style/quote/style-rtl.css +15 -3
- package/build-style/quote/style.css +15 -3
- package/build-style/quote/theme-rtl.css +15 -3
- package/build-style/quote/theme.css +15 -3
- package/build-style/read-more/style-rtl.css +15 -3
- package/build-style/read-more/style.css +15 -3
- package/build-style/reset-rtl.css +15 -3
- package/build-style/reset.css +15 -3
- package/build-style/rss/editor-rtl.css +15 -3
- package/build-style/rss/editor.css +15 -3
- package/build-style/rss/style-rtl.css +15 -3
- package/build-style/rss/style.css +15 -3
- package/build-style/search/editor-rtl.css +15 -3
- package/build-style/search/editor.css +15 -3
- package/build-style/search/style-rtl.css +15 -3
- package/build-style/search/style.css +15 -3
- package/build-style/search/theme-rtl.css +15 -3
- package/build-style/search/theme.css +15 -3
- package/build-style/separator/editor-rtl.css +15 -3
- package/build-style/separator/editor.css +15 -3
- package/build-style/separator/style-rtl.css +15 -3
- package/build-style/separator/style.css +15 -3
- package/build-style/separator/theme-rtl.css +15 -3
- package/build-style/separator/theme.css +15 -3
- package/build-style/shortcode/editor-rtl.css +16 -4
- package/build-style/shortcode/editor.css +16 -4
- package/build-style/site-logo/editor-rtl.css +15 -3
- package/build-style/site-logo/editor.css +15 -3
- package/build-style/site-logo/style-rtl.css +15 -3
- package/build-style/site-logo/style.css +15 -3
- package/build-style/site-tagline/editor-rtl.css +15 -3
- package/build-style/site-tagline/editor.css +15 -3
- package/build-style/site-title/editor-rtl.css +15 -3
- package/build-style/site-title/editor.css +15 -3
- package/build-style/site-title/style-rtl.css +15 -3
- package/build-style/site-title/style.css +15 -3
- package/build-style/social-link/editor-rtl.css +15 -3
- package/build-style/social-link/editor.css +15 -3
- package/build-style/social-links/editor-rtl.css +15 -3
- package/build-style/social-links/editor.css +15 -3
- package/build-style/social-links/style-rtl.css +15 -3
- package/build-style/social-links/style.css +15 -3
- package/build-style/spacer/editor-rtl.css +15 -3
- package/build-style/spacer/editor.css +15 -3
- package/build-style/spacer/style-rtl.css +15 -3
- package/build-style/spacer/style.css +15 -3
- package/build-style/style-rtl.css +36 -10
- package/build-style/style.css +36 -10
- package/build-style/table/editor-rtl.css +15 -11
- package/build-style/table/editor.css +15 -11
- package/build-style/table/style-rtl.css +21 -3
- package/build-style/table/style.css +21 -3
- package/build-style/table/theme-rtl.css +15 -9
- package/build-style/table/theme.css +15 -9
- package/build-style/tag-cloud/style-rtl.css +15 -3
- package/build-style/tag-cloud/style.css +15 -3
- package/build-style/template-part/editor-rtl.css +30 -4
- package/build-style/template-part/editor.css +30 -4
- package/build-style/template-part/theme-rtl.css +15 -3
- package/build-style/template-part/theme.css +15 -3
- package/build-style/text-columns/editor-rtl.css +15 -3
- package/build-style/text-columns/editor.css +15 -3
- package/build-style/text-columns/style-rtl.css +15 -3
- package/build-style/text-columns/style.css +15 -3
- package/build-style/theme-rtl.css +15 -9
- package/build-style/theme.css +15 -9
- package/build-style/verse/style-rtl.css +19 -4
- package/build-style/verse/style.css +19 -4
- package/build-style/video/editor-rtl.css +15 -3
- package/build-style/video/editor.css +15 -3
- package/build-style/video/style-rtl.css +17 -4
- package/build-style/video/style.css +17 -4
- package/build-style/video/theme-rtl.css +15 -3
- package/build-style/video/theme.css +15 -3
- 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/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/edit.native.js +1 -0
- package/src/buttons/test/edit.native.js +40 -51
- package/src/categories/edit.js +1 -1
- package/src/code/transforms.js +3 -1
- package/src/columns/edit.js +1 -0
- package/src/columns/edit.native.js +18 -26
- package/src/comment-author-avatar/edit.js +1 -0
- package/src/comments/index.php +0 -1
- package/src/cover/edit/inspector-controls.js +6 -4
- package/src/cover/edit.native.js +32 -19
- package/src/cover/test/edit.native.js +73 -126
- 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 +237 -231
- package/src/file/inspector.js +1 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +2 -6
- package/src/freeform/edit.js +48 -29
- package/src/freeform/modal.js +111 -0
- package/src/gallery/edit.js +32 -7
- package/src/gallery/gallery.js +3 -13
- package/src/gallery/gallery.native.js +1 -2
- package/src/gallery/shared.js +7 -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 +8 -7
- package/src/gallery/v1/gallery.native.js +1 -2
- package/src/gallery/v1/shared.js +7 -2
- package/src/group/block.json +3 -1
- package/src/group/edit.js +2 -6
- package/src/group/placeholder.js +6 -25
- package/src/group/test/__snapshots__/edit.native.js.snap +1 -1
- 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 +14 -8
- package/src/image/test/edit.native.js +14 -10
- package/src/index.js +2 -0
- package/src/latest-comments/edit.js +1 -0
- package/src/latest-posts/edit.js +2 -0
- package/src/latest-posts/test/__snapshots__/edit.native.js.snap +3 -0
- package/src/latest-posts/test/edit.native.js +49 -0
- package/src/list/test/edit.native.js +53 -45
- package/src/list/transforms.js +0 -11
- package/src/list/utils.js +6 -2
- 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 +6 -3
- package/src/missing/edit.native.js +13 -6
- package/src/missing/test/edit-integration.native.js +10 -12
- package/src/more/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/more/test/edit.native.js +41 -0
- package/src/navigation/edit/are-blocks-dirty.js +51 -0
- package/src/navigation/edit/index.js +229 -298
- package/src/navigation/edit/menu-inspector-controls.js +119 -0
- package/src/navigation/edit/navigation-menu-selector.js +6 -7
- package/src/navigation/edit/test/are-blocks-dirty.js +121 -0
- package/src/navigation/edit/unsaved-inner-blocks.js +12 -7
- package/src/navigation/edit/utils.js +82 -0
- package/src/navigation/editor.scss +0 -7
- package/src/navigation/index.php +89 -10
- package/src/navigation/style.scss +0 -1
- package/src/navigation/view-modal.js +11 -1
- package/src/navigation-link/edit.js +62 -386
- package/src/navigation-link/index.php +64 -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 +85 -276
- package/src/navigation-submenu/index.php +72 -0
- package/src/page-list/block.json +24 -2
- 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 +187 -118
- package/src/page-list/editor.scss +4 -0
- package/src/page-list/index.js +8 -2
- package/src/page-list/index.php +18 -10
- 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 +102 -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 +3 -2
- 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 -1
- 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/index.js +1 -0
- package/src/query/edit/inspector-controls/index.js +50 -38
- package/src/query/edit/inspector-controls/taxonomy-controls.js +102 -38
- package/src/query/edit/query-content.js +2 -1
- package/src/query/edit/query-placeholder.js +14 -25
- package/src/query/utils.js +59 -1
- package/src/rss/edit.js +3 -0
- package/src/search/edit.js +2 -2
- package/src/search/edit.native.js +31 -27
- package/src/search/index.js +5 -1
- package/src/separator/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/separator/test/edit.native.js +41 -0
- package/src/shortcode/test/edit.native.js +15 -18
- package/src/site-logo/edit.js +13 -5
- package/src/site-logo/index.js +1 -0
- package/src/site-title/index.js +1 -0
- package/src/social-link/edit.js +3 -3
- package/src/social-link/social-list.js +2 -7
- package/src/social-link/test/index.native.js +10 -16
- package/src/social-links/edit.js +0 -1
- package/src/social-links/test/edit.native.js +4 -3
- 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 +0 -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 +8 -0
- package/src/table/theme.scss +0 -8
- package/src/table/transforms.js +2 -1
- package/src/table-of-contents/edit.js +3 -3
- package/src/tag-cloud/edit.js +3 -2
- package/src/template-part/edit/advanced-controls.js +12 -0
- package/src/template-part/edit/import-controls.js +180 -0
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/selection-modal.js +4 -3
- package/src/template-part/edit/utils/hooks.js +7 -3
- package/src/template-part/edit/utils/transformers.js +37 -0
- package/src/template-part/editor.scss +20 -2
- package/src/template-part/index.php +1 -2
- package/src/text-columns/edit.js +1 -0
- package/src/utils/transformation-categories.native.js +1 -0
- package/src/verse/style.scss +4 -1
- package/src/verse/test/__snapshots__/edit.native.js.snap +13 -0
- package/src/verse/test/edit.native.js +40 -33
- 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
- package/build/query/constants.js +0 -16
- package/build/query/constants.js.map +0 -1
- package/build-module/query/constants.js +0 -7
- package/build-module/query/constants.js.map +0 -1
- package/src/query/constants.js +0 -7
|
@@ -5,71 +5,20 @@ import { Button, Modal } from '@wordpress/components';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { useDispatch } from '@wordpress/data';
|
|
7
7
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
8
|
-
import { createBlock as create } from '@wordpress/blocks';
|
|
9
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { convertToNavigationLinks } from './convert-to-navigation-links';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { convertDescription } from './constants';
|
|
10
18
|
|
|
11
19
|
const PAGE_FIELDS = [ 'id', 'title', 'link', 'type', 'parent' ];
|
|
12
20
|
const MAX_PAGE_COUNT = 100;
|
|
13
21
|
|
|
14
|
-
export const convertSelectedBlockToNavigationLinks =
|
|
15
|
-
( { pages, clientId, replaceBlock, createBlock } ) =>
|
|
16
|
-
() => {
|
|
17
|
-
if ( ! pages ) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const linkMap = {};
|
|
22
|
-
const navigationLinks = [];
|
|
23
|
-
pages.forEach( ( { id, title, link: url, type, parent } ) => {
|
|
24
|
-
// See if a placeholder exists. This is created if children appear before parents in list.
|
|
25
|
-
const innerBlocks = linkMap[ id ]?.innerBlocks ?? [];
|
|
26
|
-
linkMap[ id ] = createBlock(
|
|
27
|
-
'core/navigation-link',
|
|
28
|
-
{
|
|
29
|
-
id,
|
|
30
|
-
label: title.rendered,
|
|
31
|
-
url,
|
|
32
|
-
type,
|
|
33
|
-
kind: 'post-type',
|
|
34
|
-
},
|
|
35
|
-
innerBlocks
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
if ( ! parent ) {
|
|
39
|
-
navigationLinks.push( linkMap[ id ] );
|
|
40
|
-
} else {
|
|
41
|
-
if ( ! linkMap[ parent ] ) {
|
|
42
|
-
// Use a placeholder if the child appears before parent in list.
|
|
43
|
-
linkMap[ parent ] = { innerBlocks: [] };
|
|
44
|
-
}
|
|
45
|
-
const parentLinkInnerBlocks = linkMap[ parent ].innerBlocks;
|
|
46
|
-
parentLinkInnerBlocks.push( linkMap[ id ] );
|
|
47
|
-
}
|
|
48
|
-
} );
|
|
49
|
-
|
|
50
|
-
// Transform all links with innerBlocks into Submenus. This can't be done
|
|
51
|
-
// sooner because page objects have no information on their children.
|
|
52
|
-
|
|
53
|
-
const transformSubmenus = ( listOfLinks ) => {
|
|
54
|
-
listOfLinks.forEach( ( block, index, listOfLinksArray ) => {
|
|
55
|
-
const { attributes, innerBlocks } = block;
|
|
56
|
-
if ( innerBlocks.length !== 0 ) {
|
|
57
|
-
transformSubmenus( innerBlocks );
|
|
58
|
-
const transformedBlock = createBlock(
|
|
59
|
-
'core/navigation-submenu',
|
|
60
|
-
attributes,
|
|
61
|
-
innerBlocks
|
|
62
|
-
);
|
|
63
|
-
listOfLinksArray[ index ] = transformedBlock;
|
|
64
|
-
}
|
|
65
|
-
} );
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
transformSubmenus( navigationLinks );
|
|
69
|
-
|
|
70
|
-
replaceBlock( clientId, navigationLinks );
|
|
71
|
-
};
|
|
72
|
-
|
|
73
22
|
export default function ConvertToLinksModal( { onClose, clientId } ) {
|
|
74
23
|
const { records: pages, hasResolved: pagesFinished } = useEntityRecords(
|
|
75
24
|
'postType',
|
|
@@ -91,19 +40,12 @@ export default function ConvertToLinksModal( { onClose, clientId } ) {
|
|
|
91
40
|
<Modal
|
|
92
41
|
closeLabel={ __( 'Close' ) }
|
|
93
42
|
onRequestClose={ onClose }
|
|
94
|
-
title={ __( '
|
|
43
|
+
title={ __( 'Customize this menu' ) }
|
|
95
44
|
className={ 'wp-block-page-list-modal' }
|
|
96
45
|
aria={ { describedby: 'wp-block-page-list-modal__description' } }
|
|
97
46
|
>
|
|
98
47
|
<p id={ 'wp-block-page-list-modal__description' }>
|
|
99
|
-
{
|
|
100
|
-
'To edit this navigation menu, convert it to single page links. This allows you to add, re-order, remove items, or edit their labels.'
|
|
101
|
-
) }
|
|
102
|
-
</p>
|
|
103
|
-
<p>
|
|
104
|
-
{ __(
|
|
105
|
-
"Note: if you add new pages to your site, you'll need to add them to your navigation menu."
|
|
106
|
-
) }
|
|
48
|
+
{ convertDescription }
|
|
107
49
|
</p>
|
|
108
50
|
<div className="wp-block-page-list-modal-buttons">
|
|
109
51
|
<Button variant="tertiary" onClick={ onClose }>
|
|
@@ -112,14 +54,15 @@ export default function ConvertToLinksModal( { onClose, clientId } ) {
|
|
|
112
54
|
<Button
|
|
113
55
|
variant="primary"
|
|
114
56
|
disabled={ ! pagesFinished }
|
|
115
|
-
onClick={
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
57
|
+
onClick={ () => {
|
|
58
|
+
const navigationLinks =
|
|
59
|
+
convertToNavigationLinks( pages );
|
|
60
|
+
|
|
61
|
+
// Replace the Page List block with the Navigation Links.
|
|
62
|
+
replaceBlock( clientId, navigationLinks );
|
|
63
|
+
} }
|
|
121
64
|
>
|
|
122
|
-
{ __( '
|
|
65
|
+
{ __( 'Customize' ) }
|
|
123
66
|
</Button>
|
|
124
67
|
</div>
|
|
125
68
|
</Modal>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlock } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
export const convertToNavigationLinks = ( pages ) => {
|
|
7
|
+
if ( ! pages ) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const linkMap = {};
|
|
12
|
+
const navigationLinks = [];
|
|
13
|
+
pages.forEach( ( { id, title, link: url, type, parent } ) => {
|
|
14
|
+
// See if a placeholder exists. This is created if children appear before parents in list.
|
|
15
|
+
const innerBlocks = linkMap[ id ]?.innerBlocks ?? [];
|
|
16
|
+
linkMap[ id ] = createBlock(
|
|
17
|
+
'core/navigation-link',
|
|
18
|
+
{
|
|
19
|
+
id,
|
|
20
|
+
label: title.rendered,
|
|
21
|
+
url,
|
|
22
|
+
type,
|
|
23
|
+
kind: 'post-type',
|
|
24
|
+
},
|
|
25
|
+
innerBlocks
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if ( ! parent ) {
|
|
29
|
+
navigationLinks.push( linkMap[ id ] );
|
|
30
|
+
} else {
|
|
31
|
+
if ( ! linkMap[ parent ] ) {
|
|
32
|
+
// Use a placeholder if the child appears before parent in list.
|
|
33
|
+
linkMap[ parent ] = { innerBlocks: [] };
|
|
34
|
+
}
|
|
35
|
+
const parentLinkInnerBlocks = linkMap[ parent ].innerBlocks;
|
|
36
|
+
parentLinkInnerBlocks.push( linkMap[ id ] );
|
|
37
|
+
}
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
// Transform all links with innerBlocks into Submenus. This can't be done
|
|
41
|
+
// sooner because page objects have no information on their children.
|
|
42
|
+
const transformSubmenus = ( listOfLinks ) => {
|
|
43
|
+
listOfLinks.forEach( ( block, index, listOfLinksArray ) => {
|
|
44
|
+
const { attributes, innerBlocks } = block;
|
|
45
|
+
if ( innerBlocks.length !== 0 ) {
|
|
46
|
+
transformSubmenus( innerBlocks );
|
|
47
|
+
const transformedBlock = createBlock(
|
|
48
|
+
'core/navigation-submenu',
|
|
49
|
+
attributes,
|
|
50
|
+
innerBlocks
|
|
51
|
+
);
|
|
52
|
+
listOfLinksArray[ index ] = transformedBlock;
|
|
53
|
+
}
|
|
54
|
+
} );
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
transformSubmenus( navigationLinks );
|
|
58
|
+
|
|
59
|
+
return navigationLinks;
|
|
60
|
+
};
|
package/src/page-list/edit.js
CHANGED
|
@@ -6,28 +6,49 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { createBlock } from '@wordpress/blocks';
|
|
9
10
|
import {
|
|
11
|
+
InspectorControls,
|
|
10
12
|
BlockControls,
|
|
11
13
|
useBlockProps,
|
|
14
|
+
useInnerBlocksProps,
|
|
12
15
|
getColorClassName,
|
|
16
|
+
store as blockEditorStore,
|
|
17
|
+
Warning,
|
|
13
18
|
} from '@wordpress/block-editor';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
import {
|
|
20
|
+
PanelBody,
|
|
21
|
+
ToolbarButton,
|
|
22
|
+
Spinner,
|
|
23
|
+
Notice,
|
|
24
|
+
ComboboxControl,
|
|
25
|
+
Button,
|
|
26
|
+
} from '@wordpress/components';
|
|
27
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
28
|
+
import { useMemo, useState, useEffect } from '@wordpress/element';
|
|
29
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
30
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
31
|
|
|
20
32
|
/**
|
|
21
33
|
* Internal dependencies
|
|
22
34
|
*/
|
|
23
35
|
import ConvertToLinksModal from './convert-to-links-modal';
|
|
24
|
-
import {
|
|
36
|
+
import { convertToNavigationLinks } from './convert-to-navigation-links';
|
|
37
|
+
import { convertDescription } from './constants';
|
|
25
38
|
|
|
26
39
|
// We only show the edit option when page count is <= MAX_PAGE_COUNT
|
|
27
40
|
// Performance of Navigation Links is not good past this value.
|
|
28
41
|
const MAX_PAGE_COUNT = 100;
|
|
42
|
+
const NOOP = () => {};
|
|
29
43
|
|
|
30
|
-
export default function PageListEdit( {
|
|
44
|
+
export default function PageListEdit( {
|
|
45
|
+
context,
|
|
46
|
+
clientId,
|
|
47
|
+
attributes,
|
|
48
|
+
setAttributes,
|
|
49
|
+
} ) {
|
|
50
|
+
const { parentPageID } = attributes;
|
|
51
|
+
const [ pages ] = useGetPages();
|
|
31
52
|
const { pagesByParentId, totalPages, hasResolvedPages } = usePageData();
|
|
32
53
|
|
|
33
54
|
const isNavigationChild = 'showSubmenuIcon' in context;
|
|
@@ -52,6 +73,70 @@ export default function PageListEdit( { context, clientId } ) {
|
|
|
52
73
|
style: { ...context.style?.color },
|
|
53
74
|
} );
|
|
54
75
|
|
|
76
|
+
const getBlockList = ( parentId = parentPageID ) => {
|
|
77
|
+
const childPages = pagesByParentId.get( parentId );
|
|
78
|
+
|
|
79
|
+
if ( ! childPages?.length ) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return childPages.reduce( ( template, page ) => {
|
|
84
|
+
const hasChildren = pagesByParentId.has( page.id );
|
|
85
|
+
const pageProps = {
|
|
86
|
+
id: page.id,
|
|
87
|
+
label: page.title?.rendered,
|
|
88
|
+
title: page.title?.rendered,
|
|
89
|
+
link: page.url,
|
|
90
|
+
hasChildren,
|
|
91
|
+
};
|
|
92
|
+
let item = null;
|
|
93
|
+
const children = getBlockList( page.id );
|
|
94
|
+
item = createBlock( 'core/page-list-item', pageProps, children );
|
|
95
|
+
template.push( item );
|
|
96
|
+
|
|
97
|
+
return template;
|
|
98
|
+
}, [] );
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const makePagesTree = ( parentId = 0, level = 0 ) => {
|
|
102
|
+
const childPages = pagesByParentId.get( parentId );
|
|
103
|
+
|
|
104
|
+
if ( ! childPages?.length ) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return childPages.reduce( ( tree, page ) => {
|
|
109
|
+
const hasChildren = pagesByParentId.has( page.id );
|
|
110
|
+
const item = {
|
|
111
|
+
value: page.id,
|
|
112
|
+
label: '— '.repeat( level ) + page.title.rendered,
|
|
113
|
+
rawName: page.title.rendered,
|
|
114
|
+
};
|
|
115
|
+
tree.push( item );
|
|
116
|
+
if ( hasChildren ) {
|
|
117
|
+
tree.push( ...makePagesTree( page.id, level + 1 ) );
|
|
118
|
+
}
|
|
119
|
+
return tree;
|
|
120
|
+
}, [] );
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const pagesTree = useMemo( makePagesTree, [ pagesByParentId ] );
|
|
124
|
+
|
|
125
|
+
const blockList = useMemo( getBlockList, [
|
|
126
|
+
pagesByParentId,
|
|
127
|
+
parentPageID,
|
|
128
|
+
] );
|
|
129
|
+
|
|
130
|
+
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
131
|
+
allowedBlocks: [ 'core/page-list-item' ],
|
|
132
|
+
renderAppender: false,
|
|
133
|
+
__unstableDisableDropZone: true,
|
|
134
|
+
templateLock: 'all',
|
|
135
|
+
onInput: NOOP,
|
|
136
|
+
onChange: NOOP,
|
|
137
|
+
value: blockList,
|
|
138
|
+
} );
|
|
139
|
+
|
|
55
140
|
const getBlockContent = () => {
|
|
56
141
|
if ( ! hasResolvedPages ) {
|
|
57
142
|
return (
|
|
@@ -81,21 +166,99 @@ export default function PageListEdit( { context, clientId } ) {
|
|
|
81
166
|
);
|
|
82
167
|
}
|
|
83
168
|
|
|
84
|
-
if (
|
|
169
|
+
if ( blockList.length === 0 ) {
|
|
170
|
+
const parentPageDetails =
|
|
171
|
+
pages && pages.find( ( page ) => page.id === parentPageID );
|
|
85
172
|
return (
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
173
|
+
<div { ...blockProps }>
|
|
174
|
+
<Warning>
|
|
175
|
+
{ sprintf(
|
|
176
|
+
// translators: %s: Page title.
|
|
177
|
+
__( '"%s" page has no children.' ),
|
|
178
|
+
parentPageDetails.title.rendered
|
|
179
|
+
) }
|
|
180
|
+
</Warning>
|
|
181
|
+
</div>
|
|
92
182
|
);
|
|
93
183
|
}
|
|
184
|
+
|
|
185
|
+
if ( totalPages > 0 ) {
|
|
186
|
+
return <ul { ...innerBlocksProps }></ul>;
|
|
187
|
+
}
|
|
94
188
|
};
|
|
95
189
|
|
|
190
|
+
const { replaceBlock, selectBlock } = useDispatch( blockEditorStore );
|
|
191
|
+
|
|
192
|
+
const { parentNavBlockClientId, isNested } = useSelect(
|
|
193
|
+
( select ) => {
|
|
194
|
+
const { getSelectedBlockClientId, getBlockParentsByBlockName } =
|
|
195
|
+
select( blockEditorStore );
|
|
196
|
+
|
|
197
|
+
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
parentNavBlockClientId: getBlockParentsByBlockName(
|
|
201
|
+
_selectedBlockClientId,
|
|
202
|
+
'core/navigation',
|
|
203
|
+
true
|
|
204
|
+
)[ 0 ],
|
|
205
|
+
isNested:
|
|
206
|
+
getBlockParentsByBlockName(
|
|
207
|
+
clientId,
|
|
208
|
+
'core/navigation-submenu',
|
|
209
|
+
true
|
|
210
|
+
).length > 0,
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
[ clientId ]
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
useEffect( () => {
|
|
217
|
+
setAttributes( { isNested } );
|
|
218
|
+
}, [ isNested ] );
|
|
219
|
+
|
|
96
220
|
return (
|
|
97
221
|
<>
|
|
98
|
-
|
|
222
|
+
<InspectorControls>
|
|
223
|
+
{ isNavigationChild && pages?.length > 0 && (
|
|
224
|
+
<PanelBody title={ __( 'Customize this menu' ) }>
|
|
225
|
+
<p>{ convertDescription }</p>
|
|
226
|
+
<Button
|
|
227
|
+
variant="primary"
|
|
228
|
+
disabled={ ! hasResolvedPages }
|
|
229
|
+
onClick={ () => {
|
|
230
|
+
const navigationLinks =
|
|
231
|
+
convertToNavigationLinks( pages );
|
|
232
|
+
|
|
233
|
+
// Replace the Page List block with the Navigation Links.
|
|
234
|
+
replaceBlock( clientId, navigationLinks );
|
|
235
|
+
|
|
236
|
+
// Select the Navigation block to reveal the changes.
|
|
237
|
+
selectBlock( parentNavBlockClientId );
|
|
238
|
+
} }
|
|
239
|
+
>
|
|
240
|
+
{ __( 'Customize' ) }
|
|
241
|
+
</Button>
|
|
242
|
+
</PanelBody>
|
|
243
|
+
) }
|
|
244
|
+
{ pagesTree.length > 0 && (
|
|
245
|
+
<PanelBody>
|
|
246
|
+
<ComboboxControl
|
|
247
|
+
className="editor-page-attributes__parent"
|
|
248
|
+
label={ __( 'Parent page' ) }
|
|
249
|
+
value={ parentPageID }
|
|
250
|
+
options={ pagesTree }
|
|
251
|
+
onChange={ ( value ) =>
|
|
252
|
+
setAttributes( { parentPageID: value ?? 0 } )
|
|
253
|
+
}
|
|
254
|
+
help={ __(
|
|
255
|
+
'Choose a page to show only its subpages.'
|
|
256
|
+
) }
|
|
257
|
+
/>
|
|
258
|
+
</PanelBody>
|
|
259
|
+
) }
|
|
260
|
+
</InspectorControls>
|
|
261
|
+
{ allowConvertToLinks && totalPages > 0 && (
|
|
99
262
|
<BlockControls group="other">
|
|
100
263
|
<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
|
|
101
264
|
{ __( 'Edit' ) }
|
|
@@ -114,22 +277,7 @@ export default function PageListEdit( { context, clientId } ) {
|
|
|
114
277
|
);
|
|
115
278
|
}
|
|
116
279
|
|
|
117
|
-
function
|
|
118
|
-
return useSelect( ( select ) => {
|
|
119
|
-
const canReadSettings = select( coreStore ).canUser(
|
|
120
|
-
'read',
|
|
121
|
-
'settings'
|
|
122
|
-
);
|
|
123
|
-
if ( ! canReadSettings ) {
|
|
124
|
-
return undefined;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const site = select( coreStore ).getEntityRecord( 'root', 'site' );
|
|
128
|
-
return site?.show_on_front === 'page' && site?.page_on_front;
|
|
129
|
-
}, [] );
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function usePageData() {
|
|
280
|
+
function useGetPages() {
|
|
133
281
|
const { records: pages, hasResolved: hasResolvedPages } = useEntityRecords(
|
|
134
282
|
'postType',
|
|
135
283
|
'page',
|
|
@@ -142,10 +290,17 @@ function usePageData() {
|
|
|
142
290
|
}
|
|
143
291
|
);
|
|
144
292
|
|
|
293
|
+
return [ pages, hasResolvedPages ];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function usePageData( pageId = 0 ) {
|
|
297
|
+
const [ pages, hasResolvedPages ] = useGetPages();
|
|
298
|
+
|
|
145
299
|
return useMemo( () => {
|
|
146
300
|
// TODO: Once the REST API supports passing multiple values to
|
|
147
301
|
// 'orderby', this can be removed.
|
|
148
302
|
// https://core.trac.wordpress.org/ticket/39037
|
|
303
|
+
|
|
149
304
|
const sortedPages = [ ...( pages ?? [] ) ].sort( ( a, b ) => {
|
|
150
305
|
if ( a.menu_order === b.menu_order ) {
|
|
151
306
|
return a.title.rendered.localeCompare( b.title.rendered );
|
|
@@ -167,91 +322,5 @@ function usePageData() {
|
|
|
167
322
|
hasResolvedPages,
|
|
168
323
|
totalPages: pages?.length ?? null,
|
|
169
324
|
};
|
|
170
|
-
}, [ pages, hasResolvedPages ] );
|
|
325
|
+
}, [ pageId, pages, hasResolvedPages ] );
|
|
171
326
|
}
|
|
172
|
-
|
|
173
|
-
const PageItems = memo( function PageItems( {
|
|
174
|
-
context,
|
|
175
|
-
pagesByParentId,
|
|
176
|
-
parentId = 0,
|
|
177
|
-
depth = 0,
|
|
178
|
-
} ) {
|
|
179
|
-
const pages = pagesByParentId.get( parentId );
|
|
180
|
-
const frontPageId = useFrontPageId();
|
|
181
|
-
|
|
182
|
-
if ( ! pages?.length ) {
|
|
183
|
-
return [];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return pages.map( ( page ) => {
|
|
187
|
-
const hasChildren = pagesByParentId.has( page.id );
|
|
188
|
-
const isNavigationChild = 'showSubmenuIcon' in context;
|
|
189
|
-
return (
|
|
190
|
-
<li
|
|
191
|
-
key={ page.id }
|
|
192
|
-
className={ classnames( 'wp-block-pages-list__item', {
|
|
193
|
-
'has-child': hasChildren,
|
|
194
|
-
'wp-block-navigation-item': isNavigationChild,
|
|
195
|
-
'open-on-click': context.openSubmenusOnClick,
|
|
196
|
-
'open-on-hover-click':
|
|
197
|
-
! context.openSubmenusOnClick &&
|
|
198
|
-
context.showSubmenuIcon,
|
|
199
|
-
'menu-item-home': page.id === frontPageId,
|
|
200
|
-
} ) }
|
|
201
|
-
>
|
|
202
|
-
{ hasChildren && context.openSubmenusOnClick ? (
|
|
203
|
-
<>
|
|
204
|
-
<button
|
|
205
|
-
className="wp-block-navigation-item__content wp-block-navigation-submenu__toggle"
|
|
206
|
-
aria-expanded="false"
|
|
207
|
-
>
|
|
208
|
-
{ page.title?.rendered }
|
|
209
|
-
</button>
|
|
210
|
-
<span className="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon">
|
|
211
|
-
<ItemSubmenuIcon />
|
|
212
|
-
</span>
|
|
213
|
-
</>
|
|
214
|
-
) : (
|
|
215
|
-
<a
|
|
216
|
-
className={ classnames(
|
|
217
|
-
'wp-block-pages-list__item__link',
|
|
218
|
-
{
|
|
219
|
-
'wp-block-navigation-item__content':
|
|
220
|
-
isNavigationChild,
|
|
221
|
-
}
|
|
222
|
-
) }
|
|
223
|
-
href={ page.link }
|
|
224
|
-
>
|
|
225
|
-
{ page.title?.rendered }
|
|
226
|
-
</a>
|
|
227
|
-
) }
|
|
228
|
-
{ hasChildren && (
|
|
229
|
-
<>
|
|
230
|
-
{ ! context.openSubmenusOnClick &&
|
|
231
|
-
context.showSubmenuIcon && (
|
|
232
|
-
<button
|
|
233
|
-
className="wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
|
|
234
|
-
aria-expanded="false"
|
|
235
|
-
>
|
|
236
|
-
<ItemSubmenuIcon />
|
|
237
|
-
</button>
|
|
238
|
-
) }
|
|
239
|
-
<ul
|
|
240
|
-
className={ classnames( 'submenu-container', {
|
|
241
|
-
'wp-block-navigation__submenu-container':
|
|
242
|
-
isNavigationChild,
|
|
243
|
-
} ) }
|
|
244
|
-
>
|
|
245
|
-
<PageItems
|
|
246
|
-
context={ context }
|
|
247
|
-
pagesByParentId={ pagesByParentId }
|
|
248
|
-
parentId={ page.id }
|
|
249
|
-
depth={ depth + 1 }
|
|
250
|
-
/>
|
|
251
|
-
</ul>
|
|
252
|
-
</>
|
|
253
|
-
) }
|
|
254
|
-
</li>
|
|
255
|
-
);
|
|
256
|
-
} );
|
|
257
|
-
} );
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
.wp-block-navigation .wp-block-navigation__submenu-container > .wp-block-page-list {
|
|
26
|
+
display: block; // This is needed to make sure the page list container is 100% wide, so that the children are correctly positioned.
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
// Make links unclickable in the editor.
|
|
26
30
|
.wp-block-pages-list__item__link {
|
|
27
31
|
pointer-events: none;
|
package/src/page-list/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { pages
|
|
4
|
+
import { pages, update } from '@wordpress/icons';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -15,7 +15,13 @@ const { name } = metadata;
|
|
|
15
15
|
export { metadata, name };
|
|
16
16
|
|
|
17
17
|
export const settings = {
|
|
18
|
-
icon
|
|
18
|
+
icon: ( { context } ) => {
|
|
19
|
+
if ( context === 'list-view' ) {
|
|
20
|
+
return update;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return pages;
|
|
24
|
+
},
|
|
19
25
|
example: {},
|
|
20
26
|
edit,
|
|
21
27
|
};
|
package/src/page-list/index.php
CHANGED
|
@@ -139,13 +139,14 @@ function block_core_page_list_build_css_font_sizes( $context ) {
|
|
|
139
139
|
* @param boolean $show_submenu_icons Whether to show submenu indicator icons.
|
|
140
140
|
* @param boolean $is_navigation_child If block is a child of Navigation block.
|
|
141
141
|
* @param array $nested_pages The array of nested pages.
|
|
142
|
+
* @param boolean $is_nested Whether the submenu is nested or not.
|
|
142
143
|
* @param array $active_page_ancestor_ids An array of ancestor ids for active page.
|
|
143
144
|
* @param array $colors Color information for overlay styles.
|
|
144
145
|
* @param integer $depth The nesting depth.
|
|
145
146
|
*
|
|
146
147
|
* @return string List markup.
|
|
147
148
|
*/
|
|
148
|
-
function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0 ) {
|
|
149
|
+
function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $is_nested, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0 ) {
|
|
149
150
|
if ( empty( $nested_pages ) ) {
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
@@ -173,7 +174,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
173
174
|
$navigation_child_content_class = $is_navigation_child ? ' wp-block-navigation-item__content' : '';
|
|
174
175
|
|
|
175
176
|
// If this is the first level of submenus, include the overlay colors.
|
|
176
|
-
if (
|
|
177
|
+
if ( ( ( 0 < $depth && ! $is_nested ) || $is_nested ) && isset( $colors['overlay_css_classes'], $colors['overlay_inline_styles'] ) ) {
|
|
177
178
|
$css_class .= ' ' . trim( implode( ' ', $colors['overlay_css_classes'] ) );
|
|
178
179
|
if ( '' !== $colors['overlay_inline_styles'] ) {
|
|
179
180
|
$style_attribute = sprintf( ' style="%s"', esc_attr( $colors['overlay_inline_styles'] ) );
|
|
@@ -207,12 +208,9 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
207
208
|
$markup .= '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
|
|
208
209
|
$markup .= '</button>';
|
|
209
210
|
}
|
|
210
|
-
$markup .= '<ul class="
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
$markup .= ' wp-block-navigation__submenu-container';
|
|
214
|
-
}
|
|
215
|
-
$markup .= '">' . block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $page['children'], $active_page_ancestor_ids, $colors, $depth + 1 ) . '</ul>';
|
|
211
|
+
$markup .= '<ul class="wp-block-navigation__submenu-container">';
|
|
212
|
+
$markup .= block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $page['children'], $is_nested, $active_page_ancestor_ids, $colors, $depth + 1 );
|
|
213
|
+
$markup .= '</ul>';
|
|
216
214
|
}
|
|
217
215
|
$markup .= '</li>';
|
|
218
216
|
}
|
|
@@ -252,6 +250,9 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
252
250
|
static $block_id = 0;
|
|
253
251
|
++$block_id;
|
|
254
252
|
|
|
253
|
+
$parent_page_id = $attributes['parentPageID'];
|
|
254
|
+
$is_nested = $attributes['isNested'];
|
|
255
|
+
|
|
255
256
|
$all_pages = get_pages(
|
|
256
257
|
array(
|
|
257
258
|
'sort_column' => 'menu_order,post_title',
|
|
@@ -306,15 +307,22 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
306
307
|
|
|
307
308
|
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
|
308
309
|
|
|
310
|
+
if ( 0 !== $parent_page_id ) {
|
|
311
|
+
$nested_pages = block_core_page_list_nest_pages(
|
|
312
|
+
$pages_with_children[ $parent_page_id ],
|
|
313
|
+
$pages_with_children
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
309
317
|
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
|
310
318
|
|
|
311
319
|
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
|
312
320
|
|
|
313
321
|
$show_submenu_icons = array_key_exists( 'showSubmenuIcon', $block->context ) ? $block->context['showSubmenuIcon'] : false;
|
|
314
322
|
|
|
315
|
-
$wrapper_markup = '<ul %1$s>%2$s</ul>';
|
|
323
|
+
$wrapper_markup = $is_nested ? '%2$s' : '<ul %1$s>%2$s</ul>';
|
|
316
324
|
|
|
317
|
-
$items_markup = block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $active_page_ancestor_ids, $colors );
|
|
325
|
+
$items_markup = block_core_page_list_render_nested_page_list( $open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $is_nested, $active_page_ancestor_ids, $colors );
|
|
318
326
|
|
|
319
327
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
320
328
|
array(
|