@wordpress/block-library 7.4.0 → 7.7.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 +10 -0
- package/README.md +3 -2
- package/babel-plugin.js +154 -0
- package/build/audio/edit.js +4 -16
- package/build/audio/edit.js.map +1 -1
- package/build/block/edit.js +10 -9
- package/build/block/edit.js.map +1 -1
- package/build/button/deprecated.js +175 -35
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +7 -3
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +1 -0
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-template/edit.js +1 -3
- package/build/comment-template/edit.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit.js +3 -3
- package/build/comments/edit.js.map +1 -0
- package/build/{comments-query-loop → comments}/index.js +1 -1
- package/build/comments/index.js.map +1 -0
- package/build/{comments-query-loop → comments}/save.js +2 -2
- package/build/comments/save.js.map +1 -0
- package/build/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -35
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +5 -8
- package/build/comments-title/index.js.map +1 -1
- package/build/cover/controls.native.js +2 -3
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +212 -207
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +115 -0
- package/build/cover/edit/block-controls.js.map +1 -0
- package/build/cover/edit/cover-placeholder.js +49 -0
- package/build/cover/edit/cover-placeholder.js.map +1 -0
- package/build/cover/edit/index.js +343 -0
- package/build/cover/edit/index.js.map +1 -0
- package/build/cover/edit/inspector-controls.js +224 -0
- package/build/cover/edit/inspector-controls.js.map +1 -0
- package/build/cover/edit/resizable-cover.js +67 -0
- package/build/cover/edit/resizable-cover.js.map +1 -0
- package/build/cover/edit/use-cover-is-dark.js +81 -0
- package/build/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build/cover/edit.native.js +36 -16
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/focal-point-settings-button.native.js.map +1 -1
- package/build/cover/save.js +18 -5
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +15 -9
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +77 -6
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/use-cover-is-dark.native.js +60 -0
- package/build/cover/use-cover-is-dark.native.js.map +1 -0
- package/build/embed/embed-preview.js +1 -1
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +0 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +2 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -1
- package/build/gallery/shared.js +2 -2
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/use-get-media.js +2 -1
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-short-code-transform.js +19 -18
- package/build/gallery/use-short-code-transform.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +6 -2
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +1 -0
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +9 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.js +5 -56
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +56 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +4 -14
- package/build/image/image.js.map +1 -1
- package/build/index.js +48 -14
- package/build/index.js.map +1 -1
- package/build/is-block-metadata-experimental.js +18 -0
- package/build/is-block-metadata-experimental.js.map +1 -0
- package/build/latest-posts/edit.js +30 -4
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +49 -0
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/transforms.js +6 -0
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/edit.js +2 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/migrate.js +1 -0
- package/build/list/v2/migrate.js.map +1 -1
- package/build/list/v2/transforms.js +46 -9
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +7 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +24 -0
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js +59 -0
- package/build/list-item/hooks/use-backspace.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +6 -9
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +33 -39
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +54 -0
- package/build/list-item/hooks/use-space.js.map +1 -0
- package/build/list-item/hooks/use-split.js +44 -0
- package/build/list-item/hooks/use-split.js.map +1 -0
- package/build/list-item/index.js +1 -0
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +1 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/edit.native.js +2 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +2 -4
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/transforms.js +137 -8
- package/build/media-text/transforms.js.map +1 -1
- package/build/navigation/edit/index.js +91 -109
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +6 -12
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +3 -3
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/view-modal.js +25 -0
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation-link/edit.js +60 -35
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/fallback-variations.js +1 -1
- package/build/navigation-link/fallback-variations.js.map +1 -1
- package/build/navigation-link/hooks.js +1 -1
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +10 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/use-enter.js +94 -0
- package/build/paragraph/use-enter.js.map +1 -0
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-author-name/transforms.js +41 -0
- package/build/post-author-name/transforms.js.map +1 -0
- package/build/post-comment/index.js +2 -1
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/edit.js +138 -35
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +3 -2
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-count/index.js +1 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/edit.js +38 -4
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +58 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +1 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +13 -7
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +7 -2
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +35 -4
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/hooks.js +33 -0
- package/build/post-terms/hooks.js.map +1 -0
- package/build/post-terms/index.js +20 -5
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -1
- package/build/post-title/index.js.map +1 -1
- package/build/pullquote/edit.js +1 -1
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/edit.native.js +1 -1
- package/build/pullquote/edit.native.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +26 -17
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +148 -0
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build/query/edit/inspector-controls/sticky-control.js +41 -0
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build/query/index.js +2 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +28 -2
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-title/index.js +1 -1
- package/build/query-title/index.js.map +1 -1
- package/build/query-title/variations.js +1 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/quote/edit.js +3 -2
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/index.js +3 -0
- package/build/separator/index.js.map +1 -1
- package/build/shortcode/edit.native.js +16 -13
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/table/edit.js +15 -2
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +145 -65
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +13 -3
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +16 -9
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +40 -0
- package/build/table-of-contents/save.js.map +1 -0
- package/build/table-of-contents/utils.js +11 -77
- package/build/table-of-contents/utils.js.map +1 -1
- package/build/template-part/edit/index.js +7 -3
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +3 -8
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build-module/audio/edit.js +5 -17
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/block/edit.js +11 -10
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/deprecated.js +175 -35
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +2 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +7 -3
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +1 -0
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/categories/edit.js +1 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -3
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/edit.js +2 -2
- package/build-module/comments/edit.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/index.js +1 -1
- package/build-module/comments/index.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/save.js +1 -1
- package/build-module/comments/save.js.map +1 -0
- package/build-module/comments-title/deprecated.js +102 -0
- package/build-module/comments-title/deprecated.js.map +1 -0
- package/build-module/comments-title/edit.js +38 -38
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +4 -8
- package/build-module/comments-title/index.js.map +1 -1
- package/build-module/cover/controls.native.js +2 -3
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +206 -198
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +104 -0
- package/build-module/cover/edit/block-controls.js.map +1 -0
- package/build-module/cover/edit/cover-placeholder.js +38 -0
- package/build-module/cover/edit/cover-placeholder.js.map +1 -0
- package/build-module/cover/edit/index.js +317 -0
- package/build-module/cover/edit/index.js.map +1 -0
- package/build-module/cover/edit/inspector-controls.js +215 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -0
- package/build-module/cover/edit/resizable-cover.js +55 -0
- package/build-module/cover/edit/resizable-cover.js.map +1 -0
- package/build-module/cover/edit/use-cover-is-dark.js +70 -0
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/edit.native.js +35 -17
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
- package/build-module/cover/save.js +19 -6
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +11 -5
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +74 -6
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/use-cover-is-dark.native.js +51 -0
- package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
- package/build-module/embed/embed-preview.js +2 -2
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +0 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/save.js +7 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +2 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -1
- package/build-module/gallery/shared.js +2 -2
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/use-get-media.js +2 -1
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-short-code-transform.js +19 -18
- package/build-module/gallery/use-short-code-transform.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +6 -2
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -0
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +9 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.js +4 -52
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +57 -6
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +6 -16
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +43 -12
- package/build-module/index.js.map +1 -1
- package/build-module/is-block-metadata-experimental.js +16 -0
- package/build-module/is-block-metadata-experimental.js.map +1 -0
- package/build-module/latest-posts/edit.js +29 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +51 -2
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/transforms.js +6 -0
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/edit.js +2 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/migrate.js +1 -3
- package/build-module/list/v2/migrate.js.map +1 -1
- package/build-module/list/v2/transforms.js +46 -9
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +8 -9
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +3 -0
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js +44 -0
- package/build-module/list-item/hooks/use-backspace.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +6 -9
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +40 -0
- package/build-module/list-item/hooks/use-space.js.map +1 -0
- package/build-module/list-item/hooks/use-split.js +33 -0
- package/build-module/list-item/hooks/use-split.js.map +1 -0
- package/build-module/list-item/index.js +1 -0
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +1 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/edit.native.js +2 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +2 -4
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/transforms.js +137 -8
- package/build-module/media-text/transforms.js.map +1 -1
- package/build-module/navigation/edit/index.js +93 -110
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +7 -13
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/view-modal.js +24 -0
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation-link/edit.js +60 -36
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/fallback-variations.js +1 -1
- package/build-module/navigation-link/fallback-variations.js.map +1 -1
- package/build-module/navigation-link/hooks.js +2 -2
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +9 -0
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/use-enter.js +81 -0
- package/build-module/paragraph/use-enter.js.map +1 -0
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +3 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-author-name/transforms.js +32 -0
- package/build-module/post-author-name/transforms.js.map +1 -0
- package/build-module/post-comment/index.js +2 -1
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/edit.js +139 -37
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +3 -2
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +38 -6
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +45 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +15 -9
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +7 -2
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +35 -6
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/hooks.js +25 -0
- package/build-module/post-terms/hooks.js.map +1 -0
- package/build-module/post-terms/index.js +18 -8
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/pullquote/edit.js +2 -2
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +2 -2
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +24 -17
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build-module/query/index.js +2 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +21 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -1
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/query-title/variations.js +2 -2
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/quote/edit.js +4 -3
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +2 -2
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/index.js +4 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/separator/index.js +3 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/shortcode/edit.native.js +17 -13
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +1 -1
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/edit.js +2 -2
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table/edit.js +17 -4
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +144 -68
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +12 -3
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +18 -10
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +28 -0
- package/build-module/table-of-contents/save.js.map +1 -0
- package/build-module/table-of-contents/utils.js +11 -73
- package/build-module/table-of-contents/utils.js.map +1 -1
- package/build-module/template-part/edit/index.js +8 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +4 -9
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/video/edit.js +5 -9
- package/build-module/video/edit.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
- package/build-style/{comments-query-loop → comments}/editor.css +0 -0
- package/build-style/cover/style-rtl.css +32 -27
- package/build-style/cover/style.css +32 -27
- package/build-style/editor-rtl.css +16 -10
- package/build-style/editor.css +16 -10
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/post-comments/editor-rtl.css +79 -0
- package/build-style/post-comments/editor.css +79 -0
- package/build-style/post-comments/style-rtl.css +27 -3
- package/build-style/post-comments/style.css +27 -3
- package/build-style/post-comments-form/editor-rtl.css +79 -0
- package/build-style/post-comments-form/editor.css +79 -0
- package/build-style/post-comments-form/style-rtl.css +1 -3
- package/build-style/post-comments-form/style.css +1 -3
- package/build-style/separator/editor-rtl.css +1 -0
- package/build-style/separator/editor.css +1 -0
- package/build-style/site-logo/style-rtl.css +4 -0
- package/build-style/site-logo/style.css +4 -0
- package/build-style/style-rtl.css +69 -33
- package/build-style/style.css +71 -33
- package/build-style/video/editor-rtl.css +2 -5
- package/build-style/video/editor.css +2 -5
- package/build-types/table-of-contents/list.d.ts +12 -0
- package/build-types/table-of-contents/list.d.ts.map +1 -0
- package/build-types/table-of-contents/utils.d.ts +24 -0
- package/build-types/table-of-contents/utils.d.ts.map +1 -0
- package/package.json +30 -29
- package/src/audio/edit.js +6 -9
- package/src/avatar/block.json +0 -1
- package/src/avatar/index.php +2 -2
- package/src/block/edit.js +39 -42
- package/src/block/test/edit.native.js +1 -1
- package/src/button/block.json +1 -0
- package/src/button/deprecated.js +145 -0
- package/src/button/edit.js +3 -1
- package/src/button/edit.native.js +6 -3
- package/src/button/save.js +3 -1
- package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/buttons/test/edit.native.js +1 -1
- package/src/categories/block.json +1 -1
- package/src/categories/edit.js +1 -1
- package/src/columns/block.json +3 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comment-edit-link/index.php +1 -4
- package/src/comment-reply-link/index.php +1 -4
- package/src/comment-template/edit.js +1 -5
- package/src/comment-template/index.php +4 -0
- package/src/{comments-query-loop → comments}/block.json +1 -1
- package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/src/{comments-query-loop → comments}/edit.js +2 -1
- package/src/{comments-query-loop → comments}/editor.scss +0 -0
- package/src/{comments-query-loop → comments}/index.js +0 -0
- package/src/{comments-query-loop → comments}/save.js +1 -3
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -84
- package/src/comments-title/index.js +3 -1
- package/src/comments-title/index.php +51 -22
- package/src/cover/controls.native.js +1 -2
- package/src/cover/deprecated.js +230 -183
- package/src/cover/edit/block-controls.js +119 -0
- package/src/cover/edit/cover-placeholder.js +39 -0
- package/src/cover/edit/index.js +393 -0
- package/src/cover/edit/inspector-controls.js +286 -0
- package/src/cover/edit/resizable-cover.js +55 -0
- package/src/cover/edit/use-cover-is-dark.js +71 -0
- package/src/cover/edit.native.js +40 -14
- package/src/cover/editor.scss +1 -1
- package/src/cover/focal-point-settings-button.native.js +1 -1
- package/src/cover/index.php +20 -37
- package/src/cover/save.js +26 -13
- package/src/cover/shared.js +5 -3
- package/src/cover/style.native.scss +4 -0
- package/src/cover/style.scss +27 -26
- package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
- package/src/cover/test/block-controls.js +62 -0
- package/src/cover/test/transforms.js +301 -0
- package/src/cover/transforms.js +112 -7
- package/src/cover/use-cover-is-dark.native.js +51 -0
- package/src/editor.scss +3 -1
- package/src/embed/embed-preview.js +4 -2
- package/src/file/edit.js +5 -1
- package/src/file/edit.native.js +0 -1
- package/src/file/save.js +14 -2
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +2 -1
- package/src/gallery/gallery.js +2 -2
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.php +23 -12
- package/src/gallery/shared.js +3 -2
- package/src/gallery/use-get-media.js +2 -1
- package/src/gallery/use-short-code-transform.js +19 -16
- package/src/gallery/v1/gallery.js +2 -2
- package/src/group/block.json +1 -0
- package/src/heading/block.json +1 -0
- package/src/heading/edit.js +5 -2
- package/src/heading/transforms.js +4 -3
- package/src/image/edit.js +0 -44
- package/src/image/edit.native.js +65 -4
- package/src/image/editor.scss +1 -1
- package/src/image/image.js +10 -13
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +7 -7
- package/src/index.js +53 -33
- package/src/is-block-metadata-experimental.js +19 -0
- package/src/latest-posts/edit.js +27 -2
- package/src/latest-posts/edit.native.js +56 -1
- package/src/latest-posts/index.php +12 -6
- package/src/latest-posts/style.scss +4 -0
- package/src/list/transforms.js +7 -0
- package/src/list/v2/edit.js +1 -0
- package/src/list/v2/migrate.js +1 -1
- package/src/list/v2/transforms.js +35 -0
- package/src/list-item/block.json +2 -1
- package/src/list-item/edit.js +17 -10
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-backspace.js +52 -0
- package/src/list-item/hooks/use-enter.js +9 -16
- package/src/list-item/hooks/use-indent-list-item.js +50 -63
- package/src/list-item/hooks/use-space.js +48 -0
- package/src/list-item/hooks/use-split.js +33 -0
- package/src/list-item/utils.js +1 -1
- package/src/media-text/edit.native.js +3 -1
- package/src/media-text/media-container.native.js +2 -4
- package/src/media-text/transforms.js +154 -0
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +181 -205
- package/src/navigation/edit/inner-blocks.js +6 -15
- package/src/navigation/index.php +40 -0
- package/src/navigation/style.scss +3 -0
- package/src/navigation/use-navigation-entities.js +1 -1
- package/src/navigation/view-modal.js +32 -0
- package/src/navigation-link/edit.js +75 -48
- package/src/navigation-link/fallback-variations.js +1 -1
- package/src/navigation-link/hooks.js +2 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
- package/src/navigation-link/test/edit.js +0 -20
- package/src/navigation-submenu/edit.js +13 -17
- package/src/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +1 -4
- package/src/paragraph/edit.js +6 -0
- package/src/paragraph/use-enter.js +103 -0
- package/src/post-author/edit.js +24 -22
- package/src/post-author/index.php +4 -3
- package/src/post-author-name/block.json +1 -0
- package/src/post-author-name/index.js +2 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-author-name/transforms.js +25 -0
- package/src/post-comment/block.json +2 -1
- package/src/post-comments/block.json +3 -2
- package/src/post-comments/edit.js +206 -44
- package/src/post-comments/editor.scss +3 -0
- package/src/post-comments/index.php +3 -1
- package/src/post-comments/style.scss +30 -5
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/edit.js +52 -23
- package/src/post-comments-form/editor.scss +3 -0
- package/src/post-comments-form/form.js +50 -0
- package/src/post-comments-form/index.php +10 -3
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-comments-link/block.json +1 -0
- package/src/post-content/edit.js +15 -1
- package/src/post-date/edit.js +4 -3
- package/src/post-excerpt/edit.js +14 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-template/edit.js +5 -0
- package/src/post-template/index.php +30 -0
- package/src/post-terms/block.json +8 -0
- package/src/post-terms/edit.js +47 -1
- package/src/post-terms/hooks.js +27 -0
- package/src/post-terms/index.js +14 -7
- package/src/post-terms/index.php +50 -2
- package/src/post-title/index.js +1 -1
- package/src/pullquote/edit.js +2 -2
- package/src/pullquote/edit.native.js +2 -2
- package/src/query/block.json +2 -1
- package/src/query/edit/inspector-controls/index.js +25 -11
- package/src/query/edit/inspector-controls/parent-control.js +133 -0
- package/src/query/edit/inspector-controls/sticky-control.js +25 -0
- package/src/query/utils.js +22 -0
- package/src/query-no-results/edit.js +1 -1
- package/src/query-pagination/index.php +0 -1
- package/src/query-title/index.js +1 -1
- package/src/query-title/variations.js +2 -2
- package/src/quote/block.json +1 -0
- package/src/quote/edit.js +5 -2
- package/src/quote/v2/edit.js +4 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +4 -1
- package/src/search/index.php +29 -16
- package/src/separator/block.json +3 -0
- package/src/separator/editor.scss +1 -0
- package/src/shortcode/edit.native.js +29 -15
- package/src/shortcode/style.native.scss +11 -4
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
- package/src/shortcode/test/edit.native.js +58 -40
- package/src/site-logo/edit.js +1 -1
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/edit.js +11 -10
- package/src/table/edit.js +19 -4
- package/src/table-of-contents/block.json +9 -2
- package/src/table-of-contents/edit.js +170 -77
- package/src/table-of-contents/index.js +2 -0
- package/src/table-of-contents/list.tsx +46 -0
- package/src/table-of-contents/save.js +25 -0
- package/src/table-of-contents/utils.ts +71 -0
- package/src/tag-cloud/block.json +1 -1
- package/src/template-part/edit/index.js +25 -15
- package/src/template-part/edit/inner-blocks.js +2 -10
- package/src/video/edit.js +7 -6
- package/src/video/editor.scss +3 -6
- package/test/babel-plugin.js +67 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
- package/build/comments-query-loop/edit.js.map +0 -1
- package/build/comments-query-loop/index.js.map +0 -1
- package/build/comments-query-loop/save.js.map +0 -1
- package/build/cover/edit.js +0 -665
- package/build/cover/edit.js.map +0 -1
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build/post-terms/variations.js +0 -37
- package/build/post-terms/variations.js.map +0 -1
- package/build-module/comments-query-loop/edit.js.map +0 -1
- package/build-module/comments-query-loop/index.js.map +0 -1
- package/build-module/comments-query-loop/save.js.map +0 -1
- package/build-module/cover/edit.js +0 -642
- package/build-module/cover/edit.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/build-module/post-terms/variations.js +0 -27
- package/build-module/post-terms/variations.js.map +0 -1
- package/src/cover/edit.js +0 -822
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
- package/src/post-terms/variations.js +0 -28
- package/src/table-of-contents/index.php +0 -346
- package/src/table-of-contents/list.js +0 -28
- package/src/table-of-contents/utils.js +0 -126
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"apiVersion": 2,
|
|
4
|
-
"name": "core/navigation-area",
|
|
5
|
-
"title": "Navigation Area",
|
|
6
|
-
"category": "theme",
|
|
7
|
-
"description": "Define a navigation area for your theme. The navigation block associated with this area will be automatically displayed.",
|
|
8
|
-
"keywords": [ "menu", "navigation", "links", "location" ],
|
|
9
|
-
"textdomain": "default",
|
|
10
|
-
"attributes": {
|
|
11
|
-
"area": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"default": "primary"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"providesContext": {
|
|
17
|
-
"navigationArea": "area"
|
|
18
|
-
},
|
|
19
|
-
"supports": {
|
|
20
|
-
"html": false,
|
|
21
|
-
"inserter": false
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __, _x } from '@wordpress/i18n';
|
|
5
|
-
import deprecated from '@wordpress/deprecated';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import {
|
|
8
|
-
MenuGroup,
|
|
9
|
-
MenuItemsChoice,
|
|
10
|
-
PanelBody,
|
|
11
|
-
SelectControl,
|
|
12
|
-
ToolbarDropdownMenu,
|
|
13
|
-
ToolbarGroup,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { useMemo } from '@wordpress/element';
|
|
16
|
-
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
|
|
17
|
-
import { useSelect } from '@wordpress/data';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import InnerBlocks from './inner-blocks';
|
|
23
|
-
import PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';
|
|
24
|
-
|
|
25
|
-
function NavigationAreaBlock( { attributes, setAttributes } ) {
|
|
26
|
-
const { area } = attributes;
|
|
27
|
-
|
|
28
|
-
const { navigationAreas, hasResolvedNavigationAreas } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
return {
|
|
34
|
-
navigationAreas: getEntityRecords( 'root', 'navigationArea' ),
|
|
35
|
-
hasResolvedNavigationAreas: hasFinishedResolution(
|
|
36
|
-
'getEntityRecords',
|
|
37
|
-
[ 'root', 'navigationArea' ]
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
const navigationMenuId = navigationAreas?.length
|
|
43
|
-
? navigationAreas[ area ]
|
|
44
|
-
: undefined;
|
|
45
|
-
|
|
46
|
-
const choices = useMemo(
|
|
47
|
-
() =>
|
|
48
|
-
navigationAreas?.map( ( { name, description } ) => ( {
|
|
49
|
-
label: description,
|
|
50
|
-
value: name,
|
|
51
|
-
} ) ),
|
|
52
|
-
[ navigationAreas ]
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
deprecated( 'wp.blockLibrary.NavigationArea', {
|
|
56
|
-
since: '12.0',
|
|
57
|
-
plugin: 'gutenberg',
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
<BlockControls>
|
|
63
|
-
<ToolbarGroup>
|
|
64
|
-
<ToolbarDropdownMenu
|
|
65
|
-
label={ __( 'Select Area' ) }
|
|
66
|
-
text={ __( 'Select Area' ) }
|
|
67
|
-
icon={ null }
|
|
68
|
-
>
|
|
69
|
-
{ ( { onClose } ) => (
|
|
70
|
-
<MenuGroup>
|
|
71
|
-
<MenuItemsChoice
|
|
72
|
-
value={ area }
|
|
73
|
-
onSelect={ ( selectedArea ) => {
|
|
74
|
-
setAttributes( { area: selectedArea } );
|
|
75
|
-
onClose();
|
|
76
|
-
} }
|
|
77
|
-
choices={ choices }
|
|
78
|
-
/>
|
|
79
|
-
</MenuGroup>
|
|
80
|
-
) }
|
|
81
|
-
</ToolbarDropdownMenu>
|
|
82
|
-
</ToolbarGroup>
|
|
83
|
-
</BlockControls>
|
|
84
|
-
<InspectorControls>
|
|
85
|
-
<PanelBody title={ __( 'Options' ) }>
|
|
86
|
-
<SelectControl
|
|
87
|
-
label={ _x( 'Area' ) }
|
|
88
|
-
value={ area }
|
|
89
|
-
// `undefined` is required for the preload attribute to be unset.
|
|
90
|
-
onChange={ ( value ) =>
|
|
91
|
-
setAttributes( {
|
|
92
|
-
area: value,
|
|
93
|
-
} )
|
|
94
|
-
}
|
|
95
|
-
options={ choices }
|
|
96
|
-
/>
|
|
97
|
-
</PanelBody>
|
|
98
|
-
</InspectorControls>
|
|
99
|
-
{ ! hasResolvedNavigationAreas && <PlaceholderPreview isLoading /> }
|
|
100
|
-
{
|
|
101
|
-
// Render inner blocks only when navigationMenuId is known so
|
|
102
|
-
// that inner blocks template is correct from the start.
|
|
103
|
-
hasResolvedNavigationAreas && (
|
|
104
|
-
<InnerBlocks navigationMenuId={ navigationMenuId } />
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
</>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default NavigationAreaBlock;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { symbolFilled as icon } from '@wordpress/icons';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import edit from './edit';
|
|
10
|
-
import metadata from './block.json';
|
|
11
|
-
import save from './save';
|
|
12
|
-
|
|
13
|
-
const { name } = metadata;
|
|
14
|
-
|
|
15
|
-
export { metadata, name };
|
|
16
|
-
|
|
17
|
-
export const settings = {
|
|
18
|
-
icon,
|
|
19
|
-
example: {
|
|
20
|
-
attributes: {
|
|
21
|
-
area: 'primary',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
edit,
|
|
25
|
-
save,
|
|
26
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Server-side rendering of the `core/navigation-area` block.
|
|
4
|
-
*
|
|
5
|
-
* @deprecated 5.9.0 See https://github.com/WordPress/gutenberg/issues/36524
|
|
6
|
-
* @package WordPress
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Registers the `core/navigation-area` block on the server.
|
|
11
|
-
*/
|
|
12
|
-
function register_block_core_navigation_area() {
|
|
13
|
-
register_block_type_from_metadata(
|
|
14
|
-
__DIR__ . '/navigation-area',
|
|
15
|
-
array(
|
|
16
|
-
'provides_context' => array(
|
|
17
|
-
'navigationArea' => 'area',
|
|
18
|
-
),
|
|
19
|
-
)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
add_action( 'init', 'register_block_core_navigation_area' );
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
6
|
-
|
|
7
|
-
const ALLOWED_BLOCKS = [ 'core/navigation' ];
|
|
8
|
-
|
|
9
|
-
export default function NavigationAreaInnerBlocks( { navigationMenuId } ) {
|
|
10
|
-
const template = useMemo(
|
|
11
|
-
() => [ [ 'core/navigation', { navigationMenuId } ] ],
|
|
12
|
-
[ navigationMenuId ]
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const blockProps = useBlockProps();
|
|
16
|
-
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
17
|
-
orientation: 'horizontal',
|
|
18
|
-
renderAppender: false,
|
|
19
|
-
template,
|
|
20
|
-
templateLock: 'all',
|
|
21
|
-
allowedBlocks: ALLOWED_BLOCKS,
|
|
22
|
-
} );
|
|
23
|
-
return <div { ...innerBlocksProps } />;
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { postCategories, postTerms } from '@wordpress/icons';
|
|
6
|
-
|
|
7
|
-
const variations = [
|
|
8
|
-
{
|
|
9
|
-
name: 'category',
|
|
10
|
-
title: __( 'Post Categories' ),
|
|
11
|
-
description: __( "Display a post's categories." ),
|
|
12
|
-
icon: postCategories,
|
|
13
|
-
isDefault: true,
|
|
14
|
-
attributes: { term: 'category' },
|
|
15
|
-
isActive: ( blockAttributes ) => blockAttributes.term === 'category',
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
name: 'post_tag',
|
|
20
|
-
title: __( 'Post Tags' ),
|
|
21
|
-
description: __( "Display a post's tags." ),
|
|
22
|
-
icon: postTerms,
|
|
23
|
-
attributes: { term: 'post_tag' },
|
|
24
|
-
isActive: ( blockAttributes ) => blockAttributes.term === 'post_tag',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export default variations;
|
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Server-side rendering of the `core/table-of-contents` block.
|
|
4
|
-
*
|
|
5
|
-
* @package WordPress
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Extracts heading content, id, page, and level from the given post content.
|
|
10
|
-
*
|
|
11
|
-
* @access private
|
|
12
|
-
*
|
|
13
|
-
* @param string $content The post content to extract headings from.
|
|
14
|
-
* @param int $headings_page The page of the post where the headings are
|
|
15
|
-
* located.
|
|
16
|
-
*
|
|
17
|
-
* @return array The list of headings.
|
|
18
|
-
*/
|
|
19
|
-
function block_core_table_of_contents_get_headings_from_content(
|
|
20
|
-
$content,
|
|
21
|
-
$headings_page = 1
|
|
22
|
-
) {
|
|
23
|
-
/* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */
|
|
24
|
-
// Disabled because of PHP DOMDocument and DOMXPath APIs using camelCase.
|
|
25
|
-
|
|
26
|
-
// Create a document to load the post content into.
|
|
27
|
-
$doc = new DOMDocument();
|
|
28
|
-
|
|
29
|
-
// Enable user error handling for the HTML parsing. HTML5 elements aren't
|
|
30
|
-
// supported (as of PHP 7.4) and There's no way to guarantee that the markup
|
|
31
|
-
// is valid anyway, so we're just going to ignore all errors in parsing.
|
|
32
|
-
// Nested heading elements will still be parsed.
|
|
33
|
-
// The lack of HTML5 support is a libxml2 issue:
|
|
34
|
-
// https://bugzilla.gnome.org/show_bug.cgi?id=761534.
|
|
35
|
-
libxml_use_internal_errors( true );
|
|
36
|
-
|
|
37
|
-
// Parse the post content into an HTML document.
|
|
38
|
-
$doc->loadHTML(
|
|
39
|
-
// loadHTML expects ISO-8859-1, so we need to convert the post content to
|
|
40
|
-
// that format. We use htmlentities to encode Unicode characters not
|
|
41
|
-
// supported by ISO-8859-1 as HTML entities. However, this function also
|
|
42
|
-
// converts all special characters like < or > to HTML entities, so we use
|
|
43
|
-
// htmlspecialchars_decode to decode them.
|
|
44
|
-
htmlspecialchars_decode(
|
|
45
|
-
utf8_decode(
|
|
46
|
-
htmlentities(
|
|
47
|
-
'<html><body>' . $content . '</body></html>',
|
|
48
|
-
ENT_COMPAT,
|
|
49
|
-
'UTF-8',
|
|
50
|
-
false
|
|
51
|
-
)
|
|
52
|
-
),
|
|
53
|
-
ENT_COMPAT
|
|
54
|
-
)
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
// We're done parsing, so we can disable user error handling. This also
|
|
58
|
-
// clears any existing errors, which helps avoid a memory leak.
|
|
59
|
-
libxml_use_internal_errors( false );
|
|
60
|
-
|
|
61
|
-
// IE11 treats template elements like divs, so to avoid extracting heading
|
|
62
|
-
// elements from them, we first have to remove them.
|
|
63
|
-
// We can't use foreach directly on the $templates DOMNodeList because it's a
|
|
64
|
-
// dynamic list, and removing nodes confuses the foreach iterator. So
|
|
65
|
-
// instead, we convert the iterator to an array and then iterate over that.
|
|
66
|
-
$templates = iterator_to_array(
|
|
67
|
-
$doc->documentElement->getElementsByTagName( 'template' )
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
foreach ( $templates as $template ) {
|
|
71
|
-
$template->parentNode->removeChild( $template );
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
$xpath = new DOMXPath( $doc );
|
|
75
|
-
|
|
76
|
-
// Get all non-empty heading elements in the post content.
|
|
77
|
-
$headings = iterator_to_array(
|
|
78
|
-
$xpath->query(
|
|
79
|
-
'//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][text()!=""]'
|
|
80
|
-
)
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
return array_map(
|
|
84
|
-
function ( $heading ) use ( $headings_page ) {
|
|
85
|
-
$id = null;
|
|
86
|
-
|
|
87
|
-
if ( isset( $heading->attributes ) ) {
|
|
88
|
-
$id_attribute = $heading->attributes->getNamedItem( 'id' );
|
|
89
|
-
|
|
90
|
-
if ( null !== $id_attribute && '' !== $id_attribute->nodeValue ) {
|
|
91
|
-
$id = $id_attribute->nodeValue;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return array(
|
|
96
|
-
// A little hacky, but since we know at this point that the tag will
|
|
97
|
-
// be an h1-h6, we can just grab the 2nd character of the tag name
|
|
98
|
-
// and convert it to an integer. Should be faster than conditionals.
|
|
99
|
-
'level' => (int) $heading->nodeName[1],
|
|
100
|
-
'id' => $id,
|
|
101
|
-
'page' => $headings_page,
|
|
102
|
-
'content' => $heading->textContent,
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
$headings
|
|
106
|
-
);
|
|
107
|
-
/* phpcs:enable */
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Gets the content, anchor, level, and page of headings from a post. Returns
|
|
112
|
-
* data from all headings in a paginated post if $current_page_only is false;
|
|
113
|
-
* otherwise, returns only data from headings on the current page being
|
|
114
|
-
* rendered.
|
|
115
|
-
*
|
|
116
|
-
* @access private
|
|
117
|
-
*
|
|
118
|
-
* @param int $post_id Id of the post to extract headings from.
|
|
119
|
-
* @param bool $current_page_only Whether to include headings from the entire
|
|
120
|
-
* post, or just those from the current page (if
|
|
121
|
-
* the post is paginated).
|
|
122
|
-
*
|
|
123
|
-
* @return array The list of headings.
|
|
124
|
-
*/
|
|
125
|
-
function block_core_table_of_contents_get_headings(
|
|
126
|
-
$post_id,
|
|
127
|
-
$current_page_only
|
|
128
|
-
) {
|
|
129
|
-
global $multipage, $page, $pages;
|
|
130
|
-
|
|
131
|
-
if ( $multipage ) {
|
|
132
|
-
// Creates a list of heading lists, one list per page.
|
|
133
|
-
$pages_of_headings = array_map(
|
|
134
|
-
function( $page_content, $page_index ) {
|
|
135
|
-
return block_core_table_of_contents_get_headings_from_content(
|
|
136
|
-
$page_content,
|
|
137
|
-
$page_index + 1
|
|
138
|
-
);
|
|
139
|
-
},
|
|
140
|
-
$pages,
|
|
141
|
-
array_keys( $pages )
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
if ( $current_page_only ) {
|
|
145
|
-
// Return the headings from the current page.
|
|
146
|
-
return $pages_of_headings[ $page - 1 ];
|
|
147
|
-
} else {
|
|
148
|
-
// Concatenate the heading lists into a single array and return it.
|
|
149
|
-
return array_merge( ...$pages_of_headings );
|
|
150
|
-
}
|
|
151
|
-
} else {
|
|
152
|
-
// Only one page, so return headings from entire post_content.
|
|
153
|
-
return block_core_table_of_contents_get_headings_from_content(
|
|
154
|
-
get_post( $post_id )->post_content
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Converts a flat list of heading parameters to a hierarchical nested list
|
|
161
|
-
* based on each header's immediate parent's level.
|
|
162
|
-
*
|
|
163
|
-
* @access private
|
|
164
|
-
*
|
|
165
|
-
* @param array $heading_list Flat list of heading parameters to nest.
|
|
166
|
-
* @param int $index The current list index.
|
|
167
|
-
*
|
|
168
|
-
* @return array A hierarchical nested list of heading parameters.
|
|
169
|
-
*/
|
|
170
|
-
function block_core_table_of_contents_linear_to_nested_heading_list(
|
|
171
|
-
$heading_list,
|
|
172
|
-
$index = 0
|
|
173
|
-
) {
|
|
174
|
-
$nested_heading_list = array();
|
|
175
|
-
|
|
176
|
-
foreach ( $heading_list as $key => $heading ) {
|
|
177
|
-
// Make sure we are only working with the same level as the first
|
|
178
|
-
// iteration in our set.
|
|
179
|
-
if ( $heading['level'] === $heading_list[0]['level'] ) {
|
|
180
|
-
// Check that the next iteration will return a value.
|
|
181
|
-
// If it does and the next level is greater than the current level,
|
|
182
|
-
// the next iteration becomes a child of the current iteration.
|
|
183
|
-
if (
|
|
184
|
-
isset( $heading_list[ $key + 1 ] ) &&
|
|
185
|
-
$heading_list[ $key + 1 ]['level'] > $heading['level']
|
|
186
|
-
) {
|
|
187
|
-
// We need to calculate the last index before the next iteration
|
|
188
|
-
// that has the same level (siblings). We then use this last index
|
|
189
|
-
// to slice the array for use in recursion. This prevents duplicate
|
|
190
|
-
// nodes.
|
|
191
|
-
$heading_list_length = count( $heading_list );
|
|
192
|
-
$end_of_slice = $heading_list_length;
|
|
193
|
-
for ( $i = $key + 1; $i < $heading_list_length; $i++ ) {
|
|
194
|
-
if ( $heading_list[ $i ]['level'] === $heading['level'] ) {
|
|
195
|
-
$end_of_slice = $i;
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Found a child node: Push a new node onto the return array with
|
|
201
|
-
// children.
|
|
202
|
-
$nested_heading_list[] = array(
|
|
203
|
-
'heading' => $heading,
|
|
204
|
-
'index' => $index + $key,
|
|
205
|
-
'children' => block_core_table_of_contents_linear_to_nested_heading_list(
|
|
206
|
-
array_slice(
|
|
207
|
-
$heading_list,
|
|
208
|
-
$key + 1,
|
|
209
|
-
$end_of_slice - ( $key + 1 )
|
|
210
|
-
),
|
|
211
|
-
$index + $key + 1
|
|
212
|
-
),
|
|
213
|
-
);
|
|
214
|
-
} else {
|
|
215
|
-
// No child node: Push a new node onto the return array.
|
|
216
|
-
$nested_heading_list[] = array(
|
|
217
|
-
'heading' => $heading,
|
|
218
|
-
'index' => $index + $key,
|
|
219
|
-
'children' => null,
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return $nested_heading_list;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Renders the heading list of the `core/table-of-contents` block on server.
|
|
230
|
-
*
|
|
231
|
-
* @access private
|
|
232
|
-
*
|
|
233
|
-
* @param array $nested_heading_list Nested list of heading data.
|
|
234
|
-
* @param string $page_url URL of the page the block belongs to.
|
|
235
|
-
*
|
|
236
|
-
* @return string The heading list rendered as HTML.
|
|
237
|
-
*/
|
|
238
|
-
function block_core_table_of_contents_render_list(
|
|
239
|
-
$nested_heading_list,
|
|
240
|
-
$page_url
|
|
241
|
-
) {
|
|
242
|
-
$entry_class = 'wp-block-table-of-contents__entry';
|
|
243
|
-
|
|
244
|
-
$child_nodes = array_map(
|
|
245
|
-
function ( $child_node ) use ( $entry_class, $page_url ) {
|
|
246
|
-
global $multipage;
|
|
247
|
-
|
|
248
|
-
$id = $child_node['heading']['id'];
|
|
249
|
-
$content = $child_node['heading']['content'];
|
|
250
|
-
|
|
251
|
-
if ( isset( $id ) ) {
|
|
252
|
-
if ( $multipage ) {
|
|
253
|
-
$href = add_query_arg(
|
|
254
|
-
'page',
|
|
255
|
-
(string) $child_node['heading']['page'],
|
|
256
|
-
remove_query_arg( 'page', $page_url )
|
|
257
|
-
) . '#' . $id;
|
|
258
|
-
} else {
|
|
259
|
-
$href = $page_url . '#' . $id;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
$entry = sprintf(
|
|
263
|
-
'<a class="%1$s" href="%2$s">%3$s</a>',
|
|
264
|
-
esc_attr( $entry_class ),
|
|
265
|
-
esc_url( $href ),
|
|
266
|
-
esc_html( $content )
|
|
267
|
-
);
|
|
268
|
-
} else {
|
|
269
|
-
$entry = sprintf(
|
|
270
|
-
'<span class="%1$s">%2$s</span>',
|
|
271
|
-
esc_attr( $entry_class ),
|
|
272
|
-
esc_html( $content )
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return sprintf(
|
|
277
|
-
'<li>%1$s%2$s</li>',
|
|
278
|
-
$entry,
|
|
279
|
-
$child_node['children']
|
|
280
|
-
? block_core_table_of_contents_render_list(
|
|
281
|
-
$child_node['children'],
|
|
282
|
-
esc_url( $page_url )
|
|
283
|
-
)
|
|
284
|
-
: null
|
|
285
|
-
);
|
|
286
|
-
},
|
|
287
|
-
$nested_heading_list
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
return '<ul>' . implode( $child_nodes ) . '</ul>';
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Renders the `core/table-of-contents` block on server.
|
|
295
|
-
*
|
|
296
|
-
* @access private
|
|
297
|
-
*
|
|
298
|
-
* @param array $attributes Block attributes.
|
|
299
|
-
* @param string $content Block default content.
|
|
300
|
-
* @param WP_Block $block Block instance.
|
|
301
|
-
*
|
|
302
|
-
* @return string Rendered block HTML.
|
|
303
|
-
*/
|
|
304
|
-
function render_block_core_table_of_contents( $attributes, $content, $block ) {
|
|
305
|
-
if ( ! isset( $block->context['postId'] ) ) {
|
|
306
|
-
return '';
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
$headings = block_core_table_of_contents_get_headings(
|
|
310
|
-
$block->context['postId'],
|
|
311
|
-
$attributes['onlyIncludeCurrentPage']
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
// If there are no headings.
|
|
315
|
-
if ( count( $headings ) === 0 ) {
|
|
316
|
-
return '';
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return sprintf(
|
|
320
|
-
'<nav %1$s>%2$s</nav>',
|
|
321
|
-
get_block_wrapper_attributes(),
|
|
322
|
-
block_core_table_of_contents_render_list(
|
|
323
|
-
block_core_table_of_contents_linear_to_nested_heading_list( $headings ),
|
|
324
|
-
get_permalink( $block->context['postId'] )
|
|
325
|
-
)
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Registers the `core/table-of-contents` block on server.
|
|
331
|
-
*
|
|
332
|
-
* @access private
|
|
333
|
-
*
|
|
334
|
-
* @uses render_block_core_table_of_contents()
|
|
335
|
-
*
|
|
336
|
-
* @throws WP_Error An exception parsing the block definition.
|
|
337
|
-
*/
|
|
338
|
-
function register_block_core_table_of_contents() {
|
|
339
|
-
register_block_type_from_metadata(
|
|
340
|
-
__DIR__ . '/table-of-contents',
|
|
341
|
-
array(
|
|
342
|
-
'render_callback' => 'render_block_core_table_of_contents',
|
|
343
|
-
)
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
add_action( 'init', 'register_block_core_table_of_contents' );
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';
|
|
2
|
-
|
|
3
|
-
export default function TableOfContentsList( { nestedHeadingList } ) {
|
|
4
|
-
return nestedHeadingList.map( ( childNode, index ) => {
|
|
5
|
-
const { anchor, content } = childNode.heading;
|
|
6
|
-
|
|
7
|
-
const entry = anchor ? (
|
|
8
|
-
<a className={ ENTRY_CLASS_NAME } href={ anchor }>
|
|
9
|
-
{ content }
|
|
10
|
-
</a>
|
|
11
|
-
) : (
|
|
12
|
-
<span className={ ENTRY_CLASS_NAME }>{ content }</span>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<li key={ index }>
|
|
17
|
-
{ entry }
|
|
18
|
-
{ childNode.children ? (
|
|
19
|
-
<ul>
|
|
20
|
-
<TableOfContentsList
|
|
21
|
-
nestedHeadingList={ childNode.children }
|
|
22
|
-
/>
|
|
23
|
-
</ul>
|
|
24
|
-
) : null }
|
|
25
|
-
</li>
|
|
26
|
-
);
|
|
27
|
-
} );
|
|
28
|
-
}
|