@wordpress/block-library 7.5.0 → 7.8.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 +1 -1
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +6 -1
- package/build/audio/index.js.map +1 -1
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/block/edit.js +10 -9
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.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.map +1 -1
- package/build/button/index.js +25 -1
- 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/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.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/column/deprecated.js.map +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +1 -1
- package/build/columns/utils.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-author-name/edit.js +4 -2
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-date/edit.js +1 -1
- package/build/comment-date/edit.js.map +1 -1
- package/build/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -37
- 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 +108 -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 +336 -0
- package/build/cover/edit/index.js.map +1 -0
- package/build/cover/edit/inspector-controls.js +252 -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/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/build/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build/cover/edit.native.js +0 -1
- 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.map +1 -1
- package/build/embed/deprecated.js +6 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.js +1 -1
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/index.js +6 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +6 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +6 -1
- package/build/embed/util.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/index.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +3 -2
- 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/gallery.native.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/index.js.map +1 -1
- package/build/gallery/shared.js +29 -12
- 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/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/heading/autogenerate-anchors.js +7 -2
- package/build/heading/autogenerate-anchors.js.map +1 -1
- package/build/heading/deprecated.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 +1 -0
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.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/image/index.js +5 -0
- package/build/image/index.js.map +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +2 -1
- package/build/image/utils.js.map +1 -1
- package/build/index.js +46 -10
- 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-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +31 -5
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/index.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-outdent-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/deprecated.js +5 -3
- package/build/media-text/deprecated.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.js +3 -3
- package/build/media-text/media-container.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/save.js +3 -1
- package/build/media-text/save.js.map +1 -1
- package/build/media-text/transforms.js +137 -8
- package/build/media-text/transforms.js.map +1 -1
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +86 -81
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +1 -5
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.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/use-navigation-menu.js +130 -38
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +4 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation-link/edit.js +44 -12
- 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.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/deprecated.js +1 -1
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/pattern/edit.js.map +1 -1
- 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 +1 -0
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/edit.js +34 -16
- package/build/post-comments/edit.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/form.js +12 -2
- package/build/post-comments-form/form.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.map +1 -1
- package/build/post-date/edit.js +13 -7
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +11 -25
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +4 -0
- package/build/post-navigation-link/index.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 +11 -2
- 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 +12 -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/deprecated.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/index.js +5 -1
- package/build/query/edit/index.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/edit/query-toolbar.js +16 -2
- package/build/query/edit/query-toolbar.js.map +1 -1
- 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-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/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/edit.native.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/use-deprecated-opacity.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 +4 -13
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +15 -2
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +6 -1
- package/build/table/index.js.map +1 -1
- package/build/table/state.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/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +4 -1
- package/build/template-part/edit/advanced-controls.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/template-part/edit/utils/hooks.js +4 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/transformationCategories.native.js.map +1 -1
- package/build/video/edit-common-settings.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 +43 -0
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +6 -1
- package/build/video/index.js.map +1 -1
- package/build-module/audio/edit.js +2 -2
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +6 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/block/edit.js +11 -10
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.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.map +1 -1
- package/build-module/button/index.js +25 -1
- 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/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/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/categories/index.js +1 -1
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +2 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +2 -2
- package/build-module/columns/utils.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-author-name/edit.js +4 -2
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-date/edit.js +1 -1
- package/build-module/comment-date/edit.js.map +1 -1
- 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 -40
- 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 +99 -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 +310 -0
- package/build-module/cover/edit/index.js.map +1 -0
- package/build-module/cover/edit/inspector-controls.js +240 -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/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/edit.native.js +0 -1
- 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.map +1 -1
- package/build-module/embed/deprecated.js +6 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -2
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/index.js +6 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +6 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +6 -1
- package/build-module/embed/util.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/index.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 +4 -3
- 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/gallery.native.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/index.js.map +1 -1
- package/build-module/gallery/shared.js +27 -10
- 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/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.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/heading/autogenerate-anchors.js +5 -2
- package/build-module/heading/autogenerate-anchors.js.map +1 -1
- package/build-module/heading/deprecated.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 +1 -0
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.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/image/index.js +5 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +2 -2
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +42 -10
- 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-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +31 -7
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/index.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-outdent-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/deprecated.js +3 -1
- package/build-module/media-text/deprecated.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.js +3 -1
- package/build-module/media-text/media-container.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/save.js +4 -1
- package/build-module/media-text/save.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/missing/edit.native.js.map +1 -1
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +87 -82
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -6
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.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/use-navigation-menu.js +130 -38
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +4 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation-link/edit.js +44 -13
- 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.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/deprecated.js +2 -2
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/pattern/edit.js.map +1 -1
- 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 +1 -0
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/edit.js +35 -16
- package/build-module/post-comments/edit.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/form.js +8 -2
- package/build-module/post-comments-form/form.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.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-featured-image/edit.js +11 -24
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +4 -0
- package/build-module/post-navigation-link/index.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 +10 -3
- 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 +10 -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/deprecated.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/index.js +5 -1
- package/build-module/query/edit/index.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/edit/query-toolbar.js +14 -2
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- 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-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/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/edit.native.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/use-deprecated-opacity.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 +4 -12
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/deprecated.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/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.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/index.js +6 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/state.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/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +4 -1
- package/build-module/template-part/edit/advanced-controls.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/template-part/edit/utils/hooks.js +4 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/transformationCategories.native.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +2 -2
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +42 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +6 -1
- package/build-module/video/index.js.map +1 -1
- package/build-style/audio/style-rtl.css +0 -3
- package/build-style/audio/style.css +0 -3
- package/build-style/button/style-rtl.css +0 -5
- package/build-style/button/style.css +0 -5
- package/build-style/common-rtl.css +1 -3
- package/build-style/common.css +1 -3
- package/build-style/cover/editor-rtl.css +11 -0
- package/build-style/cover/editor.css +11 -0
- package/build-style/cover/style-rtl.css +33 -25
- package/build-style/cover/style.css +33 -25
- package/build-style/editor-rtl.css +15 -45
- package/build-style/editor.css +15 -45
- package/build-style/embed/style-rtl.css +0 -1
- package/build-style/embed/style.css +0 -1
- package/build-style/file/style-rtl.css +9 -7
- package/build-style/file/style.css +9 -7
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/image/style-rtl.css +0 -3
- package/build-style/image/style.css +0 -3
- package/build-style/post-comments/style-rtl.css +22 -0
- package/build-style/post-comments/style.css +22 -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/post-featured-image/editor-rtl.css +0 -27
- package/build-style/post-featured-image/editor.css +0 -27
- package/build-style/search/style-rtl.css +4 -4
- package/build-style/search/style.css +4 -4
- package/build-style/separator/editor-rtl.css +1 -0
- package/build-style/separator/editor.css +1 -0
- package/build-style/site-logo/editor-rtl.css +0 -12
- package/build-style/site-logo/editor.css +0 -12
- 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 +77 -64
- package/build-style/style.css +77 -64
- package/build-style/table/style-rtl.css +0 -1
- package/build-style/table/style.css +0 -1
- package/build-style/video/editor-rtl.css +2 -5
- package/build-style/video/editor.css +2 -5
- package/build-style/video/style-rtl.css +1 -5
- package/build-style/video/style.css +1 -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 +32 -30
- package/src/audio/block.json +6 -1
- package/src/audio/edit.js +4 -2
- package/src/audio/index.js +1 -2
- package/src/audio/style.scss +0 -2
- package/src/avatar/block.json +0 -1
- package/src/avatar/hooks.js +9 -6
- package/src/avatar/index.php +2 -2
- package/src/block/edit.js +43 -48
- package/src/block/edit.native.js +12 -16
- package/src/block/test/edit.native.js +6 -9
- package/src/button/block.json +25 -1
- package/src/button/deprecated.js +145 -36
- package/src/button/edit.js +7 -11
- package/src/button/edit.native.js +2 -3
- package/src/button/save.js +5 -11
- package/src/button/style.scss +0 -5
- package/src/buttons/deprecated.js +4 -6
- package/src/buttons/edit.js +3 -3
- package/src/buttons/edit.native.js +7 -11
- 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/column/deprecated.js +2 -1
- package/src/column/edit.js +2 -3
- package/src/column/edit.native.js +2 -2
- package/src/columns/block.json +3 -1
- package/src/columns/deprecated.js +4 -2
- package/src/columns/edit.js +6 -7
- package/src/columns/edit.native.js +12 -16
- package/src/columns/index.js +1 -2
- package/src/columns/utils.js +5 -3
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-author-name/edit.js +2 -2
- package/src/comment-date/edit.js +1 -1
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -100
- package/src/comments-title/index.js +3 -1
- package/src/comments-title/index.php +41 -23
- package/src/cover/controls.native.js +3 -6
- package/src/cover/deprecated.js +237 -195
- package/src/cover/edit/block-controls.js +110 -0
- package/src/cover/edit/cover-placeholder.js +39 -0
- package/src/cover/edit/index.js +396 -0
- package/src/cover/edit/inspector-controls.js +317 -0
- package/src/cover/edit/resizable-cover.js +55 -0
- package/src/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
- package/src/cover/edit.native.js +8 -14
- package/src/cover/editor.scss +14 -1
- package/src/cover/focal-point-settings-button.native.js +1 -1
- package/src/cover/index.php +20 -37
- package/src/cover/save.js +28 -16
- package/src/cover/shared.js +5 -3
- package/src/cover/style.scss +27 -22
- package/src/cover/test/block-controls.js +62 -0
- package/src/cover/test/edit.native.js +4 -7
- package/src/cover/transforms.js +2 -7
- package/src/embed/block.json +6 -1
- package/src/embed/edit.js +38 -40
- package/src/embed/edit.native.js +46 -49
- package/src/embed/embed-controls.native.js +2 -3
- package/src/embed/embed-preview.js +4 -2
- package/src/embed/style.scss +0 -1
- package/src/embed/test/index.native.js +24 -50
- package/src/file/edit.js +7 -5
- package/src/file/edit.native.js +14 -26
- package/src/file/index.js +1 -2
- package/src/file/save.js +14 -2
- package/src/file/style.scss +15 -14
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +10 -7
- package/src/gallery/gallery.js +2 -2
- package/src/gallery/gallery.native.js +2 -4
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.js +2 -4
- package/src/gallery/index.php +23 -12
- package/src/gallery/shared.js +25 -11
- package/src/gallery/test/index.native.js +18 -34
- package/src/gallery/use-get-media.js +2 -1
- package/src/gallery/use-short-code-transform.js +19 -16
- package/src/gallery/v1/edit.js +15 -20
- package/src/gallery/v1/gallery-image.js +6 -11
- package/src/gallery/v1/gallery-image.native.js +8 -17
- package/src/gallery/v1/gallery.js +2 -2
- package/src/heading/autogenerate-anchors.js +8 -5
- package/src/heading/block.json +1 -0
- package/src/heading/deprecated.js +6 -21
- package/src/heading/edit.js +7 -5
- package/src/image/block.json +5 -0
- package/src/image/deprecated.js +6 -29
- package/src/image/edit.js +0 -44
- package/src/image/edit.native.js +74 -25
- package/src/image/editor.scss +1 -1
- package/src/image/image.js +41 -51
- package/src/image/style.scss +0 -2
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +7 -7
- package/src/image/transforms.js +4 -3
- package/src/image/utils.js +2 -2
- package/src/index.js +51 -28
- package/src/is-block-metadata-experimental.js +19 -0
- package/src/latest-comments/edit.js +2 -6
- package/src/latest-posts/edit.js +33 -9
- package/src/latest-posts/edit.native.js +10 -15
- package/src/latest-posts/index.php +12 -6
- package/src/list/index.js +1 -2
- package/src/list/test/migrate.js +1 -2
- package/src/list/transforms.js +7 -0
- package/src/list/v2/edit.js +7 -9
- 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 +51 -0
- package/src/list-item/hooks/use-enter.js +8 -16
- package/src/list-item/hooks/use-indent-list-item.js +49 -63
- package/src/list-item/hooks/use-outdent-list-item.js +2 -3
- package/src/list-item/hooks/use-space.js +47 -0
- package/src/list-item/hooks/use-split.js +33 -0
- package/src/list-item/utils.js +1 -1
- package/src/media-text/deprecated.js +6 -3
- package/src/media-text/edit.native.js +5 -6
- package/src/media-text/media-container.js +1 -1
- package/src/media-text/media-container.native.js +8 -13
- package/src/media-text/save.js +2 -1
- package/src/media-text/transforms.js +154 -0
- package/src/missing/edit.native.js +2 -3
- package/src/missing/test/edit-integration.native.js +2 -3
- package/src/missing/test/edit.native.js +6 -9
- package/src/navigation/deprecated.js +2 -5
- package/src/navigation/edit/index.js +195 -201
- package/src/navigation/edit/inner-blocks.js +1 -8
- package/src/navigation/edit/navigation-menu-delete-control.js +2 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +31 -30
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +2 -3
- package/src/navigation/index.php +40 -0
- package/src/navigation/test/use-navigation-menu.js +236 -0
- package/src/navigation/use-navigation-entities.js +12 -14
- package/src/navigation/use-navigation-menu.js +152 -82
- package/src/navigation/use-template-part-area-label.js +8 -7
- package/src/navigation-link/edit.js +59 -25
- 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 +2 -24
- package/src/navigation-submenu/edit.js +10 -20
- package/src/page-list/convert-to-links-modal.js +52 -55
- package/src/page-list/edit.js +7 -10
- package/src/page-list/test/convert-to-links-modal.js +6 -12
- package/src/paragraph/deprecated.js +2 -2
- package/src/pattern/edit.js +2 -4
- package/src/post-author/edit.js +26 -25
- package/src/post-author/index.php +3 -2
- 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 +1 -0
- package/src/post-comments/edit.js +54 -22
- package/src/post-comments/index.php +1 -1
- package/src/post-comments/style.scss +26 -0
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/form.js +12 -5
- package/src/post-comments-form/index.php +1 -1
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-comments-link/block.json +1 -0
- package/src/post-content/edit.js +2 -3
- package/src/post-date/edit.js +4 -3
- package/src/post-featured-image/edit.js +15 -31
- package/src/post-featured-image/editor.scss +0 -29
- package/src/post-navigation-link/block.json +4 -0
- package/src/post-template/edit.js +5 -0
- package/src/post-template/index.php +30 -0
- package/src/post-terms/edit.js +19 -0
- package/src/post-terms/hooks.js +27 -0
- package/src/post-terms/index.js +14 -7
- package/src/post-terms/index.php +40 -2
- package/src/post-title/index.js +1 -1
- package/src/pullquote/deprecated.js +2 -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/index.js +10 -10
- package/src/query/edit/inspector-controls/index.js +25 -11
- package/src/query/edit/inspector-controls/parent-control.js +132 -0
- package/src/query/edit/inspector-controls/sticky-control.js +25 -0
- package/src/query/edit/query-toolbar.js +25 -5
- package/src/query/utils.js +22 -0
- 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/edit.js +5 -2
- package/src/quote/v2/edit.js +8 -8
- package/src/quote/v2/test/migrate.js +1 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +10 -13
- package/src/search/edit.native.js +4 -6
- package/src/search/index.php +29 -16
- package/src/search/style.scss +2 -1
- package/src/separator/editor.scss +1 -0
- package/src/separator/use-deprecated-opacity.js +2 -4
- package/src/shortcode/edit.native.js +30 -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 +55 -40
- package/src/site-logo/edit.js +4 -18
- package/src/site-logo/editor.scss +0 -14
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/deprecated.js +4 -2
- package/src/social-links/edit.js +11 -10
- package/src/social-links/edit.native.js +3 -5
- package/src/spacer/controls.js +2 -3
- package/src/spacer/test/index.native.js +10 -21
- package/src/table/block.json +6 -1
- package/src/table/deprecated.js +4 -8
- package/src/table/edit.js +19 -4
- package/src/table/state.js +2 -4
- package/src/table/style.scss +0 -1
- package/src/table-of-contents/block.json +9 -2
- package/src/table-of-contents/edit.js +166 -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/tag-cloud/edit.js +4 -7
- package/src/template-part/edit/advanced-controls.js +4 -4
- package/src/template-part/edit/index.js +31 -25
- package/src/template-part/edit/inner-blocks.js +2 -10
- package/src/template-part/edit/utils/hooks.js +8 -7
- package/src/transformationCategories.native.js +3 -3
- package/src/video/block.json +6 -1
- package/src/video/edit-common-settings.js +2 -8
- package/src/video/edit.js +4 -2
- package/src/video/edit.native.js +38 -16
- package/src/video/editor.scss +3 -6
- package/src/video/index.js +1 -2
- package/src/video/style.scss +0 -2
- package/test/babel-plugin.js +67 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/build/cover/edit.js +0 -598
- package/build/cover/edit.js.map +0 -1
- package/build/cover/use-cover-is-dark.js.map +0 -1
- package/build/post-terms/variations.js +0 -37
- package/build/post-terms/variations.js.map +0 -1
- package/build-module/cover/edit.js +0 -575
- package/build-module/cover/edit.js.map +0 -1
- package/build-module/cover/use-cover-is-dark.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 -757
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["isEqual","BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","blocksStore","PanelBody","Placeholder","ToggleControl","ToolbarButton","ToolbarGroup","useDispatch","useSelect","renderToString","useEffect","useState","__","TableOfContentsList","getHeadingsFromContent","linearToNestedHeadingList","TableOfContentsEdit","attributes","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","headings","setHeadings","headingTree","setHeadingTree","listBlockExists","postContent","select","getBlockType","getEditedPostContent","pageIndex","getBlockAttributes","getBlockIndex","getBlockName","getBlockOrder","blockIndex","blockOrder","page","i","blockName","pageBreaks","content","match","undefined","length","latestHeadings","pagesOfContent","split","replaceBlocks","toolbarControls","values","insp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E,CACF,2EADE,CADiB,GAInBA,EAAE,CACF,mFADE;AAXP,IADD,CADD,CADD,CAhHG,CAuIH;AACA;AACA;;AACA,MAAKU,QAAQ,CAACuB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,8BACC,qBAAUxB,UAAV,EACC,cAAC,WAAD;AACC,MAAA,IAAI,EAAG,cAAC,SAAD;AAAW,QAAA,IAAI,EAAC;AAAhB,QADR;AAEC,MAAA,KAAK,EAAC,mBAFP;AAGC,MAAA,YAAY,EAAGT,EAAE,CAChB,4GADgB;AAHlB,MADD,CADD,EAUGwC,iBAVH,CADD;AAcA;;AAED,SACC,8BACC,qBAAU/B,UAAV,EACC,0BACC,cAAC,mBAAD;AAAqB,IAAA,iBAAiB,EAAGG;AAAzC,IADD,CADD,CADD,EAMG0B,eANH,EAOGE,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString, useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { getHeadingsFromContent, linearToNestedHeadingList } from './utils';\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage\n * Whether to only include headings from the current page (if the post is\n * paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\t// Local state; not saved to block attributes. The saved block is dynamic and uses PHP to generate its content.\n\tconst [ headings, setHeadings ] = useState( [] );\n\tconst [ headingTree, setHeadingTree ] = useState( [] );\n\n\tconst { listBlockExists, postContent } = useSelect(\n\t\t( select ) => ( {\n\t\t\tlistBlockExists: !! select( blocksStore ).getBlockType(\n\t\t\t\t'core/list'\n\t\t\t),\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tpostContent: select( 'core/editor' ).getEditedPostContent(),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// The page this block would be part of on the front-end. For performance\n\t// reasons, this is only calculated when onlyIncludeCurrentPage is true.\n\tconst pageIndex = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! onlyIncludeCurrentPage ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst blockOrder = getBlockOrder();\n\n\t\t\t// Calculate which page the block will appear in on the front-end by\n\t\t\t// counting how many <!--nextpage--> tags precede it.\n\t\t\t// Unfortunately, this implementation only accounts for Page Break and\n\t\t\t// Classic blocks, so if there are any <!--nextpage--> tags in any\n\t\t\t// other block, they won't be counted. This will result in the table\n\t\t\t// of contents showing headings from the wrong page if\n\t\t\t// onlyIncludeCurrentPage === true. Thankfully, this issue only\n\t\t\t// affects the editor implementation.\n\t\t\tlet page = 1;\n\t\t\tfor ( let i = 0; i < blockIndex; i++ ) {\n\t\t\t\tconst blockName = getBlockName( blockOrder[ i ] );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\tpage++;\n\t\t\t\t} else if ( blockName === 'core/freeform' ) {\n\t\t\t\t\t// Count the page breaks inside the Classic block.\n\t\t\t\t\tconst pageBreaks = getBlockAttributes(\n\t\t\t\t\t\tblockOrder[ i ]\n\t\t\t\t\t).content?.match( /<!--nextpage-->/g );\n\n\t\t\t\t\tif ( pageBreaks !== null && pageBreaks !== undefined ) {\n\t\t\t\t\t\tpage += pageBreaks.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn page;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage ]\n\t);\n\n\tuseEffect( () => {\n\t\tlet latestHeadings;\n\n\t\tif ( onlyIncludeCurrentPage ) {\n\t\t\tconst pagesOfContent = postContent.split( '<!--nextpage-->' );\n\n\t\t\tlatestHeadings = getHeadingsFromContent(\n\t\t\t\tpagesOfContent[ pageIndex - 1 ]\n\t\t\t);\n\t\t} else {\n\t\t\tlatestHeadings = getHeadingsFromContent( postContent );\n\t\t}\n\n\t\tif ( ! isEqual( headings, latestHeadings ) ) {\n\t\t\tsetHeadings( latestHeadings );\n\t\t\tsetHeadingTree( linearToNestedHeadingList( latestHeadings ) );\n\t\t}\n\t}, [ pageIndex, postContent, onlyIncludeCurrentPage ] );\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst toolbarControls = listBlockExists && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Table of Contents settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon=\"list-view\" /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ul>\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ul>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["isEqual","BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","PanelBody","Placeholder","ToggleControl","ToolbarButton","ToolbarGroup","useDisabled","useDispatch","useSelect","__unstableStripHTML","stripHTML","renderToString","useEffect","__","addQueryArgs","removeQueryArgs","icon","TableOfContentsList","linearToNestedHeadingList","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","disabledRef","canInsertList","select","getBlockRootClientId","canInsertBlockType","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,iBAHD,EAICC,KAAK,IAAIC,gBAJV,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SACCC,SADD,EAECC,WAFD,EAGCC,aAHD,EAICC,aAJD,EAKCC,YALD,QAMO,uBANP;AAOA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,mBAAmB,IAAIC,SAAhC,QAAiD,gBAAjD;AACA,SAASC,cAAT,EAAyBC,SAAzB,Q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B,QADR;AAEC,MAAA,KAAK,EAAC,mBAFP;AAGC,MAAA,YAAY,EAAGH,EAAE,CAChB,4GADgB;AAHlB,MADD,CADD,EAUGyD,iBAVH,CADD;AAcA;;AAED,SACC,8BACC,qBAAU7C,UAAV,EACC;AAAI,IAAA,GAAG,EAAGC;AAAV,KACC,cAAC,mBAAD;AAAqB,IAAA,iBAAiB,EAAGwC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDisabled } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst disabledRef = useDisabled();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol ref={ disabledRef }>\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
const metadata = {
|
|
5
5
|
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
6
6
|
apiVersion: 2,
|
|
7
|
+
__experimental: true,
|
|
7
8
|
name: "core/table-of-contents",
|
|
8
9
|
title: "Table of Contents",
|
|
9
10
|
category: "layout",
|
|
@@ -11,24 +12,32 @@ const metadata = {
|
|
|
11
12
|
keywords: ["document outline", "summary"],
|
|
12
13
|
textdomain: "default",
|
|
13
14
|
attributes: {
|
|
15
|
+
headings: {
|
|
16
|
+
type: "array",
|
|
17
|
+
items: {
|
|
18
|
+
type: "object"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
14
21
|
onlyIncludeCurrentPage: {
|
|
15
22
|
type: "boolean",
|
|
16
23
|
"default": false
|
|
17
24
|
}
|
|
18
25
|
},
|
|
19
|
-
usesContext: ["postId"],
|
|
20
26
|
supports: {
|
|
21
27
|
html: false
|
|
22
|
-
}
|
|
28
|
+
},
|
|
29
|
+
example: {}
|
|
23
30
|
};
|
|
24
31
|
import edit from './edit';
|
|
25
32
|
import icon from './icon';
|
|
33
|
+
import save from './save';
|
|
26
34
|
const {
|
|
27
35
|
name
|
|
28
36
|
} = metadata;
|
|
29
37
|
export { metadata, name };
|
|
30
38
|
export const settings = {
|
|
31
39
|
icon,
|
|
32
|
-
edit
|
|
40
|
+
edit,
|
|
41
|
+
save
|
|
33
42
|
};
|
|
34
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"names":["edit","icon","name","metadata","settings"],"mappings":"AAAA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"names":["edit","icon","save","name","metadata","settings"],"mappings":"AAAA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBJ,EAAAA,IADuB;AAEvBD,EAAAA,IAFuB;AAGvBE,EAAAA;AAHuB,CAAjB","sourcesContent":["/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport icon from './icon';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n"]}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
2
10
|
const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';
|
|
3
11
|
export default function TableOfContentsList(_ref) {
|
|
4
12
|
let {
|
|
5
13
|
nestedHeadingList
|
|
6
14
|
} = _ref;
|
|
7
|
-
return nestedHeadingList.map((
|
|
15
|
+
return createElement(Fragment, null, nestedHeadingList.map((node, index) => {
|
|
8
16
|
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} =
|
|
12
|
-
const entry =
|
|
17
|
+
content,
|
|
18
|
+
link
|
|
19
|
+
} = node.heading;
|
|
20
|
+
const entry = link ? createElement("a", {
|
|
13
21
|
className: ENTRY_CLASS_NAME,
|
|
14
|
-
href:
|
|
22
|
+
href: link
|
|
15
23
|
}, content) : createElement("span", {
|
|
16
24
|
className: ENTRY_CLASS_NAME
|
|
17
25
|
}, content);
|
|
18
26
|
return createElement("li", {
|
|
19
27
|
key: index
|
|
20
|
-
}, entry,
|
|
21
|
-
nestedHeadingList:
|
|
28
|
+
}, entry, node.children ? createElement("ol", null, createElement(TableOfContentsList, {
|
|
29
|
+
nestedHeadingList: node.children
|
|
22
30
|
})) : null);
|
|
23
|
-
});
|
|
31
|
+
}));
|
|
24
32
|
}
|
|
25
33
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/list.
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/list.tsx"],"names":["ENTRY_CLASS_NAME","TableOfContentsList","nestedHeadingList","map","node","index","content","link","heading","entry","children"],"mappings":";;AAAA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,gBAAgB,GAAG,mCAAzB;AAEA,eAAe,SAASC,mBAAT,OAIA;AAAA,MAJ8B;AAC5CC,IAAAA;AAD4C,GAI9B;AACd,SACC,8BACGA,iBAAiB,CAACC,GAAlB,CAAuB,CAAEC,IAAF,EAAQC,KAAR,KAAmB;AAC3C,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAAoBH,IAAI,CAACI,OAA/B;AAEA,UAAMC,KAAK,GAAGF,IAAI,GACjB;AAAG,MAAA,SAAS,EAAGP,gBAAf;AAAkC,MAAA,IAAI,EAAGO;AAAzC,OACGD,OADH,CADiB,GAKjB;AAAM,MAAA,SAAS,EAAGN;AAAlB,OAAuCM,OAAvC,CALD;AAQA,WACC;AAAI,MAAA,GAAG,EAAGD;AAAV,OACGI,KADH,EAEGL,IAAI,CAACM,QAAL,GACD,0BACC,cAAC,mBAAD;AACC,MAAA,iBAAiB,EAAGN,IAAI,CAACM;AAD1B,MADD,CADC,GAME,IARL,CADD;AAYA,GAvBC,CADH,CADD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport type { WPElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { NestedHeadingData } from './utils';\n\nconst ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';\n\nexport default function TableOfContentsList( {\n\tnestedHeadingList,\n}: {\n\tnestedHeadingList: NestedHeadingData[];\n} ): WPElement {\n\treturn (\n\t\t<>\n\t\t\t{ nestedHeadingList.map( ( node, index ) => {\n\t\t\t\tconst { content, link } = node.heading;\n\n\t\t\t\tconst entry = link ? (\n\t\t\t\t\t<a className={ ENTRY_CLASS_NAME } href={ link }>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span className={ ENTRY_CLASS_NAME }>{ content }</span>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t{ entry }\n\t\t\t\t\t\t{ node.children ? (\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\tnestedHeadingList={ node.children }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { useBlockProps } from '@wordpress/block-editor';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import TableOfContentsList from './list';
|
|
12
|
+
import { linearToNestedHeadingList } from './utils';
|
|
13
|
+
export default function save(_ref) {
|
|
14
|
+
let {
|
|
15
|
+
attributes: {
|
|
16
|
+
headings = []
|
|
17
|
+
}
|
|
18
|
+
} = _ref;
|
|
19
|
+
|
|
20
|
+
if (headings.length === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return createElement("nav", useBlockProps.save(), createElement("ol", null, createElement(TableOfContentsList, {
|
|
25
|
+
nestedHeadingList: linearToNestedHeadingList(headings)
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/save.js"],"names":["useBlockProps","TableOfContentsList","linearToNestedHeadingList","save","attributes","headings","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,yBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,QAAhC;AACA,SAASC,yBAAT,QAA0C,SAA1C;AAEA,eAAe,SAASC,IAAT,OAAmD;AAAA,MAApC;AAAEC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,GAAG;AAAb;AAAd,GAAoC;;AACjE,MAAKA,QAAQ,CAACC,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WAAO,IAAP;AACA;;AACD,SACC,qBAAUN,aAAa,CAACG,IAAd,EAAV,EACC,0BACC,cAAC,mBAAD;AACC,IAAA,iBAAiB,EAAGD,yBAAyB,CAAEG,QAAF;AAD9C,IADD,CADD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\nexport default function save( { attributes: { headings = [] } } ) {\n\tif ( headings.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<nav { ...useBlockProps.save() }>\n\t\t\t<ol>\n\t\t\t\t<TableOfContentsList\n\t\t\t\t\tnestedHeadingList={ linearToNestedHeadingList( headings ) }\n\t\t\t\t/>\n\t\t\t</ol>\n\t\t</nav>\n\t);\n}\n"]}
|
|
@@ -1,75 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef WPHeadingData
|
|
3
|
-
*
|
|
4
|
-
* @property {string} anchor The anchor link to the heading, or '' if none.
|
|
5
|
-
* @property {string} content The plain text content of the heading.
|
|
6
|
-
* @property {number} level The heading level.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Extracts text, anchor, and level from a list of heading elements.
|
|
11
|
-
*
|
|
12
|
-
* @param {NodeList} headingElements The list of heading elements.
|
|
13
|
-
*
|
|
14
|
-
* @return {WPHeadingData[]} The list of heading parameters.
|
|
15
|
-
*/
|
|
16
|
-
export function getHeadingsFromHeadingElements(headingElements) {
|
|
17
|
-
return [...headingElements].map(heading => ({
|
|
18
|
-
// A little hacky, but since we know at this point that the tag will
|
|
19
|
-
// be an H1-H6, we can just grab the 2nd character of the tag name and
|
|
20
|
-
// convert it to an integer. Should be faster than conditionals.
|
|
21
|
-
level: parseInt(heading.tagName[1], 10),
|
|
22
|
-
anchor: heading.hasAttribute('id') ? `#${heading.id}` : '',
|
|
23
|
-
content: heading.textContent
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Extracts heading data from the provided content.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} content The content to extract heading data from.
|
|
30
|
-
*
|
|
31
|
-
* @return {WPHeadingData[]} The list of heading parameters.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
export function getHeadingsFromContent(content) {
|
|
35
|
-
// Create a temporary container to put the post content into, so we can
|
|
36
|
-
// use the DOM to find all the headings.
|
|
37
|
-
const tempPostContentDOM = document.createElement('div');
|
|
38
|
-
tempPostContentDOM.innerHTML = content; // Remove template elements so that headings inside them aren't counted.
|
|
39
|
-
// This is only needed for IE11, which doesn't recognize the element and
|
|
40
|
-
// treats it like a div.
|
|
41
|
-
|
|
42
|
-
for (const template of tempPostContentDOM.querySelectorAll('template')) {
|
|
43
|
-
template.remove();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const headingElements = tempPostContentDOM.querySelectorAll('h1:not(:empty), h2:not(:empty), h3:not(:empty), h4:not(:empty), h5:not(:empty), h6:not(:empty)');
|
|
47
|
-
return getHeadingsFromHeadingElements(headingElements);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @typedef WPNestedHeadingData
|
|
51
|
-
*
|
|
52
|
-
* @property {WPHeadingData} heading The heading content, anchor,
|
|
53
|
-
* and level.
|
|
54
|
-
* @property {number} index The index of this heading
|
|
55
|
-
* node in the entire nested
|
|
56
|
-
* list of heading data.
|
|
57
|
-
* @property {WPNestedHeadingData[]|null} children The sub-headings of this
|
|
58
|
-
* heading, if any.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
1
|
/**
|
|
62
2
|
* Takes a flat list of heading parameters and nests them based on each header's
|
|
63
3
|
* immediate parent's level.
|
|
64
4
|
*
|
|
65
|
-
* @param
|
|
66
|
-
* @param {number} index The current list index.
|
|
5
|
+
* @param headingList The flat list of headings to nest.
|
|
67
6
|
*
|
|
68
|
-
* @return
|
|
7
|
+
* @return The nested list of headings.
|
|
69
8
|
*/
|
|
70
|
-
|
|
71
9
|
export function linearToNestedHeadingList(headingList) {
|
|
72
|
-
let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
73
10
|
const nestedHeadingList = [];
|
|
74
11
|
headingList.forEach((heading, key) => {
|
|
75
12
|
if (heading.content === '') {
|
|
@@ -78,13 +15,15 @@ export function linearToNestedHeadingList(headingList) {
|
|
|
78
15
|
|
|
79
16
|
|
|
80
17
|
if (heading.level === headingList[0].level) {
|
|
18
|
+
var _headingList;
|
|
19
|
+
|
|
81
20
|
// Check that the next iteration will return a value.
|
|
82
21
|
// If it does and the next level is greater than the current level,
|
|
83
22
|
// the next iteration becomes a child of the current iteration.
|
|
84
|
-
if (headingList[key + 1]
|
|
85
|
-
// We
|
|
86
|
-
// We then use this
|
|
87
|
-
// This prevents duplicate nodes.
|
|
23
|
+
if (((_headingList = headingList[key + 1]) === null || _headingList === void 0 ? void 0 : _headingList.level) > heading.level) {
|
|
24
|
+
// We must calculate the last index before the next iteration that
|
|
25
|
+
// has the same level (siblings). We then use this index to slice
|
|
26
|
+
// the array for use in recursion. This prevents duplicate nodes.
|
|
88
27
|
let endOfSlice = headingList.length;
|
|
89
28
|
|
|
90
29
|
for (let i = key + 1; i < headingList.length; i++) {
|
|
@@ -92,19 +31,18 @@ export function linearToNestedHeadingList(headingList) {
|
|
|
92
31
|
endOfSlice = i;
|
|
93
32
|
break;
|
|
94
33
|
}
|
|
95
|
-
} // We found a child node: Push a new node onto the return array
|
|
34
|
+
} // We found a child node: Push a new node onto the return array
|
|
35
|
+
// with children.
|
|
96
36
|
|
|
97
37
|
|
|
98
38
|
nestedHeadingList.push({
|
|
99
39
|
heading,
|
|
100
|
-
|
|
101
|
-
children: linearToNestedHeadingList(headingList.slice(key + 1, endOfSlice), index + key + 1)
|
|
40
|
+
children: linearToNestedHeadingList(headingList.slice(key + 1, endOfSlice))
|
|
102
41
|
});
|
|
103
42
|
} else {
|
|
104
43
|
// No child node: Push a new node onto the return array.
|
|
105
44
|
nestedHeadingList.push({
|
|
106
45
|
heading,
|
|
107
|
-
index: index + key,
|
|
108
46
|
children: null
|
|
109
47
|
});
|
|
110
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"mappings":"AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,yBAAT,CACNC,WADM,EAEgB;AACtB,QAAMC,iBAAsC,GAAG,EAA/C;AAEAD,EAAAA,WAAW,CAACE,OAAZ,CAAqB,CAAEC,OAAF,EAAWC,GAAX,KAAoB;AACxC,QAAKD,OAAO,CAACE,OAAR,KAAoB,EAAzB,EAA8B;AAC7B;AACA,KAHuC,CAKxC;;;AACA,QAAKF,OAAO,CAACG,KAAR,KAAkBN,WAAW,CAAE,CAAF,CAAX,CAAiBM,KAAxC,EAAgD;AAAA;;AAC/C;AACA;AACA;AACA,UAAK,iBAAAN,WAAW,CAAEI,GAAG,GAAG,CAAR,CAAX,8DAAwBE,KAAxB,IAAgCH,OAAO,CAACG,KAA7C,EAAqD;AACpD;AACA;AACA;AACA,YAAIC,UAAU,GAAGP,WAAW,CAACQ,MAA7B;;AACA,aAAM,IAAIC,CAAC,GAAGL,GAAG,GAAG,CAApB,EAAuBK,CAAC,GAAGT,WAAW,CAACQ,MAAvC,EAA+CC,CAAC,EAAhD,EAAqD;AACpD,cAAKT,WAAW,CAAES,CAAF,CAAX,CAAiBH,KAAjB,KAA2BH,OAAO,CAACG,KAAxC,EAAgD;AAC/CC,YAAAA,UAAU,GAAGE,CAAb;AACA;AACA;AACD,SAVmD,CAYpD;AACA;;;AACAR,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAEZ,yBAAyB,CAClCC,WAAW,CAACY,KAAZ,CAAmBR,GAAG,GAAG,CAAzB,EAA4BG,UAA5B,CADkC;AAFZ,SAAxB;AAMA,OApBD,MAoBO;AACN;AACAN,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAE;AAFa,SAAxB;AAIA;AACD;AACD,GAtCD;AAwCA,SAAOV,iBAAP;AACA","sourcesContent":["export interface HeadingData {\n\t/** The plain text content of the heading. */\n\tcontent: string;\n\t/** The heading level. */\n\tlevel: number;\n\t/** Link to the heading. */\n\tlink: string;\n}\n\nexport interface NestedHeadingData {\n\t/** The heading content, level, and link. */\n\theading: HeadingData;\n\t/** The sub-headings of this heading, if any. */\n\tchildren: NestedHeadingData[] | null;\n}\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param headingList The flat list of headings to nest.\n *\n * @return The nested list of headings.\n */\nexport function linearToNestedHeadingList(\n\theadingList: HeadingData[]\n): NestedHeadingData[] {\n\tconst nestedHeadingList: NestedHeadingData[] = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif ( headingList[ key + 1 ]?.level > heading.level ) {\n\t\t\t\t// We must calculate the last index before the next iteration that\n\t\t\t\t// has the same level (siblings). We then use this index to slice\n\t\t\t\t// the array for use in recursion. This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array\n\t\t\t\t// with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"names":["map","filter","Flex","FlexItem","PanelBody","ToggleControl","SelectControl","RangeControl","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","withSelect","__","InspectorControls","useBlockProps","useSetting","ServerSideRender","store","coreStore","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomies","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","units","availableUnits","getTaxonomyOptions","selectOption","label","value","disabled","taxonomyOptions","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","inspectorControls","selectedTaxonomy","select","getTaxonomies","per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EAAE;AAHU,KAArB;AAKA,UAAMC,eAAe,GAAG1C,GAAG,CAC1BC,MAAM,CAAE4B,UAAF,EAAc,YAAd,CADoB,EAExBc,IAAF,IAAY;AACX,aAAO;AACNH,QAAAA,KAAK,EAAEG,IAAI,CAACC,IADN;AAENL,QAAAA,KAAK,EAAEI,IAAI,CAACE;AAFN,OAAP;AAIA,KAPyB,CAA3B;AAUA,WAAO,CAAEP,YAAF,EAAgB,GAAGI,eAAnB,CAAP;AACA,GAjBD;;AAmBA,QAAMI,gBAAgB,GAAG,CAAEC,aAAF,EAAiBC,QAAjB,KAA+B;AACvD;AACA,UAAM,CAAEC,QAAF,EAAYC,OAAZ,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"names":["map","filter","Flex","FlexItem","PanelBody","ToggleControl","SelectControl","RangeControl","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","withSelect","__","InspectorControls","useBlockProps","useSetting","ServerSideRender","store","coreStore","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomies","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","units","availableUnits","getTaxonomyOptions","selectOption","label","value","disabled","taxonomyOptions","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","inspectorControls","selectedTaxonomy","select","getTaxonomies","per_page"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,MAAd,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SACCC,IADD,EAECC,QAFD,EAGCC,SAHD,EAICC,aAJD,EAKCC,aALD,EAMCC,YAND,EAOCC,yBAAyB,IAAIC,WAP9B,EAQCC,4BAA4B,IAAIC,cARjC,EASCC,8CAA8C,IAAIC,gC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U5C,aAAa,EAAvB,EACC,cAAC,gBAAD;AACC,IAAA,GAAG,EAAC,WADL;AAEC,IAAA,KAAK,EAAC,gBAFP;AAGC,IAAA,UAAU,EAAGU;AAHd,IADD,CAFD,CADD;AAYA;;AAED,eAAeb,UAAU,CAAIiD,MAAF,IAAc;AACxC,SAAO;AACNlC,IAAAA,UAAU,EAAEkC,MAAM,CAAE1C,SAAF,CAAN,CAAoB2C,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AADN,GAAP;AAGA,CAJwB,CAAV,CAIVvC,YAJU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { map, filter } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tFlex,\n\tFlexItem,\n\tPanelBody,\n\tToggleControl,\n\tSelectControl,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Minimum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_TAGS = 1;\n\n/**\n * Maximum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_TAGS = 100;\n\nconst MIN_FONT_SIZE = 0.1;\nconst MAX_FONT_SIZE = 100;\n\nfunction TagCloudEdit( { attributes, setAttributes, taxonomies } ) {\n\tconst {\n\t\ttaxonomy,\n\t\tshowTagCounts,\n\t\tnumberOfTags,\n\t\tsmallestFontSize,\n\t\tlargestFontSize,\n\t} = attributes;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t],\n\t} );\n\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( '- Select -' ),\n\t\t\tvalue: '',\n\t\t\tdisabled: true,\n\t\t};\n\t\tconst taxonomyOptions = map(\n\t\t\tfilter( taxonomies, 'show_cloud' ),\n\t\t\t( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t}\n\t\t);\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst onFontSizeChange = ( fontSizeLabel, newValue ) => {\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst [ quantity, newUnit ] =\n\t\t\tparseQuantityAndUnitFromRawValue( newValue );\n\t\tif ( ! Number.isFinite( quantity ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst updateObj = { [ fontSizeLabel ]: newValue };\n\t\t// We need to keep in sync the `unit` changes to both `smallestFontSize`\n\t\t// and `largestFontSize` attributes.\n\t\tObject.entries( {\n\t\t\tsmallestFontSize,\n\t\t\tlargestFontSize,\n\t\t} ).forEach( ( [ attribute, currentValue ] ) => {\n\t\t\tconst [ currentQuantity, currentUnit ] =\n\t\t\t\tparseQuantityAndUnitFromRawValue( currentValue );\n\t\t\t// Only add an update if the other font size attribute has a different unit.\n\t\t\tif ( attribute !== fontSizeLabel && currentUnit !== newUnit ) {\n\t\t\t\tupdateObj[ attribute ] = `${ currentQuantity }${ newUnit }`;\n\t\t\t}\n\t\t} );\n\t\tsetAttributes( updateObj );\n\t};\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\tsetAttributes( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\tchecked={ showTagCounts }\n\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\tsetAttributes( { showTagCounts: ! showTagCounts } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<RangeControl\n\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\tvalue={ numberOfTags }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { numberOfTags: value } )\n\t\t\t\t\t}\n\t\t\t\t\tmin={ MIN_TAGS }\n\t\t\t\t\tmax={ MAX_TAGS }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Smallest size' ) }\n\t\t\t\t\t\t\tvalue={ smallestFontSize }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tonFontSizeChange( 'smallestFontSize', value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Largest size' ) }\n\t\t\t\t\t\t\tvalue={ largestFontSize }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tonFontSizeChange( 'largestFontSize', value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<ServerSideRender\n\t\t\t\t\tkey=\"tag-cloud\"\n\t\t\t\t\tblock=\"core/tag-cloud\"\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\treturn {\n\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t};\n} )( TagCloudEdit );\n"]}
|
|
@@ -23,8 +23,11 @@ export function TemplatePartAdvancedControls(_ref) {
|
|
|
23
23
|
} = useSelect(select => {
|
|
24
24
|
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
|
|
25
25
|
// Blocks can be loaded into a *non-post* block editor.
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
/* eslint-disable @wordpress/data-no-store-string-literals */
|
|
27
28
|
const definedAreas = select('core/editor').__experimentalGetDefaultTemplatePartAreas();
|
|
29
|
+
/* eslint-enable @wordpress/data-no-store-string-literals */
|
|
30
|
+
|
|
28
31
|
|
|
29
32
|
return {
|
|
30
33
|
areaOptions: definedAreas.map(_ref2 => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"names":["useEntityProp","SelectControl","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","area","setArea","title","setTitle","areaOptions","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","map","label","_area","value","event","target"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,sBAA9B;AACA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,uBAA3C;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,OAAO,SAASC,4BAAT,OAMH;AAAA,MAN0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,aAF6C;AAG7CC,IAAAA,iBAH6C;AAI7CC,IAAAA,cAJ6C;AAK7CC,IAAAA;AAL6C,GAM1C;AACH,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBd,aAAa,CACtC,UADsC,EAEtC,kBAFsC,EAGtC,MAHsC,EAItCW,cAJsC,CAAvC;AAOA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBhB,aAAa,CACxC,UADwC,EAExC,kBAFwC,EAGxC,OAHwC,EAIxCW,cAJwC,CAAzC;AAOA,QAAM;AAAEM,IAAAA;AAAF,MAAkBX,SAAS,CAAIY,MAAF,IAAc;AAChD;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"names":["useEntityProp","SelectControl","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","area","setArea","title","setTitle","areaOptions","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","map","label","_area","value","event","target"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,sBAA9B;AACA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,uBAA3C;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,OAAO,SAASC,4BAAT,OAMH;AAAA,MAN0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,aAF6C;AAG7CC,IAAAA,iBAH6C;AAI7CC,IAAAA,cAJ6C;AAK7CC,IAAAA;AAL6C,GAM1C;AAC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AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,cAAF,CADX;AAEC,IAAA,OAAO,EAAG,CACT;AACCkB,MAAAA,KAAK,EAAEnB,OAAO;AACb;AACAC,MAAAA,EAAE,CAAE,4BAAF,CAFW,EAGZ,IAAIQ,cAAgB,GAHR,CADf;AAMCY,MAAAA,KAAK,EAAE;AANR,KADS,EAST;AAAEF,MAAAA,KAAK,EAAE,UAAT;AAAqBE,MAAAA,KAAK,EAAE;AAA5B,KATS,EAUT;AAAEF,MAAAA,KAAK,EAAE,QAAT;AAAmBE,MAAAA,KAAK,EAAE;AAA1B,KAVS,EAWT;AAAEF,MAAAA,KAAK,EAAE,WAAT;AAAsBE,MAAAA,KAAK,EAAE;AAA7B,KAXS,EAYT;AAAEF,MAAAA,KAAK,EAAE,WAAT;AAAsBE,MAAAA,KAAK,EAAE;AAA7B,KAZS,EAaT;AAAEF,MAAAA,KAAK,EAAE,SAAT;AAAoBE,MAAAA,KAAK,EAAE;AAA3B,KAbS,EAcT;AAAEF,MAAAA,KAAK,EAAE,UAAT;AAAqBE,MAAAA,KAAK,EAAE;AAA5B,KAdS,EAeT;AAAEF,MAAAA,KAAK,EAAE,OAAT;AAAkBE,MAAAA,KAAK,EAAE;AAAzB,KAfS,CAFX;AAmBC,IAAA,KAAK,EAAGhB,OAAO,IAAI,EAnBpB;AAoBC,IAAA,QAAQ,EAAKgB,KAAF,IAAaf,aAAa,CAAE;AAAED,MAAAA,OAAO,EAAEgB;AAAX,KAAF;AApBtC,IArBD,CADD;AA8CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst { areaOptions } = useSelect( ( select ) => {\n\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t/* eslint-disable @wordpress/data-no-store-string-literals */\n\t\tconst definedAreas =\n\t\t\tselect( 'core/editor' ).__experimentalGetDefaultTemplatePartAreas();\n\t\t/* eslint-enable @wordpress/data-no-store-string-literals */\n\t\treturn {\n\t\t\tareaOptions: definedAreas.map( ( { label, area: _area } ) => ( {\n\t\t\t\tlabel,\n\t\t\t\tvalue: _area,\n\t\t\t} ) ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import { isEmpty } from 'lodash';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
|
-
import { BlockControls, useBlockProps, __experimentalUseNoRecursiveRenders as useNoRecursiveRenders, Warning, store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
|
+
import { BlockControls, useBlockProps, __experimentalUseNoRecursiveRenders as useNoRecursiveRenders, Warning, store as blockEditorStore, __experimentalUseBlockOverlayActive as useBlockOverlayActive } from '@wordpress/block-editor';
|
|
13
13
|
import { ToolbarGroup, ToolbarButton, Spinner, Modal } from '@wordpress/components';
|
|
14
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
15
15
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -74,7 +74,12 @@ export default function TemplatePartEdit(_ref) {
|
|
|
74
74
|
const blockPatterns = useAlternativeBlockPatterns(area, clientId);
|
|
75
75
|
const hasReplacements = !!templateParts.length || !!blockPatterns.length;
|
|
76
76
|
const areaObject = useTemplatePartArea(area);
|
|
77
|
-
const
|
|
77
|
+
const hasBlockOverlay = useBlockOverlayActive(clientId);
|
|
78
|
+
const blockProps = useBlockProps({
|
|
79
|
+
className: hasBlockOverlay ? 'block-editor-block-content-overlay' : undefined
|
|
80
|
+
}, {
|
|
81
|
+
__unstableIsDisabled: hasBlockOverlay
|
|
82
|
+
});
|
|
78
83
|
const isPlaceholder = !slug;
|
|
79
84
|
const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
|
|
80
85
|
const TagName = tagName || areaObject.tagName; // We don't want to render a missing state if we have any inner blocks.
|
|
@@ -102,12 +107,11 @@ export default function TemplatePartEdit(_ref) {
|
|
|
102
107
|
clientId: clientId,
|
|
103
108
|
setAttributes: setAttributes,
|
|
104
109
|
onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
|
|
105
|
-
})), isEntityAvailable && hasReplacements && createElement(BlockControls, null, createElement(ToolbarGroup, {
|
|
110
|
+
})), isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer') && createElement(BlockControls, null, createElement(ToolbarGroup, {
|
|
106
111
|
className: "wp-block-template-part__block-control-group"
|
|
107
112
|
}, createElement(ToolbarButton, {
|
|
108
113
|
onClick: () => setIsTemplatePartSelectionOpen(true)
|
|
109
114
|
}, __('Replace')))), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
|
|
110
|
-
clientId: clientId,
|
|
111
115
|
tagName: TagName,
|
|
112
116
|
blockProps: blockProps,
|
|
113
117
|
postId: templatePartId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"names":["isEmpty","useSelect","BlockControls","useBlockProps","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","Warning","store","blockEditorStore","ToolbarGroup","ToolbarButton","Spinner","Modal","__","sprintf","coreStore","useState","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","RecursionProvider","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","templateParts","blockPatterns","hasReplacements","length","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","label","toLowerCase"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,OAJD,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SACCC,YADD,EAECC,aAFD,EAGCC,OAHD,EAICC,KAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,eAApC;AACA,OAAOC,0BAAP,MAAuC,mBAAvC;AACA,SAASC,4BAAT,QAA6C,qBAA7C;AACA,OAAOC,uBAAP,MAAoC,gBAApC;AACA,SAASC,oBAAT,QAAqC,iCAArC;AACA,SACCC,2BADD,EAECC,2BAFD,EAGCC,mBAHD,QAIO,eAJP;AAMA,eAAe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,UADyC;AAEzCC,IAAAA,aAFyC;AAGzCC,IAAAA;AAHyC,GAItC;AACH,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAeC,IAAAA,OAAf;AAAwBC,IAAAA,MAAM,GAAG;AAAjC,MAAwCN,UAA9C;AACA,QAAMO,cAAc,GAAGZ,oBAAoB,CAAES,KAAF,EAASD,IAAT,CAA3C;AACA,QAAM,CAAEK,kBAAF,EAAsBC,iBAAtB,IAA4C9B,qBAAqB,CACtE4B,cAD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\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n\tWarning,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tSpinner,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders(\n\t\ttemplatePartId\n\t);\n\tconst [\n\t\tisTemplatePartSelectionOpen,\n\t\tsetIsTemplatePartSelectionOpen,\n\t] = useState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing: hasResolvedEntity && isEmpty( entityRecord ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider>\n\t\t\t<TemplatePartAdvancedControls\n\t\t\t\ttagName={ tagName }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t/>\n\t\t\t{ isPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isEntityAvailable && hasReplacements && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tclassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"names":["isEmpty","useSelect","BlockControls","useBlockProps","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","Warning","store","blockEditorStore","__experimentalUseBlockOverlayActive","useBlockOverlayActive","ToolbarGroup","ToolbarButton","Spinner","Modal","__","sprintf","coreStore","useState","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","RecursionProvider","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","templateParts","blockPatterns","hasReplacements","length","areaObject","hasBlockOverlay","blockProps","className","undefined","__unstableIsDisabled","isPlaceholder","isEntityAvailable","TagName","label","toLowerCase"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,OAJD,EAKCC,KAAK,IAAIC,gBALV,EAMCC,mCAAmC,IAAIC,qBANxC,QAOO,yBAPP;AAQA,SACCC,YADD,EAECC,aAFD,EAGCC,OAHD,EAICC,KAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAAST,KAAK,IAAIU,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,eAApC;AACA,OAAOC,0BAAP,MAAuC,mBAAvC;AACA,SAASC,4BAAT,QAA6C,qBAA7C;AACA,OAAOC,uBAAP,MAAoC,gBAApC;AACA,SAASC,oBAAT,QAAqC,iCAArC;AACA,SACCC,2BADD,EAECC,2BAFD,EAGCC,mBAHD,QAIO,eAJP;AAMA,eAAe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,UADyC;AAEzCC,IAAAA,aAFyC;AAGzCC,IAAAA;AAHyC,GAItC;AACH,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAeC,IAAAA,OAAf;AAAwBC,IAAAA,MAAM,GAAG;AAAjC,MAAwCN,UAA9C;AACA,QAAMO,cAAc,GAAGZ,oBAAoB,CAAES,KAAF,EAASD,IAAT,CAA3C;AACA,QAAM,C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IAAA,cAAc,EAAGJ,cADlB;AAEC,IAAA,QAAQ,EAAGL,QAFZ;AAGC,IAAA,IAAI,EAAGa,IAHR;AAIC,IAAA,aAAa,EAAGd,aAJjB;AAKC,IAAA,OAAO,EAAG,MACTU,8BAA8B,CAAE,KAAF;AANhC,IAZD,CAnDF,CADD;AA6EA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockOverlayActive as useBlockOverlayActive,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tSpinner,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst [ hasAlreadyRendered, RecursionProvider ] =\n\t\tuseNoRecursiveRenders( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing: hasResolvedEntity && isEmpty( entityRecord ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst hasBlockOverlay = useBlockOverlayActive( clientId );\n\tconst blockProps = useBlockProps(\n\t\t{\n\t\t\tclassName: hasBlockOverlay\n\t\t\t\t? 'block-editor-block-content-overlay'\n\t\t\t\t: undefined,\n\t\t},\n\t\t{ __unstableIsDisabled: hasBlockOverlay }\n\t);\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider>\n\t\t\t<TemplatePartAdvancedControls\n\t\t\t\ttagName={ tagName }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t/>\n\t\t\t{ isPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isEntityAvailable &&\n\t\t\t\thasReplacements &&\n\t\t\t\t( area === 'header' || area === 'footer' ) && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tclassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
|
@@ -4,16 +4,15 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
7
|
-
import { InnerBlocks, useInnerBlocksProps,
|
|
7
|
+
import { InnerBlocks, useInnerBlocksProps, useSetting, store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { useSelect } from '@wordpress/data';
|
|
9
9
|
export default function TemplatePartInnerBlocks(_ref) {
|
|
10
10
|
let {
|
|
11
11
|
postId: id,
|
|
12
12
|
hasInnerBlocks,
|
|
13
13
|
layout,
|
|
14
|
-
tagName,
|
|
15
|
-
blockProps
|
|
16
|
-
clientId
|
|
14
|
+
tagName: TagName,
|
|
15
|
+
blockProps
|
|
17
16
|
} = _ref;
|
|
18
17
|
const themeSupportsLayout = useSelect(select => {
|
|
19
18
|
var _getSettings;
|
|
@@ -35,10 +34,6 @@ export default function TemplatePartInnerBlocks(_ref) {
|
|
|
35
34
|
renderAppender: hasInnerBlocks ? undefined : InnerBlocks.ButtonBlockAppender,
|
|
36
35
|
__experimentalLayout: themeSupportsLayout ? usedLayout : undefined
|
|
37
36
|
});
|
|
38
|
-
return createElement(
|
|
39
|
-
clientId: clientId,
|
|
40
|
-
tagName: tagName,
|
|
41
|
-
wrapperProps: innerBlocksProps
|
|
42
|
-
});
|
|
37
|
+
return createElement(TagName, innerBlocksProps);
|
|
43
38
|
}
|
|
44
39
|
//# sourceMappingURL=inner-blocks.js.map
|