@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
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,0BASO;AACP,wBAKO;AACP,kBAAuC;AACvC,kBAA4B;AAC5B,mBAA+C;AAsB3C;AApBJ,SAAS,wBAAyB,EAAE,OAAO,cAAc,GAAI;AAC5D,QAAM,CAAE,cAAe,QAAI,iCAAa,eAAgB;AACxD,QAAM,YAAQ,kBAAAA,8BAAgB;AAAA,IAC7B,gBAAgB,kBAAkB,CAAE,KAAK,MAAM,MAAM,OAAO,IAAK;AAAA,EAClE,CAAE;AACF,QAAM,wBAAoB,6CAA+B;AACzD,SACC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,UAAW,MAAM;AAChB,sBAAe,EAAE,OAAO,OAAU,CAAE;AAAA,MACrC;AAAA,MACA;AAAA,MAEA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,UAAW,MAAM,UAAU;AAAA,UAC3B,WAAQ,gBAAI,OAAQ;AAAA,UACpB,YAAa,MAAM,cAAe,EAAE,OAAO,OAAU,CAAE;AAAA,UACvD,kBAAgB;AAAA,UAEhB;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACA,WAAQ,gBAAI,OAAQ;AAAA,cACpB,sBAAqB;AAAA,cACrB,OAAQ,SAAS;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AY,YAAa;AAAA,IACzB;AAAA,IACA;AAAA,EACD;AAEA,QAAM,uBAAmB;AAAA,IACxB,EAAE,GAAG,YAAY,cAAc,MAAM;AAAA,IACrC;AAAA,
|
|
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\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AChB;AAAA,EACD;AAEA,SACC,4EACC;AAAA,gDAAC,qCACA;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,OAAQ;AAAA,QACR,UAAW,CAAE,OAAO,UAAU,UAAU,SAAU;AAAA;AAAA,IACnD,GACD;AAAA,IACA,4CAAC,yCACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,SAAM,GAAG,kBAAmB;AAAA,KAC9B;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["useCustomUnits", "ToolsPanel", "ToolsPanelItem", "UnitControl", "clsx", "blockEditorStore"]
|
|
7
7
|
}
|
package/build/columns/block.json
CHANGED
package/build/columns/edit.cjs
CHANGED
|
@@ -39,87 +39,14 @@ var import_components = require("@wordpress/components");
|
|
|
39
39
|
var import_block_editor = require("@wordpress/block-editor");
|
|
40
40
|
var import_data = require("@wordpress/data");
|
|
41
41
|
var import_blocks = require("@wordpress/blocks");
|
|
42
|
-
var import_utils = require("./utils.cjs");
|
|
43
42
|
var import_hooks = require("../utils/hooks.cjs");
|
|
44
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
44
|
var DEFAULT_BLOCK = {
|
|
46
45
|
name: "core/column"
|
|
47
46
|
};
|
|
48
|
-
function ColumnInspectorControls({
|
|
49
|
-
clientId,
|
|
50
|
-
setAttributes,
|
|
51
|
-
isStackedOnMobile
|
|
52
|
-
}) {
|
|
53
|
-
const { count, canInsertColumnBlock, minCount } = (0, import_data.useSelect)(
|
|
54
|
-
(select) => {
|
|
55
|
-
const { canInsertBlockType, canRemoveBlock, getBlockOrder } = select(import_block_editor.store);
|
|
56
|
-
const blockOrder = getBlockOrder(clientId);
|
|
57
|
-
const preventRemovalBlockIndexes = blockOrder.reduce(
|
|
58
|
-
(acc, blockId, index) => {
|
|
59
|
-
if (!canRemoveBlock(blockId)) {
|
|
60
|
-
acc.push(index);
|
|
61
|
-
}
|
|
62
|
-
return acc;
|
|
63
|
-
},
|
|
64
|
-
[]
|
|
65
|
-
);
|
|
66
|
-
return {
|
|
67
|
-
count: blockOrder.length,
|
|
68
|
-
canInsertColumnBlock: canInsertBlockType(
|
|
69
|
-
"core/column",
|
|
70
|
-
clientId
|
|
71
|
-
),
|
|
72
|
-
minCount: Math.max(...preventRemovalBlockIndexes) + 1
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
[clientId]
|
|
76
|
-
);
|
|
77
|
-
const { getBlocks } = (0, import_data.useSelect)(import_block_editor.store);
|
|
78
|
-
const { replaceInnerBlocks } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
79
|
-
function updateColumns(previousColumns, newColumns) {
|
|
80
|
-
let innerBlocks = getBlocks(clientId);
|
|
81
|
-
const hasExplicitWidths = (0, import_utils.hasExplicitPercentColumnWidths)(innerBlocks);
|
|
82
|
-
const isAddingColumn = newColumns > previousColumns;
|
|
83
|
-
if (isAddingColumn && hasExplicitWidths) {
|
|
84
|
-
const newColumnWidth = (0, import_utils.toWidthPrecision)(100 / newColumns);
|
|
85
|
-
const newlyAddedColumns = newColumns - previousColumns;
|
|
86
|
-
const widths = (0, import_utils.getRedistributedColumnWidths)(
|
|
87
|
-
innerBlocks,
|
|
88
|
-
100 - newColumnWidth * newlyAddedColumns
|
|
89
|
-
);
|
|
90
|
-
innerBlocks = [
|
|
91
|
-
...(0, import_utils.getMappedColumnWidths)(innerBlocks, widths),
|
|
92
|
-
...Array.from({
|
|
93
|
-
length: newlyAddedColumns
|
|
94
|
-
}).map(() => {
|
|
95
|
-
return (0, import_blocks.createBlock)("core/column", {
|
|
96
|
-
width: `${newColumnWidth}%`
|
|
97
|
-
});
|
|
98
|
-
})
|
|
99
|
-
];
|
|
100
|
-
} else if (isAddingColumn) {
|
|
101
|
-
innerBlocks = [
|
|
102
|
-
...innerBlocks,
|
|
103
|
-
...Array.from({
|
|
104
|
-
length: newColumns - previousColumns
|
|
105
|
-
}).map(() => {
|
|
106
|
-
return (0, import_blocks.createBlock)("core/column");
|
|
107
|
-
})
|
|
108
|
-
];
|
|
109
|
-
} else if (newColumns < previousColumns) {
|
|
110
|
-
innerBlocks = innerBlocks.slice(
|
|
111
|
-
0,
|
|
112
|
-
-(previousColumns - newColumns)
|
|
113
|
-
);
|
|
114
|
-
if (hasExplicitWidths) {
|
|
115
|
-
const widths = (0, import_utils.getRedistributedColumnWidths)(innerBlocks, 100);
|
|
116
|
-
innerBlocks = (0, import_utils.getMappedColumnWidths)(innerBlocks, widths);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
replaceInnerBlocks(clientId, innerBlocks);
|
|
120
|
-
}
|
|
47
|
+
function ColumnInspectorControls({ setAttributes, isStackedOnMobile }) {
|
|
121
48
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
122
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
50
|
import_components.__experimentalToolsPanel,
|
|
124
51
|
{
|
|
125
52
|
label: (0, import_i18n.__)("Settings"),
|
|
@@ -129,44 +56,27 @@ function ColumnInspectorControls({
|
|
|
129
56
|
});
|
|
130
57
|
},
|
|
131
58
|
dropdownMenuProps,
|
|
132
|
-
children:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
59
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
import_components.__experimentalToolsPanelItem,
|
|
61
|
+
{
|
|
62
|
+
label: (0, import_i18n.__)("Stack on mobile"),
|
|
63
|
+
isShownByDefault: true,
|
|
64
|
+
hasValue: () => isStackedOnMobile !== true,
|
|
65
|
+
onDeselect: () => setAttributes({
|
|
66
|
+
isStackedOnMobile: true
|
|
67
|
+
}),
|
|
68
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_components.ToggleControl,
|
|
136
70
|
{
|
|
137
|
-
label: (0, import_i18n.__)("
|
|
138
|
-
|
|
139
|
-
onChange: (
|
|
140
|
-
|
|
141
|
-
|
|
71
|
+
label: (0, import_i18n.__)("Stack on mobile"),
|
|
72
|
+
checked: isStackedOnMobile,
|
|
73
|
+
onChange: () => setAttributes({
|
|
74
|
+
isStackedOnMobile: !isStackedOnMobile
|
|
75
|
+
})
|
|
142
76
|
}
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
) })
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
-
import_components.__experimentalToolsPanelItem,
|
|
150
|
-
{
|
|
151
|
-
label: (0, import_i18n.__)("Stack on mobile"),
|
|
152
|
-
isShownByDefault: true,
|
|
153
|
-
hasValue: () => isStackedOnMobile !== true,
|
|
154
|
-
onDeselect: () => setAttributes({
|
|
155
|
-
isStackedOnMobile: true
|
|
156
|
-
}),
|
|
157
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
-
import_components.ToggleControl,
|
|
159
|
-
{
|
|
160
|
-
label: (0, import_i18n.__)("Stack on mobile"),
|
|
161
|
-
checked: isStackedOnMobile,
|
|
162
|
-
onChange: () => setAttributes({
|
|
163
|
-
isStackedOnMobile: !isStackedOnMobile
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
]
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
)
|
|
170
80
|
}
|
|
171
81
|
);
|
|
172
82
|
}
|
|
@@ -209,7 +119,6 @@ function ColumnsEditContainer({ attributes, setAttributes, clientId }) {
|
|
|
209
119
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
120
|
ColumnInspectorControls,
|
|
211
121
|
{
|
|
212
|
-
clientId,
|
|
213
122
|
setAttributes,
|
|
214
123
|
isStackedOnMobile
|
|
215
124
|
}
|
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAmB;AACnB,
|
|
6
|
-
"names": ["
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAmB;AACnB,wBAIO;AACP,0BAQO;AACP,kBAAoD;AACpD,oBAGO;AACP,mBAA+C;AA6B3C;AA3BJ,IAAM,gBAAgB;AAAA,EACrB,MAAM;AACP;AAEA,SAAS,wBAAyB,EAAE,eAAe,kBAAkB,GAAI;AACxE,QAAM,wBAAoB,6CAA+B;AAEzD,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,UAAW,MAAM;AAChB,sBAAe;AAAA,UACd,mBAAmB;AAAA,QACpB,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MAEA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,WAAQ,gBAAI,iBAAkB;AAAA,UAC9B,kBAAgB;AAAA,UAChB,UAAW,MAAM,sBAAsB;AAAA,UACvC,YAAa,MACZ,cAAe;AAAA,YACd,mBAAmB;AAAA,UACpB,CAAE;AAAA,UAGH;AAAA,YAAC;AAAA;AAAA,cACA,WAAQ,gBAAI,iBAAkB;AAAA,cAC9B,SAAU;AAAA,cACV,UAAW,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AAI;AAAA,IACjC,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,aAAa,IAAI,OAAQ,cAAAC,KAAY;AAEjE,aAAO;AAAA,QACN,WAAW,aAAc,IAAK;AAAA,QAC9B,YAAY,mBAAoB,MAAM,OAAQ;AAAA,MAC/C;AAAA,IACD;AAAA,IACA,CAAE,IAAK;AAAA,EACR;AACA,QAAM,EAAE,mBAAmB,QAAI,yBAAa,oBAAAF,KAAiB;AAC7D,QAAM,iBAAa,mCAAc;AAEjC,SACC,4CAAC,SAAM,GAAG,YACT;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,WAAW,MAAM;AAAA,MACxB,OAAQ,WAAW;AAAA,MACnB;AAAA,MACA,kBAAe,gBAAI,uCAAwC;AAAA,MAC3D,UAAW,CAAE,kBAAmB;AAC/B,YAAK,cAAc,YAAa;AAC/B,wBAAe,cAAc,UAAW;AAAA,QACzC;AACA,YAAK,cAAc,aAAc;AAChC;AAAA,YACC;AAAA,gBACA;AAAA,cACC,cAAc;AAAA,YACf;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;AAoBA,IAAM,cAAc,CAAE,UAAW;AAChC,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,qBAAiB;AAAA,IACtB,CAAE,WACD,OAAQ,oBAAAA,KAAiB,EAAE,UAAW,QAAS,EAAE,SAAS;AAAA,IAC3D,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,YAAY,iBAAiB,uBAAuB;AAE1D,SAAO,4CAAC,aAAY,GAAG,OAAQ;AAChC;AAEA,IAAO,eAAQ;",
|
|
6
|
+
"names": ["ToolsPanel", "ToolsPanelItem", "blockEditorStore", "clsx", "blocksStore"]
|
|
7
7
|
}
|
|
@@ -38,6 +38,7 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
38
38
|
var import_data = require("@wordpress/data");
|
|
39
39
|
var import_core_data = require("@wordpress/core-data");
|
|
40
40
|
var import_element = require("@wordpress/element");
|
|
41
|
+
var import_react_inert_value = require("@wordpress/react-inert-value");
|
|
41
42
|
var import_form = __toESM(require("../../post-comments-form/form.cjs"));
|
|
42
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
44
|
function PostCommentsPlaceholder({ postType, postId }) {
|
|
@@ -47,98 +48,105 @@ function PostCommentsPlaceholder({ postType, postId }) {
|
|
|
47
48
|
(select) => select(import_block_editor.store).getSettings().__experimentalDiscussionSettings?.avatarURL,
|
|
48
49
|
[]
|
|
49
50
|
);
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"img",
|
|
70
|
-
{
|
|
71
|
-
alt: (0, import_i18n.__)("Commenter Avatar"),
|
|
72
|
-
src: avatarURL,
|
|
73
|
-
className: "avatar avatar-32 photo",
|
|
74
|
-
height: "32",
|
|
75
|
-
width: "32",
|
|
76
|
-
loading: "lazy"
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { className: "fn", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "#top", className: "url", children: (0, import_i18n.__)("A WordPress Commenter") }) }),
|
|
80
|
-
" ",
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "says", children: [
|
|
82
|
-
(0, import_i18n.__)("says"),
|
|
83
|
-
":"
|
|
84
|
-
] })
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: "wp-block-comments__legacy-placeholder",
|
|
55
|
+
inert: (0, import_react_inert_value.inertValue)(true),
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
58
|
+
/* translators: %s: Post title. */
|
|
59
|
+
children: (0, import_i18n.sprintf)((0, import_i18n.__)("One response to %s"), postTitle)
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "navigation", children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignleft", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
63
|
+
"« ",
|
|
64
|
+
(0, import_i18n.__)("Older Comments")
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignright", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
67
|
+
(0, import_i18n.__)("Newer Comments"),
|
|
68
|
+
" »"
|
|
69
|
+
] }) })
|
|
85
70
|
] }),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("
|
|
87
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
88
|
-
|
|
89
|
-
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "commentlist", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "comment even thread-even depth-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "comment-body", children: [
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("footer", { className: "comment-meta", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "comment-author vcard", children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
"img",
|
|
76
|
+
{
|
|
77
|
+
alt: (0, import_i18n.__)("Commenter Avatar"),
|
|
78
|
+
src: avatarURL,
|
|
79
|
+
className: "avatar avatar-32 photo",
|
|
80
|
+
height: "32",
|
|
81
|
+
width: "32",
|
|
82
|
+
loading: "lazy"
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { className: "fn", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "#top", className: "url", children: (0, import_i18n.__)("A WordPress Commenter") }) }),
|
|
86
|
+
" ",
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "says", children: [
|
|
88
|
+
(0, import_i18n.__)("says"),
|
|
89
|
+
":"
|
|
90
|
+
] })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "comment-metadata", children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "#top", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { dateTime: "2000-01-01T00:00:00+00:00", children: (0, import_i18n.__)("January 1, 2000 at 00:00 am") }) }),
|
|
94
|
+
" ",
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "edit-link", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"a",
|
|
97
|
+
{
|
|
98
|
+
className: "comment-edit-link",
|
|
99
|
+
href: "#top",
|
|
100
|
+
children: (0, import_i18n.__)("Edit")
|
|
101
|
+
}
|
|
102
|
+
) })
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "comment-content", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
106
|
+
(0, import_i18n.__)("Hi, this is a comment."),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
108
|
+
(0, import_i18n.__)(
|
|
109
|
+
"To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard."
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
112
|
+
(0, import_element.createInterpolateElement)(
|
|
113
|
+
(0, import_i18n.__)(
|
|
114
|
+
"Commenter avatars come from <a>Gravatar</a>."
|
|
115
|
+
),
|
|
116
|
+
{
|
|
117
|
+
a: (
|
|
118
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://gravatar.com/" })
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] }) }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "reply", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
125
|
"a",
|
|
91
126
|
{
|
|
92
|
-
className: "comment-
|
|
127
|
+
className: "comment-reply-link",
|
|
93
128
|
href: "#top",
|
|
94
|
-
|
|
129
|
+
"aria-label": (0, import_i18n.__)(
|
|
130
|
+
"Reply to A WordPress Commenter"
|
|
131
|
+
),
|
|
132
|
+
/* translators: Comment reply button text. */
|
|
133
|
+
children: (0, import_i18n._x)("Reply", "verb")
|
|
95
134
|
}
|
|
96
135
|
) })
|
|
97
|
-
] })
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://gravatar.com/" })
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
] }) }),
|
|
118
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "reply", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
-
"a",
|
|
120
|
-
{
|
|
121
|
-
className: "comment-reply-link",
|
|
122
|
-
href: "#top",
|
|
123
|
-
"aria-label": (0, import_i18n.__)(
|
|
124
|
-
"Reply to A WordPress Commenter"
|
|
125
|
-
),
|
|
126
|
-
/* translators: Comment reply button text. */
|
|
127
|
-
children: (0, import_i18n._x)("Reply", "verb")
|
|
128
|
-
}
|
|
129
|
-
) })
|
|
130
|
-
] }) }) }),
|
|
131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "navigation", children: [
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignleft", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
133
|
-
"« ",
|
|
134
|
-
(0, import_i18n.__)("Older Comments")
|
|
135
|
-
] }) }),
|
|
136
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignright", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
137
|
-
(0, import_i18n.__)("Newer Comments"),
|
|
138
|
-
" »"
|
|
139
|
-
] }) })
|
|
140
|
-
] }),
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.default, { postId, postType })
|
|
142
|
-
] });
|
|
136
|
+
] }) }) }),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "navigation", children: [
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignleft", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
139
|
+
"« ",
|
|
140
|
+
(0, import_i18n.__)("Older Comments")
|
|
141
|
+
] }) }),
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "alignright", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: "#top", children: [
|
|
143
|
+
(0, import_i18n.__)("Newer Comments"),
|
|
144
|
+
" »"
|
|
145
|
+
] }) })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.default, { postId, postType })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
);
|
|
143
151
|
}
|
|
144
152
|
//# sourceMappingURL=placeholder.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/comments/edit/placeholder.jsx"],
|
|
4
|
-
"sourcesContent": ["import { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA0C;AAC1C,kBAAgC;AAChC,kBAA0B;AAC1B,uBAA8B;AAC9B,qBAAyC;AACzC,kBAAyB;
|
|
4
|
+
"sourcesContent": ["import { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"wp-block-comments__legacy-placeholder\"\n\t\t\tinert={ inertValue( true ) }\n\t\t>\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ __( 'Commenter Avatar' ) }\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t),\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</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t'Reply to A WordPress Commenter'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. */\n\t\t\t\t\t\t\t\t\t_x( 'Reply', 'verb' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA0C;AAC1C,kBAAgC;AAChC,kBAA0B;AAC1B,uBAA8B;AAC9B,qBAAyC;AACzC,+BAA2B;AAC3B,kBAAyB;AAkBtB;AAhBY,SAAR,wBAA0C,EAAE,UAAU,OAAO,GAAI;AACvE,MAAI,CAAE,SAAU,QAAI,gCAAe,YAAY,UAAU,SAAS,MAAO;AACzE,cAAY,iBAAa,gBAAI,YAAa;AAE1C,QAAM,gBAAY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,aACf;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAU;AAAA,kBACV,MAAK;AAAA,kBAEH,8BAAI,MAAO;AAAA;AAAA,cACd,GACD;AAAA,eACD;AAAA,aACD;AAAA,UAEA,4CAAC,SAAI,WAAU,mBACd,uDAAC,OACE;AAAA,gCAAI,wBAAyB;AAAA,YAC/B,4CAAC,QAAG;AAAA,gBACF;AAAA,cACD;AAAA,YACD;AAAA,YACA,4CAAC,QAAG;AAAA,gBACF;AAAA,kBACD;AAAA,gBACC;AAAA,cACD;AAAA,cACA;AAAA,gBACC;AAAA;AAAA,kBAEC,4CAAC,OAAE,MAAK,yBAAwB;AAAA;AAAA,cAElC;AAAA,YACD;AAAA,aACD,GACD;AAAA,UAEA,4CAAC,SAAI,WAAU,SACd;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,MAAK;AAAA,cACL,kBAAa;AAAA,gBACZ;AAAA,cACD;AAAA;AAAA,cAIC,8BAAI,SAAS,MAAO;AAAA;AAAA,UAEtB,GACD;AAAA,WACD,GACD,GACD;AAAA,QAEA,6CAAC,SAAI,WAAU,cACd;AAAA,sDAAC,SAAI,WAAU,aACd,uDAAC,OAAE,MAAK,QAAO;AAAA;AAAA,gBAAI,gBAAI,gBAAiB;AAAA,aAAG,GAC5C;AAAA,UACA,4CAAC,SAAI,WAAU,cACd,uDAAC,OAAE,MAAK,QAAS;AAAA,gCAAI,gBAAiB;AAAA,YAAG;AAAA,aAAE,GAC5C;AAAA,WACD;AAAA,QAEA,4CAAC,YAAAC,SAAA,EAAa,QAAkB,UAAsB;AAAA;AAAA;AAAA,EACvD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "CommentsForm"]
|
|
7
7
|
}
|
|
@@ -50,6 +50,11 @@
|
|
|
50
50
|
"type": "flex"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
+
"spacing": {
|
|
54
|
+
"padding": true,
|
|
55
|
+
"margin": true,
|
|
56
|
+
"blockGap": true
|
|
57
|
+
},
|
|
53
58
|
"typography": {
|
|
54
59
|
"fontSize": true,
|
|
55
60
|
"lineHeight": true,
|
|
@@ -63,6 +68,12 @@
|
|
|
63
68
|
"fontSize": true
|
|
64
69
|
}
|
|
65
70
|
},
|
|
71
|
+
"__experimentalBorder": {
|
|
72
|
+
"color": true,
|
|
73
|
+
"radius": true,
|
|
74
|
+
"style": true,
|
|
75
|
+
"width": true
|
|
76
|
+
},
|
|
66
77
|
"interactivity": {
|
|
67
78
|
"clientNavigation": true
|
|
68
79
|
}
|