@wordpress/block-library 9.9.0 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +2 -2
- package/build/block/edit.native.js.map +1 -1
- package/build/block-keyboard-shortcuts/index.js.map +1 -1
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/get-updated-link-attributes.js.map +1 -1
- package/build/button/save.js.map +1 -1
- package/build/buttons/deprecated.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.js.map +1 -1
- package/build/column/deprecated.js.map +1 -1
- package/build/column/edit.js +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/column/save.js.map +1 -1
- package/build/columns/deprecated.js.map +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/save.js.map +1 -1
- package/build/columns/transforms.js.map +1 -1
- package/build/columns/utils.js.map +1 -1
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-content/edit.js.map +1 -1
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/comment-reply-link/edit.js.map +1 -1
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/comments-pagination-next/edit.js.map +1 -1
- package/build/comments-pagination-numbers/edit.js.map +1 -1
- package/build/comments-pagination-previous/edit.js.map +1 -1
- package/build/comments-title/edit.js +2 -2
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +74 -30
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js.map +1 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js +16 -3
- package/build/embed/edit.js.map +1 -1
- package/build/embed/embed-preview.js +5 -19
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -1
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/embed/save.js.map +1 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.native.js.map +1 -1
- package/build/file/deprecated.js +3 -3
- package/build/file/deprecated.js.map +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/save.js.map +1 -1
- package/build/footnotes/edit.js.map +1 -1
- package/build/footnotes/format.js.map +1 -1
- package/build/form/edit.js.map +1 -1
- package/build/form-submission-notification/edit.js.map +1 -1
- package/build/form-submission-notification/save.js.map +1 -1
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/modal.js.map +1 -1
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +2 -2
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/save.js.map +1 -1
- package/build/group/placeholder.js.map +1 -1
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/heading/edit.native.js.map +1 -1
- package/build/heading/index.js +2 -2
- package/build/heading/index.js.map +1 -1
- package/build/heading/save.js.map +1 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/home-link/edit.js.map +1 -1
- package/build/html/preview.js.map +1 -1
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +3 -3
- package/build/image/image.js.map +1 -1
- package/build/image/save.js.map +1 -1
- package/build/image/view.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/edit.js +2 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/image-fill.js.map +1 -1
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.js +2 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/edit.js.map +1 -1
- package/build/more/save.js.map +1 -1
- package/build/navigation/edit/accessible-menu-description.js.map +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/leaf-more-menu.js +1 -1
- package/build/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +1 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation/edit/utils.js.map +1 -1
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/nextpage/edit.native.js +1 -1
- package/build/nextpage/edit.native.js.map +1 -1
- package/build/page-list-item/edit.js +1 -1
- package/build/page-list-item/edit.js.map +1 -1
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/save.js.map +1 -1
- package/build/pattern/recursion-detector.js +1 -0
- package/build/pattern/recursion-detector.js.map +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-biography/edit.js.map +1 -1
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-comments-count/edit.js.map +1 -1
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-comments-link/edit.js +1 -1
- package/build/post-comments-link/edit.js.map +1 -1
- package/build/post-content/edit.js +29 -2
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-time-to-read/edit.js +1 -1
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/post-title/edit.js.map +1 -1
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/save.js.map +1 -1
- package/build/pullquote/shared.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +1 -0
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +8 -11
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +1 -0
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/query/view.js.map +1 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/query-title/edit.js +3 -3
- package/build/query-title/edit.js.map +1 -1
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js.map +1 -1
- package/build/quote/save.js.map +1 -1
- package/build/quote/transforms.js.map +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/shortcode/edit.js.map +1 -1
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-title/edit.js.map +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/deprecated.js.map +1 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js.map +1 -1
- package/build/table/save.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/hooks.js.map +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +1 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/import-controls.js +2 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +2 -2
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/variations.js.map +1 -1
- package/build/term-description/edit.js.map +1 -1
- package/build/text-columns/edit.js.map +1 -1
- package/build/text-columns/save.js.map +1 -1
- package/build/verse/deprecated.js.map +1 -1
- package/build/verse/edit.js.map +1 -1
- package/build/verse/save.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build/video/tracks-editor.js +1 -1
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +1 -3
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/deprecated.js +1 -2
- package/build-module/audio/deprecated.js.map +1 -1
- package/build-module/audio/edit.js +1 -3
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +2 -4
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/save.js +1 -2
- package/build-module/audio/save.js.map +1 -1
- package/build-module/avatar/edit.js +1 -3
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/block/edit-title.native.js +1 -2
- package/build-module/block/edit-title.native.js.map +1 -1
- package/build-module/block/edit.js +1 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +3 -4
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/block-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/button/color-background.native.js +1 -2
- package/build-module/button/color-background.native.js.map +1 -1
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +1 -3
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -3
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/get-updated-link-attributes.js.map +1 -1
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -3
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +2 -4
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js +2 -4
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +1 -3
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/column/save.js.map +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +1 -3
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -4
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/save.js.map +1 -1
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -3
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-author-name/edit.js +1 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-content/edit.js +1 -3
- package/build-module/comment-content/edit.js.map +1 -1
- package/build-module/comment-date/edit.js +1 -3
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +1 -3
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/comment-reply-link/edit.js +1 -3
- package/build-module/comment-reply-link/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -2
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +1 -3
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/comments/edit/index.js +1 -3
- package/build-module/comments/edit/index.js.map +1 -1
- package/build-module/comments/edit/placeholder.js +1 -2
- package/build-module/comments/edit/placeholder.js.map +1 -1
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js +1 -2
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js.map +1 -1
- package/build-module/comments-pagination/edit.js +1 -3
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-pagination-next/edit.js +1 -2
- package/build-module/comments-pagination-next/edit.js.map +1 -1
- package/build-module/comments-pagination-numbers/edit.js +1 -2
- package/build-module/comments-pagination-numbers/edit.js.map +1 -1
- package/build-module/comments-pagination-previous/edit.js +1 -2
- package/build-module/comments-pagination-previous/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +3 -5
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/controls.native.js +1 -3
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +1 -2
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +1 -3
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +1 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +76 -34
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js +1 -3
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/save.js +1 -2
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/details/edit.js +1 -3
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/save.js +1 -2
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/deprecated.js +1 -2
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js +17 -6
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -3
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.js +1 -3
- package/build-module/embed/embed-controls.js.map +1 -1
- package/build-module/embed/embed-controls.native.js +1 -3
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-no-preview.native.js +1 -3
- package/build-module/embed/embed-no-preview.native.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +1 -2
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +1 -3
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +6 -21
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +2 -4
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/embed/icons.js +1 -2
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/save.js +1 -2
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.native.js.map +1 -1
- package/build-module/file/deprecated.js +4 -6
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/edit.js +1 -3
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -2
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/inspector.js +1 -3
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/file/save.js +1 -3
- package/build-module/file/save.js.map +1 -1
- package/build-module/footnotes/edit.js +1 -2
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/footnotes/format.js.map +1 -1
- package/build-module/form/edit.js +1 -3
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form-input/deprecated.js +1 -2
- package/build-module/form-input/deprecated.js.map +1 -1
- package/build-module/form-input/edit.js +1 -3
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/form-input/save.js +1 -2
- package/build-module/form-input/save.js.map +1 -1
- package/build-module/form-submission-notification/edit.js.map +1 -1
- package/build-module/form-submission-notification/save.js.map +1 -1
- package/build-module/freeform/edit.js +1 -3
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/modal.js +1 -3
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/gallery/deprecated.js +1 -2
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +3 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +2 -3
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/save.js +1 -2
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/group/edit.js +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/edit.native.js +1 -2
- package/build-module/group/edit.native.js.map +1 -1
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/edit.js +1 -3
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/edit.native.js +1 -3
- package/build-module/heading/edit.native.js.map +1 -1
- package/build-module/heading/index.js +2 -2
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/save.js.map +1 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/home-link/edit.js +1 -2
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/html/edit.js +1 -3
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +1 -3
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/deprecated.js +1 -3
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +2 -4
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +2 -4
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +4 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/save.js +1 -3
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -2
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +3 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +1 -3
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/edit.js +1 -3
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +1 -2
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/list-item/edit.js +1 -3
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +1 -2
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/list-style-type.native.js +1 -2
- package/build-module/list-item/list-style-type.native.js.map +1 -1
- package/build-module/list-item/save.js +1 -2
- package/build-module/list-item/save.js.map +1 -1
- package/build-module/loginout/edit.js +1 -3
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/deprecated.js +1 -2
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +1 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -3
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/icon-retry.native.js +1 -2
- package/build-module/media-text/icon-retry.native.js.map +1 -1
- package/build-module/media-text/image-fill.js.map +1 -1
- package/build-module/media-text/media-container.js +1 -2
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -3
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +1 -2
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.js +3 -4
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +1 -2
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/more/edit.js +1 -3
- package/build-module/more/edit.js.map +1 -1
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation/edit/accessible-menu-description.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -3
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/leaf-more-menu.js +2 -4
- package/build-module/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +2 -3
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -3
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +1 -3
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-icon.js +1 -2
- package/build-module/navigation/edit/overlay-menu-icon.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +1 -3
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +1 -3
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/placeholder/placeholder-preview.js +1 -2
- package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +1 -3
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation/edit/utils.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -3
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +1 -2
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -3
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/nextpage/edit.native.js +1 -1
- package/build-module/nextpage/edit.native.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -2
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -3
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list-item/edit.js +2 -4
- package/build-module/page-list-item/edit.js.map +1 -1
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -3
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/edit.native.js +1 -3
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/paragraph/save.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +1 -0
- package/build-module/pattern/recursion-detector.js.map +1 -1
- package/build-module/post-author/edit.js +1 -3
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-biography/edit.js +1 -3
- package/build-module/post-author-biography/edit.js.map +1 -1
- package/build-module/post-author-name/edit.js +1 -3
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-comment/edit.js +1 -2
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comments-count/edit.js +1 -3
- package/build-module/post-comments-count/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +1 -3
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -3
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-comments-link/edit.js +2 -4
- package/build-module/post-comments-link/edit.js.map +1 -1
- package/build-module/post-content/edit.js +32 -5
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +1 -3
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -3
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +1 -3
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +1 -3
- package/build-module/post-featured-image/overlay-controls.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -3
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-template/edit.js +1 -3
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +1 -3
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-time-to-read/edit.js +2 -4
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/post-title/edit.js +1 -3
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/pullquote/deprecated.js +1 -2
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/pullquote/edit.js +1 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +1 -3
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/pullquote/save.js +1 -2
- package/build-module/pullquote/save.js.map +1 -1
- package/build-module/pullquote/shared.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -2
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/index.js +1 -3
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +1 -0
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +1 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +9 -14
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +1 -0
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +2 -3
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -3
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +1 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +1 -2
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/view.js.map +1 -1
- package/build-module/query-pagination/edit.js +1 -3
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.js +1 -2
- package/build-module/query-pagination/query-pagination-arrow-controls.js.map +1 -1
- package/build-module/query-pagination-next/edit.js +1 -2
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +1 -3
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js +1 -2
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/query-title/edit.js +4 -6
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/quote/deprecated.js +1 -2
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +1 -3
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/save.js +1 -2
- package/build-module/quote/save.js.map +1 -1
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -3
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -3
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +1 -2
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/icons.js +1 -2
- package/build-module/search/icons.js.map +1 -1
- package/build-module/separator/edit.js +1 -2
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/shortcode/edit.js.map +1 -1
- package/build-module/shortcode/edit.native.js +1 -2
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +1 -3
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +1 -3
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-title/edit.js +1 -3
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/social-link/edit.js +1 -3
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +1 -3
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +1 -3
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/controls.js +1 -3
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -2
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/deprecated.js.map +1 -1
- package/build-module/spacer/edit.js +1 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -2
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +1 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/save.js +1 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table-of-contents/edit.js +2 -4
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/hooks.js.map +1 -1
- package/build-module/table-of-contents/list.js +1 -3
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -3
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +2 -4
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +3 -3
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -5
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +1 -2
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +3 -4
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +1 -2
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/term-description/edit.js +1 -3
- package/build-module/term-description/edit.js.map +1 -1
- package/build-module/text-columns/edit.js +1 -3
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/text-columns/save.js.map +1 -1
- package/build-module/utils/caption.js +1 -3
- package/build-module/utils/caption.js.map +1 -1
- package/build-module/verse/deprecated.js.map +1 -1
- package/build-module/verse/edit.js +1 -3
- package/build-module/verse/edit.js.map +1 -1
- package/build-module/verse/save.js.map +1 -1
- package/build-module/video/deprecated.js +1 -2
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/edit-common-settings.js +1 -3
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +2 -4
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +2 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/icon-retry.native.js +1 -2
- package/build-module/video/icon-retry.native.js.map +1 -1
- package/build-module/video/save.js +1 -2
- package/build-module/video/save.js.map +1 -1
- package/build-module/video/tracks-editor.js +2 -4
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/code/style-rtl.css +2 -0
- package/build-style/code/style.css +4 -0
- package/build-style/common-rtl.css +0 -2
- package/build-style/common.css +0 -2
- package/build-style/post-content/style-rtl.css +2 -4
- package/build-style/post-content/style.css +2 -4
- package/build-style/style-rtl.css +4 -6
- package/build-style/style.css +6 -6
- package/package.json +36 -36
- package/src/code/style.scss +5 -0
- package/src/common.scss +0 -3
- package/src/cover/edit/inspector-controls.js +103 -44
- package/src/cover/index.php +38 -19
- package/src/cover/test/edit.js +2 -2
- package/src/embed/edit.js +19 -2
- package/src/embed/embed-preview.js +2 -18
- package/src/image/index.php +1 -1
- package/src/post-content/edit.js +30 -1
- package/src/post-content/style.scss +2 -4
- package/src/post-terms/index.php +7 -6
- package/src/query/edit/inspector-controls/index.js +10 -16
- package/src/query/edit/pattern-selection-modal.js +1 -1
- package/src/template-part/edit/selection-modal.js +1 -1
package/build/table/save.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","getColorClassesAndStyles","borderProps","getBorderClassesAndStyles","classes","clsx","className","hasCaption","RichText","Section","type","rows","Tag","jsx","children","map","cells","rowIndex","content","tag","scope","align","colspan","rowspan","cellIndex","cellClasses","Content","undefined","tagName","value","colSpan","rowSpan","jsxs","useBlockProps","style","__experimentalGetElementClassName"],"sources":["@wordpress/block-library/src/table/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = clsx( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t<Tag>\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcellIndex\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst cellClasses = clsx( {\n\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<RichText.Content\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t? cellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdata-align={ align }\n\t\t\t\t\t\t\t\t\t\ttagName={ tag }\n\t\t\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\t\t\tkey={ cellIndex }\n\t\t\t\t\t\t\t\t\t\tscope={\n\t\t\t\t\t\t\t\t\t\t\ttag === 'th' ? scope : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\t\t\trowSpan={ rowspan }\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</tr>\n\t\t\t\t) ) }\n\t\t\t</Tag>\n\t\t);\n\t};\n\n\treturn (\n\t\t<figure { ...useBlockProps.save() }>\n\t\t\t<table\n\t\t\t\tclassName={ classes === '' ? undefined : classes }\n\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t>\n\t\t\t\t<Section type=\"head\" rows={ head } />\n\t\t\t\t<Section type=\"body\" rows={ body } />\n\t\t\t\t<Section type=\"foot\" rows={ foot } />\n\t\t\t</table>\n\t\t\t{ hasCaption && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMiC,IAAAE,WAAA,GAAAF,OAAA;AAdjC;AACA;AACA;;AAGA;AACA;AACA;;AASe,SAASG,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGL,UAAU;EAChE,MAAMM,OAAO,GAAG,CAAEJ,IAAI,CAACK,MAAM,IAAI,CAAEJ,IAAI,CAACI,MAAM,IAAI,CAAEH,IAAI,CAACG,MAAM;EAE/D,IAAKD,OAAO,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAME,UAAU,GAAG,IAAAC,mDAAwB,EAAET,UAAW,CAAC;EACzD,MAAMU,WAAW,GAAG,IAAAC,oDAAyB,EAAEX,UAAW,CAAC;EAE3D,MAAMY,OAAO,GAAG,IAAAC,aAAI,EAAEL,UAAU,CAACM,SAAS,EAAEJ,WAAW,CAACI,SAAS,EAAE;IAClE,kBAAkB,EAAEb;EACrB,CAAE,CAAC;EAEH,MAAMc,UAAU,GAAG,CAAEC,qBAAQ,CAACV,OAAO,CAAED,OAAQ,CAAC;EAEhD,MAAMY,OAAO,GAAGA,CAAE;IAAEC,IAAI;IAAEC;EAAK,CAAC,KAAM;IACrC,IAAK,CAAEA,IAAI,CAACZ,MAAM,EAAG;MACpB,OAAO,IAAI;IACZ;IAEA,MAAMa,GAAG,
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","getColorClassesAndStyles","borderProps","getBorderClassesAndStyles","classes","clsx","className","hasCaption","RichText","Section","type","rows","Tag","jsx","children","map","cells","rowIndex","content","tag","scope","align","colspan","rowspan","cellIndex","cellClasses","Content","undefined","tagName","value","colSpan","rowSpan","jsxs","useBlockProps","style","__experimentalGetElementClassName"],"sources":["@wordpress/block-library/src/table/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = clsx( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t<Tag>\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcellIndex\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst cellClasses = clsx( {\n\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<RichText.Content\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t? cellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdata-align={ align }\n\t\t\t\t\t\t\t\t\t\ttagName={ tag }\n\t\t\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\t\t\tkey={ cellIndex }\n\t\t\t\t\t\t\t\t\t\tscope={\n\t\t\t\t\t\t\t\t\t\t\ttag === 'th' ? scope : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\t\t\trowSpan={ rowspan }\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</tr>\n\t\t\t\t) ) }\n\t\t\t</Tag>\n\t\t);\n\t};\n\n\treturn (\n\t\t<figure { ...useBlockProps.save() }>\n\t\t\t<table\n\t\t\t\tclassName={ classes === '' ? undefined : classes }\n\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t>\n\t\t\t\t<Section type=\"head\" rows={ head } />\n\t\t\t\t<Section type=\"body\" rows={ body } />\n\t\t\t\t<Section type=\"foot\" rows={ foot } />\n\t\t\t</table>\n\t\t\t{ hasCaption && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMiC,IAAAE,WAAA,GAAAF,OAAA;AAdjC;AACA;AACA;;AAGA;AACA;AACA;;AASe,SAASG,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGL,UAAU;EAChE,MAAMM,OAAO,GAAG,CAAEJ,IAAI,CAACK,MAAM,IAAI,CAAEJ,IAAI,CAACI,MAAM,IAAI,CAAEH,IAAI,CAACG,MAAM;EAE/D,IAAKD,OAAO,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAME,UAAU,GAAG,IAAAC,mDAAwB,EAAET,UAAW,CAAC;EACzD,MAAMU,WAAW,GAAG,IAAAC,oDAAyB,EAAEX,UAAW,CAAC;EAE3D,MAAMY,OAAO,GAAG,IAAAC,aAAI,EAAEL,UAAU,CAACM,SAAS,EAAEJ,WAAW,CAACI,SAAS,EAAE;IAClE,kBAAkB,EAAEb;EACrB,CAAE,CAAC;EAEH,MAAMc,UAAU,GAAG,CAAEC,q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,GAAGvB,OAAS;MAClD8B,KAAK,EAAG;QAAE,GAAGlC,UAAU,CAACkC,KAAK;QAAE,GAAGhC,WAAW,CAACgC;MAAM,CAAG;MAAApB,QAAA,gBAEvD,IAAAxB,WAAA,CAAAuB,GAAA,EAACJ,OAAO;QAACC,IAAI,EAAC,MAAM;QAACC,IAAI,EAAGjB;MAAM,CAAE,CAAC,eACrC,IAAAJ,WAAA,CAAAuB,GAAA,EAACJ,OAAO;QAACC,IAAI,EAAC,MAAM;QAACC,IAAI,EAAGhB;MAAM,CAAE,CAAC,eACrC,IAAAL,WAAA,CAAAuB,GAAA,EAACJ,OAAO;QAACC,IAAI,EAAC,MAAM;QAACC,IAAI,EAAGf;MAAM,CAAE,CAAC;IAAA,CAC/B,CAAC,EACNW,UAAU,iBACX,IAAAjB,WAAA,CAAAuB,GAAA,EAACxB,YAAA,CAAAmB,QAAQ,CAACkB,OAAO;MAChBE,OAAO,EAAC,YAAY;MACpBC,KAAK,EAAGhC,OAAS;MACjBS,SAAS,EAAG,IAAA6B,8CAAiC,EAAE,SAAU;IAAG,CAC5D,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -84,7 +84,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
84
84
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
85
85
|
onClick: () => replaceBlocks(clientId, (0, _blocks.createBlock)('core/list', {
|
|
86
86
|
ordered: true,
|
|
87
|
-
values: (0, _element.renderToString)(
|
|
87
|
+
values: (0, _element.renderToString)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_list.default, {
|
|
88
88
|
nestedHeadingList: headingTree
|
|
89
89
|
}))
|
|
90
90
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","removeNotice","useDispatch","noticeStore","noticeId","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\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 { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\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 {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticeStore );\n\tlet noticeId;\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\t// Remove previous warning if any, to show one at a time per block.\n\t\tremoveNotice( noticeId );\n\t\tnoticeId = `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`;\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: noticeId,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\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 { replaceBlocks } = useDispatch( blockEditorStore );\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\t__nextHasNoMarginBottom\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>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\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"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAA6C,IAAAa,WAAA,GAAAb,OAAA;AA9B7C;AACA;AACA;;AAuBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASc,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC,QAAQ,GAAG,EAAE;IAAEC;EAAuB,CAAC;EACrDC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,IAAAC,yBAAkB,EAAEF,QAAS,CAAC;EAE9B,MAAMG,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAC/BV,mBAAmB,EACnB,mBACD,CAAC;;EAED;EACA,MAAM;IAAEW,mBAAmB;IAAEC;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAY,CAAC;EACxE,IAAIC,QAAQ;EACZ,MAAMC,8BAA8B,GAAKC,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AA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA9C,WAAA,CAAA0D,IAAA,EAAA1D,WAAA,CAAA2D,QAAA;IAAAvB,QAAA,gBACC,IAAApC,WAAA,CAAAkC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA;QAAAE,QAAA,eACC,IAAApC,WAAA,CAAAkC,GAAA,EAACtC,KAAA,CAAAgD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCiC,qBAAqB;UACrBzB,OAAO,EAAGtB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJgB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","removeNotice","useDispatch","noticeStore","noticeId","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\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 { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\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 {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticeStore );\n\tlet noticeId;\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\t// Remove previous warning if any, to show one at a time per block.\n\t\tremoveNotice( noticeId );\n\t\tnoticeId = `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`;\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: noticeId,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\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 { replaceBlocks } = useDispatch( blockEditorStore );\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\t__nextHasNoMarginBottom\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>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\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"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,M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,EACF,mFACA;MACH,CACD;IAAC,CACQ;EAAC,CACM,CACnB;;EAED;EACA;EACA;EACA,IAAKjB,QAAQ,CAACsD,MAAM,KAAK,CAAC,EAAG;IAC5B,oBACC,IAAAzD,WAAA,CAAA0D,IAAA,EAAA1D,WAAA,CAAA2D,QAAA;MAAAvB,QAAA,gBACC,IAAApC,WAAA,CAAAkC,GAAA;QAAA,GAAU1B,UAAU;QAAA4B,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA,EAAC7C,WAAA,CAAAuE,WAAW;UACXC,IAAI,eAAG,IAAA7D,WAAA,CAAAkC,GAAA,EAAChD,YAAA,CAAA4E,SAAS;YAACD,IAAI,EAAGA;UAAM,CAAE,CAAG;UACpCT,KAAK,EAAG,IAAAhC,QAAE,EAAE,mBAAoB,CAAG;UACnC2C,YAAY,EAAG,IAAA3C,QAAE,EAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ0B,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA9C,WAAA,CAAA0D,IAAA,EAAA1D,WAAA,CAAA2D,QAAA;IAAAvB,QAAA,gBACC,IAAApC,WAAA,CAAAkC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA;QAAAE,QAAA,eACC,IAAApC,WAAA,CAAAkC,GAAA,EAACtC,KAAA,CAAAgD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCiC,qBAAqB;UACrBzB,OAAO,EAAGtB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJgB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getClientIdsWithDescendants","getBlocksByName","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","canBeLinked","anchor","push","content","stripHTML","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetClientIdsWithDescendants,\n\t\tgetBlocksByName,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\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\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings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KAAK,EAAEP,iBAAiB,CAACO,KAAK;UAC9BC,IAAI,EAAEP,WAAW,
|
|
1
|
+
{"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getClientIdsWithDescendants","getBlocksByName","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","canBeLinked","anchor","push","content","stripHTML","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetClientIdsWithDescendants,\n\t\tgetBlocksByName,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\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\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,2BAA2B;IAC3BC;EACD,CAAC,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,SAAS,IAAAP,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACU,YAAY,CAAC,CAAC,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMS,WAAW,GAAGJ,eAAe,CAAE,eAAgB,CAAC,CAACK,MAAM,KAAK,CAAC;EACnE,MAAM;IAAEC;EAAuB,CAAC,IAAAV,mBAAA,GAAGC,kBAAkB,CAAEH,QAAS,CAAC,cAAAE,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;;EAEvE;EACA,MAAMW,iBAAiB,GAAGR,2BAA2B,CAAC,CAAC;;EAEvD;EACA,IAAIS,OAAO,GAAG,CAAC;EAEf,IAAKJ,WAAW,IAAIE,sBAAsB,EAAG;IAC5C;IACA;IACA,MAAMG,QAAQ,GAAGF,iBAAiB,CAACG,OA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MAAM,EAAE6C,QAAQ,CAACP,QAAQ,EAAErC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAE4C,QAAQ,EAAE5C,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_coreData","_jsxRuntime","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","availableUnits","useSettings","units","useCustomUnits","taxonomies","useSelect","select","coreStore","getTaxonomies","per_page","getTaxonomyOptions","selectOption","label","__","value","disabled","taxonomyOptions","filter","tax","show_cloud","map","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","parseQuantityAndUnitFromRawValue","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","serverSideAttributes","style","border","undefined","inspectorControls","jsx","InspectorControls","children","PanelBody","title","jsxs","__experimentalVStack","spacing","className","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","options","onChange","selectedTaxonomy","Flex","gap","FlexItem","isBlock","__experimentalUnitControl","min","max","size","RangeControl","required","ToggleControl","checked","Fragment","useBlockProps","Disabled","default","skipBlockSupportAttributes","block","_default","exports"],"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"sourcesContent":["/**\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\t__experimentalVStack as VStack,\n\tDisabled,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\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 } ) {\n\tconst {\n\t\ttaxonomy,\n\t\tshowTagCounts,\n\t\tnumberOfTags,\n\t\tsmallestFontSize,\n\t\tlargestFontSize,\n\t} = attributes;\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\n\t// The `pt` unit is used as the default value and is therefore\n\t// always considered an available unit.\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits\n\t\t\t? [ ...availableUnits, 'pt' ]\n\t\t\t: [ '%', 'px', 'em', 'rem', 'pt' ],\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\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 = ( taxonomies ?? [] )\n\t\t\t.filter( ( tax ) => !! tax.show_cloud )\n\t\t\t.map( ( 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\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\t// Remove border styles from the server-side attributes to prevent duplicate border.\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tborder: undefined,\n\t\t},\n\t};\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<VStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tclassName=\"wp-block-tag-cloud__inspector-settings\"\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\tsetAttributes( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Smallest size' ) }\n\t\t\t\t\t\t\t\tvalue={ smallestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'smallestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\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\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Largest size' ) }\n\t\t\t\t\t\t\t\tvalue={ largestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'largestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\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\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\t\tvalue={ numberOfTags }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { numberOfTags: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ MIN_TAGS }\n\t\t\t\t\t\tmax={ MAX_TAGS }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show tag counts' ) }\n\t\t\t\t\t\tchecked={ showTagCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTagCounts: ! showTagCounts } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\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<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tblock=\"core/tag-cloud\"\n\t\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default TagCloudEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAaA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAxB1D;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA,GACA,MAAMQ,QAAQ,GAAG,CAAC;;AAElB;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,GAAG;AAEpB,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,aAAa,GAAG,GAAG;AAEzB,SAASC,YAAYA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACtD,MAAM;IACLC,QAAQ;IACRC,aAAa;IACbC,YAAY;IACZC,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B;UACvBC,qBAAqB;UACrB5C,KAAK,EAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAG;UAChCC,KAAK,EAAGjB,YAAc;UACtB6D,QAAQ,EAAK5C,KAAK,IACjBpB,aAAa,CAAE;YAAEG,YAAY,EAAEiB;UAAM,CAAE,CACvC;UACDmD,GAAG,EAAG7E,QAAU;UAChB8E,GAAG,EAAG7E,QAAU;UAChBgF,QAAQ;QAAA,CACR,CAAC,eACF,IAAAlF,WAAA,CAAA0D,GAAA,EAAClE,WAAA,CAAA2F,aAAa;UACbf,uBAAuB;UACvB3C,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAG;UACjC0D,OAAO,EAAG3E,aAAe;UACzB8D,QAAQ,EAAGA,CAAA,KACVhE,aAAa,CAAE;YAAEE,aAAa,EAAE,CAAEA;UAAc,CAAE;QAClD,CACD,CAAC;MAAA,CACK;IAAC,CACC;EAAC,CACM,CACnB;EAED,oBACC,IAAAT,WAAA,CAAA+D,IAAA,EAAA/D,WAAA,CAAAqF,QAAA;IAAAzB,QAAA,GACGH,iBAAiB,eACnB,IAAAzD,WAAA,CAAA0D,GAAA;MAAA,GAAU,IAAA4B,0BAAa,EAAC,CAAC;MAAA1B,QAAA,eACxB,IAAA5D,WAAA,CAAA0D,GAAA,EAAClE,WAAA,CAAA+F,QAAQ;QAAA3B,QAAA,eACR,IAAA5D,WAAA,CAAA0D,GAAA,EAAC7D,iBAAA,CAAA2F,OAAgB;UAChBC,0BAA0B;UAC1BC,KAAK,EAAC,gBAAgB;UACtBpF,UAAU,EAAG+C;QAAsB,CACnC;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcnF,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_coreData","_jsxRuntime","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","availableUnits","useSettings","units","useCustomUnits","taxonomies","useSelect","select","coreStore","getTaxonomies","per_page","getTaxonomyOptions","selectOption","label","__","value","disabled","taxonomyOptions","filter","tax","show_cloud","map","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","parseQuantityAndUnitFromRawValue","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","serverSideAttributes","style","border","undefined","inspectorControls","jsx","InspectorControls","children","PanelBody","title","jsxs","__experimentalVStack","spacing","className","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","options","onChange","selectedTaxonomy","Flex","gap","FlexItem","isBlock","__experimentalUnitControl","min","max","size","RangeControl","required","ToggleControl","checked","Fragment","useBlockProps","Disabled","default","skipBlockSupportAttributes","block","_default","exports"],"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"sourcesContent":["/**\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\t__experimentalVStack as VStack,\n\tDisabled,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\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 } ) {\n\tconst {\n\t\ttaxonomy,\n\t\tshowTagCounts,\n\t\tnumberOfTags,\n\t\tsmallestFontSize,\n\t\tlargestFontSize,\n\t} = attributes;\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\n\t// The `pt` unit is used as the default value and is therefore\n\t// always considered an available unit.\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits\n\t\t\t? [ ...availableUnits, 'pt' ]\n\t\t\t: [ '%', 'px', 'em', 'rem', 'pt' ],\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\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 = ( taxonomies ?? [] )\n\t\t\t.filter( ( tax ) => !! tax.show_cloud )\n\t\t\t.map( ( 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\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\t// Remove border styles from the server-side attributes to prevent duplicate border.\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tborder: undefined,\n\t\t},\n\t};\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<VStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tclassName=\"wp-block-tag-cloud__inspector-settings\"\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\tsetAttributes( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Smallest size' ) }\n\t\t\t\t\t\t\t\tvalue={ smallestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'smallestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\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\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Largest size' ) }\n\t\t\t\t\t\t\t\tvalue={ largestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'largestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\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\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\t\tvalue={ numberOfTags }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { numberOfTags: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ MIN_TAGS }\n\t\t\t\t\t\tmax={ MAX_TAGS }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show tag counts' ) }\n\t\t\t\t\t\tchecked={ showTagCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTagCounts: ! showTagCounts } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\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<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tblock=\"core/tag-cloud\"\n\t\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default TagCloudEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAaA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAxB1D;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA,GACA,MAAMQ,QAAQ,GAAG,CAAC;;AAElB;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,GAAG;AAEpB,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,aAAa,GAAG,GAAG;AAEzB,SAASC,YAAYA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACtD,MAAM;IACLC,QAAQ;IACRC,aAAa;IACbC,YAAY;IACZC,gBAAgB;IAChBC;EACD,CAAC,GAAGN,UAAU;EAEd,MAAM,CAAEO,cAAc,CAAE,GAAG,IAAAC,wBAAW,EAAE,eAAgB,CAAC;;EAEzD;EACA;EACA,MAAMC,KAAK,GAAG,IAAAC,wCAAc,EAAE;IAC7BH,cAAc,EAAEA,cAAc,GAC3B,CAAE,GAAGA,cAAc,EAAE,IAAI,CAAE,GAC3B,CAAE,GAAG,EAAE,IAAI,EAAE,IA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F,IAAAlF,WAAA,CAAA0D,GAAA,EAAClE,WAAA,CAAA2F,aAAa;UACbf,uBAAuB;UACvB3C,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAG;UACjC0D,OAAO,EAAG3E,aAAe;UACzB8D,QAAQ,EAAGA,CAAA,KACVhE,aAAa,CAAE;YAAEE,aAAa,EAAE,CAAEA;UAAc,CAAE;QAClD,CACD,CAAC;MAAA,CACK;IAAC,CACC;EAAC,CACM,CACnB;EAED,oBACC,IAAAT,WAAA,CAAA+D,IAAA,EAAA/D,WAAA,CAAAqF,QAAA;IAAAzB,QAAA,GACGH,iBAAiB,eACnB,IAAAzD,WAAA,CAAA0D,GAAA;MAAA,GAAU,IAAA4B,0BAAa,EAAC,CAAC;MAAA1B,QAAA,eACxB,IAAA5D,WAAA,CAAA0D,GAAA,EAAClE,WAAA,CAAA+F,QAAQ;QAAA3B,QAAA,eACR,IAAA5D,WAAA,CAAA0D,GAAA,EAAC7D,iBAAA,CAAA2F,OAAgB;UAChBC,0BAA0B;UAC1BC,KAAK,EAAC,gBAAgB;UACtBpF,UAAU,EAAG+C;QAAsB,CACnC;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcnF,YAAY","ignoreList":[]}
|
|
@@ -74,7 +74,7 @@ function TemplatePartAdvancedControls({
|
|
|
74
74
|
__next40pxDefaultSize: true,
|
|
75
75
|
label: (0, _i18n.__)('HTML element'),
|
|
76
76
|
options: [{
|
|
77
|
-
label: (0, _i18n.sprintf)(
|
|
77
|
+
label: (0, _i18n.sprintf)(/* translators: %s: HTML tag based on area. */
|
|
78
78
|
(0, _i18n.__)('Default based on area (%s)'), `<${defaultWrapper}>`),
|
|
79
79
|
value: ''
|
|
80
80
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_jsxRuntime","htmlElementMessages","header","__","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","definedAreas","useSelect","select","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\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 definedAreas = 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-next-line @wordpress/data-no-store-string-literals */\n\t\treturn select(\n\t\t\t'core/editor'\n\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t}, [] );\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\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\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\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\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AAA+D,IAAAK,WAAA,GAAAL,OAAA;AAX/D;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,mBAAmB,GAAG;EAC3BC,MAAM,EAAE,IAAAC,QAAE,EACT,qHACD,CAAC;EACDC,IAAI,EAAE,IAAAD,QAAE,EACP,kFACD,CAAC;EACDE,OAAO,EAAE,IAAAF,QAAE,EACV,kIACD,CAAC;EACDG,OAAO,EAAE,IAAAH,QAAE,EACV,gGACD,CAAC;EACDI,KAAK,EAAE,IAAAJ,QAAE,EACR,uIACD,CAAC;EACDK,MAAM,EAAE,IAAAL,QAAE,EACT,8HACD;AACD,CAAC;AAEM,SAASM,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,EAAG;EACH,MAAM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,EAAC,KAAK;QACnBC,OAAO,EAAGlB,WAAa;QACvBI,KAAK,EAAGb,IAAM;QACdqB,QAAQ,EAAGpB;MAAS,CACpB,CAAC;IAAA,CACD,CACF,eACD,IAAAjB,WAAA,CAAAiC,GAAA,EAACrC,WAAA,CAAA6C,aAAa;MACbL,uBAAuB;MACvBD,qBAAqB;MACrBR,KAAK,EAAG,IAAAxB,QAAE,EAAE,cAAe,CAAG;MAC9BwC,OAAO,EAAG,CACT;QACChB,KAAK,EAAE,IAAAiB,aAAO,
|
|
1
|
+
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_jsxRuntime","htmlElementMessages","header","__","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","definedAreas","useSelect","select","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\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 definedAreas = 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-next-line @wordpress/data-no-store-string-literals */\n\t\treturn select(\n\t\t\t'core/editor'\n\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t}, [] );\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\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\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\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\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AAA+D,IAAAK,WAAA,GAAAL,OAAA;AAX/D;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,mBAAmB,GAAG;EAC3BC,MAAM,EAAE,IAAAC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AO;QAAEE,KAAK,EAAE;MAAM,CAAC,CAC9B;MACHA,KAAK,EAAGnB,OAAO,IAAI,EAAI;MACvB2B,QAAQ,EAAKR,KAAK,IAAMlB,aAAa,CAAE;QAAED,OAAO,EAAEmB;MAAM,CAAE,CAAG;MAC7DgB,IAAI,EAAG5C,mBAAmB,CAAES,OAAO;IAAI,CACvC,CAAC,EACA,CAAEK,cAAc,iBACjB,IAAAf,WAAA,CAAAiC,GAAA,EAAClC,eAAA,CAAA+C,0BAA0B;MAC1B9B,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -107,7 +108,7 @@ function TemplatePartImportControls({
|
|
|
107
108
|
await createFromBlocks(blocks, /* translators: %s: name of the widget area */
|
|
108
109
|
(0, _i18n.sprintf)((0, _i18n.__)('Widget area: %s'), sidebar.label));
|
|
109
110
|
if (skippedWidgets.size) {
|
|
110
|
-
createErrorNotice((0, _i18n.sprintf)(
|
|
111
|
+
createErrorNotice((0, _i18n.sprintf)(/* translators: %s: the list of widgets */
|
|
111
112
|
(0, _i18n.__)('Unable to import the following widgets: %s.'), Array.from(skippedWidgets).join(', ')), {
|
|
112
113
|
type: 'snackbar'
|
|
113
114
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy || ! selectedSidebar }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDef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IAAAjE,WAAA,CAAAkE,IAAA,EAACvE,WAAA,CAAAwE,oBAAM;MAACC,EAAE,EAAC,MAAM;MAACC,QAAQ,EAAG3B,iBAAmB;MAAAuB,QAAA,gBAC/C,IAAAjE,WAAA,CAAAuC,GAAA,EAAC5C,WAAA,CAAA2E,SAAS;QAAAL,QAAA,eACT,IAAAjE,WAAA,CAAAuC,GAAA,EAAC5C,WAAA,CAAA4E,aAAa;UACbnC,KAAK,EAAG,IAAAE,QAAE,EAAE,oBAAqB,CAAG;UACpCH,KAAK,EAAG5B,eAAiB;UACzBmB,OAAO,EAAGA,OAAS;UACnB8C,QAAQ,EAAKrC,KAAK,IAAM3B,kBAAkB,CAAE2B,KAAM,CAAG;UACrDsC,QAAQ,EAAG,CAAE/C,OAAO,CAACO,MAAQ;UAC7ByC,qBAAqB;UACrBC,uBAAuB;QAAA,CACvB;MAAC,CACQ,CAAC,eACZ,IAAA3E,WAAA,CAAAuC,GAAA,EAAC5C,WAAA,CAAAiF,QAAQ;QACRC,KAAK,EAAG;UACPpC,YAAY,EAAE,KAAK;UACnBqC,SAAS,EAAE;QACZ,CAAG;QAAAb,QAAA,eAEH,IAAAjE,WAAA,CAAAuC,GAAA,EAAC5C,WAAA,CAAAoF,MAAM;UACNL,qBAAqB;UACrBM,OAAO,EAAC,SAAS;UACjBhB,IAAI,EAAC,QAAQ;UACbtD,MAAM,EAAGA,MAAQ;UACjB,iBAAgBA,MAAM,IAAI,CAAEH,eAAiB;UAAA0D,QAAA,EAE3C,IAAAgB,QAAE,EAAE,QAAQ,EAAE,cAAe;QAAC,CACzB;MAAC,CACA,CAAC;IAAA,CACJ;EAAC,CACF,CAAC;AAEX","ignoreList":[]}
|
|
@@ -147,7 +147,7 @@ function TemplatePartEdit({
|
|
|
147
147
|
blocks: pattern.blocks,
|
|
148
148
|
content: (0, _blocks.serialize)(pattern.blocks)
|
|
149
149
|
});
|
|
150
|
-
createSuccessNotice((0, _i18n.sprintf)(
|
|
150
|
+
createSuccessNotice((0, _i18n.sprintf)(/* translators: %s: template part title. */
|
|
151
151
|
(0, _i18n.__)('Template Part "%s" updated.'), title || slug), {
|
|
152
152
|
type: 'snackbar'
|
|
153
153
|
});
|
|
@@ -159,7 +159,7 @@ function TemplatePartEdit({
|
|
|
159
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
|
|
160
160
|
...blockProps,
|
|
161
161
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
|
|
162
|
-
children: (0, _i18n.sprintf)(
|
|
162
|
+
children: (0, _i18n.sprintf)(/* translators: %s: Template part slug */
|
|
163
163
|
(0, _i18n.__)('Template part has been deleted or is unavailable: %s'), slug)
|
|
164
164
|
})
|
|
165
165
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_compose","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","shownTemplates","useAsyncList","PanelBody","title","__experimentalBlockPatternsList","label","shownPatterns","onClickPattern","showTitle","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useAsyncList } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\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\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\tconst shownTemplates = useAsyncList( blockPatterns );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tshownPatterns={ shownTemplates }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitle={ false }\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = 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\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\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\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\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\t! hasInnerBlocks &&\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<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\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\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\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</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\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</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"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\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\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</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,YAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,eAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,qBAA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,UAAU;QAAA5D,QAAA,eACvB,IAAAf,WAAA,CAAAY,GAAA,EAACzB,WAAA,CAAAoH,OAAO,IAAE;MAAC,CACH,CACT;IAAA,CACiB,CAAC,EAClBlG,2BAA2B,iBAC5B,IAAAL,WAAA,CAAAY,GAAA,EAACzB,WAAA,CAAAqH,KAAK;MACLC,gBAAgB,EAAC,6CAA6C;MAC9DhF,KAAK,EAAG,IAAA2D,aAAO;MACd;MACA,IAAApE,QAAE,EAAE,aAAc,CAAC,EACnByD,UAAU,CAAC9C,KAAK,CAAC+E,WAAW,CAAC,CAC9B,CAAG;MACHC,cAAc,EAAGA,CAAA,KAChBrG,8BAA8B,CAAE,KAAM,CACtC;MACDsG,YAAY;MAAA7F,QAAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAwG,OAA0B;QAC1B/F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb8B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTvG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_compose","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","shownTemplates","useAsyncList","PanelBody","title","__experimentalBlockPatternsList","label","shownPatterns","onClickPattern","showTitle","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useAsyncList } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\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\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\tconst shownTemplates = useAsyncList( blockPatterns );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tshownPatterns={ shownTemplates }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitle={ false }\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = 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\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\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\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\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\t! hasInnerBlocks &&\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<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\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\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\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</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\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</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"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\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\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</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN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,OAAuB;QACvBrD,OAAO,EAAGgC,OAAS;QACnBH,UAAU,EAAGA,UAAY;QACzBmB,MAAM,EAAG1F,cAAgB;QACzBiD,cAAc,EAAGA,cAAgB;QACjCN,MAAM,EAAGA;MAAQ,CACjB,CACD,EACC,CAAE8B,aAAa,IAAI,CAAEzB,UAAU,iBAChC,IAAApD,WAAA,CAAAY,GAAA,EAACkE,OAAO;QAAA,GAAMH,UAAU;QAAA5D,QAAA,eACvB,IAAAf,WAAA,CAAAY,GAAA,EAACzB,WAAA,CAAAoH,OAAO,IAAE;MAAC,CACH,CACT;IAAA,CACiB,CAAC,EAClBlG,2BAA2B,iBAC5B,IAAAL,WAAA,CAAAY,GAAA,EAACzB,WAAA,CAAAqH,KAAK;MACLC,gBAAgB,EAAC,6CAA6C;MAC9DhF,KAAK,EAAG,IAAA2D,aAAO;MACd;MACA,IAAApE,QAAE,EAAE,aAAc,CAAC,EACnByD,UAAU,CAAC9C,KAAK,CAAC+E,WAAW,CAAC,CAC9B,CAAG;MACHC,cAAc,EAAGA,CAAA,KAChBrG,8BAA8B,CAAE,KAAM,CACtC;MACDsG,YAAY;MAAA7F,QAAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAwG,OAA0B;QAC1B/F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb8B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTvG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -54,7 +54,7 @@ function TemplatePartSelectionModal({
|
|
|
54
54
|
theme: templatePart.theme,
|
|
55
55
|
area: undefined
|
|
56
56
|
});
|
|
57
|
-
createSuccessNotice((0, _i18n.sprintf)(
|
|
57
|
+
createSuccessNotice((0, _i18n.sprintf)(/* translators: %s: template part title. */
|
|
58
58
|
(0, _i18n.__)('Template Part "%s" inserted.'), templatePart.title?.rendered || templatePart.slug), {
|
|
59
59
|
type: 'snackbar'
|
|
60
60
|
});
|
|
@@ -70,7 +70,7 @@ function TemplatePartSelectionModal({
|
|
|
70
70
|
__nextHasNoMarginBottom: true,
|
|
71
71
|
onChange: setSearchValue,
|
|
72
72
|
value: searchValue,
|
|
73
|
-
label: (0, _i18n.__)('Search
|
|
73
|
+
label: (0, _i18n.__)('Search'),
|
|
74
74
|
placeholder: (0, _i18n.__)('Search')
|
|
75
75
|
})
|
|
76
76
|
}), hasTemplateParts && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_notices","_data","_compose","_blockEditor","_components","_hooks","_mapTemplatePartToBlockPattern","_searchPatterns","_jsxRuntime","TemplatePartSelectionModal","setAttributes","onClose","templatePartId","area","clientId","searchValue","setSearchValue","useState","templateParts","useAlternativeTemplateParts","filteredTemplateParts","useMemo","partsAsPatterns","map","templatePart","mapTemplatePartToBlockPattern","searchPatterns","shownTemplateParts","useAsyncList","blockPatterns","useAlternativeBlockPatterns","filteredBlockPatterns","createSuccessNotice","useDispatch","noticesStore","onTemplatePartSelect","slug","theme","undefined","sprintf","__","title","rendered","type","hasTemplateParts","length","hasBlockPatterns","jsxs","className","children","jsx","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","__experimentalBlockPatternsList","shownPatterns","onClickPattern","pattern","__experimentalHStack","alignment"],"sources":["@wordpress/block-library/src/template-part/edit/selection-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport {\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n} from './utils/hooks';\nimport { mapTemplatePartToBlockPattern } from './utils/map-template-part-to-block-pattern';\nimport { searchPatterns } from '../../utils/search-patterns';\n\nexport default function TemplatePartSelectionModal( {\n\tsetAttributes,\n\tonClose,\n\ttemplatePartId = null,\n\tarea,\n\tclientId,\n} ) {\n\tconst [ searchValue, setSearchValue ] = useState( '' );\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\n\t// We can map template parts to block patters to reuse the BlockPatternsList UI\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tconst partsAsPatterns = templateParts.map( ( templatePart ) =>\n\t\t\tmapTemplatePartToBlockPattern( templatePart )\n\t\t);\n\n\t\treturn searchPatterns( partsAsPatterns, searchValue );\n\t}, [ templateParts, searchValue ] );\n\tconst shownTemplateParts = useAsyncList( filteredTemplateParts );\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\treturn searchPatterns( blockPatterns, searchValue );\n\t}, [ blockPatterns, searchValue ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onTemplatePartSelect = ( templatePart ) => {\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" inserted.' ),\n\t\t\t\ttemplatePart.title?.rendered || templatePart.slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t\tonClose();\n\t};\n\n\tconst hasTemplateParts = !! filteredTemplateParts.length;\n\tconst hasBlockPatterns = !! filteredBlockPatterns.length;\n\n\treturn (\n\t\t<div className=\"block-library-template-part__selection-content\">\n\t\t\t<div className=\"block-library-template-part__selection-search\">\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonChange={ setSearchValue }\n\t\t\t\t\tvalue={ searchValue }\n\t\t\t\t\tlabel={ __( 'Search
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_notices","_data","_compose","_blockEditor","_components","_hooks","_mapTemplatePartToBlockPattern","_searchPatterns","_jsxRuntime","TemplatePartSelectionModal","setAttributes","onClose","templatePartId","area","clientId","searchValue","setSearchValue","useState","templateParts","useAlternativeTemplateParts","filteredTemplateParts","useMemo","partsAsPatterns","map","templatePart","mapTemplatePartToBlockPattern","searchPatterns","shownTemplateParts","useAsyncList","blockPatterns","useAlternativeBlockPatterns","filteredBlockPatterns","createSuccessNotice","useDispatch","noticesStore","onTemplatePartSelect","slug","theme","undefined","sprintf","__","title","rendered","type","hasTemplateParts","length","hasBlockPatterns","jsxs","className","children","jsx","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","__experimentalBlockPatternsList","shownPatterns","onClickPattern","pattern","__experimentalHStack","alignment"],"sources":["@wordpress/block-library/src/template-part/edit/selection-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport {\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n} from './utils/hooks';\nimport { mapTemplatePartToBlockPattern } from './utils/map-template-part-to-block-pattern';\nimport { searchPatterns } from '../../utils/search-patterns';\n\nexport default function TemplatePartSelectionModal( {\n\tsetAttributes,\n\tonClose,\n\ttemplatePartId = null,\n\tarea,\n\tclientId,\n} ) {\n\tconst [ searchValue, setSearchValue ] = useState( '' );\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\n\t// We can map template parts to block patters to reuse the BlockPatternsList UI\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tconst partsAsPatterns = templateParts.map( ( templatePart ) =>\n\t\t\tmapTemplatePartToBlockPattern( templatePart )\n\t\t);\n\n\t\treturn searchPatterns( partsAsPatterns, searchValue );\n\t}, [ templateParts, searchValue ] );\n\tconst shownTemplateParts = useAsyncList( filteredTemplateParts );\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\treturn searchPatterns( blockPatterns, searchValue );\n\t}, [ blockPatterns, searchValue ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onTemplatePartSelect = ( templatePart ) => {\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" inserted.' ),\n\t\t\t\ttemplatePart.title?.rendered || templatePart.slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t\tonClose();\n\t};\n\n\tconst hasTemplateParts = !! filteredTemplateParts.length;\n\tconst hasBlockPatterns = !! filteredBlockPatterns.length;\n\n\treturn (\n\t\t<div className=\"block-library-template-part__selection-content\">\n\t\t\t<div className=\"block-library-template-part__selection-search\">\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonChange={ setSearchValue }\n\t\t\t\t\tvalue={ searchValue }\n\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ hasTemplateParts && (\n\t\t\t\t<div>\n\t\t\t\t\t<h2>{ __( 'Existing template parts' ) }</h2>\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tblockPatterns={ filteredTemplateParts }\n\t\t\t\t\t\tshownPatterns={ shownTemplateParts }\n\t\t\t\t\t\tonClickPattern={ ( pattern ) => {\n\t\t\t\t\t\t\tonTemplatePartSelect( pattern.templatePart );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ! hasTemplateParts && ! hasBlockPatterns && (\n\t\t\t\t<HStack alignment=\"center\">\n\t\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAQA,IAAAO,MAAA,GAAAP,OAAA;AAIA,IAAAQ,8BAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AAA6D,IAAAU,WAAA,GAAAV,OAAA;AAtB7D;AACA;AACA;;AAYA;AACA;AACA;;AAQe,SAASW,0BAA0BA,CAAE;EACnDC,aAAa;EACbC,OAAO;EACPC,cAAc,GAAG,IAAI;EACrBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EACtD,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kCAA2B,EACpDN,IAAI,EACJD,cACD,CAAC;;EAED;EACA,MAAMQ,qBAAqB,GAAG,IAAAC,gBA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gBAC9D,IAAAzC,WAAA,CAAA0C,GAAA;MAAKF,SAAS,EAAC,+CAA+C;MAAAC,QAAA,eAC7D,IAAAzC,WAAA,CAAA0C,GAAA,EAAC9C,WAAA,CAAA+C,aAAa;QACbC,uBAAuB;QACvBC,QAAQ,EAAGrC,cAAgB;QAC3BsC,KAAK,EAAGvC,WAAa;QACrBwC,KAAK,EAAG,IAAAf,QAAE,EAAE,QAAS,CAAG;QACxBgB,WAAW,EAAG,IAAAhB,QAAE,EAAE,QAAS;MAAG,CAC9B;IAAC,CACE,CAAC,EACJI,gBAAgB,iBACjB,IAAApC,WAAA,CAAAuC,IAAA;MAAAE,QAAA,gBACC,IAAAzC,WAAA,CAAA0C,GAAA;QAAAD,QAAA,EAAM,IAAAT,QAAE,EAAE,yBAA0B;MAAC,CAAM,CAAC,eAC5C,IAAAhC,WAAA,CAAA0C,GAAA,EAAC/C,YAAA,CAAAsD,+BAAiB;QACjB5B,aAAa,EAAGT,qBAAuB;QACvCsC,aAAa,EAAG/B,kBAAoB;QACpCgC,cAAc,EAAKC,OAAO,IAAM;UAC/BzB,oBAAoB,CAAEyB,OAAO,CAACpC,YAAa,CAAC;QAC7C;MAAG,CACH,CAAC;IAAA,CACE,CACL,EAEC,CAAEoB,gBAAgB,IAAI,CAAEE,gBAAgB,iBACzC,IAAAtC,WAAA,CAAA0C,GAAA,EAAC9C,WAAA,CAAAyD,oBAAM;MAACC,SAAS,EAAC,QAAQ;MAAAb,QAAA,eACzB,IAAAzC,WAAA,CAAA0C,GAAA;QAAAD,QAAA,EAAK,IAAAT,QAAE,EAAE,mBAAoB;MAAC,CAAK;IAAC,CAC7B,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_data","_coreData","_blockEditor","_element","_blocks","_i18n","_createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","useSelect","select","getEntityRecords","_isResolving","coreStore","query","per_page","filteredTemplateParts","useMemo","filter","templatePart","createTemplatePartId","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","useDispatch","blocks","title","__","cleanSlug","kebabCase","replace","record","content","serialize","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","__experimentalGetDefaultTemplatePartAreas","selectedArea","find","definedArea","defaultArea","icon","label","tagName","area_tag"],"sources":["@wordpress/block-library/src/template-part/edit/utils/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * Retrieves the available template parts for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} excludedId Template part ID to exclude.\n *\n * @return {{ templateParts: Array, isResolving: boolean }} array of template parts.\n */\nexport function useAlternativeTemplateParts( area, excludedId ) {\n\tconst { templateParts, isResolving } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst query = { per_page: -1 };\n\t\treturn {\n\t\t\ttemplateParts: getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery\n\t\t\t),\n\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\ttemplateParts.filter(\n\t\t\t\t( templatePart ) =>\n\t\t\t\t\tcreateTemplatePartId(\n\t\t\t\t\t\ttemplatePart.theme,\n\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t) !== excludedId &&\n\t\t\t\t\t( ! area ||\n\t\t\t\t\t\t'uncategorized' === area ||\n\t\t\t\t\t\ttemplatePart.area === area )\n\t\t\t) || []\n\t\t);\n\t}, [ templateParts, area, excludedId ] );\n\n\treturn {\n\t\ttemplateParts: filteredTemplateParts,\n\t\tisResolving,\n\t};\n}\n\n/**\n * Retrieves the available block patterns for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).\n *\n * @return {Array} array of block patterns.\n */\nexport function useAlternativeBlockPatterns( area, clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNameWithArea = area\n\t\t\t\t? `core/template-part/${ area }`\n\t\t\t\t: 'core/template-part';\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( blockNameWithArea, rootClientId );\n\t\t},\n\t\t[ area, clientId ]\n\t);\n}\n\nexport function useCreateTemplatePartFromBlocks( area, setAttributes ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\treturn async ( blocks = [], title = __( 'Untitled Template Part' ) ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\t// If we have `area` set from block attributes, means an exposed\n\t\t// block variation was inserted. So add this prop to the template\n\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t// block attributes.\n\t\tconst record = {\n\t\t\ttitle,\n\t\t\tslug: cleanSlug,\n\t\t\tcontent: serialize( blocks ),\n\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t// if provided value is not allowed.\n\t\t\tarea,\n\t\t};\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\trecord\n\t\t);\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t};\n}\n\n/**\n * Retrieves the template part area object.\n *\n * @param {string} area Template part area identifier.\n *\n * @return {{icon: Object, label: string, tagName: string}} Template Part area.\n */\nexport function useTemplatePartArea( area ) {\n\treturn useSelect(\n\t\t( select ) => {\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 @wordpress/data-no-store-string-literals */\n\t\t\tconst definedAreas =\n\t\t\t\tselect(\n\t\t\t\t\t'core/editor'\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t\t\t/* eslint-enable @wordpress/data-no-store-string-literals */\n\n\t\t\tconst selectedArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === area\n\t\t\t);\n\t\t\tconst defaultArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === 'uncategorized'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ticon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tlabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t\ttagName: selectedArea?.area_tag ?? 'div',\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,qB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IAAM;IACb,MAAMe,iBAAiB,GAAGpB,IAAI,
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_data","_coreData","_blockEditor","_element","_blocks","_i18n","_createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","useSelect","select","getEntityRecords","_isResolving","coreStore","query","per_page","filteredTemplateParts","useMemo","filter","templatePart","createTemplatePartId","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","useDispatch","blocks","title","__","cleanSlug","kebabCase","replace","record","content","serialize","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","__experimentalGetDefaultTemplatePartAreas","selectedArea","find","definedArea","defaultArea","icon","label","tagName","area_tag"],"sources":["@wordpress/block-library/src/template-part/edit/utils/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * Retrieves the available template parts for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} excludedId Template part ID to exclude.\n *\n * @return {{ templateParts: Array, isResolving: boolean }} array of template parts.\n */\nexport function useAlternativeTemplateParts( area, excludedId ) {\n\tconst { templateParts, isResolving } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst query = { per_page: -1 };\n\t\treturn {\n\t\t\ttemplateParts: getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery\n\t\t\t),\n\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\ttemplateParts.filter(\n\t\t\t\t( templatePart ) =>\n\t\t\t\t\tcreateTemplatePartId(\n\t\t\t\t\t\ttemplatePart.theme,\n\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t) !== excludedId &&\n\t\t\t\t\t( ! area ||\n\t\t\t\t\t\t'uncategorized' === area ||\n\t\t\t\t\t\ttemplatePart.area === area )\n\t\t\t) || []\n\t\t);\n\t}, [ templateParts, area, excludedId ] );\n\n\treturn {\n\t\ttemplateParts: filteredTemplateParts,\n\t\tisResolving,\n\t};\n}\n\n/**\n * Retrieves the available block patterns for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).\n *\n * @return {Array} array of block patterns.\n */\nexport function useAlternativeBlockPatterns( area, clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNameWithArea = area\n\t\t\t\t? `core/template-part/${ area }`\n\t\t\t\t: 'core/template-part';\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( blockNameWithArea, rootClientId );\n\t\t},\n\t\t[ area, clientId ]\n\t);\n}\n\nexport function useCreateTemplatePartFromBlocks( area, setAttributes ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\treturn async ( blocks = [], title = __( 'Untitled Template Part' ) ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\t// If we have `area` set from block attributes, means an exposed\n\t\t// block variation was inserted. So add this prop to the template\n\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t// block attributes.\n\t\tconst record = {\n\t\t\ttitle,\n\t\t\tslug: cleanSlug,\n\t\t\tcontent: serialize( blocks ),\n\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t// if provided value is not allowed.\n\t\t\tarea,\n\t\t};\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\trecord\n\t\t);\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t};\n}\n\n/**\n * Retrieves the template part area object.\n *\n * @param {string} area Template part area identifier.\n *\n * @return {{icon: Object, label: string, tagName: string}} Template Part area.\n */\nexport function useTemplatePartArea( area ) {\n\treturn useSelect(\n\t\t( select ) => {\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 @wordpress/data-no-store-string-literals */\n\t\t\tconst definedAreas =\n\t\t\t\tselect(\n\t\t\t\t\t'core/editor'\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t\t\t/* eslint-enable @wordpress/data-no-store-string-literals */\n\n\t\t\tconst selectedArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === area\n\t\t\t);\n\t\t\tconst defaultArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === 'uncategorized'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ticon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tlabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t\ttagName: selectedArea?.area_tag ?? 'div',\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAA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