@wordpress/block-library 11.1.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 +32 -0
- package/build/accordion-heading/block.json +1 -0
- package/build/archives/block.json +3 -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/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 +6 -1
- package/build/code/block.json +4 -0
- package/build/column/edit.cjs +5 -0
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/block.json +4 -0
- package/build/columns/edit.cjs +21 -112
- package/build/columns/edit.cjs.map +3 -3
- package/build/comments/edit/placeholder.cjs +95 -87
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/comments-pagination/block.json +11 -0
- package/build/cover/block.json +2 -1
- package/build/cover/edit/index.cjs +26 -5
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +4 -1
- 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 +3 -0
- package/build/embed/block.json +6 -1
- package/build/file/block.json +5 -0
- package/build/footnotes/block.json +4 -0
- package/build/gallery/block.json +13 -0
- package/build/gallery/dynamic-gallery.cjs +32 -93
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +103 -40
- 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/edit.cjs +3 -3
- package/build/group/edit.cjs.map +2 -2
- package/build/heading/block.json +5 -0
- package/build/home-link/block.json +12 -0
- 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/use-open-image-media-editor-modal.cjs +32 -28
- 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 +10 -0
- package/build/latest-posts/block.json +4 -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 +4 -0
- package/build/math/block.json +4 -0
- package/build/media-text/block.json +18 -0
- 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/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/page-list/block.json +4 -0
- package/build/paragraph/block.json +1 -0
- package/build/post-author-biography/block.json +1 -0
- package/build/post-comments-form/block.json +5 -0
- package/build/post-content/block.json +2 -1
- package/build/post-excerpt/block.json +4 -0
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/edit.cjs +1 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/block.json +4 -0
- package/build/post-time-to-read/block.json +4 -0
- package/build/post-title/block.json +4 -0
- package/build/preformatted/block.json +4 -0
- package/build/pullquote/block.json +2 -1
- package/build/query-no-results/block.json +4 -0
- package/build/query-pagination/block.json +17 -0
- package/build/query-total/block.json +4 -0
- package/build/quote/block.json +2 -0
- package/build/read-more/block.json +5 -0
- package/build/rss/block.json +4 -0
- package/build/search/block.json +2 -1
- package/build/site-tagline/block.json +4 -0
- package/build/site-title/block.json +4 -0
- package/build/social-links/block.json +1 -0
- 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-panels/block.json +3 -0
- package/build/tabs/block.json +3 -0
- package/build/term-count/block.json +5 -0
- package/build/term-description/block.json +4 -0
- package/build/term-name/block.json +6 -1
- package/build/term-template/block.json +4 -0
- 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 +7 -1
- package/build/video/edit.cjs +10 -2
- package/build/video/edit.cjs.map +2 -2
- package/build-module/accordion-heading/block.json +1 -0
- package/build-module/archives/block.json +3 -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/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 +6 -1
- package/build-module/code/block.json +4 -0
- package/build-module/column/edit.mjs +5 -0
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/block.json +4 -0
- package/build-module/columns/edit.mjs +22 -122
- package/build-module/columns/edit.mjs.map +2 -2
- 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 +11 -0
- package/build-module/cover/block.json +2 -1
- package/build-module/cover/edit/index.mjs +32 -6
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +5 -2
- 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 +3 -0
- package/build-module/embed/block.json +6 -1
- package/build-module/file/block.json +5 -0
- package/build-module/footnotes/block.json +4 -0
- package/build-module/gallery/block.json +13 -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 +110 -42
- 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/edit.mjs +4 -4
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/heading/block.json +5 -0
- package/build-module/home-link/block.json +12 -0
- 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/use-open-image-media-editor-modal.mjs +32 -28
- 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 +10 -0
- package/build-module/latest-posts/block.json +4 -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 +4 -0
- package/build-module/math/block.json +4 -0
- package/build-module/media-text/block.json +18 -0
- 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/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/page-list/block.json +4 -0
- package/build-module/paragraph/block.json +1 -0
- package/build-module/post-author-biography/block.json +1 -0
- package/build-module/post-comments-form/block.json +5 -0
- package/build-module/post-content/block.json +2 -1
- package/build-module/post-excerpt/block.json +4 -0
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/edit.mjs +1 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/block.json +4 -0
- package/build-module/post-time-to-read/block.json +4 -0
- package/build-module/post-title/block.json +4 -0
- package/build-module/preformatted/block.json +4 -0
- package/build-module/pullquote/block.json +2 -1
- package/build-module/query-no-results/block.json +4 -0
- package/build-module/query-pagination/block.json +17 -0
- package/build-module/query-total/block.json +4 -0
- package/build-module/quote/block.json +2 -0
- package/build-module/read-more/block.json +5 -0
- package/build-module/rss/block.json +4 -0
- package/build-module/search/block.json +2 -1
- package/build-module/site-tagline/block.json +4 -0
- package/build-module/site-title/block.json +4 -0
- package/build-module/social-links/block.json +1 -0
- 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-panels/block.json +3 -0
- package/build-module/tabs/block.json +3 -0
- package/build-module/term-count/block.json +5 -0
- package/build-module/term-description/block.json +4 -0
- package/build-module/term-name/block.json +6 -1
- package/build-module/term-template/block.json +4 -0
- 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 +7 -1
- package/build-module/video/edit.mjs +10 -2
- package/build-module/video/edit.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 +11 -4
- package/build-style/editor.css +11 -4
- 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/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/query-pagination/style-rtl.css +3 -0
- package/build-style/query-pagination/style.css +3 -0
- package/build-style/style-rtl.css +70 -9
- package/build-style/style.css +73 -10
- 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 +44 -41
- package/src/accordion-heading/README.md +1 -0
- package/src/accordion-heading/block.json +1 -0
- package/src/archives/README.md +2 -0
- package/src/archives/block.json +3 -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/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 +4 -0
- package/src/buttons/block.json +6 -1
- package/src/code/README.md +3 -0
- package/src/code/block.json +4 -0
- package/src/column/edit.jsx +6 -0
- package/src/columns/README.md +3 -0
- package/src/columns/block.json +4 -0
- package/src/columns/edit.jsx +1 -131
- package/src/comments/edit/placeholder.jsx +5 -1
- package/src/comments-pagination/README.md +4 -0
- package/src/comments-pagination/block.json +11 -0
- package/src/comments-pagination/style.scss +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 +38 -6
- package/src/cover/edit/inspector-controls.jsx +10 -1
- package/src/cover/embed-video-utils.js +18 -10
- package/src/cover/index.php +44 -15
- package/src/cover/test/edit.browser.test.js +182 -2
- package/src/cover/test/embed-video-utils.test.js +48 -0
- package/src/cover/view.js +22 -0
- package/src/details/README.md +2 -0
- package/src/details/block.json +3 -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 +4 -0
- package/src/file/block.json +5 -0
- package/src/footnotes/README.md +3 -0
- package/src/footnotes/block.json +4 -0
- package/src/gallery/README.md +13 -0
- package/src/gallery/block.json +13 -0
- package/src/gallery/dynamic-gallery.jsx +11 -91
- package/src/gallery/edit.jsx +146 -47
- 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/edit.jsx +5 -5
- package/src/heading/README.md +4 -0
- package/src/heading/block.json +5 -0
- package/src/home-link/README.md +6 -0
- package/src/home-link/block.json +12 -0
- package/src/icon/components/custom-inserter/index.jsx +5 -1
- package/src/icon/edit.jsx +68 -7
- package/src/icon/index.php +1 -1
- 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 +122 -60
- package/src/image/use-open-image-media-editor-modal.js +37 -41
- package/src/image/view.js +64 -68
- package/src/latest-comments/README.md +3 -0
- package/src/latest-comments/block.json +10 -0
- package/src/latest-posts/README.md +3 -0
- package/src/latest-posts/block.json +4 -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 +3 -0
- package/src/loginout/block.json +4 -0
- package/src/math/README.md +3 -0
- package/src/math/block.json +4 -0
- package/src/media-text/README.md +17 -0
- package/src/media-text/block.json +18 -0
- package/src/media-text/style.scss +5 -1
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +1 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/link-ui/index.jsx +60 -27
- package/src/navigation-link/link-ui/test/get-suggestions-query.jsdom.test.js +67 -0
- 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/use-block-suggestions.js +192 -0
- package/src/page-list/README.md +3 -0
- package/src/page-list/block.json +4 -0
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/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 +1 -0
- package/src/post-author-biography/block.json +1 -0
- package/src/post-comments-form/README.md +3 -0
- package/src/post-comments-form/block.json +5 -0
- package/src/post-content/README.md +1 -0
- package/src/post-content/block.json +2 -1
- package/src/post-excerpt/README.md +3 -0
- package/src/post-excerpt/block.json +4 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/edit.jsx +2 -2
- package/src/post-terms/README.md +3 -0
- package/src/post-terms/block.json +4 -0
- package/src/post-time-to-read/README.md +3 -0
- package/src/post-time-to-read/block.json +4 -0
- package/src/post-title/README.md +3 -0
- package/src/post-title/block.json +4 -0
- package/src/preformatted/README.md +3 -0
- package/src/preformatted/block.json +4 -0
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +2 -1
- package/src/query-no-results/README.md +3 -0
- package/src/query-no-results/block.json +4 -0
- package/src/query-pagination/README.md +4 -0
- package/src/query-pagination/block.json +17 -0
- package/src/query-pagination/style.scss +3 -0
- package/src/query-total/README.md +3 -0
- package/src/query-total/block.json +4 -0
- package/src/quote/README.md +2 -0
- package/src/quote/block.json +2 -0
- package/src/read-more/README.md +3 -0
- package/src/read-more/block.json +5 -0
- package/src/rss/README.md +3 -0
- package/src/rss/block.json +4 -0
- package/src/search/README.md +1 -0
- package/src/search/block.json +2 -1
- package/src/site-tagline/README.md +3 -0
- package/src/site-tagline/block.json +4 -0
- package/src/site-title/README.md +3 -0
- package/src/site-title/block.json +4 -0
- package/src/social-links/README.md +1 -0
- package/src/social-links/block.json +1 -0
- 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-panels/README.md +2 -0
- package/src/tab-panels/block.json +3 -0
- package/src/table/editor.scss +8 -2
- package/src/table/style.scss +4 -4
- package/src/tabs/README.md +2 -0
- package/src/tabs/block.json +3 -0
- package/src/tag-cloud/style.scss +1 -1
- package/src/template-part/index.php +16 -3
- package/src/term-count/README.md +4 -0
- package/src/term-count/block.json +5 -0
- package/src/term-description/README.md +3 -0
- package/src/term-description/block.json +4 -0
- package/src/term-name/README.md +4 -0
- package/src/term-name/block.json +6 -1
- package/src/term-template/README.md +3 -0
- package/src/term-template/block.json +4 -0
- 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 +4 -0
- package/src/video/block.json +7 -1
- package/src/video/edit.jsx +13 -2
- package/build/columns/utils.cjs +0 -112
- package/build/columns/utils.cjs.map +0 -7
- package/build-module/columns/utils.mjs +0 -78
- package/build-module/columns/utils.mjs.map +0 -7
- package/src/columns/test/utils.js +0 -331
- package/src/columns/utils.js +0 -176
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
LinkControl,
|
|
18
18
|
__experimentalUseBorderProps as useBorderProps,
|
|
19
19
|
__experimentalUseColorProps as useColorProps,
|
|
20
|
+
useBackgroundProps,
|
|
20
21
|
__experimentalGetSpacingClassesAndStyles as useSpacingProps,
|
|
21
22
|
__experimentalGetShadowClassesAndStyles as useShadowProps,
|
|
22
23
|
__experimentalGetDimensionsClassesAndStyles as useDimensionsProps,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
privateApis as blockEditorPrivateApis
|
|
29
30
|
} from "@wordpress/block-editor";
|
|
30
31
|
import { displayShortcut, isKeyboardEvent, ENTER } from "@wordpress/keycodes";
|
|
31
|
-
import { link
|
|
32
|
+
import { link } from "@wordpress/icons";
|
|
32
33
|
import {
|
|
33
34
|
createBlock,
|
|
34
35
|
cloneBlock,
|
|
@@ -149,6 +150,7 @@ function ButtonEdit(props) {
|
|
|
149
150
|
const colorProps = useColorProps(attributes);
|
|
150
151
|
const spacingProps = useSpacingProps(attributes);
|
|
151
152
|
const shadowProps = useShadowProps(attributes);
|
|
153
|
+
const backgroundProps = useBackgroundProps(attributes);
|
|
152
154
|
const dimensionsProps = useDimensionsProps(attributes);
|
|
153
155
|
const ref = useRef();
|
|
154
156
|
const richTextRef = useRef();
|
|
@@ -307,6 +309,7 @@ function ButtonEdit(props) {
|
|
|
307
309
|
className,
|
|
308
310
|
"wp-block-button__link",
|
|
309
311
|
colorProps.className,
|
|
312
|
+
backgroundProps.className,
|
|
310
313
|
borderProps.className,
|
|
311
314
|
typographyProps.className,
|
|
312
315
|
{
|
|
@@ -320,6 +323,7 @@ function ButtonEdit(props) {
|
|
|
320
323
|
style: {
|
|
321
324
|
...borderProps.style,
|
|
322
325
|
...colorProps.style,
|
|
326
|
+
...backgroundProps.style,
|
|
323
327
|
...spacingProps.style,
|
|
324
328
|
...shadowProps.style,
|
|
325
329
|
...typographyProps.style,
|
|
@@ -336,14 +340,14 @@ function ButtonEdit(props) {
|
|
|
336
340
|
ToolbarButton,
|
|
337
341
|
{
|
|
338
342
|
name: "link",
|
|
339
|
-
icon:
|
|
340
|
-
title:
|
|
341
|
-
shortcut:
|
|
342
|
-
onClick:
|
|
343
|
+
icon: link,
|
|
344
|
+
title: __("Link"),
|
|
345
|
+
shortcut: displayShortcut.primary("k"),
|
|
346
|
+
onClick: () => setIsEditingURL(!isEditingURL),
|
|
343
347
|
isActive: isURLSet
|
|
344
348
|
}
|
|
345
349
|
) }),
|
|
346
|
-
isLinkTag && isSelected &&
|
|
350
|
+
isLinkTag && isSelected && isEditingURL && !lockUrlControls && /* @__PURE__ */ jsx(
|
|
347
351
|
Popover,
|
|
348
352
|
{
|
|
349
353
|
placement: "bottom",
|
|
@@ -375,7 +379,7 @@ function ButtonEdit(props) {
|
|
|
375
379
|
unlink();
|
|
376
380
|
richTextRef.current?.focus();
|
|
377
381
|
},
|
|
378
|
-
forceIsEditingLink:
|
|
382
|
+
forceIsEditingLink: !isURLSet,
|
|
379
383
|
settings: LINK_SETTINGS,
|
|
380
384
|
createSuggestion: createPageEntity && handleCreate,
|
|
381
385
|
withCreateSuggestion: userCanCreatePages,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/button/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { TextControl, ToolbarButton, Popover } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetDimensionsClassesAndStyles as useDimensionsProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link, linkOff } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport {\n\tuseMergeRefs,\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Link } from '@wordpress/ui';\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { unlock } from '../lock-unlock';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\nimport { getWidthClasses, isPercentageWidth } from './utils';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlock,\n\t\tgetBlockAttributes,\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t} = useSelect( blockEditorStore );\n\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { text } = getBlockAttributes( clientId ) ?? {};\n\t\t\tif ( text?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\t// Capture phase so we run before writing-flow's ancestor-bubble\n\t\t// keydown handlers that gate on `event.defaultPrevented`.\n\t\treturn subscribeDelegatedListener(\n\t\t\telement,\n\t\t\t'keydown',\n\t\t\tonKeyDown,\n\t\t\ttrue\n\t\t);\n\t}, [] );\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\tmetadata,\n\t} = attributes;\n\tconst width = style?.dimensions?.width;\n\n\tuseDeprecatedTextAlign( props );\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\n\t\t}\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tconst {\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tlockUrlControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcreatePageEntity: _settings.__experimentalCreatePageEntity,\n\t\t\t\tuserCanCreatePages: _settings.__experimentalUserCanCreatePages,\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await createPageEntity( {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: page.type,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tfunction createButtonText( searchTerm ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create page: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( clientId );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst [ fluidTypographySettings, layout, dimensionSizes ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout',\n\t\t'dimensions.dimensionSizes'\n\t);\n\tconst dimensionPresets = useMemo( () => {\n\t\tif ( ! dimensionSizes ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...( dimensionSizes?.custom ?? [] ),\n\t\t\t...( dimensionSizes?.theme ?? [] ),\n\t\t\t...( dimensionSizes?.default ?? [] ),\n\t\t];\n\t}, [ dimensionSizes ] );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\t// Resolve preset dimension references to their actual values.\n\tconst resolvedWidth = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst presetPrefix = 'var:preset|dimension|';\n\t\tif ( width.startsWith( presetPrefix ) ) {\n\t\t\tconst slug = width.slice( presetPrefix.length );\n\t\t\tconst preset = dimensionPresets?.find( ( p ) => p.slug === slug );\n\t\t\treturn preset?.size ?? width;\n\t\t}\n\t\treturn width;\n\t}, [ width, dimensionPresets ] );\n\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst hasBlockControls =\n\t\thasNonContentControls || ( isLinkTag && ! lockUrlControls );\n\tconst classes = clsx(\n\t\tblockProps.className,\n\t\tgetWidthClasses( resolvedWidth )\n\t);\n\n\tconst widthStyle = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn {};\n\t\t}\n\t\tif ( isPercentageWidth( resolvedWidth ) ) {\n\t\t\treturn {\n\t\t\t\t'--wp--block-button--width': parseFloat( resolvedWidth ),\n\t\t\t};\n\t\t}\n\t\treturn dimensionsProps.style;\n\t}, [ width, resolvedWidth, dimensionsProps.style ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classes }\n\t\t\t\tstyle={ { ...blockProps.style, ...widthStyle } }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ hasBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ ! isURLSet ? link : linkOff }\n\t\t\t\t\t\t\ttitle={ ! isURLSet ? __( 'Link' ) : __( 'Unlink' ) }\n\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t! isURLSet\n\t\t\t\t\t\t\t\t\t? displayShortcut.primary( 'k' )\n\t\t\t\t\t\t\t\t\t: displayShortcut.primaryShift( 'k' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ ! isURLSet ? startEditing : unlink }\n\t\t\t\t\t\t\tisActive={ isURLSet }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isLinkTag &&\n\t\t\t\tisSelected &&\n\t\t\t\t( isEditingURL || isURLSet ) &&\n\t\t\t\t! lockUrlControls && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\t\tshift\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\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\tonRemove={ () => {\n\t\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tforceIsEditingLink={ isEditingURL }\n\t\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\t\tcreateSuggestion={\n\t\t\t\t\t\t\t\tcreatePageEntity && handleCreate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreatePages }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={ createButtonText }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<a>)' ), value: 'a' },\n\t\t\t\t\t\t{ label: '<button>', value: 'button' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\thref=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\"\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\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,eAAe,eAAe;AACpD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,4CAA4C;AAAA,EAC5C,2CAA2C;AAAA,EAC3C,+CAA+C;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,iCAAiC;AAAA,EACjC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,iBAAiB,iBAAiB,aAAa;AACxD,SAAS,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { TextControl, ToolbarButton, Popover } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tLinkControl,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tuseBackgroundProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\t__experimentalGetShadowClassesAndStyles as useShadowProps,\n\t__experimentalGetDimensionsClassesAndStyles as useDimensionsProps,\n\t__experimentalGetElementClassName,\n\tstore as blockEditorStore,\n\tuseBlockEditingMode,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { link } from '@wordpress/icons';\nimport {\n\tcreateBlock,\n\tcloneBlock,\n\tgetDefaultBlockName,\n\tgetBlockBindingsSource,\n} from '@wordpress/blocks';\nimport {\n\tuseMergeRefs,\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Link } from '@wordpress/ui';\nimport { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';\nimport { getUpdatedLinkAttributes } from './get-updated-link-attributes';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { unlock } from '../lock-unlock';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\nimport { getWidthClasses, isPercentageWidth } from './utils';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\nconst LINK_SETTINGS = [\n\t...LinkControl.DEFAULT_LINK_SETTINGS,\n\t{\n\t\tid: 'nofollow',\n\t\ttitle: __( 'Mark as nofollow' ),\n\t},\n];\n\nfunction useEnter( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlock,\n\t\tgetBlockAttributes,\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t} = useSelect( blockEditorStore );\n\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { text } = getBlockAttributes( clientId ) ?? {};\n\t\t\tif ( text?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\tconst after = topParentListBlock.innerBlocks.slice(\n\t\t\t\tblockIndex + 1\n\t\t\t);\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\t// Capture phase so we run before writing-flow's ancestor-bubble\n\t\t// keydown handlers that gate on `event.defaultPrevented`.\n\t\treturn subscribeDelegatedListener(\n\t\t\telement,\n\t\t\t'keydown',\n\t\t\tonKeyDown,\n\t\t\ttrue\n\t\t);\n\t}, [] );\n}\n\nfunction ButtonEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tclassName,\n\t\tisSelected,\n\t\tonReplace,\n\t\tmergeBlocks,\n\t\tclientId,\n\t\tcontext,\n\t} = props;\n\tconst {\n\t\ttagName,\n\t\tlinkTarget,\n\t\tplaceholder,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\turl,\n\t\tmetadata,\n\t} = attributes;\n\tconst width = style?.dimensions?.width;\n\n\tuseDeprecatedTextAlign( props );\n\n\tconst TagName = tagName || 'a';\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tstartEditing( event );\n\t\t} else if ( isKeyboardEvent.primaryShift( event, 'k' ) ) {\n\t\t\tunlink();\n\t\t\trichTextRef.current?.focus();\n\t\t}\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst shadowProps = useShadowProps( attributes );\n\tconst backgroundProps = useBackgroundProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\tconst ref = useRef();\n\tconst richTextRef = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonKeyDown,\n\t} );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst isURLSet = !! url;\n\tconst opensInNewTab = linkTarget === NEW_TAB_TARGET;\n\tconst nofollow = !! rel?.includes( NOFOLLOW_REL );\n\tconst isLinkTag = 'a' === TagName;\n\n\tconst {\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tlockUrlControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcreatePageEntity: _settings.__experimentalCreatePageEntity,\n\t\t\t\tuserCanCreatePages: _settings.__experimentalUserCanCreatePages,\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSelected, metadata?.bindings?.url ]\n\t);\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst page = await createPageEntity( {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: page.type,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tfunction createButtonText( searchTerm ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create page: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\tfunction startEditing( event ) {\n\t\tevent.preventDefault();\n\t\tsetIsEditingURL( true );\n\t}\n\n\tfunction unlink() {\n\t\tsetAttributes( {\n\t\t\turl: undefined,\n\t\t\tlinkTarget: undefined,\n\t\t\trel: undefined,\n\t\t} );\n\t\tsetIsEditingURL( false );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingURL( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// Memoize link value to avoid overriding the LinkControl's internal state.\n\t// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.\n\tconst linkValue = useMemo(\n\t\t() => ( { url, opensInNewTab, nofollow } ),\n\t\t[ url, opensInNewTab, nofollow ]\n\t);\n\n\tconst useEnterRef = useEnter( clientId );\n\tconst mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );\n\n\tconst [ fluidTypographySettings, layout, dimensionSizes ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout',\n\t\t'dimensions.dimensionSizes'\n\t);\n\tconst dimensionPresets = useMemo( () => {\n\t\tif ( ! dimensionSizes ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...( dimensionSizes?.custom ?? [] ),\n\t\t\t...( dimensionSizes?.theme ?? [] ),\n\t\t\t...( dimensionSizes?.default ?? [] ),\n\t\t];\n\t}, [ dimensionSizes ] );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\t// Resolve preset dimension references to their actual values.\n\tconst resolvedWidth = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst presetPrefix = 'var:preset|dimension|';\n\t\tif ( width.startsWith( presetPrefix ) ) {\n\t\t\tconst slug = width.slice( presetPrefix.length );\n\t\t\tconst preset = dimensionPresets?.find( ( p ) => p.slug === slug );\n\t\t\treturn preset?.size ?? width;\n\t\t}\n\t\treturn width;\n\t}, [ width, dimensionPresets ] );\n\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst hasBlockControls =\n\t\thasNonContentControls || ( isLinkTag && ! lockUrlControls );\n\tconst classes = clsx(\n\t\tblockProps.className,\n\t\tgetWidthClasses( resolvedWidth )\n\t);\n\n\tconst widthStyle = useMemo( () => {\n\t\tif ( ! width ) {\n\t\t\treturn {};\n\t\t}\n\t\tif ( isPercentageWidth( resolvedWidth ) ) {\n\t\t\treturn {\n\t\t\t\t'--wp--block-button--width': parseFloat( resolvedWidth ),\n\t\t\t};\n\t\t}\n\t\treturn dimensionsProps.style;\n\t}, [ width, resolvedWidth, dimensionsProps.style ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classes }\n\t\t\t\tstyle={ { ...blockProps.style, ...widthStyle } }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ mergedRef }\n\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'Add text…' ) }\n\t\t\t\t\tvalue={ text }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttext: removeAnchorTag( value ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-button__link',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tbackgroundProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\ttypographyProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// For backwards compatibility add style that isn't\n\t\t\t\t\t\t\t// provided via block support.\n\t\t\t\t\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t\t\t\t\t\t[ `has-custom-font-size` ]:\n\t\t\t\t\t\t\t\tblockProps.style.fontSize,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...backgroundProps.style,\n\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t\t...typographyProps.style,\n\t\t\t\t\t\twritingMode: undefined,\n\t\t\t\t\t} }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ hasBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ isLinkTag && ! lockUrlControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ link }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsEditingURL( ! isEditingURL ) }\n\t\t\t\t\t\t\tisActive={ isURLSet }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isLinkTag && isSelected && isEditingURL && ! lockUrlControls && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tfocusOnMount={ isEditingURL ? 'firstElement' : false }\n\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t\tshift\n\t\t\t\t>\n\t\t\t\t\t<LinkControl\n\t\t\t\t\t\tvalue={ linkValue }\n\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\tnofollow: newNofollow,\n\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\tsetAttributes(\n\t\t\t\t\t\t\t\tgetUpdatedLinkAttributes( {\n\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\turl: newURL,\n\t\t\t\t\t\t\t\t\topensInNewTab: newOpensInNewTab,\n\t\t\t\t\t\t\t\t\tnofollow: newNofollow,\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\tonRemove={ () => {\n\t\t\t\t\t\t\tunlink();\n\t\t\t\t\t\t\trichTextRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tforceIsEditingLink={ ! isURLSet }\n\t\t\t\t\t\tsettings={ LINK_SETTINGS }\n\t\t\t\t\t\tcreateSuggestion={ createPageEntity && handleCreate }\n\t\t\t\t\t\twithCreateSuggestion={ userCanCreatePages }\n\t\t\t\t\t\tcreateSuggestionButtonText={ createButtonText }\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<a>)' ), value: 'a' },\n\t\t\t\t\t\t{ label: '<button>', value: 'button' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ isLinkTag && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\thref=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\"\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\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n\nexport default ButtonEdit;\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,eAAe,eAAe;AACpD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B;AAAA,EACA,4CAA4C;AAAA,EAC5C,2CAA2C;AAAA,EAC3C,+CAA+C;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,iCAAiC;AAAA,EACjC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,iBAAiB,iBAAiB,aAAa;AACxD,SAAS,YAAY;AACrB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,YAAY;AACrB,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,gCAAgC;AACzC,OAAO,qBAAqB;AAC5B,SAAS,cAAc;AACvB,OAAO,4BAA4B;AACnC,SAAS,iBAAiB,yBAAyB;AA6LxC,SA6FT,UA7FS,KAkMR,YAlMQ;AA3LX,IAAM,EAAE,mBAAmB,IAAI,OAAQ,sBAAuB;AAC9D,IAAM,EAAE,2BAA2B,IAAI,OAAQ,kBAAmB;AAElE,IAAM,gBAAgB;AAAA,EACrB,GAAG,YAAY;AAAA,EACf;AAAA,IACC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AA;AAAA,cACN;AAAA,YAEF;AAAA,UACD;AAAA,UACA,OAAQ,OAAO;AAAA,UACf,UAAW,CAAE,WACZ,cAAe,EAAE,KAAK,OAAO,CAAE;AAAA;AAAA,MAEjC;AAAA,OAEF;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"fontSize": true
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
+
"dimensions": {
|
|
54
|
+
"minHeight": true,
|
|
55
|
+
"minWidth": true
|
|
56
|
+
},
|
|
53
57
|
"__experimentalBorder": {
|
|
54
58
|
"color": true,
|
|
55
59
|
"radius": true,
|
|
@@ -73,7 +77,8 @@
|
|
|
73
77
|
"clientNavigation": true
|
|
74
78
|
},
|
|
75
79
|
"listView": true,
|
|
76
|
-
"contentRole": true
|
|
80
|
+
"contentRole": true,
|
|
81
|
+
"shadow": true
|
|
77
82
|
},
|
|
78
83
|
"editorStyle": "wp-block-buttons-editor",
|
|
79
84
|
"style": "wp-block-buttons"
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
__experimentalToolsPanelItem as ToolsPanelItem
|
|
18
18
|
} from "@wordpress/components";
|
|
19
19
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
20
|
+
import { useState } from "@wordpress/element";
|
|
20
21
|
import { sprintf, __ } from "@wordpress/i18n";
|
|
21
22
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
22
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -87,7 +88,9 @@ function ColumnEdit({
|
|
|
87
88
|
});
|
|
88
89
|
};
|
|
89
90
|
const widthWithUnit = Number.isFinite(width) ? width + "%" : width;
|
|
91
|
+
const [dropZoneElement, setDropZoneElement] = useState(null);
|
|
90
92
|
const blockProps = useBlockProps({
|
|
93
|
+
ref: setDropZoneElement,
|
|
91
94
|
className: classes,
|
|
92
95
|
style: widthWithUnit ? { flexBasis: widthWithUnit } : void 0
|
|
93
96
|
});
|
|
@@ -103,6 +106,8 @@ function ColumnEdit({
|
|
|
103
106
|
const innerBlocksProps = useInnerBlocksProps(
|
|
104
107
|
{ ...blockProps, "aria-label": label },
|
|
105
108
|
{
|
|
109
|
+
// Allows dropping before or after the column, not only inside it.
|
|
110
|
+
dropZoneElement,
|
|
106
111
|
templateLock,
|
|
107
112
|
allowedBlocks,
|
|
108
113
|
renderAppender: hasChildBlocks ? false : InnerBlocks.ButtonBlockAppender
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/column/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction ColumnInspectorControls( { width, setAttributes } ) {\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],\n\t} );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( { width: undefined } );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => width !== undefined }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t__unstableInputWidth=\"calc(50% - 8px)\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t0 > parseFloat( nextWidth ) ? '0' : nextWidth;\n\t\t\t\t\t\tsetAttributes( { width: nextWidth } );\n\t\t\t\t\t} }\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\n/**\n * Renders the `core/column` block in the editor.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Block attributes.\n * @param {string} [props.attributes.verticalAlignment] Vertical alignment of the column, one of `top`, `center`, `bottom` or `stretch`. Setting it resets the alignment on the parent Columns block.\n * @param {string|number} [props.attributes.width] Column width, used as its `flex-basis`. A number is treated as a percentage, for content saved before the attribute became a CSS length.\n * @param {string|boolean} [props.attributes.templateLock] Template lock applied to the inner blocks, one of `all`, `insert`, `contentOnly` or `false`.\n * @param {string[]} [props.attributes.allowedBlocks] Names of the blocks allowed as inner blocks, added by the `allowedBlocks` block support.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {string} props.clientId Client ID of the block.\n *\n * @return {React.JSX.Element} React element.\n */\nfunction ColumnEdit( {\n\tattributes: { verticalAlignment, width, templateLock, allowedBlocks },\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst classes = clsx( 'block-core-columns', {\n\t\t[ `is-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t} );\n\tconst { columnsIds, hasChildBlocks, rootClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockOrder, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootId = getBlockRootClientId( clientId );\n\n\t\t\treturn {\n\t\t\t\thasChildBlocks: getBlockOrder( clientId ).length > 0,\n\t\t\t\trootClientId: rootId,\n\t\t\t\tcolumnsIds: getBlockOrder( rootId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst updateAlignment = ( value ) => {\n\t\t// Update own alignment.\n\t\tsetAttributes( { verticalAlignment: value } );\n\t\t// Reset parent Columns block.\n\t\tupdateBlockAttributes( rootClientId, {\n\t\t\tverticalAlignment: null,\n\t\t} );\n\t};\n\n\tconst widthWithUnit = Number.isFinite( width ) ? width + '%' : width;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t\tstyle: widthWithUnit ? { flexBasis: widthWithUnit } : undefined,\n\t} );\n\n\tconst columnsCount = columnsIds.length;\n\tconst currentColumnPosition = columnsIds.indexOf( clientId ) + 1;\n\n\tconst label = sprintf(\n\t\t/* translators: 1: Block label (i.e. \"Block: Column\"), 2: Position of the selected block, 3: Total number of sibling blocks of the same type */\n\t\t__( '%1$s (%2$d of %3$d)' ),\n\t\tblockProps[ 'aria-label' ],\n\t\tcurrentColumnPosition,\n\t\tcolumnsCount\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ...blockProps, 'aria-label': label },\n\t\t{\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender: hasChildBlocks\n\t\t\t\t? false\n\t\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\tcontrols={ [ 'top', 'center', 'bottom', 'stretch' ] }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\twidth={ width }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nexport default ColumnEdit;\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,UAAU;AAC5B,SAAS,sCAAsC;AAsB3C,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tInnerBlocks,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction ColumnInspectorControls( { width, setAttributes } ) {\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],\n\t} );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( { width: undefined } );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => width !== undefined }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t__unstableInputWidth=\"calc(50% - 8px)\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t0 > parseFloat( nextWidth ) ? '0' : nextWidth;\n\t\t\t\t\t\tsetAttributes( { width: nextWidth } );\n\t\t\t\t\t} }\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\n/**\n * Renders the `core/column` block in the editor.\n *\n * @param {Object} props Component props.\n * @param {Object} props.attributes Block attributes.\n * @param {string} [props.attributes.verticalAlignment] Vertical alignment of the column, one of `top`, `center`, `bottom` or `stretch`. Setting it resets the alignment on the parent Columns block.\n * @param {string|number} [props.attributes.width] Column width, used as its `flex-basis`. A number is treated as a percentage, for content saved before the attribute became a CSS length.\n * @param {string|boolean} [props.attributes.templateLock] Template lock applied to the inner blocks, one of `all`, `insert`, `contentOnly` or `false`.\n * @param {string[]} [props.attributes.allowedBlocks] Names of the blocks allowed as inner blocks, added by the `allowedBlocks` block support.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n * @param {string} props.clientId Client ID of the block.\n *\n * @return {React.JSX.Element} React element.\n */\nfunction ColumnEdit( {\n\tattributes: { verticalAlignment, width, templateLock, allowedBlocks },\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst classes = clsx( 'block-core-columns', {\n\t\t[ `is-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t} );\n\tconst { columnsIds, hasChildBlocks, rootClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockOrder, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootId = getBlockRootClientId( clientId );\n\n\t\t\treturn {\n\t\t\t\thasChildBlocks: getBlockOrder( clientId ).length > 0,\n\t\t\t\trootClientId: rootId,\n\t\t\t\tcolumnsIds: getBlockOrder( rootId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst updateAlignment = ( value ) => {\n\t\t// Update own alignment.\n\t\tsetAttributes( { verticalAlignment: value } );\n\t\t// Reset parent Columns block.\n\t\tupdateBlockAttributes( rootClientId, {\n\t\t\tverticalAlignment: null,\n\t\t} );\n\t};\n\n\tconst widthWithUnit = Number.isFinite( width ) ? width + '%' : width;\n\t// State, not a ref, so that the element is there on the next render.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\tconst blockProps = useBlockProps( {\n\t\tref: setDropZoneElement,\n\t\tclassName: classes,\n\t\tstyle: widthWithUnit ? { flexBasis: widthWithUnit } : undefined,\n\t} );\n\n\tconst columnsCount = columnsIds.length;\n\tconst currentColumnPosition = columnsIds.indexOf( clientId ) + 1;\n\n\tconst label = sprintf(\n\t\t/* translators: 1: Block label (i.e. \"Block: Column\"), 2: Position of the selected block, 3: Total number of sibling blocks of the same type */\n\t\t__( '%1$s (%2$d of %3$d)' ),\n\t\tblockProps[ 'aria-label' ],\n\t\tcurrentColumnPosition,\n\t\tcolumnsCount\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ...blockProps, 'aria-label': label },\n\t\t{\n\t\t\t// Allows dropping before or after the column, not only inside it.\n\t\t\tdropZoneElement,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender: hasChildBlocks\n\t\t\t\t? false\n\t\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t\tcontrols={ [ 'top', 'center', 'bottom', 'stretch' ] }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\twidth={ width }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nexport default ColumnEdit;\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,gBAAgB;AACzB,SAAS,SAAS,UAAU;AAC5B,SAAS,sCAAsC;AAsB3C,SAmGF,UAnGE,KAmGF,YAnGE;AApBJ,SAAS,wBAAyB,EAAE,OAAO,cAAc,GAAI;AAC5D,QAAM,CAAE,cAAe,IAAI,YAAa,eAAgB;AACxD,QAAM,QAAQ,eAAgB;AAAA,IAC7B,gBAAgB,kBAAkB,CAAE,KAAK,MAAM,MAAM,OAAO,IAAK;AAAA,EAClE,CAAE;AACF,QAAM,oBAAoB,+BAA+B;AACzD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,UAAW;AAAA,MACvB,UAAW,MAAM;AAChB,sBAAe,EAAE,OAAO,OAAU,CAAE;AAAA,MACrC;AAAA,MACA;AAA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E/D,QAAM,CAAE,iBAAiB,kBAAmB,IAAI,SAAU,IAAK;AAC/D,QAAM,aAAa,cAAe;AAAA,IACjC,KAAK;AAAA,IACL,WAAW;AAAA,IACX,OAAO,gBAAgB,EAAE,WAAW,cAAc,IAAI;AAAA,EACvD,CAAE;AAEF,QAAM,eAAe,WAAW;AAChC,QAAM,wBAAwB,WAAW,QAAS,QAAS,IAAI;AAE/D,QAAM,QAAQ;AAAA;AAAA,IAEb,GAAI,qBAAsB;AAAA,IAC1B,WAAY,YAAa;AAAA,IACzB;AAAA,IACA;AAAA,EACD;AAEA,QAAM,mBAAmB;AAAA,IACxB,EAAE,GAAG,YAAY,cAAc,MAAM;AAAA,IACrC;AAAA;AAAA,MAEC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,iBACb,QACA,YAAY;AAAA,IAChB;AAAA,EACD;AAEA,SACC,iCACC;AAAA,wBAAC,iBACA;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,OAAQ;AAAA,QACR,UAAW,CAAE,OAAO,UAAU,UAAU,SAAU;AAAA;AAAA,IACnD,GACD;AAAA,IACA,oBAAC,qBACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IACA,oBAAC,SAAM,GAAG,kBAAmB;AAAA,KAC9B;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { __ } from "@wordpress/i18n";
|
|
4
4
|
import {
|
|
5
|
-
Notice,
|
|
6
|
-
RangeControl,
|
|
7
5
|
ToggleControl,
|
|
8
6
|
__experimentalToolsPanel as ToolsPanel,
|
|
9
|
-
__experimentalToolsPanelItem as ToolsPanelItem
|
|
10
|
-
__experimentalVStack as VStack
|
|
7
|
+
__experimentalToolsPanelItem as ToolsPanelItem
|
|
11
8
|
} from "@wordpress/components";
|
|
12
9
|
import {
|
|
13
10
|
InspectorControls,
|
|
@@ -20,96 +17,17 @@ import {
|
|
|
20
17
|
} from "@wordpress/block-editor";
|
|
21
18
|
import { useDispatch, useSelect, useRegistry } from "@wordpress/data";
|
|
22
19
|
import {
|
|
23
|
-
createBlock,
|
|
24
20
|
createBlocksFromInnerBlocksTemplate,
|
|
25
21
|
store as blocksStore
|
|
26
22
|
} from "@wordpress/blocks";
|
|
27
|
-
import {
|
|
28
|
-
hasExplicitPercentColumnWidths,
|
|
29
|
-
getMappedColumnWidths,
|
|
30
|
-
getRedistributedColumnWidths,
|
|
31
|
-
toWidthPrecision
|
|
32
|
-
} from "./utils.mjs";
|
|
33
23
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
34
24
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
25
|
var DEFAULT_BLOCK = {
|
|
36
26
|
name: "core/column"
|
|
37
27
|
};
|
|
38
|
-
function ColumnInspectorControls({
|
|
39
|
-
clientId,
|
|
40
|
-
setAttributes,
|
|
41
|
-
isStackedOnMobile
|
|
42
|
-
}) {
|
|
43
|
-
const { count, canInsertColumnBlock, minCount } = useSelect(
|
|
44
|
-
(select) => {
|
|
45
|
-
const { canInsertBlockType, canRemoveBlock, getBlockOrder } = select(blockEditorStore);
|
|
46
|
-
const blockOrder = getBlockOrder(clientId);
|
|
47
|
-
const preventRemovalBlockIndexes = blockOrder.reduce(
|
|
48
|
-
(acc, blockId, index) => {
|
|
49
|
-
if (!canRemoveBlock(blockId)) {
|
|
50
|
-
acc.push(index);
|
|
51
|
-
}
|
|
52
|
-
return acc;
|
|
53
|
-
},
|
|
54
|
-
[]
|
|
55
|
-
);
|
|
56
|
-
return {
|
|
57
|
-
count: blockOrder.length,
|
|
58
|
-
canInsertColumnBlock: canInsertBlockType(
|
|
59
|
-
"core/column",
|
|
60
|
-
clientId
|
|
61
|
-
),
|
|
62
|
-
minCount: Math.max(...preventRemovalBlockIndexes) + 1
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
[clientId]
|
|
66
|
-
);
|
|
67
|
-
const { getBlocks } = useSelect(blockEditorStore);
|
|
68
|
-
const { replaceInnerBlocks } = useDispatch(blockEditorStore);
|
|
69
|
-
function updateColumns(previousColumns, newColumns) {
|
|
70
|
-
let innerBlocks = getBlocks(clientId);
|
|
71
|
-
const hasExplicitWidths = hasExplicitPercentColumnWidths(innerBlocks);
|
|
72
|
-
const isAddingColumn = newColumns > previousColumns;
|
|
73
|
-
if (isAddingColumn && hasExplicitWidths) {
|
|
74
|
-
const newColumnWidth = toWidthPrecision(100 / newColumns);
|
|
75
|
-
const newlyAddedColumns = newColumns - previousColumns;
|
|
76
|
-
const widths = getRedistributedColumnWidths(
|
|
77
|
-
innerBlocks,
|
|
78
|
-
100 - newColumnWidth * newlyAddedColumns
|
|
79
|
-
);
|
|
80
|
-
innerBlocks = [
|
|
81
|
-
...getMappedColumnWidths(innerBlocks, widths),
|
|
82
|
-
...Array.from({
|
|
83
|
-
length: newlyAddedColumns
|
|
84
|
-
}).map(() => {
|
|
85
|
-
return createBlock("core/column", {
|
|
86
|
-
width: `${newColumnWidth}%`
|
|
87
|
-
});
|
|
88
|
-
})
|
|
89
|
-
];
|
|
90
|
-
} else if (isAddingColumn) {
|
|
91
|
-
innerBlocks = [
|
|
92
|
-
...innerBlocks,
|
|
93
|
-
...Array.from({
|
|
94
|
-
length: newColumns - previousColumns
|
|
95
|
-
}).map(() => {
|
|
96
|
-
return createBlock("core/column");
|
|
97
|
-
})
|
|
98
|
-
];
|
|
99
|
-
} else if (newColumns < previousColumns) {
|
|
100
|
-
innerBlocks = innerBlocks.slice(
|
|
101
|
-
0,
|
|
102
|
-
-(previousColumns - newColumns)
|
|
103
|
-
);
|
|
104
|
-
if (hasExplicitWidths) {
|
|
105
|
-
const widths = getRedistributedColumnWidths(innerBlocks, 100);
|
|
106
|
-
innerBlocks = getMappedColumnWidths(innerBlocks, widths);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
replaceInnerBlocks(clientId, innerBlocks);
|
|
110
|
-
}
|
|
28
|
+
function ColumnInspectorControls({ setAttributes, isStackedOnMobile }) {
|
|
111
29
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
112
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
113
31
|
ToolsPanel,
|
|
114
32
|
{
|
|
115
33
|
label: __("Settings"),
|
|
@@ -119,44 +37,27 @@ function ColumnInspectorControls({
|
|
|
119
37
|
});
|
|
120
38
|
},
|
|
121
39
|
dropdownMenuProps,
|
|
122
|
-
children:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
ToolsPanelItem,
|
|
42
|
+
{
|
|
43
|
+
label: __("Stack on mobile"),
|
|
44
|
+
isShownByDefault: true,
|
|
45
|
+
hasValue: () => isStackedOnMobile !== true,
|
|
46
|
+
onDeselect: () => setAttributes({
|
|
47
|
+
isStackedOnMobile: true
|
|
48
|
+
}),
|
|
49
|
+
children: /* @__PURE__ */ jsx(
|
|
50
|
+
ToggleControl,
|
|
126
51
|
{
|
|
127
|
-
label: __("
|
|
128
|
-
|
|
129
|
-
onChange: (
|
|
130
|
-
|
|
131
|
-
|
|
52
|
+
label: __("Stack on mobile"),
|
|
53
|
+
checked: isStackedOnMobile,
|
|
54
|
+
onChange: () => setAttributes({
|
|
55
|
+
isStackedOnMobile: !isStackedOnMobile
|
|
56
|
+
})
|
|
132
57
|
}
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
) })
|
|
137
|
-
] }),
|
|
138
|
-
/* @__PURE__ */ jsx(
|
|
139
|
-
ToolsPanelItem,
|
|
140
|
-
{
|
|
141
|
-
label: __("Stack on mobile"),
|
|
142
|
-
isShownByDefault: true,
|
|
143
|
-
hasValue: () => isStackedOnMobile !== true,
|
|
144
|
-
onDeselect: () => setAttributes({
|
|
145
|
-
isStackedOnMobile: true
|
|
146
|
-
}),
|
|
147
|
-
children: /* @__PURE__ */ jsx(
|
|
148
|
-
ToggleControl,
|
|
149
|
-
{
|
|
150
|
-
label: __("Stack on mobile"),
|
|
151
|
-
checked: isStackedOnMobile,
|
|
152
|
-
onChange: () => setAttributes({
|
|
153
|
-
isStackedOnMobile: !isStackedOnMobile
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
]
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
)
|
|
160
61
|
}
|
|
161
62
|
);
|
|
162
63
|
}
|
|
@@ -199,7 +100,6 @@ function ColumnsEditContainer({ attributes, setAttributes, clientId }) {
|
|
|
199
100
|
/* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsx(
|
|
200
101
|
ColumnInspectorControls,
|
|
201
102
|
{
|
|
202
|
-
clientId,
|
|
203
103
|
setAttributes,
|
|
204
104
|
isStackedOnMobile
|
|
205
105
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/columns/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tRangeControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnInspectorControls( {\n\tclientId,\n\tsetAttributes,\n\tisStackedOnMobile,\n} ) {\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, canRemoveBlock, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockOrder = getBlockOrder( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = blockOrder.reduce(\n\t\t\t\t( acc, blockId, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( blockId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: blockOrder.length,\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\t\t\tconst newlyAddedColumns = newColumns - previousColumns;\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth * newlyAddedColumns\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newlyAddedColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t<VStack spacing={ 4 } style={ { gridColumn: '1 / -1' } }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tupdateColumns( count, Math.max( minCount, value ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => isStackedOnMobile !== true }\n\t\t\t\tonDeselect={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst registry = useRegistry();\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst classes = clsx( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to override anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockVariations, getBlockType } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tinstructions={ __( 'Divide into columns. Select a layout:' ) }\n\t\t\t\tonSelect={ ( nextVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\n/**\n * Renders the `core/columns` block in the editor.\n *\n * Until the block has inner blocks it renders a variation picker; afterwards it\n * renders the columns container. Every prop is forwarded to whichever of the two\n * is rendered.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Client ID of the block.\n * @param {string} props.name Block name, used to look up the variations offered by the picker.\n * @param {Object} props.attributes Block attributes.\n * @param {string} [props.attributes.verticalAlignment] Vertical alignment applied to the block and to every child Column block.\n * @param {boolean} [props.attributes.isStackedOnMobile] Whether the columns stack on small viewports. Defaults to `true`.\n * @param {string|boolean} [props.attributes.templateLock] Template lock applied to the inner blocks, one of `all`, `insert`, `contentOnly` or `false`.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n *\n * @return {React.JSX.Element} React element.\n */\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnInspectorControls( { setAttributes, isStackedOnMobile } ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Settings' ) }\n\t\t\tresetAll={ () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\tisShownByDefault\n\t\t\t\thasValue={ () => isStackedOnMobile !== true }\n\t\t\t\tonDeselect={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisStackedOnMobile: true,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst registry = useRegistry();\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst classes = clsx( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to override anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockVariations, getBlockType } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tinstructions={ __( 'Divide into columns. Select a layout:' ) }\n\t\t\t\tonSelect={ ( nextVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\n/**\n * Renders the `core/columns` block in the editor.\n *\n * Until the block has inner blocks it renders a variation picker; afterwards it\n * renders the columns container. Every prop is forwarded to whichever of the two\n * is rendered.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Client ID of the block.\n * @param {string} props.name Block name, used to look up the variations offered by the picker.\n * @param {Object} props.attributes Block attributes.\n * @param {string} [props.attributes.verticalAlignment] Vertical alignment applied to the block and to every child Column block.\n * @param {boolean} [props.attributes.isStackedOnMobile] Whether the columns stack on small viewports. Defaults to `true`.\n * @param {string|boolean} [props.attributes.templateLock] Template lock applied to the inner blocks, one of `all`, `insert`, `contentOnly` or `false`.\n * @param {Function} props.setAttributes Callback for updating block attributes.\n *\n * @return {React.JSX.Element} React element.\n */\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OAC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