@wordpress/block-library 11.0.2-next.v.202609171837.0 → 11.2.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 +44 -1
- package/build/accordion/block.json +4 -1
- package/build/accordion-heading/block.json +1 -0
- package/build/accordion-item/block.json +7 -1
- package/build/accordion-panel/block.json +9 -1
- package/build/archives/block.json +12 -0
- package/build/audio/block.json +8 -0
- package/build/audio/edit.cjs +2 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/avatar/block.json +4 -0
- package/build/avatar/edit.cjs +31 -1
- package/build/avatar/edit.cjs.map +3 -3
- package/build/breadcrumbs/block.json +3 -0
- package/build/breadcrumbs/edit.cjs.map +3 -3
- package/build/button/block.json +6 -0
- package/build/button/edit.cjs +9 -6
- package/build/button/edit.cjs.map +2 -2
- package/build/buttons/block.json +15 -1
- package/build/categories/block.json +12 -1
- package/build/code/block.json +13 -0
- package/build/column/block.json +9 -0
- package/build/column/edit.cjs +5 -0
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/block.json +13 -0
- package/build/columns/edit.cjs +21 -112
- package/build/columns/edit.cjs.map +3 -3
- package/build/comment-author-name/block.json +3 -0
- package/build/comment-content/block.json +5 -0
- package/build/comment-date/block.json +3 -0
- package/build/comment-edit-link/block.json +3 -0
- package/build/comment-reply-link/block.json +3 -0
- package/build/comments/block.json +10 -0
- package/build/comments/edit/placeholder.cjs +95 -87
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/comments-pagination/block.json +14 -0
- package/build/comments-pagination-next/block.json +3 -0
- package/build/comments-pagination-numbers/block.json +3 -0
- package/build/comments-pagination-previous/block.json +6 -0
- package/build/comments-title/block.json +3 -0
- package/build/cover/block.json +2 -1
- package/build/cover/edit/index.cjs +30 -6
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +56 -14
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +9 -8
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/cover/view.cjs +21 -0
- package/build/cover/view.cjs.map +7 -0
- package/build/details/block.json +14 -0
- package/build/embed/block.json +6 -1
- package/build/file/block.json +14 -0
- package/build/footnotes/block.json +13 -0
- package/build/gallery/block.json +22 -0
- package/build/gallery/dynamic-gallery.cjs +32 -93
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +104 -42
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/order-controls.cjs +107 -0
- package/build/gallery/order-controls.cjs.map +7 -0
- package/build/gallery/order-images.cjs +92 -0
- package/build/gallery/order-images.cjs.map +7 -0
- package/build/gallery/order-options.cjs +62 -0
- package/build/gallery/order-options.cjs.map +7 -0
- package/build/gallery/use-dynamic-gallery.cjs +1 -7
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/gallery/use-get-media.cjs +2 -3
- package/build/gallery/use-get-media.cjs.map +2 -2
- package/build/group/block.json +1 -0
- package/build/group/edit.cjs +3 -3
- package/build/group/edit.cjs.map +2 -2
- package/build/heading/block.json +14 -0
- package/build/home-link/block.json +30 -0
- package/build/home-link/edit.cjs.map +3 -3
- package/build/icon/components/custom-inserter/index.cjs +3 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +49 -5
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +10 -8
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +32 -8
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/image/view.cjs +44 -50
- package/build/image/view.cjs.map +2 -2
- package/build/latest-comments/block.json +20 -0
- package/build/latest-posts/block.json +14 -0
- package/build/list/block.json +12 -1
- package/build/list-item/block.json +8 -1
- package/build/list-item/index.cjs +4 -0
- package/build/list-item/index.cjs.map +3 -3
- package/build/loginout/block.json +14 -0
- package/build/math/block.json +14 -0
- package/build/media-text/block.json +19 -0
- package/build/navigation/edit/index.cjs +1 -4
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +33 -19
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/index.cjs +5 -0
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/use-block-suggestions.cjs +141 -0
- package/build/navigation-link/shared/use-block-suggestions.cjs.map +7 -0
- package/build/navigation-link/shared/use-link-preview.cjs +13 -13
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/block.json +7 -0
- package/build/navigation-submenu/block.json +6 -0
- package/build/navigation-submenu/edit.cjs +9 -1
- package/build/navigation-submenu/edit.cjs.map +3 -3
- package/build/page-list/block.json +14 -0
- package/build/paragraph/block.json +1 -0
- package/build/paragraph/edit.cjs +1 -2
- package/build/paragraph/edit.cjs.map +2 -2
- package/build/playlist/block.json +1 -0
- package/build/post-author-biography/block.json +5 -0
- package/build/post-author-name/block.json +5 -0
- package/build/post-comments-count/block.json +3 -0
- package/build/post-comments-form/block.json +15 -0
- package/build/post-content/block.json +4 -1
- package/build/post-date/block.json +3 -0
- package/build/post-excerpt/block.json +9 -0
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/edit.cjs +12 -10
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +30 -0
- package/build/post-navigation-link/edit.cjs +13 -2
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-template/block.json +13 -1
- package/build/post-terms/block.json +10 -0
- package/build/post-time-to-read/block.json +10 -0
- package/build/post-title/block.json +14 -0
- package/build/preformatted/block.json +11 -0
- package/build/pullquote/block.json +3 -1
- package/build/query-no-results/block.json +14 -2
- package/build/query-pagination/block.json +20 -0
- package/build/query-pagination-next/block.json +3 -0
- package/build/query-pagination-numbers/block.json +3 -0
- package/build/query-pagination-previous/block.json +3 -0
- package/build/query-title/block.json +3 -0
- package/build/query-total/block.json +10 -0
- package/build/quote/block.json +3 -0
- package/build/read-more/block.json +11 -0
- package/build/rss/block.json +10 -0
- package/build/search/block.json +2 -1
- package/build/site-tagline/block.json +12 -1
- package/build/site-title/block.json +11 -1
- package/build/social-links/block.json +4 -0
- package/build/social-links/edit.cjs +2 -3
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +4 -0
- package/build/tab-list/edit.cjs +3 -1
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +3 -1
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panel/block.json +25 -0
- package/build/tab-panel/controls.cjs.map +3 -3
- package/build/tab-panels/block.json +21 -1
- package/build/table-of-contents/block.json +7 -0
- package/build/tabs/block.json +27 -1
- package/build/tag-cloud/block.json +19 -0
- package/build/template-part/edit/selection-modal.cjs.map +1 -1
- package/build/term-count/block.json +12 -0
- package/build/term-description/block.json +13 -0
- package/build/term-name/block.json +16 -1
- package/build/term-template/block.json +14 -1
- package/build/utils/search-patterns.cjs +7 -43
- package/build/utils/search-patterns.cjs.map +3 -3
- package/build/utils/style-state.cjs +4 -6
- package/build/utils/style-state.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +2 -2
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/block.json +4 -0
- package/build/video/block.json +12 -0
- package/build/video/edit.cjs +30 -14
- package/build/video/edit.cjs.map +3 -3
- package/build/video/index.cjs +0 -2
- package/build/video/index.cjs.map +3 -3
- package/build/video/save.cjs +5 -1
- package/build/video/save.cjs.map +3 -3
- package/build-module/accordion/block.json +4 -1
- package/build-module/accordion-heading/block.json +1 -0
- package/build-module/accordion-item/block.json +7 -1
- package/build-module/accordion-panel/block.json +9 -1
- package/build-module/archives/block.json +12 -0
- package/build-module/audio/block.json +8 -0
- package/build-module/audio/edit.mjs +2 -1
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/block.json +4 -0
- package/build-module/avatar/edit.mjs +33 -2
- package/build-module/avatar/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/block.json +3 -0
- package/build-module/breadcrumbs/edit.mjs +3 -3
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/block.json +6 -0
- package/build-module/button/edit.mjs +11 -7
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/buttons/block.json +15 -1
- package/build-module/categories/block.json +12 -1
- package/build-module/code/block.json +13 -0
- package/build-module/column/block.json +9 -0
- package/build-module/column/edit.mjs +5 -0
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/block.json +13 -0
- package/build-module/columns/edit.mjs +22 -122
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/comment-author-name/block.json +3 -0
- package/build-module/comment-content/block.json +5 -0
- package/build-module/comment-date/block.json +3 -0
- package/build-module/comment-edit-link/block.json +3 -0
- package/build-module/comment-reply-link/block.json +3 -0
- package/build-module/comments/block.json +10 -0
- package/build-module/comments/edit/placeholder.mjs +95 -87
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/comments-pagination/block.json +14 -0
- package/build-module/comments-pagination-next/block.json +3 -0
- package/build-module/comments-pagination-numbers/block.json +3 -0
- package/build-module/comments-pagination-previous/block.json +6 -0
- package/build-module/comments-title/block.json +3 -0
- package/build-module/cover/block.json +2 -1
- package/build-module/cover/edit/index.mjs +36 -7
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +62 -16
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +9 -8
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/cover/view.mjs +19 -0
- package/build-module/cover/view.mjs.map +7 -0
- package/build-module/details/block.json +14 -0
- package/build-module/embed/block.json +6 -1
- package/build-module/file/block.json +14 -0
- package/build-module/footnotes/block.json +13 -0
- package/build-module/gallery/block.json +22 -0
- package/build-module/gallery/dynamic-gallery.mjs +33 -97
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +111 -44
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/order-controls.mjs +87 -0
- package/build-module/gallery/order-controls.mjs.map +7 -0
- package/build-module/gallery/order-images.mjs +66 -0
- package/build-module/gallery/order-images.mjs.map +7 -0
- package/build-module/gallery/order-options.mjs +33 -0
- package/build-module/gallery/order-options.mjs.map +7 -0
- package/build-module/gallery/use-dynamic-gallery.mjs +1 -7
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/use-get-media.mjs +2 -3
- package/build-module/gallery/use-get-media.mjs.map +2 -2
- package/build-module/group/block.json +1 -0
- package/build-module/group/edit.mjs +4 -4
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/heading/block.json +14 -0
- package/build-module/home-link/block.json +30 -0
- package/build-module/home-link/edit.mjs +2 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +3 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +50 -6
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +12 -10
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +32 -8
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/image/view.mjs +44 -50
- package/build-module/image/view.mjs.map +2 -2
- package/build-module/latest-comments/block.json +20 -0
- package/build-module/latest-posts/block.json +14 -0
- package/build-module/list/block.json +12 -1
- package/build-module/list-item/block.json +8 -1
- package/build-module/list-item/index.mjs +4 -0
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/loginout/block.json +14 -0
- package/build-module/math/block.json +14 -0
- package/build-module/media-text/block.json +19 -0
- package/build-module/navigation/edit/index.mjs +1 -4
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +39 -20
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +2 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +6 -0
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-block-suggestions.mjs +120 -0
- package/build-module/navigation-link/shared/use-block-suggestions.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-link-preview.mjs +13 -13
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/block.json +7 -0
- package/build-module/navigation-submenu/block.json +6 -0
- package/build-module/navigation-submenu/edit.mjs +11 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +14 -0
- package/build-module/paragraph/block.json +1 -0
- package/build-module/paragraph/edit.mjs +1 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -0
- package/build-module/post-author-biography/block.json +5 -0
- package/build-module/post-author-name/block.json +5 -0
- package/build-module/post-comments-count/block.json +3 -0
- package/build-module/post-comments-form/block.json +15 -0
- package/build-module/post-content/block.json +4 -1
- package/build-module/post-date/block.json +3 -0
- package/build-module/post-excerpt/block.json +9 -0
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/edit.mjs +12 -10
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +30 -0
- package/build-module/post-navigation-link/edit.mjs +17 -3
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-template/block.json +13 -1
- package/build-module/post-terms/block.json +10 -0
- package/build-module/post-time-to-read/block.json +10 -0
- package/build-module/post-title/block.json +14 -0
- package/build-module/preformatted/block.json +11 -0
- package/build-module/pullquote/block.json +3 -1
- package/build-module/query-no-results/block.json +14 -2
- package/build-module/query-pagination/block.json +20 -0
- package/build-module/query-pagination-next/block.json +3 -0
- package/build-module/query-pagination-numbers/block.json +3 -0
- package/build-module/query-pagination-previous/block.json +3 -0
- package/build-module/query-title/block.json +3 -0
- package/build-module/query-total/block.json +10 -0
- package/build-module/quote/block.json +3 -0
- package/build-module/read-more/block.json +11 -0
- package/build-module/rss/block.json +10 -0
- package/build-module/search/block.json +2 -1
- package/build-module/site-tagline/block.json +12 -1
- package/build-module/site-title/block.json +11 -1
- package/build-module/social-links/block.json +4 -0
- package/build-module/social-links/edit.mjs +2 -3
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +4 -0
- package/build-module/tab-list/edit.mjs +4 -1
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +4 -1
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/block.json +25 -0
- package/build-module/tab-panel/controls.mjs +2 -2
- package/build-module/tab-panel/controls.mjs.map +2 -2
- package/build-module/tab-panels/block.json +21 -1
- package/build-module/table-of-contents/block.json +7 -0
- package/build-module/tabs/block.json +27 -1
- package/build-module/tag-cloud/block.json +19 -0
- package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
- package/build-module/term-count/block.json +12 -0
- package/build-module/term-description/block.json +13 -0
- package/build-module/term-name/block.json +16 -1
- package/build-module/term-template/block.json +14 -1
- package/build-module/utils/search-patterns.mjs +7 -32
- package/build-module/utils/search-patterns.mjs.map +2 -2
- package/build-module/utils/style-state.mjs +6 -4
- package/build-module/utils/style-state.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +1 -1
- package/build-module/utils/waveform-utils.mjs.map +1 -1
- package/build-module/verse/block.json +4 -0
- package/build-module/video/block.json +12 -0
- package/build-module/video/edit.mjs +32 -15
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -2
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/save.mjs +7 -2
- package/build-module/video/save.mjs.map +2 -2
- package/build-style/avatar/editor-rtl.css +4 -0
- package/build-style/avatar/editor.css +4 -0
- package/build-style/comments-pagination/style-rtl.css +3 -0
- package/build-style/comments-pagination/style.css +3 -0
- package/build-style/common-rtl.css +32 -1
- package/build-style/common.css +35 -2
- package/build-style/editor-rtl.css +23 -6
- package/build-style/editor.css +23 -6
- package/build-style/embed/style-rtl.css +4 -1
- package/build-style/embed/style.css +4 -1
- package/build-style/gallery/editor-rtl.css +1 -3
- package/build-style/gallery/editor.css +1 -3
- package/build-style/image/editor-rtl.css +6 -0
- package/build-style/image/editor.css +6 -0
- package/build-style/image/style-rtl.css +11 -2
- package/build-style/image/style.css +11 -2
- package/build-style/media-text/style-rtl.css +4 -1
- package/build-style/media-text/style.css +4 -1
- package/build-style/navigation/style-rtl.css +18 -3
- package/build-style/navigation/style.css +18 -3
- package/build-style/navigation-link/editor-rtl.css +3 -1
- package/build-style/navigation-link/editor.css +3 -1
- package/build-style/navigation-overlay-close/style-rtl.css +1 -1
- package/build-style/navigation-overlay-close/style.css +1 -1
- package/build-style/navigation-submenu/editor-rtl.css +3 -1
- package/build-style/navigation-submenu/editor.css +3 -1
- package/build-style/post-navigation-link/style-rtl.css +3 -0
- package/build-style/post-navigation-link/style.css +3 -0
- package/build-style/query-pagination/style-rtl.css +3 -0
- package/build-style/query-pagination/style.css +3 -0
- package/build-style/style-rtl.css +94 -13
- package/build-style/style.css +97 -14
- package/build-style/tab-panel/style-rtl.css +2 -0
- package/build-style/tab-panel/style.css +2 -0
- package/build-style/table/editor-rtl.css +6 -1
- package/build-style/table/editor.css +6 -1
- package/build-style/table/style-rtl.css +4 -2
- package/build-style/table/style.css +4 -2
- package/build-style/tag-cloud/style-rtl.css +1 -1
- package/build-style/tag-cloud/style.css +1 -1
- package/build-style/verse/style-rtl.css +8 -1
- package/build-style/verse/style.css +8 -1
- package/build-types/gallery/order-controls.d.ts +58 -0
- package/build-types/gallery/order-controls.d.ts.map +1 -0
- package/build-types/gallery/order-options.d.ts +67 -0
- package/build-types/gallery/order-options.d.ts.map +1 -0
- package/package.json +46 -44
- package/src/accordion/README.md +3 -0
- package/src/accordion/block.json +4 -1
- package/src/accordion-heading/README.md +1 -0
- package/src/accordion-heading/block.json +1 -0
- package/src/accordion-item/README.md +5 -0
- package/src/accordion-item/block.json +7 -1
- package/src/accordion-panel/README.md +7 -0
- package/src/accordion-panel/block.json +9 -1
- package/src/archives/README.md +6 -0
- package/src/archives/block.json +12 -0
- package/src/audio/README.md +4 -0
- package/src/audio/block.json +8 -0
- package/src/audio/edit.jsx +2 -1
- package/src/avatar/README.md +2 -0
- package/src/avatar/block.json +4 -0
- package/src/avatar/edit.jsx +48 -2
- package/src/avatar/editor.scss +4 -0
- package/src/avatar/index.php +5 -3
- package/src/breadcrumbs/README.md +2 -0
- package/src/breadcrumbs/block.json +3 -0
- package/src/breadcrumbs/edit.jsx +3 -3
- package/src/breadcrumbs/index.php +1 -1
- package/src/button/README.md +4 -0
- package/src/button/block.json +6 -0
- package/src/button/edit.jsx +47 -52
- package/src/button/index.php +47 -0
- package/src/buttons/README.md +8 -0
- package/src/buttons/block.json +15 -1
- package/src/categories/README.md +6 -0
- package/src/categories/block.json +12 -1
- package/src/code/README.md +7 -0
- package/src/code/block.json +13 -0
- package/src/column/README.md +4 -0
- package/src/column/block.json +9 -0
- package/src/column/edit.jsx +6 -0
- package/src/columns/README.md +7 -0
- package/src/columns/block.json +13 -0
- package/src/columns/edit.jsx +1 -131
- package/src/comment-author-name/README.md +2 -0
- package/src/comment-author-name/block.json +3 -0
- package/src/comment-content/README.md +4 -0
- package/src/comment-content/block.json +5 -0
- package/src/comment-date/README.md +2 -0
- package/src/comment-date/block.json +3 -0
- package/src/comment-edit-link/README.md +2 -0
- package/src/comment-edit-link/block.json +3 -0
- package/src/comment-reply-link/README.md +2 -0
- package/src/comment-reply-link/block.json +3 -0
- package/src/comments/README.md +5 -0
- package/src/comments/block.json +10 -0
- package/src/comments/edit/placeholder.jsx +5 -1
- package/src/comments-pagination/README.md +6 -0
- package/src/comments-pagination/block.json +14 -0
- package/src/comments-pagination/style.scss +3 -0
- package/src/comments-pagination-next/README.md +2 -0
- package/src/comments-pagination-next/block.json +3 -0
- package/src/comments-pagination-numbers/README.md +2 -0
- package/src/comments-pagination-numbers/block.json +3 -0
- package/src/comments-pagination-previous/README.md +2 -0
- package/src/comments-pagination-previous/block.json +6 -0
- package/src/comments-title/README.md +2 -0
- package/src/comments-title/block.json +3 -0
- package/src/common.scss +38 -0
- package/src/cover/README.md +1 -0
- package/src/cover/block.json +2 -1
- package/src/cover/edit/index.jsx +41 -6
- package/src/cover/edit/inspector-controls.jsx +74 -14
- package/src/cover/embed-video-utils.js +18 -10
- package/src/cover/index.php +44 -15
- package/src/cover/test/edit.browser.test.js +200 -4
- package/src/cover/test/embed-video-utils.test.js +48 -0
- package/src/cover/view.js +22 -0
- package/src/details/README.md +8 -0
- package/src/details/block.json +14 -0
- package/src/embed/README.md +4 -0
- package/src/embed/block.json +6 -1
- package/src/embed/style.scss +7 -1
- package/src/file/README.md +8 -0
- package/src/file/block.json +14 -0
- package/src/footnotes/README.md +7 -0
- package/src/footnotes/block.json +13 -0
- package/src/gallery/README.md +17 -0
- package/src/gallery/block.json +22 -0
- package/src/gallery/dynamic-gallery.jsx +11 -91
- package/src/gallery/edit.jsx +147 -49
- package/src/gallery/editor.scss +5 -9
- package/src/gallery/order-controls.tsx +143 -0
- package/src/gallery/order-images.js +111 -0
- package/src/gallery/order-options.ts +75 -0
- package/src/gallery/test/edit.jsdom.test.js +87 -10
- package/src/gallery/test/order-images.js +162 -0
- package/src/gallery/use-dynamic-gallery.js +1 -9
- package/src/gallery/use-get-media.js +7 -2
- package/src/group/README.md +1 -0
- package/src/group/block.json +1 -0
- package/src/group/edit.jsx +5 -5
- package/src/heading/README.md +8 -0
- package/src/heading/block.json +14 -0
- package/src/home-link/README.md +11 -0
- package/src/home-link/block.json +30 -0
- package/src/home-link/edit.jsx +2 -2
- package/src/icon/components/custom-inserter/index.jsx +5 -1
- package/src/icon/edit.jsx +68 -7
- package/src/icon/index.php +10 -1
- package/src/image/editor.scss +8 -0
- package/src/image/image.jsx +13 -11
- package/src/image/index.php +3 -4
- package/src/image/style.scss +14 -2
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +201 -0
- package/src/image/use-open-image-media-editor-modal.js +37 -4
- package/src/image/view.js +64 -68
- package/src/latest-comments/README.md +8 -0
- package/src/latest-comments/block.json +20 -0
- package/src/latest-posts/README.md +8 -0
- package/src/latest-posts/block.json +14 -0
- package/src/list/README.md +6 -0
- package/src/list/block.json +12 -1
- package/src/list-item/README.md +6 -0
- package/src/list-item/block.json +8 -1
- package/src/list-item/index.js +5 -0
- package/src/loginout/README.md +8 -0
- package/src/loginout/block.json +14 -0
- package/src/math/README.md +8 -0
- package/src/math/block.json +14 -0
- package/src/media-text/README.md +18 -0
- package/src/media-text/block.json +19 -0
- package/src/media-text/style.scss +5 -1
- package/src/navigation/edit/index.jsx +2 -4
- package/src/navigation/style.scss +40 -4
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +1 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/editor.scss +6 -1
- package/src/navigation-link/link-ui/index.jsx +60 -27
- package/src/navigation-link/link-ui/page-creator.jsx +2 -2
- package/src/navigation-link/link-ui/test/get-suggestions-query.jsdom.test.js +67 -0
- package/src/navigation-link/shared/controls.jsx +2 -2
- package/src/navigation-link/shared/index.js +4 -0
- package/src/navigation-link/shared/test/use-block-suggestions.jsdom.test.js +158 -0
- package/src/navigation-link/shared/test/use-entity-binding.jsdom.test.js +1 -7
- package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
- package/src/navigation-link/shared/use-block-suggestions.js +192 -0
- package/src/navigation-link/shared/use-link-preview.js +15 -14
- package/src/navigation-overlay-close/README.md +1 -0
- package/src/navigation-overlay-close/block.json +7 -0
- package/src/navigation-overlay-close/style.scss +1 -1
- package/src/navigation-submenu/README.md +7 -0
- package/src/navigation-submenu/block.json +6 -0
- package/src/navigation-submenu/edit.jsx +11 -1
- package/src/navigation-submenu/editor.scss +6 -1
- package/src/navigation-submenu/index.php +11 -0
- package/src/page-list/README.md +8 -0
- package/src/page-list/block.json +14 -0
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/edit.jsx +1 -3
- package/src/playlist/README.md +1 -0
- package/src/playlist/block.json +1 -0
- package/src/playlist/test/edit-component.jsdom.test.jsx +11 -11
- package/src/playlist-track/test/edit.jsdom.test.jsx +3 -3
- package/src/post-author-biography/README.md +4 -0
- package/src/post-author-biography/block.json +5 -0
- package/src/post-author-name/README.md +4 -0
- package/src/post-author-name/block.json +5 -0
- package/src/post-comments-count/README.md +2 -0
- package/src/post-comments-count/block.json +3 -0
- package/src/post-comments-form/README.md +8 -0
- package/src/post-comments-form/block.json +15 -0
- package/src/post-content/README.md +3 -0
- package/src/post-content/block.json +4 -1
- package/src/post-date/README.md +2 -0
- package/src/post-date/block.json +3 -0
- package/src/post-excerpt/README.md +7 -0
- package/src/post-excerpt/block.json +9 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/edit.jsx +13 -11
- package/src/post-navigation-link/README.md +12 -0
- package/src/post-navigation-link/block.json +30 -0
- package/src/post-navigation-link/edit.jsx +23 -2
- package/src/post-navigation-link/index.php +94 -5
- package/src/post-navigation-link/style.scss +2 -0
- package/src/post-template/README.md +7 -0
- package/src/post-template/block.json +13 -1
- package/src/post-terms/README.md +8 -0
- package/src/post-terms/block.json +10 -0
- package/src/post-time-to-read/README.md +8 -0
- package/src/post-time-to-read/block.json +10 -0
- package/src/post-title/README.md +8 -0
- package/src/post-title/block.json +14 -0
- package/src/preformatted/README.md +9 -0
- package/src/preformatted/block.json +11 -0
- package/src/pullquote/README.md +2 -0
- package/src/pullquote/block.json +3 -1
- package/src/query-no-results/README.md +10 -0
- package/src/query-no-results/block.json +14 -2
- package/src/query-pagination/README.md +6 -0
- package/src/query-pagination/block.json +20 -0
- package/src/query-pagination/style.scss +3 -0
- package/src/query-pagination-next/README.md +2 -0
- package/src/query-pagination-next/block.json +3 -0
- package/src/query-pagination-numbers/README.md +2 -0
- package/src/query-pagination-numbers/block.json +3 -0
- package/src/query-pagination-previous/README.md +2 -0
- package/src/query-pagination-previous/block.json +3 -0
- package/src/query-title/README.md +2 -0
- package/src/query-title/block.json +3 -0
- package/src/query-total/README.md +8 -0
- package/src/query-total/block.json +10 -0
- package/src/quote/README.md +3 -0
- package/src/quote/block.json +3 -0
- package/src/read-more/README.md +8 -0
- package/src/read-more/block.json +11 -0
- package/src/rss/README.md +8 -0
- package/src/rss/block.json +10 -0
- package/src/search/README.md +1 -0
- package/src/search/block.json +2 -1
- package/src/site-tagline/README.md +9 -0
- package/src/site-tagline/block.json +12 -1
- package/src/site-title/README.md +8 -0
- package/src/site-title/block.json +11 -1
- package/src/social-links/README.md +3 -0
- package/src/social-links/block.json +4 -0
- package/src/social-links/edit.jsx +2 -3
- package/src/tab-list/README.md +2 -0
- package/src/tab-list/block.json +4 -0
- package/src/tab-list/edit.jsx +3 -0
- package/src/tab-list/save.jsx +3 -0
- package/src/tab-panel/README.md +9 -0
- package/src/tab-panel/block.json +25 -0
- package/src/tab-panel/controls.jsx +2 -2
- package/src/tab-panel/style.scss +5 -2
- package/src/tab-panels/README.md +9 -0
- package/src/tab-panels/block.json +21 -1
- package/src/table/editor.scss +8 -2
- package/src/table/style.scss +4 -4
- package/src/table-of-contents/README.md +6 -0
- package/src/table-of-contents/block.json +7 -0
- package/src/tabs/README.md +11 -0
- package/src/tabs/block.json +27 -1
- package/src/tag-cloud/README.md +9 -0
- package/src/tag-cloud/block.json +19 -0
- package/src/tag-cloud/style.scss +1 -1
- package/src/template-part/edit/selection-modal.jsx +1 -1
- package/src/template-part/index.php +16 -3
- package/src/term-count/README.md +10 -0
- package/src/term-count/block.json +12 -0
- package/src/term-description/README.md +8 -0
- package/src/term-description/block.json +13 -0
- package/src/term-name/README.md +9 -0
- package/src/term-name/block.json +16 -1
- package/src/term-name/index.php +1 -1
- package/src/term-template/README.md +8 -0
- package/src/term-template/block.json +14 -1
- package/src/utils/search-patterns.js +9 -53
- package/src/utils/style-state.js +6 -4
- package/src/utils/test/{search-patterns.js → search-patterns.jsdom.test.js} +1 -22
- package/src/utils/test/waveform-player-auto-init.jsdom.test.js +25 -0
- package/src/utils/test/waveform-player-dependency.jsdom.test.js +7 -60
- package/src/utils/test/waveform-utils.browser.test.js +3 -15
- package/src/utils/waveform-utils.js +1 -1
- package/src/verse/README.md +4 -0
- package/src/verse/block.json +4 -0
- package/src/verse/style.scss +11 -2
- package/src/video/README.md +11 -0
- package/src/video/block.json +12 -0
- package/src/video/edit.jsx +65 -49
- package/src/video/index.js +0 -2
- package/src/video/save.jsx +10 -1
- package/build/columns/utils.cjs +0 -112
- package/build/columns/utils.cjs.map +0 -7
- package/build/video/variations.cjs +0 -75
- package/build/video/variations.cjs.map +0 -7
- package/build-module/columns/utils.mjs +0 -78
- package/build-module/columns/utils.mjs.map +0 -7
- package/build-module/video/variations.mjs +0 -50
- package/build-module/video/variations.mjs.map +0 -7
- package/src/columns/test/utils.js +0 -331
- package/src/columns/utils.js +0 -176
- package/src/video/test/variations.js +0 -63
- package/src/video/variations.js +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -2,16 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 11.
|
|
5
|
+
## 11.2.0 (2026-10-07)
|
|
6
|
+
|
|
7
|
+
### Enhancements
|
|
8
|
+
|
|
9
|
+
- Navigation Link: Search every entity type from the link UI instead of only the link's own type; so a category, tag or post can be added without needing to add that specific type's navigation link block ([#83408](https://github.com/WordPress/gutenberg/pull/83408)).
|
|
10
|
+
- Navigation Link: List the blocks a Navigation allows in the link UI search results, so typing "Home" finds the Home Link block ([#83652](https://github.com/WordPress/gutenberg/pull/83652)).
|
|
11
|
+
- Cover: Don't autoplay an embedded background video on the front end when the visitor prefers reduced motion. A new view module swaps the iframe source for one without the autoplay parameters ([#83452](https://github.com/WordPress/gutenberg/pull/83452)).
|
|
12
|
+
- Columns: Remove the column count slider from the block settings ([#83262](https://github.com/WordPress/gutenberg/pull/83262)).
|
|
13
|
+
- Avatar: Explain in the block settings that avatars use the Gravatar service, and link users who can manage settings to the Discussion settings where the default avatar is chosen ([#83567](https://github.com/WordPress/gutenberg/pull/83567)).
|
|
14
|
+
- Media & Text: Lower the specificity of the content area's default padding so themes can override it, including through the block's custom CSS in `theme.json` ([#83563](https://github.com/WordPress/gutenberg/pull/83563)).
|
|
15
|
+
- Gallery: Add an "Order by" sorting control to the static gallery mode, and consolidate sorting control for static and dynamic modes in the Settings panel ([#83438](https://github.com/WordPress/gutenberg/pull/83438)).
|
|
16
|
+
- Icon: Match an icon's keywords as well as its name and label when searching the icon library ([#82367](https://github.com/WordPress/gutenberg/pull/82367)).
|
|
17
|
+
- Button: Only open the link popover from the toolbar button or keyboard shortcut instead of whenever a linked button is selected. The toolbar button now shows a pressed state when a link is set ([#30166](https://github.com/WordPress/gutenberg/pull/30166)).
|
|
18
|
+
- Use the `inertValue` helper to set `inert` attributes, for better React 18/19 compatibility ([#83871](https://github.com/WordPress/gutenberg/pull/83871)).
|
|
19
|
+
- Image, Cover: Restore the previous attachment with snackbar Undo, including attachment-derived Image attributes while preserving Cover settings ([#81805](https://github.com/WordPress/gutenberg/pull/81805)).
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- Tag Cloud: Space the tags of the Outline style evenly. The base link margin outranked the style's own reset, so each tag carried that margin on top of the container's gap and the horizontal spacing did not match the spacing between rows ([#70224](https://github.com/WordPress/gutenberg/pull/70224)).
|
|
24
|
+
- Image: Stop a click on the enlarged image from closing the lightbox, so tapping the image to inspect it, or mis-tapping while reaching for Previous or Next, no longer dismisses it. The Close button, Escape and the area around the image still close the lightbox ([#78898](https://github.com/WordPress/gutenberg/pull/78898)).
|
|
25
|
+
- Math: Align the cells of `aligned` and `cases`, and draw `\overline` and `\underline`, in Chromium, in the Math block and in inline math. The rules key on the MathML attributes and only apply where the engine does not render them natively ([#83164](https://github.com/WordPress/gutenberg/pull/83164)).
|
|
26
|
+
- Image: Fix the lightbox being impossible to close when its overlay is not a direct child of `<body>` ([#83480](https://github.com/WordPress/gutenberg/pull/83480)).
|
|
27
|
+
- Image: Stop the lightbox from removing `inert` that a theme set on elements outside the overlay ([#83480](https://github.com/WordPress/gutenberg/pull/83480)).
|
|
28
|
+
- Image: Show the original image proportions in the lightbox and animate the thumbnail crop during zooming ([#79058](https://github.com/WordPress/gutenberg/pull/79058)).
|
|
29
|
+
- Template Part: Fall back to the theme's template part file and report the error with `wp_trigger_error()` when the customized template part can't be loaded, instead of rendering nothing and logging an `Undefined property: WP_Error::$content` warning ([#83809](https://github.com/WordPress/gutenberg/pull/83809)).
|
|
30
|
+
- Post Featured Image: Do not wrap the media placeholder in a post link when `isLink` comes from the template, so adding a featured image no longer crashes the editor ([#81584](https://github.com/WordPress/gutenberg/pull/81584)).
|
|
31
|
+
- Image: Percent-encode the inline SVG in the circle-mask style's `mask-image`, and drop the malformed `;utf8` media type parameter, so audit tools no longer report the data URI as an invalid `url()` value ([#82333](https://github.com/WordPress/gutenberg/pull/82333)).
|
|
32
|
+
|
|
33
|
+
### Internal
|
|
34
|
+
|
|
35
|
+
- Playlist: Update `@arraypress/waveform-player` to `^1.27.0` and import its `no-autoinit` entry, replacing the dependency patch ([#83132](https://github.com/WordPress/gutenberg/pull/83132)).
|
|
36
|
+
|
|
37
|
+
## 11.1.0 (2026-09-23)
|
|
38
|
+
|
|
39
|
+
### Enhancements
|
|
40
|
+
|
|
41
|
+
- Site Tagline: Add Fit text support ([#83034](https://github.com/WordPress/gutenberg/pull/83034)).
|
|
42
|
+
- Post Navigation Link: Add border and spacing support. The block renders an empty wrapper when there is no adjacent post, so both supports skip serialization and the styles are applied only when a link renders ([#83122](https://github.com/WordPress/gutenberg/pull/83122)).
|
|
43
|
+
- Post Navigation Link: Add shadow support, withheld from the empty wrapper the same way ([#83058](https://github.com/WordPress/gutenberg/pull/83058)).
|
|
44
|
+
- Icon: Don't render icons from non-public icon collections on the front end, since they aren't available in the editor anyway ([#82774](https://github.com/WordPress/gutenberg/pull/82774)).
|
|
6
45
|
|
|
7
46
|
### Bug Fixes
|
|
8
47
|
|
|
48
|
+
- Image: The resize box no longer takes the pointer from the image while the block is selected, so the image has its context menu and is the source of a drag by it; the resize handles are unaffected ([#72983](https://github.com/WordPress/gutenberg/pull/72983)).
|
|
49
|
+
- Navigation: Stop the flyout `min-width` from applying to always-open submenus. Hovering, focusing or selecting an item in a vertical menu with submenus set to always show forced its inline submenu to at least 200px and made the menu re-wrap ([#83142](https://github.com/WordPress/gutenberg/pull/83142)).
|
|
9
50
|
- Math: Read the LaTeX source from the `<annotation>` inside the saved `<math>` instead of the block comment, so `&` and `<` survive `wp_kses` for users without `unfiltered_html`. Input that cannot be rendered is saved as an annotation-only `<semantics>`, which browsers display as the source text ([#82987](https://github.com/WordPress/gutenberg/pull/82987)).
|
|
10
51
|
- Image: Inject the lightbox trigger with a literal string replacement instead of `preg_replace`, so `$` and `\` sequences in author-controlled image attributes (such as a price in the alt text) are no longer interpreted as regex backreferences and silently removed ([#79369](https://github.com/WordPress/gutenberg/pull/79369)).
|
|
11
52
|
- Cover: Grow the block with its content in Safari when an aspect ratio is set, instead of clipping the overflow. WebKit locks the box to the ratio where other engines let content expand it ([#70152](https://github.com/WordPress/gutenberg/pull/70152)).
|
|
12
53
|
- Query Pagination: Remove the editor-only `margin: 0` override on the block wrapper so the parent layout's block gap applies in the canvas as it does on the front end ([#82399](https://github.com/WordPress/gutenberg/pull/82399)).
|
|
13
54
|
- Navigation: Reset the submenu detection for each rendered block. Once a Navigation with a submenu rendered, every Navigation rendered afterwards in the same request was treated as having one and loaded the navigation view module it does not need ([#82366](https://github.com/WordPress/gutenberg/pull/82366)).
|
|
14
55
|
- Gallery: Skip the generated gap styles, and the unique classname that scopes them, for themes opting out of layout styles via `add_theme_support( 'disable-layout-styles' )` ([#81633](https://github.com/WordPress/gutenberg/pull/81633)).
|
|
56
|
+
- Term Name: Apply the term name display filters when rendering, so adjustments plugins make to term names take effect and the name is escaped in the heading and link markup ([#82365](https://github.com/WordPress/gutenberg/pull/82365)).
|
|
15
57
|
|
|
16
58
|
### Internal
|
|
17
59
|
|
|
@@ -25,6 +67,7 @@
|
|
|
25
67
|
|
|
26
68
|
### Enhancements
|
|
27
69
|
|
|
70
|
+
- Navigation Link: emit `@wordpress/ui` `Badge` intents for the link preview badges, replacing the private `@wordpress/components` `Badge` vocabulary. Draft, Scheduled and Pending previously shared one `warning` intent; Draft and Pending now read as `low` and Scheduled as `informational` ([#82684](https://github.com/WordPress/gutenberg/pull/82684)).
|
|
28
71
|
- Math: Declare `interactivity.clientNavigation` support. The block's front end output is static markup, and without the declaration a Math block inside a Query block forced full page reloads on pagination ([#82248](https://github.com/WordPress/gutenberg/pull/82248)).
|
|
29
72
|
- Paragraph, List, Heading, Preformatted, Columns, Group, Template Part: Read the default padding these blocks add when they have a background color from the `--wp--style--block-background-padding` custom property, so themes can change or remove it ([#82024](https://github.com/WordPress/gutenberg/pull/82024)).
|
|
30
73
|
- Query: Show a snackbar notice instead of a blocking modal when "Reload full page" is turned on automatically because a block inside the Query block doesn't support client-side navigation ([#82246](https://github.com/WordPress/gutenberg/pull/82246)).
|
|
@@ -9,9 +9,15 @@
|
|
|
9
9
|
"allowedBlocks": [ "core/accordion-heading", "core/accordion-panel" ],
|
|
10
10
|
"supports": {
|
|
11
11
|
"html": false,
|
|
12
|
+
"background": {
|
|
13
|
+
"gradient": true
|
|
14
|
+
},
|
|
12
15
|
"color": {
|
|
13
16
|
"background": true,
|
|
14
|
-
"gradients": true
|
|
17
|
+
"gradients": true,
|
|
18
|
+
"link": true,
|
|
19
|
+
"heading": true,
|
|
20
|
+
"button": true
|
|
15
21
|
},
|
|
16
22
|
"interactivity": true,
|
|
17
23
|
"spacing": {
|
|
@@ -10,9 +10,17 @@
|
|
|
10
10
|
"supports": {
|
|
11
11
|
"__experimentalOnEnter": true,
|
|
12
12
|
"html": false,
|
|
13
|
+
"background": {
|
|
14
|
+
"backgroundImage": true,
|
|
15
|
+
"backgroundSize": true,
|
|
16
|
+
"gradient": true
|
|
17
|
+
},
|
|
13
18
|
"color": {
|
|
14
19
|
"background": true,
|
|
15
|
-
"gradients": true
|
|
20
|
+
"gradients": true,
|
|
21
|
+
"link": true,
|
|
22
|
+
"heading": true,
|
|
23
|
+
"button": true
|
|
16
24
|
},
|
|
17
25
|
"interactivity": true,
|
|
18
26
|
"spacing": {
|
|
@@ -33,6 +33,18 @@
|
|
|
33
33
|
"width": true,
|
|
34
34
|
"style": true
|
|
35
35
|
},
|
|
36
|
+
"background": {
|
|
37
|
+
"backgroundImage": true,
|
|
38
|
+
"backgroundSize": true,
|
|
39
|
+
"gradient": true,
|
|
40
|
+
"__experimentalDefaultControls": {
|
|
41
|
+
"backgroundImage": true,
|
|
42
|
+
"gradient": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"dimensions": {
|
|
46
|
+
"minHeight": true
|
|
47
|
+
},
|
|
36
48
|
"html": false,
|
|
37
49
|
"spacing": {
|
|
38
50
|
"margin": true,
|
package/build/audio/block.json
CHANGED
package/build/audio/edit.cjs
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(edit_exports);
|
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
37
|
var import_blob = require("@wordpress/blob");
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
|
+
var import_react_inert_value = require("@wordpress/react-inert-value");
|
|
39
40
|
var import_ui = require("@wordpress/ui");
|
|
40
41
|
var import_block_editor = require("@wordpress/block-editor");
|
|
41
42
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -242,7 +243,7 @@ function AudioEdit({
|
|
|
242
243
|
"audio",
|
|
243
244
|
{
|
|
244
245
|
controls: "controls",
|
|
245
|
-
inert: !isSingleSelected
|
|
246
|
+
inert: (0, import_react_inert_value.inertValue)(!isSingleSelected),
|
|
246
247
|
src: src ?? temporaryURL
|
|
247
248
|
}
|
|
248
249
|
),
|
package/build/audio/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/audio/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tSelectControl as WCSelectControl,\n\tSpinner,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { Text } from '@wordpress/ui';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { audio as icon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport {\n\tuseUploadMediaFromBlobURL,\n\tuseToolsPanelDropdownMenuProps,\n} from '../utils/hooks';\nimport { Caption } from '../utils/caption';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\n/**\n * Renders the `core/audio` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes: `blob`, `src`, `caption`, `id`, `autoplay`, `loop` and `preload`.\n * @param {string} props.className Class name generated for the block.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Function} props.onReplace Callback for replacing this block with other blocks.\n * @param {boolean} props.isSelected Whether the block is the only selected block.\n * @param {Function} props.insertBlocksAfter Callback for inserting blocks after this one.\n *\n * @return {React.JSX.Element} React element.\n */\nfunction AudioEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tonReplace,\n\tisSelected: isSingleSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectAudio,\n\t\tonError: onUploadError,\n\t} );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\t// Set the block's src from the edit component's state, and switch off\n\t\t// the editing UI.\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock && onReplace ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, blob: undefined } );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tcaption: media.caption,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! src && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isSingleSelected && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ () => onSelectAudio( undefined ) }\n\t\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tautoplay: false,\n\t\t\t\t\t\t\tloop: false,\n\t\t\t\t\t\t\tpreload: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<Text className=\"wp-block-audio__autoplay-help-text\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Most browsers block audio until a visitor interacts with the page, so autoplay often won’t work, especially on mobile. Unexpected sound can also be disruptive for screen reader users.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! autoplay }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tautoplay: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\t\tchecked={ !! autoplay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! loop }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tloop: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\t\tchecked={ !! loop }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! preload }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tpreload: undefined,\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\t\t<WCSelectControl\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Preload',\n\t\t\t\t\t\t\t\t'noun; Audio block parameter'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\t\tlabel: _x( 'None', 'Preload value' ),\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\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BAAAC;AAAA,gBAAA;AAAA,kBACA,WAAQ;AAAA,oBACP;AAAA,oBACA;AAAA,kBACD;AAAA,kBACA,OAAQ,WAAW;AAAA,kBAEnB,UAAW,CAAE,UACZ,cAAe;AAAA,oBACd,SAAS,SAAS;AAAA,kBACnB,CAAE;AAAA,kBAEH,SAAU;AAAA,oBACT,EAAE,OAAO,IAAI,WAAO,gBAAI,iBAAkB,EAAE;AAAA,oBAC5C,EAAE,OAAO,QAAQ,WAAO,gBAAI,MAAO,EAAE;AAAA,oBACrC,EAAE,OAAO,YAAY,WAAO,gBAAI,UAAW,EAAE;AAAA,oBAC7C;AAAA,sBACC,OAAO;AAAA,sBACP,WAAO,gBAAI,QAAQ,eAAgB;AAAA,oBACpC;AAAA,kBACD;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,6CAAC,YAAS,GAAG,YACZ;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,UAAS;AAAA,UACT,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tSelectControl as WCSelectControl,\n\tSpinner,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport { Text } from '@wordpress/ui';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { audio as icon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport {\n\tuseUploadMediaFromBlobURL,\n\tuseToolsPanelDropdownMenuProps,\n} from '../utils/hooks';\nimport { Caption } from '../utils/caption';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\n/**\n * Renders the `core/audio` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes: `blob`, `src`, `caption`, `id`, `autoplay`, `loop` and `preload`.\n * @param {string} props.className Class name generated for the block.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Function} props.onReplace Callback for replacing this block with other blocks.\n * @param {boolean} props.isSelected Whether the block is the only selected block.\n * @param {Function} props.insertBlocksAfter Callback for inserting blocks after this one.\n *\n * @return {React.JSX.Element} React element.\n */\nfunction AudioEdit( {\n\tattributes,\n\tclassName,\n\tsetAttributes,\n\tonReplace,\n\tisSelected: isSingleSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectAudio,\n\t\tonError: onUploadError,\n\t} );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\t// Set the block's src from the edit component's state, and switch off\n\t\t// the editing UI.\n\t\tif ( newSrc !== src ) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tconst embedBlock = createUpgradedEmbedBlock( {\n\t\t\t\tattributes: { url: newSrc },\n\t\t\t} );\n\t\t\tif ( undefined !== embedBlock && onReplace ) {\n\t\t\t\tonReplace( embedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetAttributes( { src: newSrc, id: undefined, blob: undefined } );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( {\n\t\t\t\tsrc: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\tsrc: media.url,\n\t\t\tid: media.id,\n\t\t\tcaption: media.caption,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! src && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isSingleSelected && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ src }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonReset={ () => onSelectAudio( undefined ) }\n\t\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tautoplay: false,\n\t\t\t\t\t\t\tloop: false,\n\t\t\t\t\t\t\tpreload: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<Text className=\"wp-block-audio__autoplay-help-text\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Most browsers block audio until a visitor interacts with the page, so autoplay often won’t work, especially on mobile. Unexpected sound can also be disruptive for screen reader users.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! autoplay }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tautoplay: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\t\tchecked={ !! autoplay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! loop }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tloop: false,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\t\tchecked={ !! loop }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Preload' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! preload }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tpreload: undefined,\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\t\t<WCSelectControl\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Preload',\n\t\t\t\t\t\t\t\t'noun; Audio block parameter'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\t\tlabel: _x( 'None', 'Preload value' ),\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t<audio\n\t\t\t\t\tcontrols=\"controls\"\n\t\t\t\t\tinert={ inertValue( ! isSingleSelected ) }\n\t\t\t\t\tsrc={ src ?? temporaryURL }\n\t\t\t\t/>\n\t\t\t\t{ !! temporaryURL && <Spinner /> }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Audio caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && hasNonContentControls\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t</>\n\t);\n}\n\nexport default AudioEdit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA0B;AAC1B,wBAMO;AACP,+BAA2B;AAC3B,gBAAqB;AACrB,0BAQO;AACP,kBAAuB;AACvB,kBAA4B;AAC5B,mBAA8B;AAC9B,qBAAsC;AACtC,qBAAyB;AACzB,kBAAyC;AACzC,mBAGO;AACP,qBAAwB;AA4GZ;AA1GZ,IAAM,sBAAsB,CAAE,OAAQ;AAetC,SAAS,UAAW;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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A;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,6CAAC,YAAS,GAAG,YACZ;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,UAAS;AAAA,UACT,WAAQ,qCAAY,CAAE,gBAAiB;AAAA,UACvC,KAAM,OAAO;AAAA;AAAA,MACd;AAAA,MACE,CAAC,CAAE,gBAAgB,4CAAC,6BAAQ;AAAA,MAC9B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAa;AAAA,UACb;AAAA,UACA,WAAQ,gBAAI,oBAAqB;AAAA,UACjC,mBACC,oBAAoB;AAAA;AAAA,MAEtB;AAAA,OACD;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["noticesStore", "clsx", "icon", "ToolsPanel", "ToolsPanelItem", "WCSelectControl"]
|
|
7
7
|
}
|
package/build/avatar/block.json
CHANGED
|
@@ -54,12 +54,16 @@
|
|
|
54
54
|
"filter": {
|
|
55
55
|
"duotone": true
|
|
56
56
|
},
|
|
57
|
+
"shadow": {
|
|
58
|
+
"__experimentalSkipSerialization": true
|
|
59
|
+
},
|
|
57
60
|
"interactivity": {
|
|
58
61
|
"clientNavigation": true
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
"selectors": {
|
|
62
65
|
"border": ".wp-block-avatar img",
|
|
66
|
+
"shadow": ".wp-block-avatar img",
|
|
63
67
|
"filter": {
|
|
64
68
|
"duotone": ".wp-block-avatar img"
|
|
65
69
|
}
|
package/build/avatar/edit.cjs
CHANGED
|
@@ -36,12 +36,36 @@ module.exports = __toCommonJS(edit_exports);
|
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
37
|
var import_block_editor = require("@wordpress/block-editor");
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
|
+
var import_core_data = require("@wordpress/core-data");
|
|
40
|
+
var import_data = require("@wordpress/data");
|
|
41
|
+
var import_element = require("@wordpress/element");
|
|
39
42
|
var import_i18n = require("@wordpress/i18n");
|
|
43
|
+
var import_ui = require("@wordpress/ui");
|
|
40
44
|
var import_url = require("@wordpress/url");
|
|
41
45
|
var import_hooks = require("../utils/hooks.cjs");
|
|
42
46
|
var import_hooks2 = require("./hooks.cjs");
|
|
43
47
|
var import_user_control = __toESM(require("./user-control.cjs"));
|
|
44
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
function useAvatarHelpText() {
|
|
50
|
+
const canManageSettings = (0, import_data.useSelect)(
|
|
51
|
+
(select) => select(import_core_data.store).canUser("update", {
|
|
52
|
+
kind: "root",
|
|
53
|
+
name: "site"
|
|
54
|
+
}),
|
|
55
|
+
[]
|
|
56
|
+
);
|
|
57
|
+
if (!canManageSettings) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return (0, import_element.createInterpolateElement)(
|
|
61
|
+
(0, import_i18n.__)(
|
|
62
|
+
"Avatars use the Gravatar service. Go to <a>Discussion settings</a> to change the default avatar."
|
|
63
|
+
),
|
|
64
|
+
{
|
|
65
|
+
a: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Link, { href: "options-discussion.php", openInNewTab: true })
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
45
69
|
var AvatarInspectorControls = ({
|
|
46
70
|
setAttributes,
|
|
47
71
|
avatar,
|
|
@@ -49,6 +73,7 @@ var AvatarInspectorControls = ({
|
|
|
49
73
|
selectUser
|
|
50
74
|
}) => {
|
|
51
75
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
76
|
+
const helpText = useAvatarHelpText();
|
|
52
77
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
53
78
|
import_components.__experimentalToolsPanel,
|
|
54
79
|
{
|
|
@@ -63,6 +88,7 @@ var AvatarInspectorControls = ({
|
|
|
63
88
|
},
|
|
64
89
|
dropdownMenuProps,
|
|
65
90
|
children: [
|
|
91
|
+
helpText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Text, { className: "wp-block-avatar__help-text", children: helpText }),
|
|
66
92
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
93
|
import_components.__experimentalToolsPanelItem,
|
|
68
94
|
{
|
|
@@ -162,6 +188,7 @@ var ResizableAvatar = ({
|
|
|
162
188
|
isSelected
|
|
163
189
|
}) => {
|
|
164
190
|
const borderProps = (0, import_block_editor.__experimentalUseBorderProps)(attributes);
|
|
191
|
+
const shadowProps = (0, import_block_editor.__experimentalGetShadowClassesAndStyles)(attributes);
|
|
165
192
|
const doubledSizedSrc = (0, import_url.addQueryArgs)(
|
|
166
193
|
(0, import_url.removeQueryArgs)(avatar?.src, ["s"]),
|
|
167
194
|
{
|
|
@@ -205,7 +232,10 @@ var ResizableAvatar = ({
|
|
|
205
232
|
"wp-block-avatar__image",
|
|
206
233
|
borderProps.className
|
|
207
234
|
),
|
|
208
|
-
style:
|
|
235
|
+
style: {
|
|
236
|
+
...borderProps.style,
|
|
237
|
+
...shadowProps.style
|
|
238
|
+
}
|
|
209
239
|
}
|
|
210
240
|
)
|
|
211
241
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/avatar/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n} from '@wordpress/block-editor';\nimport {\n\tRangeControl,\n\tResizableBox,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { useCommentAvatar, useUserAvatar } from './hooks';\nimport UserControl from './user-control';\n\n/**\n * Renders the inspector controls for the `core/avatar` block.\n *\n * @param {Object} props React props.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.avatar Avatar data returned by `useCommentAvatar` or `useUserAvatar`, with the `minSize` and `maxSize` bounds of the size control.\n * @param {Object} props.attributes Block attributes: `size`, `isLink`, `linkTarget` and `userId`.\n * @param {boolean} props.selectUser Whether to render the user selection control.\n *\n * @return {React.JSX.Element} React element.\n */\nconst AvatarInspectorControls = ( {\n\tsetAttributes,\n\tavatar,\n\tattributes,\n\tselectUser,\n} ) => {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tsize: 96,\n\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\tuserId: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => attributes?.size !== 96 }\n\t\t\t\t\tonDeselect={ () => setAttributes( { size: 96 } ) }\n\t\t\t\t>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tsize: newSize,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ avatar.minSize }\n\t\t\t\t\t\tmax={ avatar.maxSize }\n\t\t\t\t\t\tinitialPosition={ attributes?.size }\n\t\t\t\t\t\tvalue={ attributes?.size }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to user profile' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => attributes?.isLink }\n\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to user profile' ) }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { isLink: ! attributes.isLink } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ attributes.isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ attributes.isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => attributes?.linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ attributes.linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ selectUser && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'User' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! attributes?.userId }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { userId: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<UserControl\n\t\t\t\t\t\t\tvalue={ attributes?.userId }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tuserId: value,\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</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\n/**\n * Wraps the avatar image in a placeholder link when the block links to the user\n * profile. The link is inert in the editor: it points at a fragment and its\n * click handler prevents navigation.\n *\n * @param {Object} props React props.\n * @param {React.ReactNode} props.children Avatar image to wrap.\n * @param {boolean} props.isLink Whether to wrap the children in a link.\n *\n * @return {React.ReactNode} The children, wrapped in a link when `isLink` is true.\n */\nconst AvatarLinkWrapper = ( { children, isLink } ) =>\n\tisLink ? (\n\t\t<a\n\t\t\thref=\"#avatar-pseudo-link\"\n\t\t\tclassName=\"wp-block-avatar__link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ children }\n\t\t</a>\n\t) : (\n\t\tchildren\n\t);\n\n/**\n * Renders the avatar image inside a `ResizableBox` so its size can be adjusted\n * by dragging. Resizing keeps the aspect ratio and updates the `size` attribute.\n *\n * @param {Object} props React props.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes: `size` and `isLink`, plus the border support values read by `useBorderProps`.\n * @param {Object} props.avatar Avatar data returned by `useCommentAvatar` or `useUserAvatar`, with the image `src` and `alt` and the `minSize` and `maxSize` resize bounds.\n * @param {Object} props.blockProps Props returned by `useBlockProps`, applied to the wrapper element.\n * @param {boolean} props.isSelected Whether the block is selected. Resize handles are only shown when it is.\n *\n * @return {React.JSX.Element} React element.\n */\nconst ResizableAvatar = ( {\n\tsetAttributes,\n\tattributes,\n\tavatar,\n\tblockProps,\n\tisSelected,\n} ) => {\n\tconst borderProps = useBorderProps( attributes );\n\tconst doubledSizedSrc = addQueryArgs(\n\t\tremoveQueryArgs( avatar?.src, [ 's' ] ),\n\t\t{\n\t\t\ts: attributes?.size * 2,\n\t\t}\n\t);\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<AvatarLinkWrapper isLink={ attributes.isLink }>\n\t\t\t\t<ResizableBox\n\t\t\t\t\tsize={ {\n\t\t\t\t\t\twidth: attributes.size,\n\t\t\t\t\t\theight: attributes.size,\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tsize: parseInt(\n\t\t\t\t\t\t\t\tattributes.size +\n\t\t\t\t\t\t\t\t\t( delta.height || delta.width ),\n\t\t\t\t\t\t\t\t10\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\tlockAspectRatio\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: ! isRTL(),\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: isRTL(),\n\t\t\t\t\t} }\n\t\t\t\t\tminWidth={ avatar.minSize }\n\t\t\t\t\tmaxWidth={ avatar.maxSize }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ doubledSizedSrc }\n\t\t\t\t\t\talt={ avatar.alt }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'avatar',\n\t\t\t\t\t\t\t'avatar-' + attributes.size,\n\t\t\t\t\t\t\t'photo',\n\t\t\t\t\t\t\t'wp-block-avatar__image',\n\t\t\t\t\t\t\tborderProps.className\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ borderProps.style }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableBox>\n\t\t\t</AvatarLinkWrapper>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the block for a comment author, resolving the avatar from the\n * `commentId` context. The user selection control is not offered here because\n * the author is determined by the comment.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes.\n * @param {Object} props.context Inherited context, from which the comment ID is read.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nconst CommentEdit = ( { attributes, context, setAttributes, isSelected } ) => {\n\tconst { commentId } = context;\n\tconst blockProps = useBlockProps();\n\tconst avatar = useCommentAvatar( { commentId } );\n\treturn (\n\t\t<>\n\t\t\t<AvatarInspectorControls\n\t\t\t\tavatar={ avatar }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tselectUser={ false }\n\t\t\t/>\n\t\t\t<ResizableAvatar\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tblockProps={ blockProps }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\n/**\n * Renders the block for a user, resolving the avatar from the `userId`\n * attribute when set, and otherwise from the author of the post identified by\n * the `postType` and `postId` context.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes, from which the `userId` is read.\n * @param {Object} props.context Inherited context, from which the post type and post ID are read.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nconst UserEdit = ( { attributes, context, setAttributes, isSelected } ) => {\n\tconst { postId, postType } = context;\n\tconst avatar = useUserAvatar( {\n\t\tuserId: attributes?.userId,\n\t\tpostId,\n\t\tpostType,\n\t} );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<>\n\t\t\t<AvatarInspectorControls\n\t\t\t\tselectUser\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\n\t\t\t<ResizableAvatar\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tblockProps={ blockProps }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\n/**\n * Renders the `core/avatar` block on the editor. All props are forwarded to\n * either `CommentEdit` or `UserEdit`, depending on whether the block is used\n * inside a comment.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes.\n * @param {Object} props.context Inherited context.\n * @param {number|null} [props.context.commentId] The comment ID when the block is used inside a comment. `null` in the Site Editor, where no comment is resolved but the comment variant is still rendered.\n * @param {string} [props.context.postType] The post type of the current post.\n * @param {number} [props.context.postId] The ID of the current post.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\t// Don't show the Comment Edit controls if we have a comment ID set, or if we're in the Site Editor (where it is `null`).\n\tif ( props?.context?.commentId || props?.context?.commentId === null ) {\n\t\treturn <CommentEdit { ...props } />;\n\t}\n\treturn <UserEdit { ...props } />;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,
|
|
6
|
-
"names": ["import_hooks", "ToolsPanel", "ToolsPanelItem", "UserControl", "useBorderProps", "clsx"]
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n} from '@wordpress/block-editor';\nimport {\n\tRangeControl,\n\tResizableBox,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Link, Text } from '@wordpress/ui';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { useCommentAvatar, useUserAvatar } from './hooks';\nimport UserControl from './user-control';\n\n/**\n * Returns the help text explaining where avatars come from, with a link to the\n * Discussion settings where the default avatar is chosen. Only users who can\n * manage the site's settings get it, since nobody else can act on it.\n *\n * @return {React.ReactNode|null} Help text, or `null` when the user can't manage settings.\n */\nfunction useAvatarHelpText() {\n\tconst canManageSettings = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tif ( ! canManageSettings ) {\n\t\treturn null;\n\t}\n\n\treturn createInterpolateElement(\n\t\t__(\n\t\t\t'Avatars use the Gravatar service. Go to <a>Discussion settings</a> to change the default avatar.'\n\t\t),\n\t\t{\n\t\t\ta: <Link href=\"options-discussion.php\" openInNewTab />,\n\t\t}\n\t);\n}\n\n/**\n * Renders the inspector controls for the `core/avatar` block.\n *\n * @param {Object} props React props.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.avatar Avatar data returned by `useCommentAvatar` or `useUserAvatar`, with the `minSize` and `maxSize` bounds of the size control.\n * @param {Object} props.attributes Block attributes: `size`, `isLink`, `linkTarget` and `userId`.\n * @param {boolean} props.selectUser Whether to render the user selection control.\n *\n * @return {React.JSX.Element} React element.\n */\nconst AvatarInspectorControls = ( {\n\tsetAttributes,\n\tavatar,\n\tattributes,\n\tselectUser,\n} ) => {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst helpText = useAvatarHelpText();\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tsize: 96,\n\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\tuserId: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t{ helpText && (\n\t\t\t\t\t<Text className=\"wp-block-avatar__help-text\">\n\t\t\t\t\t\t{ helpText }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => attributes?.size !== 96 }\n\t\t\t\t\tonDeselect={ () => setAttributes( { size: 96 } ) }\n\t\t\t\t>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tsize: newSize,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ avatar.minSize }\n\t\t\t\t\t\tmax={ avatar.maxSize }\n\t\t\t\t\t\tinitialPosition={ attributes?.size }\n\t\t\t\t\t\tvalue={ attributes?.size }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to user profile' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => attributes?.isLink }\n\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to user profile' ) }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { isLink: ! attributes.isLink } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ attributes.isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ attributes.isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => attributes?.linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ attributes.linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ selectUser && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'User' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! attributes?.userId }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { userId: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<UserControl\n\t\t\t\t\t\t\tvalue={ attributes?.userId }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tuserId: value,\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</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\n/**\n * Wraps the avatar image in a placeholder link when the block links to the user\n * profile. The link is inert in the editor: it points at a fragment and its\n * click handler prevents navigation.\n *\n * @param {Object} props React props.\n * @param {React.ReactNode} props.children Avatar image to wrap.\n * @param {boolean} props.isLink Whether to wrap the children in a link.\n *\n * @return {React.ReactNode} The children, wrapped in a link when `isLink` is true.\n */\nconst AvatarLinkWrapper = ( { children, isLink } ) =>\n\tisLink ? (\n\t\t<a\n\t\t\thref=\"#avatar-pseudo-link\"\n\t\t\tclassName=\"wp-block-avatar__link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ children }\n\t\t</a>\n\t) : (\n\t\tchildren\n\t);\n\n/**\n * Renders the avatar image inside a `ResizableBox` so its size can be adjusted\n * by dragging. Resizing keeps the aspect ratio and updates the `size` attribute.\n *\n * @param {Object} props React props.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes: `size` and `isLink`, plus the border and shadow support values applied to the image.\n * @param {Object} props.avatar Avatar data returned by `useCommentAvatar` or `useUserAvatar`, with the image `src` and `alt` and the `minSize` and `maxSize` resize bounds.\n * @param {Object} props.blockProps Props returned by `useBlockProps`, applied to the wrapper element.\n * @param {boolean} props.isSelected Whether the block is selected. Resize handles are only shown when it is.\n *\n * @return {React.JSX.Element} React element.\n */\nconst ResizableAvatar = ( {\n\tsetAttributes,\n\tattributes,\n\tavatar,\n\tblockProps,\n\tisSelected,\n} ) => {\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst doubledSizedSrc = addQueryArgs(\n\t\tremoveQueryArgs( avatar?.src, [ 's' ] ),\n\t\t{\n\t\t\ts: attributes?.size * 2,\n\t\t}\n\t);\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<AvatarLinkWrapper isLink={ attributes.isLink }>\n\t\t\t\t<ResizableBox\n\t\t\t\t\tsize={ {\n\t\t\t\t\t\twidth: attributes.size,\n\t\t\t\t\t\theight: attributes.size,\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tsize: parseInt(\n\t\t\t\t\t\t\t\tattributes.size +\n\t\t\t\t\t\t\t\t\t( delta.height || delta.width ),\n\t\t\t\t\t\t\t\t10\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\tlockAspectRatio\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: ! isRTL(),\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: isRTL(),\n\t\t\t\t\t} }\n\t\t\t\t\tminWidth={ avatar.minSize }\n\t\t\t\t\tmaxWidth={ avatar.maxSize }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ doubledSizedSrc }\n\t\t\t\t\t\talt={ avatar.alt }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'avatar',\n\t\t\t\t\t\t\t'avatar-' + attributes.size,\n\t\t\t\t\t\t\t'photo',\n\t\t\t\t\t\t\t'wp-block-avatar__image',\n\t\t\t\t\t\t\tborderProps.className\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableBox>\n\t\t\t</AvatarLinkWrapper>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the block for a comment author, resolving the avatar from the\n * `commentId` context. The user selection control is not offered here because\n * the author is determined by the comment.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes.\n * @param {Object} props.context Inherited context, from which the comment ID is read.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nconst CommentEdit = ( { attributes, context, setAttributes, isSelected } ) => {\n\tconst { commentId } = context;\n\tconst blockProps = useBlockProps();\n\tconst avatar = useCommentAvatar( { commentId } );\n\treturn (\n\t\t<>\n\t\t\t<AvatarInspectorControls\n\t\t\t\tavatar={ avatar }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tselectUser={ false }\n\t\t\t/>\n\t\t\t<ResizableAvatar\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tblockProps={ blockProps }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\n/**\n * Renders the block for a user, resolving the avatar from the `userId`\n * attribute when set, and otherwise from the author of the post identified by\n * the `postType` and `postId` context.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes, from which the `userId` is read.\n * @param {Object} props.context Inherited context, from which the post type and post ID are read.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nconst UserEdit = ( { attributes, context, setAttributes, isSelected } ) => {\n\tconst { postId, postType } = context;\n\tconst avatar = useUserAvatar( {\n\t\tuserId: attributes?.userId,\n\t\tpostId,\n\t\tpostType,\n\t} );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<>\n\t\t\t<AvatarInspectorControls\n\t\t\t\tselectUser\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\n\t\t\t<ResizableAvatar\n\t\t\t\tattributes={ attributes }\n\t\t\t\tavatar={ avatar }\n\t\t\t\tblockProps={ blockProps }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\n/**\n * Renders the `core/avatar` block on the editor. All props are forwarded to\n * either `CommentEdit` or `UserEdit`, depending on whether the block is used\n * inside a comment.\n *\n * @param {Object} props React props.\n * @param {Object} props.attributes Block attributes.\n * @param {Object} props.context Inherited context.\n * @param {number|null} [props.context.commentId] The comment ID when the block is used inside a comment. `null` in the Site Editor, where no comment is resolved but the comment variant is still rendered.\n * @param {string} [props.context.postType] The post type of the current post.\n * @param {number} [props.context.postId] The ID of the current post.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {boolean} props.isSelected Whether the block is selected.\n *\n * @return {React.JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\t// Don't show the Comment Edit controls if we have a comment ID set, or if we're in the Site Editor (where it is `null`).\n\tif ( props?.context?.commentId || props?.context?.commentId === null ) {\n\t\treturn <CommentEdit { ...props } />;\n\t}\n\treturn <UserEdit { ...props } />;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,0BAKO;AACP,wBAMO;AACP,uBAAmC;AACnC,kBAA0B;AAC1B,qBAAyC;AACzC,kBAA0B;AAC1B,gBAA2B;AAC3B,iBAA8C;AAC9C,mBAA+C;AAC/C,IAAAA,gBAAgD;AAChD,0BAAwB;AA4BlB;AAnBN,SAAS,oBAAoB;AAC5B,QAAM,wBAAoB;AAAA,IACzB,CAAE,WACD,OAAQ,iBAAAC,KAAU,EAAE,QAAS,UAAU;AAAA,MACtC,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AAAA,IACH,CAAC;AAAA,EACF;AAEA,MAAK,CAAE,mBAAoB;AAC1B,WAAO;AAAA,EACR;AAEA,aAAO;AAAA,QACN;AAAA,MACC;AAAA,IACD;AAAA,IACA;AAAA,MACC,GAAG,4CAAC,kBAAK,MAAK,0BAAyB,cAAY,MAAC;AAAA,IACrD;AAAA,EACD;AACD;AA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AAa;AAAA;AAAA,IACd;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAeA,IAAM,WAAW,CAAE,EAAE,YAAY,SAAS,eAAe,WAAW,MAAO;AAC1E,QAAM,EAAE,QAAQ,SAAS,IAAI;AAC7B,QAAM,aAAS,6BAAe;AAAA,IAC7B,QAAQ,YAAY;AAAA,IACpB;AAAA,IACA;AAAA,EACD,CAAE;AACF,QAAM,iBAAa,mCAAc;AACjC,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,YAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAkBe,SAAR,KAAuB,OAAQ;AAErC,MAAK,OAAO,SAAS,aAAa,OAAO,SAAS,cAAc,MAAO;AACtE,WAAO,4CAAC,eAAc,GAAG,OAAQ;AAAA,EAClC;AACA,SAAO,4CAAC,YAAW,GAAG,OAAQ;AAC/B;",
|
|
6
|
+
"names": ["import_hooks", "coreStore", "ToolsPanel", "ToolsPanelItem", "UserControl", "useBorderProps", "getShadowClassesAndStyles", "clsx"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tname,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t\turlQueryArgs: { post_id: postId, invalidationKey },\n\t} );\n\tconst prevContentRef = useRef( '' );\n\tuseEffect( () => {\n\t\tif ( status === 'success' ) {\n\t\t\tprevContentRef.current = content;\n\t\t}\n\t}, [ content, status ] );\n\tconst [ showLoader, setShowLoader ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( status !== 'loading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetShowLoader( true );\n\t\t}, 400 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t\tsetShowLoader( false );\n\t\t};\n\t}, [ status ] );\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Try to determine breadcrumb type for more accurate previews.\n\tlet _showTerms;\n\t// Some non-hierarchical post types (e.g., attachments) can have parents.\n\t// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.\n\tif ( ! isPostTypeHierarchical && ! post?.parent ) {\n\t\t_showTerms = true;\n\t} else if ( ! postTypeHasTaxonomies ) {\n\t\t// Hierarchical post type without taxonomies can only use ancestors.\n\t\t_showTerms = false;\n\t} else {\n\t\t// For hierarchical post types with taxonomies, use the attribute.\n\t\t_showTerms = prefersTaxonomy;\n\t}\n\tlet placeholder = null;\n\t// This is fragile because this block is server side rendered and we'll have to\n\t// update the placeholder html if the server side rendering output changes.\n\tconst showPlaceholder =\n\t\t! postId ||\n\t\t! postType ||\n\t\t// When `templateSlug` is set only show placeholder if the post type is not.\n\t\t// This is needed because when we are showing the template in post editor we\n\t\t// want to show the real breadcrumbs if we have the post type.\n\t\t( templateSlug && ! postType ) ||\n\t\t( ! _showTerms && ! isPostTypeHierarchical ) ||\n\t\t( _showTerms && ! hasTermsAssigned );\n\tif ( showPlaceholder ) {\n\t\tconst placeholderItems = [];\n\t\tif ( showHomeItem ) {\n\t\t\tplaceholderItems.push( __( 'Home' ) );\n\t\t}\n\t\tif ( templateSlug && ! postId ) {\n\t\t\tplaceholderItems.push( __( 'Page' ) );\n\t\t} else if ( _showTerms ) {\n\t\t\tplaceholderItems.push( __( 'Category' ) );\n\t\t} else {\n\t\t\tplaceholderItems.push( __( 'Ancestor' ), __( 'Parent' ) );\n\t\t}\n\t\tplaceholder = (\n\t\t\t<nav\n\t\t\t\t{ ...blockProps }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--separator': `\"${ separator\n\t\t\t\t\t\t.replace( /\\\\/g, '\\\\\\\\' )\n\t\t\t\t\t\t.replace( /\"/g, '\\\\\"' ) }\"`,\n\t\t\t\t\t...blockProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ol>\n\t\t\t\t\t{ placeholderItems.map( ( text, index ) => (\n\t\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t\t<a href={ `#breadcrumbs-pseudo-link-${ index }` }>\n\t\t\t\t\t\t\t\t{ text }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ showCurrentItem && (\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span aria-current=\"page\">{ __( 'Current' ) }</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) }\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tseparator: separatorDefaultValue,\n\t\t\t\t\t\t\tshowHomeItem: true,\n\t\t\t\t\t\t\tshowCurrentItem: true,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showHomeItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowHomeItem: true,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showHomeItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showHomeItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showCurrentItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCurrentItem: true,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showCurrentItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showCurrentItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => separator !== separatorDefaultValue }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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\t\t<TextControl\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\t\tvalue={ separator }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { separator: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tif ( ! separator ) {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Show on homepage' ) }\n\t\t\t\t\tchecked={ showOnHomePage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showOnHomePage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'If this Breadcrumbs block appears in a template or template part that’s shown on the homepage, enable this option to display the breadcrumb trail. Otherwise, this setting has no effect.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Prefer taxonomy terms' ) }\n\t\t\t\t\tchecked={ prefersTaxonomy }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { prefersTaxonomy: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The exact type of breadcrumbs shown will vary automatically depending on the page in which this block is displayed. In the specific case of a hierarchical post type with taxonomies, the breadcrumbs can either reflect its post hierarchy (default) or the hierarchy of its assigned taxonomy terms.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ status === 'loading' &&\n\t\t\t\t! showPlaceholder &&\n\t\t\t\t( prevContentRef.current ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\t...blockProps,\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...blockProps.style,\n\t\t\t\t\t\t\t\topacity: showLoader ? 0.3 : 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thtml={ prevContentRef.current }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t{ status === 'error' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: error message returned when rendering the block. */\n\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\terror\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ showPlaceholder && placeholder }\n\t\t\t{ ! showPlaceholder && status === 'success' && (\n\t\t\t\t<HtmlRenderer wrapperProps={ blockProps } html={ content } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,0BAAiD;AACjD,wBAOO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA4C;AAC5C,gCAAoC;AACpC,qBAA4B;AAC5B,mBAA+C;AAC/C,2BAAyB;AAiHrB;AA/GJ,IAAM,wBAAwB;AAEf,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,EAAE,QAAQ,UAAU,aAAa;AAC3C,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AACJ,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;AAAA,IACH,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO,CAAC;AAAA,MACT;AACA,YAAM,QAAQ,OAAQ,iBAAAA,KAAU,EAAE;AAAA,QACjC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,YAAM,iBAAiB,OAAQ,iBAAAA,KAAU,EAAE,YAAa,QAAS;AACjE,YAAM,yBACL,kBAAkB,eAAe,WAAW;AAC7C,UAAI;A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,IAEC,mBAAmB;AAAA,IACnB,CAAE,mBAAmB,WAAW,aACjC,4CAAC,qBAAAA,SAAA,EAAa,cAAe,YAAa,MAAO,SAAU;AAAA,KAE7D;AAEF;",
|
|
6
|
-
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "HtmlRenderer"]
|
|
4
|
+
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl as WCCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tname,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t\turlQueryArgs: { post_id: postId, invalidationKey },\n\t} );\n\tconst prevContentRef = useRef( '' );\n\tuseEffect( () => {\n\t\tif ( status === 'success' ) {\n\t\t\tprevContentRef.current = content;\n\t\t}\n\t}, [ content, status ] );\n\tconst [ showLoader, setShowLoader ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( status !== 'loading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetShowLoader( true );\n\t\t}, 400 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t\tsetShowLoader( false );\n\t\t};\n\t}, [ status ] );\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Try to determine breadcrumb type for more accurate previews.\n\tlet _showTerms;\n\t// Some non-hierarchical post types (e.g., attachments) can have parents.\n\t// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.\n\tif ( ! isPostTypeHierarchical && ! post?.parent ) {\n\t\t_showTerms = true;\n\t} else if ( ! postTypeHasTaxonomies ) {\n\t\t// Hierarchical post type without taxonomies can only use ancestors.\n\t\t_showTerms = false;\n\t} else {\n\t\t// For hierarchical post types with taxonomies, use the attribute.\n\t\t_showTerms = prefersTaxonomy;\n\t}\n\tlet placeholder = null;\n\t// This is fragile because this block is server side rendered and we'll have to\n\t// update the placeholder html if the server side rendering output changes.\n\tconst showPlaceholder =\n\t\t! postId ||\n\t\t! postType ||\n\t\t// When `templateSlug` is set only show placeholder if the post type is not.\n\t\t// This is needed because when we are showing the template in post editor we\n\t\t// want to show the real breadcrumbs if we have the post type.\n\t\t( templateSlug && ! postType ) ||\n\t\t( ! _showTerms && ! isPostTypeHierarchical ) ||\n\t\t( _showTerms && ! hasTermsAssigned );\n\tif ( showPlaceholder ) {\n\t\tconst placeholderItems = [];\n\t\tif ( showHomeItem ) {\n\t\t\tplaceholderItems.push( __( 'Home' ) );\n\t\t}\n\t\tif ( templateSlug && ! postId ) {\n\t\t\tplaceholderItems.push( __( 'Page' ) );\n\t\t} else if ( _showTerms ) {\n\t\t\tplaceholderItems.push( __( 'Category' ) );\n\t\t} else {\n\t\t\tplaceholderItems.push( __( 'Ancestor' ), __( 'Parent' ) );\n\t\t}\n\t\tplaceholder = (\n\t\t\t<nav\n\t\t\t\t{ ...blockProps }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--separator': `\"${ separator\n\t\t\t\t\t\t.replace( /\\\\/g, '\\\\\\\\' )\n\t\t\t\t\t\t.replace( /\"/g, '\\\\\"' ) }\"`,\n\t\t\t\t\t...blockProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ol>\n\t\t\t\t\t{ placeholderItems.map( ( text, index ) => (\n\t\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t\t<a href={ `#breadcrumbs-pseudo-link-${ index }` }>\n\t\t\t\t\t\t\t\t{ text }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ showCurrentItem && (\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span aria-current=\"page\">{ __( 'Current' ) }</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) }\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tseparator: separatorDefaultValue,\n\t\t\t\t\t\t\tshowHomeItem: true,\n\t\t\t\t\t\t\tshowCurrentItem: true,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showHomeItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowHomeItem: true,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showHomeItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showHomeItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showCurrentItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCurrentItem: true,\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\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showCurrentItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showCurrentItem }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => separator !== separatorDefaultValue }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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\t\t<TextControl\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\t\tvalue={ separator }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { separator: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tif ( ! separator ) {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<WCCheckboxControl\n\t\t\t\t\tlabel={ __( 'Show on homepage' ) }\n\t\t\t\t\tchecked={ showOnHomePage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showOnHomePage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'If this Breadcrumbs block appears in a template or template part that’s shown on the homepage, enable this option to display the breadcrumb trail. Otherwise, this setting has no effect.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<WCCheckboxControl\n\t\t\t\t\tlabel={ __( 'Prefer taxonomy terms' ) }\n\t\t\t\t\tchecked={ prefersTaxonomy }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { prefersTaxonomy: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The exact type of breadcrumbs shown will vary automatically depending on the page in which this block is displayed. In the specific case of a hierarchical post type with taxonomies, the breadcrumbs can either reflect its post hierarchy (default) or the hierarchy of its assigned taxonomy terms.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ status === 'loading' &&\n\t\t\t\t! showPlaceholder &&\n\t\t\t\t( prevContentRef.current ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\t...blockProps,\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...blockProps.style,\n\t\t\t\t\t\t\t\topacity: showLoader ? 0.3 : 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thtml={ prevContentRef.current }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t{ status === 'error' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: error message returned when rendering the block. */\n\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\terror\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ showPlaceholder && placeholder }\n\t\t\t{ ! showPlaceholder && status === 'success' && (\n\t\t\t\t<HtmlRenderer wrapperProps={ blockProps } html={ content } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,0BAAiD;AACjD,wBAOO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA4C;AAC5C,gCAAoC;AACpC,qBAA4B;AAC5B,mBAA+C;AAC/C,2BAAyB;AAiHrB;AA/GJ,IAAM,wBAAwB;AAEf,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,EAAE,QAAQ,UAAU,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A,UAE3C,UAAO;AAAA,YACN;AAAA,UACD;AAAA;AAAA,MACD;AAAA,OACD;AAAA,IACE,WAAW,aACZ,CAAE,oBACA,eAAe,UAChB;AAAA,MAAC,qBAAAC;AAAA,MAAA;AAAA,QACA,cAAe;AAAA,UACd,GAAG;AAAA,UACH,OAAO;AAAA,YACN,GAAG,WAAW;AAAA,YACd,SAAS,aAAa,MAAM;AAAA,UAC7B;AAAA,QACD;AAAA,QACA,MAAO,eAAe;AAAA;AAAA,IACvB,IAEA,4CAAC,SAAM,GAAG,YACT,sDAAC,6BAAQ,GACV;AAAA,IAEA,WAAW,WACZ,4CAAC,SAAM,GAAG,YACT,sDAAC,OACE;AAAA;AAAA,UAED,gBAAI,WAAY;AAAA,MAChB;AAAA,IACD,GACD,GACD;AAAA,IAEC,mBAAmB;AAAA,IACnB,CAAE,mBAAmB,WAAW,aACjC,4CAAC,qBAAAA,SAAA,EAAa,cAAe,YAAa,MAAO,SAAU;AAAA,KAE7D;AAEF;",
|
|
6
|
+
"names": ["coreStore", "ToolsPanel", "ToolsPanelItem", "WCCheckboxControl", "HtmlRenderer"]
|
|
7
7
|
}
|
package/build/button/block.json
CHANGED
|
@@ -70,6 +70,12 @@
|
|
|
70
70
|
"splitting": true,
|
|
71
71
|
"align": false,
|
|
72
72
|
"alignWide": false,
|
|
73
|
+
"background": {
|
|
74
|
+
"backgroundImage": true,
|
|
75
|
+
"backgroundSize": true,
|
|
76
|
+
"gradient": true,
|
|
77
|
+
"__experimentalSkipSerialization": true
|
|
78
|
+
},
|
|
73
79
|
"color": {
|
|
74
80
|
"__experimentalSkipSerialization": true,
|
|
75
81
|
"gradients": true,
|
package/build/button/edit.cjs
CHANGED
|
@@ -151,6 +151,7 @@ function ButtonEdit(props) {
|
|
|
151
151
|
const colorProps = (0, import_block_editor.__experimentalUseColorProps)(attributes);
|
|
152
152
|
const spacingProps = (0, import_block_editor.__experimentalGetSpacingClassesAndStyles)(attributes);
|
|
153
153
|
const shadowProps = (0, import_block_editor.__experimentalGetShadowClassesAndStyles)(attributes);
|
|
154
|
+
const backgroundProps = (0, import_block_editor.useBackgroundProps)(attributes);
|
|
154
155
|
const dimensionsProps = (0, import_block_editor.__experimentalGetDimensionsClassesAndStyles)(attributes);
|
|
155
156
|
const ref = (0, import_element.useRef)();
|
|
156
157
|
const richTextRef = (0, import_element.useRef)();
|
|
@@ -309,6 +310,7 @@ function ButtonEdit(props) {
|
|
|
309
310
|
className,
|
|
310
311
|
"wp-block-button__link",
|
|
311
312
|
colorProps.className,
|
|
313
|
+
backgroundProps.className,
|
|
312
314
|
borderProps.className,
|
|
313
315
|
typographyProps.className,
|
|
314
316
|
{
|
|
@@ -322,6 +324,7 @@ function ButtonEdit(props) {
|
|
|
322
324
|
style: {
|
|
323
325
|
...borderProps.style,
|
|
324
326
|
...colorProps.style,
|
|
327
|
+
...backgroundProps.style,
|
|
325
328
|
...spacingProps.style,
|
|
326
329
|
...shadowProps.style,
|
|
327
330
|
...typographyProps.style,
|
|
@@ -338,14 +341,14 @@ function ButtonEdit(props) {
|
|
|
338
341
|
import_components.ToolbarButton,
|
|
339
342
|
{
|
|
340
343
|
name: "link",
|
|
341
|
-
icon:
|
|
342
|
-
title:
|
|
343
|
-
shortcut:
|
|
344
|
-
onClick:
|
|
344
|
+
icon: import_icons.link,
|
|
345
|
+
title: (0, import_i18n.__)("Link"),
|
|
346
|
+
shortcut: import_keycodes.displayShortcut.primary("k"),
|
|
347
|
+
onClick: () => setIsEditingURL(!isEditingURL),
|
|
345
348
|
isActive: isURLSet
|
|
346
349
|
}
|
|
347
350
|
) }),
|
|
348
|
-
isLinkTag && isSelected &&
|
|
351
|
+
isLinkTag && isSelected && isEditingURL && !lockUrlControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
349
352
|
import_components.Popover,
|
|
350
353
|
{
|
|
351
354
|
placement: "bottom",
|
|
@@ -377,7 +380,7 @@ function ButtonEdit(props) {
|
|
|
377
380
|
unlink();
|
|
378
381
|
richTextRef.current?.focus();
|
|
379
382
|
},
|
|
380
|
-
forceIsEditingLink:
|
|
383
|
+
forceIsEditingLink: !isURLSet,
|
|
381
384
|
settings: LINK_SETTINGS,
|
|
382
385
|
createSuggestion: createPageEntity && handleCreate,
|
|
383
386
|
withCreateSuggestion: userCanCreatePages,
|