@wordpress/block-library 10.5.2-next.v.202608281122.0 → 11.0.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 +19 -1
- package/build/audio/edit.cjs +5 -5
- package/build/audio/edit.cjs.map +2 -2
- package/build/audio/index.cjs +0 -37
- package/build/audio/index.cjs.map +3 -3
- package/build/button/index.cjs +0 -34
- package/build/button/index.cjs.map +3 -3
- package/build/code/index.cjs +0 -17
- package/build/code/index.cjs.map +3 -3
- package/build/comment-template/edit.cjs.map +1 -1
- package/build/cover/index.cjs +0 -38
- package/build/cover/index.cjs.map +3 -3
- package/build/details/index.cjs +0 -17
- package/build/details/index.cjs.map +3 -3
- package/build/file/index.cjs +0 -43
- package/build/file/index.cjs.map +3 -3
- package/build/footnotes/format.cjs +1 -1
- package/build/footnotes/format.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs +22 -12
- package/build/gallery/dynamic-gallery.cjs.map +2 -2
- package/build/heading/index.cjs +0 -16
- package/build/heading/index.cjs.map +3 -3
- package/build/image/image.cjs +7 -5
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +0 -81
- package/build/image/index.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +81 -14
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +0 -10
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs.map +1 -1
- package/build/list-item/edit.cjs +14 -11
- package/build/list-item/edit.cjs.map +2 -2
- package/build/list-item/hooks/index.cjs +6 -9
- package/build/list-item/hooks/index.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +62 -67
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-merge.cjs +26 -44
- package/build/list-item/hooks/use-merge.cjs.map +3 -3
- package/build/list-item/hooks/use-multi-select-tab.cjs +80 -0
- package/build/list-item/hooks/use-multi-select-tab.cjs.map +7 -0
- package/build/list-item/hooks/use-tab.cjs +65 -0
- package/build/list-item/hooks/use-tab.cjs.map +7 -0
- package/build/list-item/index.cjs +0 -17
- package/build/list-item/index.cjs.map +3 -3
- package/build/list-item/utils.cjs +169 -0
- package/build/list-item/utils.cjs.map +7 -0
- package/build/math/block.json +3 -0
- package/build/media-text/index.cjs +0 -50
- package/build/media-text/index.cjs.map +3 -3
- package/build/media-text/media-container.cjs +16 -11
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/more/index.cjs +0 -18
- package/build/more/index.cjs.map +3 -3
- package/build/navigation/constants.cjs +1 -1
- package/build/navigation/constants.cjs.map +1 -1
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/deprecated.cjs +69 -0
- package/build/navigation-link/deprecated.cjs.map +7 -0
- package/build/navigation-link/index.cjs +6 -74
- package/build/navigation-link/index.cjs.map +4 -4
- package/build/{form-submit-button/init.cjs → navigation-link/variations.cjs} +23 -8
- package/build/navigation-link/variations.cjs.map +7 -0
- package/build/navigation-submenu/index.cjs +0 -32
- package/build/navigation-submenu/index.cjs.map +3 -3
- package/build/paragraph/index.cjs +0 -17
- package/build/paragraph/index.cjs.map +3 -3
- package/build/paragraph/use-enter.cjs +8 -4
- package/build/paragraph/use-enter.cjs.map +2 -2
- package/build/post-template/edit.cjs +3 -1
- package/build/post-template/edit.cjs.map +2 -2
- package/build/preformatted/index.cjs +0 -17
- package/build/preformatted/index.cjs.map +3 -3
- package/build/pullquote/index.cjs +0 -24
- package/build/pullquote/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +13 -5
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +9 -4
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/query-content.cjs +30 -9
- package/build/query/edit/query-content.cjs.map +3 -3
- package/build/query/utils.cjs +11 -4
- package/build/query/utils.cjs.map +2 -2
- package/build/search/edit.cjs +3 -1
- package/build/search/edit.cjs.map +2 -2
- package/build/search/index.cjs +0 -31
- package/build/search/index.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +11 -17
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +12 -18
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-link/index.cjs +0 -31
- package/build/social-link/index.cjs.map +3 -3
- package/build/verse/index.cjs +0 -17
- package/build/verse/index.cjs.map +3 -3
- package/build/video/index.cjs +0 -40
- package/build/video/index.cjs.map +3 -3
- package/build/video/tracks-editor.cjs +2 -3
- package/build/video/tracks-editor.cjs.map +3 -3
- package/build-module/audio/edit.mjs +5 -5
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/audio/index.mjs +0 -37
- package/build-module/audio/index.mjs.map +2 -2
- package/build-module/button/index.mjs +0 -34
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/code/index.mjs +0 -17
- package/build-module/code/index.mjs.map +2 -2
- package/build-module/comment-template/edit.mjs.map +1 -1
- package/build-module/cover/index.mjs +0 -38
- package/build-module/cover/index.mjs.map +2 -2
- package/build-module/details/index.mjs +0 -17
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/file/index.mjs +1 -44
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/footnotes/format.mjs +1 -1
- package/build-module/footnotes/format.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +23 -13
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/heading/index.mjs +1 -21
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/image/image.mjs +7 -5
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +0 -81
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +84 -14
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +0 -10
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs.map +1 -1
- package/build-module/list-item/edit.mjs +20 -18
- package/build-module/list-item/edit.mjs.map +2 -2
- package/build-module/list-item/hooks/index.mjs +8 -10
- package/build-module/list-item/hooks/index.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +63 -58
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +27 -35
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/list-item/hooks/use-multi-select-tab.mjs +59 -0
- package/build-module/list-item/hooks/use-multi-select-tab.mjs.map +7 -0
- package/build-module/list-item/hooks/use-tab.mjs +44 -0
- package/build-module/list-item/hooks/use-tab.mjs.map +7 -0
- package/build-module/list-item/index.mjs +0 -17
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/list-item/utils.mjs +140 -0
- package/build-module/list-item/utils.mjs.map +7 -0
- package/build-module/math/block.json +3 -0
- package/build-module/media-text/index.mjs +0 -50
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +17 -12
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/more/index.mjs +0 -18
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/constants.mjs +1 -1
- package/build-module/navigation/constants.mjs.map +1 -1
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/deprecated.mjs +48 -0
- package/build-module/navigation-link/deprecated.mjs.map +7 -0
- package/build-module/navigation-link/index.mjs +7 -75
- package/build-module/navigation-link/index.mjs.map +3 -3
- package/build-module/navigation-link/variations.mjs +22 -0
- package/build-module/navigation-link/variations.mjs.map +7 -0
- package/build-module/navigation-submenu/index.mjs +1 -33
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +0 -17
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +8 -4
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/post-template/edit.mjs +3 -1
- package/build-module/post-template/edit.mjs.map +2 -2
- package/build-module/preformatted/index.mjs +0 -17
- package/build-module/preformatted/index.mjs.map +2 -2
- package/build-module/pullquote/index.mjs +0 -24
- package/build-module/pullquote/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +14 -6
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +9 -4
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/query-content.mjs +32 -11
- package/build-module/query/edit/query-content.mjs.map +2 -2
- package/build-module/query/utils.mjs +10 -7
- package/build-module/query/utils.mjs.map +2 -2
- package/build-module/search/edit.mjs +4 -2
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/search/index.mjs +0 -31
- package/build-module/search/index.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +13 -19
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -20
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-link/index.mjs +0 -31
- package/build-module/social-link/index.mjs.map +2 -2
- package/build-module/verse/index.mjs +0 -17
- package/build-module/verse/index.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -40
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +3 -5
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/columns/style-rtl.css +1 -1
- package/build-style/columns/style.css +1 -1
- package/build-style/comment-template/style-rtl.css +0 -1
- package/build-style/comment-template/style.css +0 -1
- package/build-style/cover/style-rtl.css +1 -2
- package/build-style/cover/style.css +1 -2
- package/build-style/editor-rtl.css +20 -81
- package/build-style/editor.css +20 -81
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/group/theme-rtl.css +1 -1
- package/build-style/group/theme.css +1 -1
- package/build-style/heading/style-rtl.css +1 -1
- package/build-style/heading/style.css +1 -1
- package/build-style/icon/style-rtl.css +3 -0
- package/build-style/icon/style.css +3 -0
- package/build-style/image/editor-rtl.css +0 -1
- package/build-style/image/editor.css +0 -1
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/media-text/style-rtl.css +2 -3
- package/build-style/media-text/style.css +2 -3
- package/build-style/navigation/editor-rtl.css +8 -0
- package/build-style/navigation/editor.css +8 -0
- package/build-style/paragraph/style-rtl.css +1 -1
- package/build-style/paragraph/style.css +1 -1
- package/build-style/playlist/style-rtl.css +1 -2
- package/build-style/playlist/style.css +1 -2
- package/build-style/playlist-track/style-rtl.css +1 -2
- package/build-style/playlist-track/style.css +1 -2
- package/build-style/preformatted/style-rtl.css +1 -1
- package/build-style/preformatted/style.css +1 -1
- package/build-style/query/editor-rtl.css +5 -15
- package/build-style/query/editor.css +5 -15
- package/build-style/read-more/style-rtl.css +0 -1
- package/build-style/read-more/style.css +0 -1
- package/build-style/reset-rtl.css +1 -3
- package/build-style/reset.css +1 -3
- package/build-style/search/style-rtl.css +1 -3
- package/build-style/search/style.css +1 -3
- package/build-style/site-logo/editor-rtl.css +1 -2
- package/build-style/site-logo/editor.css +1 -2
- package/build-style/style-rtl.css +18 -77
- package/build-style/style.css +18 -77
- package/build-style/tab-list/style-rtl.css +1 -3
- package/build-style/tab-list/style.css +1 -3
- package/build-style/template-part/editor-rtl.css +4 -8
- package/build-style/template-part/editor.css +4 -8
- package/build-style/template-part/theme-rtl.css +1 -1
- package/build-style/template-part/theme.css +1 -1
- package/build-style/theme-rtl.css +2 -2
- package/build-style/theme.css +2 -2
- package/build-style/video/style-rtl.css +1 -2
- package/build-style/video/style.css +1 -2
- package/build-types/navigation-link/deprecated.d.ts +48 -0
- package/build-types/navigation-link/deprecated.d.ts.map +1 -0
- package/package.json +43 -43
- package/src/accordion/index.php +2 -2
- package/src/accordion-item/index.php +1 -1
- package/src/audio/edit.jsx +6 -7
- package/src/audio/index.js +0 -37
- package/src/breadcrumbs/index.php +4 -4
- package/src/button/index.js +0 -34
- package/src/button/style.scss +16 -15
- package/src/button/test/{get-experimental-label.js → get-experimental-label.jsdom.test.js} +1 -0
- package/src/button/test/get-updated-link-attributes.js +1 -0
- package/src/button/test/utils.js +1 -0
- package/src/categories/index.php +4 -0
- package/src/code/index.js +0 -18
- package/src/code/test/utils.js +1 -0
- package/src/columns/style.scss +2 -1
- package/src/columns/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/columns/test/utils.js +1 -0
- package/src/comment-template/edit.jsx +1 -1
- package/src/comment-template/index.php +2 -2
- package/src/comment-template/test/index.js +1 -0
- package/src/common.scss +51 -50
- package/src/cover/README.md +37 -0
- package/src/cover/index.js +0 -39
- package/src/cover/style.scss +3 -3
- package/src/cover/test/{edit.js → edit.jsdom.test.js} +18 -17
- package/src/cover/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/details/index.js +0 -18
- package/src/editor.scss +0 -2
- package/src/embed/editor.scss +1 -0
- package/src/embed/test/{index.js → index.jsdom.test.js} +5 -1
- package/src/file/index.js +1 -43
- package/src/footnotes/format.jsx +5 -1
- package/src/gallery/dynamic-gallery.jsx +31 -4
- package/src/gallery/test/dynamic-source.js +1 -0
- package/src/gallery/test/{edit.js → edit.jsdom.test.js} +4 -0
- package/src/gallery/test/responsive-styles.js +1 -0
- package/src/gallery/test/shared.js +1 -0
- package/src/gallery/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/gallery/test/{use-get-new-images.jsx → use-get-new-images.jsdom.test.jsx} +1 -0
- package/src/gallery/test/variations.js +1 -0
- package/src/group/test/{placeholder.jsx → placeholder.jsdom.test.jsx} +1 -0
- package/src/group/theme.scss +1 -1
- package/src/heading/index.js +1 -22
- package/src/heading/index.php +1 -1
- package/src/heading/style.scss +1 -1
- package/src/heading/test/shared.js +1 -0
- package/src/home-link/index.php +2 -2
- package/src/html/test/{index.js → index.jsdom.test.js} +9 -0
- package/src/html/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/icon/index.php +18 -6
- package/src/icon/style.scss +7 -0
- package/src/image/image.jsx +18 -11
- package/src/image/index.js +0 -80
- package/src/image/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/image/test/{use-open-image-media-editor-modal.js → use-open-image-media-editor-modal.jsdom.test.js} +343 -28
- package/src/image/use-open-image-media-editor-modal.js +184 -21
- package/src/index.jsx +0 -11
- package/src/latest-posts/edit.jsx +1 -1
- package/src/latest-posts/test/{deprecated.js → deprecated.jsdom.test.js} +1 -0
- package/src/list/index.php +1 -1
- package/src/list/style.scss +1 -1
- package/src/list-item/edit.jsx +20 -20
- package/src/list-item/hooks/index.js +2 -3
- package/src/list-item/hooks/use-enter.js +82 -70
- package/src/list-item/hooks/use-merge.js +28 -36
- package/src/list-item/hooks/use-multi-select-tab.js +83 -0
- package/src/list-item/hooks/use-tab.js +62 -0
- package/src/list-item/index.js +0 -18
- package/src/list-item/utils.js +236 -0
- package/src/math/README.md +2 -0
- package/src/math/block.json +3 -0
- package/src/media-text/index.js +0 -50
- package/src/media-text/media-container.jsx +22 -12
- package/src/media-text/style.scss +2 -1
- package/src/media-text/test/image-fill.js +1 -0
- package/src/more/index.js +0 -19
- package/src/navigation/constants.js +1 -1
- package/src/navigation/edit/test/are-blocks-dirty.js +1 -0
- package/src/navigation/edit/test/{layout-custom-properties.js → layout-custom-properties.jsdom.test.js} +8 -7
- package/src/navigation/edit/test/{navigation-menu-selector.jsx → navigation-menu-selector.jsdom.test.jsx} +23 -14
- package/src/navigation/edit/test/{overlay-template-part-selector.jsx → overlay-template-part-selector.jsdom.test.jsx} +22 -20
- package/src/navigation/edit/test/{responsive-wrapper.jsx → responsive-wrapper.jsdom.test.jsx} +14 -13
- package/src/navigation/edit/test/{use-create-overlay.js → use-create-overlay.jsdom.test.js} +19 -24
- package/src/navigation/edit/test/utils.js +1 -0
- package/src/navigation/editor.scss +13 -0
- package/src/navigation/index.php +14 -14
- package/src/navigation/test/{menu-items-to-blocks.js → menu-items-to-blocks.jsdom.test.js} +3 -2
- package/src/navigation/test/{use-navigation-menu.js → use-navigation-menu.jsdom.test.js} +7 -4
- package/src/navigation/test/{view.js → view.jsdom.test.js} +4 -2
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/deprecated.tsx +58 -0
- package/src/navigation-link/{index.jsx → index.js} +5 -77
- package/src/navigation-link/index.php +5 -5
- package/src/navigation-link/shared/test/{controls.jsx → controls.jsdom.test.jsx} +18 -18
- package/src/navigation-link/shared/test/update-attributes.test.js +52 -51
- package/src/navigation-link/shared/test/{use-enable-link-status-validation.test.js → use-enable-link-status-validation.jsdom.test.js} +8 -6
- package/src/navigation-link/shared/test/{use-entity-binding.js → use-entity-binding.jsdom.test.js} +12 -11
- package/src/navigation-link/shared/test/{use-handle-link-change.test.js → use-handle-link-change.jsdom.test.js} +23 -20
- package/src/navigation-link/shared/test/{use-link-preview.test.js → use-link-preview.jsdom.test.js} +17 -14
- package/src/navigation-link/test/__snapshots__/{hooks.js.snap → hooks.jsdom.test.js.snap} +23 -6
- package/src/navigation-link/test/block-labelling.js +1 -0
- package/src/navigation-link/test/{hooks.js → hooks.jsdom.test.js} +1 -0
- package/src/navigation-link/variations.js +19 -0
- package/src/navigation-submenu/index.js +1 -33
- package/src/page-list/index.php +10 -10
- package/src/page-list/test/{convert-to-navigation-links.js → convert-to-navigation-links.jsdom.test.js} +3 -2
- package/src/paragraph/index.js +0 -18
- package/src/paragraph/style.scss +1 -1
- package/src/paragraph/use-enter.js +13 -6
- package/src/pattern/test/index.js +1 -0
- package/src/playlist/test/{edit-component.jsx → edit-component.jsdom.test.jsx} +31 -30
- package/src/playlist/test/{edit.js → edit.jsdom.test.js} +1 -0
- package/src/playlist/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/playlist-track/test/{edit.jsx → edit.jsdom.test.jsx} +20 -19
- package/src/post-author/index.php +3 -3
- package/src/post-author-biography/index.php +3 -3
- package/src/post-author-name/index.php +3 -3
- package/src/post-comments-link/index.php +4 -4
- package/src/post-date/test/{edit.js → edit.jsdom.test.js} +1 -0
- package/src/post-template/edit.jsx +3 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/post-title/style.scss +1 -0
- package/src/preformatted/index.js +0 -18
- package/src/preformatted/style.scss +1 -1
- package/src/pullquote/index.js +0 -24
- package/src/query/edit/inspector-controls/enhanced-pagination-control.jsx +13 -6
- package/src/query/edit/inspector-controls/index.jsx +9 -4
- package/src/query/edit/query-content.jsx +31 -8
- package/src/query/editor.scss +1 -7
- package/src/query/index.php +2 -2
- package/src/query/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/query/utils.js +15 -11
- package/src/quote/test/{migrate.js → migrate.jsdom.test.js} +1 -0
- package/src/read-more/index.php +1 -1
- package/src/search/edit.jsx +12 -2
- package/src/search/index.js +0 -30
- package/src/search/index.php +1 -1
- package/src/separator/test/{edit.jsx → edit.jsdom.test.jsx} +5 -4
- package/src/site-logo/index.php +1 -1
- package/src/site-tagline/edit.jsx +18 -27
- package/src/site-title/edit.jsx +20 -27
- package/src/social-link/index.js +0 -32
- package/src/social-link/index.php +0 -1
- package/src/style.scss +0 -1
- package/src/table/editor.scss +1 -0
- package/src/table/style.scss +2 -0
- package/src/table/test/state.js +1 -0
- package/src/table/test/utils.js +1 -0
- package/src/table-of-contents/index.php +3 -3
- package/src/template-part/theme.scss +1 -1
- package/src/utils/test/search-patterns.js +1 -0
- package/src/utils/test/{style-state.js → style-state.jsdom.test.js} +1 -0
- package/src/utils/test/{waveform-player-dependency.js → waveform-player-dependency.jsdom.test.js} +15 -21
- package/src/verse/index.js +0 -18
- package/src/verse/style.scss +1 -0
- package/src/video/index.js +0 -40
- package/src/video/test/variations.js +1 -0
- package/src/video/tracks-editor.jsx +4 -5
- package/build/form/block.json +0 -65
- package/build/form/deprecated.cjs +0 -111
- package/build/form/deprecated.cjs.map +0 -7
- package/build/form/edit.cjs +0 -180
- package/build/form/edit.cjs.map +0 -7
- package/build/form/icons.cjs +0 -33
- package/build/form/icons.cjs.map +0 -7
- package/build/form/index.cjs +0 -118
- package/build/form/index.cjs.map +0 -7
- package/build/form/init.cjs +0 -28
- package/build/form/init.cjs.map +0 -7
- package/build/form/save.cjs +0 -40
- package/build/form/save.cjs.map +0 -7
- package/build/form/utils.cjs +0 -61
- package/build/form/utils.cjs.map +0 -7
- package/build/form/variations.cjs +0 -152
- package/build/form/variations.cjs.map +0 -7
- package/build/form/view.cjs +0 -48
- package/build/form/view.cjs.map +0 -7
- package/build/form-input/block.json +0 -72
- package/build/form-input/deprecated.cjs +0 -252
- package/build/form-input/deprecated.cjs.map +0 -7
- package/build/form-input/edit.cjs +0 -206
- package/build/form-input/edit.cjs.map +0 -7
- package/build/form-input/icons.cjs +0 -33
- package/build/form-input/icons.cjs.map +0 -7
- package/build/form-input/index.cjs +0 -63
- package/build/form-input/index.cjs.map +0 -7
- package/build/form-input/init.cjs +0 -28
- package/build/form-input/init.cjs.map +0 -7
- package/build/form-input/save.cjs +0 -88
- package/build/form-input/save.cjs.map +0 -7
- package/build/form-input/variations.cjs +0 -105
- package/build/form-input/variations.cjs.map +0 -7
- package/build/form-submission-notification/block.json +0 -19
- package/build/form-submission-notification/edit.cjs +0 -71
- package/build/form-submission-notification/edit.cjs.map +0 -7
- package/build/form-submission-notification/index.cjs +0 -73
- package/build/form-submission-notification/index.cjs.map +0 -7
- package/build/form-submission-notification/init.cjs +0 -28
- package/build/form-submission-notification/init.cjs.map +0 -7
- package/build/form-submission-notification/save.cjs +0 -54
- package/build/form-submission-notification/save.cjs.map +0 -7
- package/build/form-submission-notification/variations.cjs +0 -78
- package/build/form-submission-notification/variations.cjs.map +0 -7
- package/build/form-submit-button/block.json +0 -15
- package/build/form-submit-button/edit.cjs +0 -36
- package/build/form-submit-button/edit.cjs.map +0 -7
- package/build/form-submit-button/index.cjs +0 -75
- package/build/form-submit-button/index.cjs.map +0 -7
- package/build/form-submit-button/init.cjs.map +0 -7
- package/build/form-submit-button/save.cjs +0 -32
- package/build/form-submit-button/save.cjs.map +0 -7
- package/build/list-item/hooks/use-indent-list-item.cjs +0 -79
- package/build/list-item/hooks/use-indent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-outdent-list-item.cjs +0 -106
- package/build/list-item/hooks/use-outdent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-space.cjs +0 -83
- package/build/list-item/hooks/use-space.cjs.map +0 -7
- package/build/query/edit/enhanced-pagination-modal.cjs +0 -89
- package/build/query/edit/enhanced-pagination-modal.cjs.map +0 -7
- package/build-module/form/block.json +0 -65
- package/build-module/form/deprecated.mjs +0 -96
- package/build-module/form/deprecated.mjs.map +0 -7
- package/build-module/form/edit.mjs +0 -170
- package/build-module/form/edit.mjs.map +0 -7
- package/build-module/form/icons.mjs +0 -8
- package/build-module/form/icons.mjs.map +0 -7
- package/build-module/form/index.mjs +0 -83
- package/build-module/form/index.mjs.map +0 -7
- package/build-module/form/init.mjs +0 -7
- package/build-module/form/init.mjs.map +0 -7
- package/build-module/form/save.mjs +0 -19
- package/build-module/form/save.mjs.map +0 -7
- package/build-module/form/utils.mjs +0 -35
- package/build-module/form/utils.mjs.map +0 -7
- package/build-module/form/variations.mjs +0 -134
- package/build-module/form/variations.mjs.map +0 -7
- package/build-module/form/view.mjs +0 -46
- package/build-module/form/view.mjs.map +0 -7
- package/build-module/form-input/block.json +0 -72
- package/build-module/form-input/deprecated.mjs +0 -226
- package/build-module/form-input/deprecated.mjs.map +0 -7
- package/build-module/form-input/edit.mjs +0 -186
- package/build-module/form-input/edit.mjs.map +0 -7
- package/build-module/form-input/icons.mjs +0 -8
- package/build-module/form-input/icons.mjs.map +0 -7
- package/build-module/form-input/index.mjs +0 -25
- package/build-module/form-input/index.mjs.map +0 -7
- package/build-module/form-input/init.mjs +0 -7
- package/build-module/form-input/init.mjs.map +0 -7
- package/build-module/form-input/save.mjs +0 -62
- package/build-module/form-input/save.mjs.map +0 -7
- package/build-module/form-input/variations.mjs +0 -84
- package/build-module/form-input/variations.mjs.map +0 -7
- package/build-module/form-submission-notification/block.json +0 -19
- package/build-module/form-submission-notification/edit.mjs +0 -45
- package/build-module/form-submission-notification/edit.mjs.map +0 -7
- package/build-module/form-submission-notification/index.mjs +0 -35
- package/build-module/form-submission-notification/index.mjs.map +0 -7
- package/build-module/form-submission-notification/init.mjs +0 -7
- package/build-module/form-submission-notification/init.mjs.map +0 -7
- package/build-module/form-submission-notification/save.mjs +0 -23
- package/build-module/form-submission-notification/save.mjs.map +0 -7
- package/build-module/form-submission-notification/variations.mjs +0 -57
- package/build-module/form-submission-notification/variations.mjs.map +0 -7
- package/build-module/form-submit-button/block.json +0 -15
- package/build-module/form-submit-button/edit.mjs +0 -15
- package/build-module/form-submit-button/edit.mjs.map +0 -7
- package/build-module/form-submit-button/index.mjs +0 -37
- package/build-module/form-submit-button/index.mjs.map +0 -7
- package/build-module/form-submit-button/init.mjs +0 -7
- package/build-module/form-submit-button/init.mjs.map +0 -7
- package/build-module/form-submit-button/save.mjs +0 -11
- package/build-module/form-submit-button/save.mjs.map +0 -7
- package/build-module/list-item/hooks/use-indent-list-item.mjs +0 -58
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-outdent-list-item.mjs +0 -85
- package/build-module/list-item/hooks/use-outdent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-space.mjs +0 -52
- package/build-module/list-item/hooks/use-space.mjs.map +0 -7
- package/build-module/query/edit/enhanced-pagination-modal.mjs +0 -72
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +0 -7
- package/build-style/form-input/editor-rtl.css +0 -19
- package/build-style/form-input/editor.css +0 -19
- package/build-style/form-input/style-rtl.css +0 -48
- package/build-style/form-input/style.css +0 -48
- package/build-style/form-submission-notification/editor-rtl.css +0 -30
- package/build-style/form-submission-notification/editor.css +0 -30
- package/build-style/form-submit-button/style-rtl.css +0 -3
- package/build-style/form-submit-button/style.css +0 -3
- package/src/form/README.md +0 -90
- package/src/form/block.json +0 -65
- package/src/form/deprecated.jsx +0 -93
- package/src/form/edit.jsx +0 -169
- package/src/form/icons.jsx +0 -7
- package/src/form/index.js +0 -91
- package/src/form/index.php +0 -197
- package/src/form/init.js +0 -3
- package/src/form/save.jsx +0 -15
- package/src/form/utils.js +0 -36
- package/src/form/variations.js +0 -133
- package/src/form/view.js +0 -54
- package/src/form-input/README.md +0 -74
- package/src/form-input/block.json +0 -72
- package/src/form-input/deprecated.jsx +0 -248
- package/src/form-input/edit.jsx +0 -187
- package/src/form-input/editor.scss +0 -24
- package/src/form-input/icons.jsx +0 -7
- package/src/form-input/index.js +0 -22
- package/src/form-input/index.php +0 -47
- package/src/form-input/init.js +0 -3
- package/src/form-input/save.jsx +0 -89
- package/src/form-input/style.scss +0 -64
- package/src/form-input/variations.js +0 -82
- package/src/form-submission-notification/README.md +0 -50
- package/src/form-submission-notification/block.json +0 -19
- package/src/form-submission-notification/edit.jsx +0 -44
- package/src/form-submission-notification/editor.scss +0 -45
- package/src/form-submission-notification/index.js +0 -33
- package/src/form-submission-notification/index.php +0 -48
- package/src/form-submission-notification/init.js +0 -3
- package/src/form-submission-notification/save.jsx +0 -18
- package/src/form-submission-notification/variations.js +0 -56
- package/src/form-submit-button/README.md +0 -54
- package/src/form-submit-button/block.json +0 -15
- package/src/form-submit-button/edit.jsx +0 -12
- package/src/form-submit-button/index.js +0 -35
- package/src/form-submit-button/init.js +0 -3
- package/src/form-submit-button/save.jsx +0 -10
- package/src/form-submit-button/style.scss +0 -3
- package/src/list-item/hooks/use-indent-list-item.js +0 -73
- package/src/list-item/hooks/use-outdent-list-item.js +0 -100
- package/src/list-item/hooks/use-space.js +0 -66
- package/src/query/edit/enhanced-pagination-modal.jsx +0 -77
- /package/src/utils/test/{waveform-player.jsx → waveform-player.jsdom.test.jsx} +0 -0
- /package/src/utils/test/{waveform-utils.js → waveform-utils.jsdom.test.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/details/index.js"],
|
|
4
|
-
"sourcesContent": ["import { details as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport
|
|
5
|
-
"mappings": ";AAAA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;AAC5B,
|
|
4
|
+
"sourcesContent": ["import { details as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __( 'Type / to add a hidden block' ),\n\t\t},\n\t],\n];\n\nexport const settings = {\n\ticon,\n\ttemplate: TEMPLATE,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: __( 'La Mancha' ),\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { summary } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasSummary = summary?.trim().length > 0;\n\n\t\t// In the list view, use the block's summary as the label.\n\t\t// If the summary is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasSummary ) ) {\n\t\t\treturn customName || summary;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasSummary\n\t\t\t\t? __( 'Details. Empty.' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: accessibility text; summary title. */\n\t\t\t\t\t\t__( 'Details. %s' ),\n\t\t\t\t\t\tsummary\n\t\t\t\t );\n\t\t}\n\t},\n\tsave,\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;AAC5B,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAGjB,IAAM,WAAW;AAAA,EAChB;AAAA,IACC;AAAA,IACA;AAAA,MACC,aAAa,GAAI,8BAA+B;AAAA,IACjD;AAAA,EACD;AACD;AAEO,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS,GAAI,WAAY;AAAA,MACzB,aAAa;AAAA,IACd;AAAA,IACA,aAAa;AAAA,MACZ;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,SAAS;AAAA,YACR;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,QAAQ,IAAI;AAEpB,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,SAAS,KAAK,EAAE,SAAS;AAI5C,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,YAAY,gBAAgB,YAAa;AAC7C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,aAAO,CAAE,aACN,GAAI,iBAAkB,IACtB;AAAA;AAAA,QAEA,GAAI,aAAc;AAAA,QAClB;AAAA,MACA;AAAA,IACJ;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// packages/block-library/src/file/index.js
|
|
2
|
-
import { _x
|
|
2
|
+
import { _x } from "@wordpress/i18n";
|
|
3
3
|
import { file as icon } from "@wordpress/icons";
|
|
4
|
-
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
5
4
|
import initBlock from "../utils/init-block.mjs";
|
|
6
5
|
import deprecated from "./deprecated.mjs";
|
|
7
6
|
import edit from "./edit.mjs";
|
|
@@ -9,8 +8,6 @@ import metadata from "./block.json";
|
|
|
9
8
|
import save from "./save.mjs";
|
|
10
9
|
import transforms from "./transforms.mjs";
|
|
11
10
|
import variations from "./variations.mjs";
|
|
12
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
13
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
14
11
|
var { name } = metadata;
|
|
15
12
|
var settings = {
|
|
16
13
|
icon,
|
|
@@ -26,46 +23,6 @@ var settings = {
|
|
|
26
23
|
save,
|
|
27
24
|
variations
|
|
28
25
|
};
|
|
29
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
30
|
-
settings[fieldsKey] = [
|
|
31
|
-
{
|
|
32
|
-
id: "file",
|
|
33
|
-
label: __("File"),
|
|
34
|
-
type: "media",
|
|
35
|
-
Edit: {
|
|
36
|
-
control: "media",
|
|
37
|
-
// TODO: replace with custom component
|
|
38
|
-
allowedTypes: [],
|
|
39
|
-
multiple: false
|
|
40
|
-
},
|
|
41
|
-
getValue: ({ item }) => ({
|
|
42
|
-
id: item.id,
|
|
43
|
-
url: item.href
|
|
44
|
-
}),
|
|
45
|
-
setValue: ({ value }) => ({
|
|
46
|
-
id: value.id,
|
|
47
|
-
href: value.url
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "fileName",
|
|
52
|
-
label: __("Filename"),
|
|
53
|
-
type: "text",
|
|
54
|
-
Edit: "rich-text"
|
|
55
|
-
// TODO: replace with custom component
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: "downloadButtonText",
|
|
59
|
-
label: __("Button Text"),
|
|
60
|
-
type: "text",
|
|
61
|
-
Edit: "rich-text"
|
|
62
|
-
// TODO: replace with custom component
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
settings[formKey] = {
|
|
66
|
-
fields: ["file", "fileName", "downloadButtonText"]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
26
|
var init = () => initBlock({ name, metadata, settings });
|
|
70
27
|
export {
|
|
71
28
|
init,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file/index.js"],
|
|
4
|
-
"sourcesContent": ["import { _x
|
|
5
|
-
"mappings": ";AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thref: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t\tfileName: _x( 'Armstrong_Small_Step', 'Name of the file' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,QAAQ,YAAY;AAC7B,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,MAAM;AAAA,MACN,UAAU,GAAI,wBAAwB,kBAAmB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/footnotes/format.jsx"],
|
|
4
|
-
"sourcesContent": ["import { v4 as createId } from 'uuid';\nimport { __ } from '@wordpress/i18n';\nimport { formatListNumbered as icon } from '@wordpress/icons';\nimport { insertObject } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tstore as blockEditorStore,\n\tprivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { unlock } from '../lock-unlock';\nimport { name as FOOTNOTES_BLOCK_NAME } from './';\n\nexport const formatName = 'core/footnote';\n\nconst { usesContextKey } = unlock( privateApis );\nconst POST_CONTENT_BLOCK_NAME = 'core/post-content';\nconst SYNCED_PATTERN_BLOCK_NAME = 'core/block';\n\nexport const format = {\n\ttitle: __( 'Footnote' ),\n\ttagName: 'sup',\n\tclassName: 'fn',\n\tattributes: {\n\t\t'data-fn': 'data-fn',\n\t},\n\tinteractive: true,\n\tcontentEditable: false,\n\t[ usesContextKey ]: [ 'postType', 'postId' ],\n\tedit: function Edit( {\n\t\tvalue,\n\t\tonChange,\n\t\tisObjectActive,\n\t\tcontext: { postType, postId },\n\t} ) {\n\t\tconst registry = useRegistry();\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlocks,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockName,\n\t\t\tgetBlockParentsByBlockName,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst isFootnotesSupported = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif (\n\t\t\t\t\t! select( blocksStore ).getBlockType( 'core/footnotes' )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst allowedBlocks =\n\t\t\t\t\tselect( blockEditorStore ).getSettings().allowedBlockTypes;\n\t\t\t\tif (\n\t\t\t\t\tallowedBlocks === false ||\n\t\t\t\t\t( Array.isArray( allowedBlocks ) &&\n\t\t\t\t\t\t! allowedBlocks.includes( 'core/footnotes' ) )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst entityRecord = select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t);\n\n\t\t\t\tif ( 'string' !== typeof entityRecord?.meta?.footnotes ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Checks if the selected block lives within a pattern.\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockParentsByBlockName: _getBlockParentsByBlockName,\n\t\t\t\t\tgetSelectedBlockClientId: _getSelectedBlockClientId,\n\t\t\t\t\tgetBlockName: _getBlockName,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst selectedClientId = _getSelectedBlockClientId();\n\n\t\t\t\tif ( ! selectedClientId ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Check if the selected block itself is a footnotes block.\n\t\t\t\tif (\n\t\t\t\t\t_getBlockName( selectedClientId ) === FOOTNOTES_BLOCK_NAME\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst parentCoreBlocks = _getBlockParentsByBlockName(\n\t\t\t\t\tselectedClientId,\n\t\t\t\t\tSYNCED_PATTERN_BLOCK_NAME\n\t\t\t\t);\n\t\t\t\treturn ! parentCoreBlocks || parentCoreBlocks.length === 0;\n\t\t\t},\n\t\t\t[ postType, postId ]\n\t\t);\n\n\t\tconst { selectionChange, insertBlock } =\n\t\t\tuseDispatch( blockEditorStore );\n\n\t\tif ( ! isFootnotesSupported ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tregistry.batch( () => {\n\t\t\t\tlet id;\n\t\t\t\tif ( isObjectActive ) {\n\t\t\t\t\tconst object = value.replacements[ value.start ];\n\t\t\t\t\tid = object?.attributes?.[ 'data-fn' ];\n\t\t\t\t} else {\n\t\t\t\t\tid = createId()
|
|
5
|
-
"mappings": ";AAAA,SAAS,MAAM,gBAAgB;AAC/B,SAAS,UAAU;AACnB,SAAS,sBAAsB,YAAY;AAC3C,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,WAAW,aAAa,mBAAmB;AACpD,SAAS,SAAS,qBAAqB;AACvC,SAAS,aAAa,SAAS,mBAAmB;AAClD,SAAS,cAAc;AACvB,SAAS,QAAQ,4BAA4B;
|
|
4
|
+
"sourcesContent": ["import { v4 as createId } from 'uuid';\nimport { __ } from '@wordpress/i18n';\nimport { formatListNumbered as icon } from '@wordpress/icons';\nimport { insertObject } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tstore as blockEditorStore,\n\tprivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { unlock } from '../lock-unlock';\nimport { name as FOOTNOTES_BLOCK_NAME } from './';\n\nexport const formatName = 'core/footnote';\n\nconst { usesContextKey } = unlock( privateApis );\nconst POST_CONTENT_BLOCK_NAME = 'core/post-content';\nconst SYNCED_PATTERN_BLOCK_NAME = 'core/block';\n\nexport const format = {\n\ttitle: __( 'Footnote' ),\n\ttagName: 'sup',\n\tclassName: 'fn',\n\tattributes: {\n\t\t'data-fn': 'data-fn',\n\t},\n\tinteractive: true,\n\tcontentEditable: false,\n\t[ usesContextKey ]: [ 'postType', 'postId' ],\n\tedit: function Edit( {\n\t\tvalue,\n\t\tonChange,\n\t\tisObjectActive,\n\t\tcontext: { postType, postId },\n\t} ) {\n\t\tconst registry = useRegistry();\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlocks,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockName,\n\t\t\tgetBlockParentsByBlockName,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst isFootnotesSupported = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tif (\n\t\t\t\t\t! select( blocksStore ).getBlockType( 'core/footnotes' )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst allowedBlocks =\n\t\t\t\t\tselect( blockEditorStore ).getSettings().allowedBlockTypes;\n\t\t\t\tif (\n\t\t\t\t\tallowedBlocks === false ||\n\t\t\t\t\t( Array.isArray( allowedBlocks ) &&\n\t\t\t\t\t\t! allowedBlocks.includes( 'core/footnotes' ) )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst entityRecord = select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t);\n\n\t\t\t\tif ( 'string' !== typeof entityRecord?.meta?.footnotes ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Checks if the selected block lives within a pattern.\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockParentsByBlockName: _getBlockParentsByBlockName,\n\t\t\t\t\tgetSelectedBlockClientId: _getSelectedBlockClientId,\n\t\t\t\t\tgetBlockName: _getBlockName,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst selectedClientId = _getSelectedBlockClientId();\n\n\t\t\t\tif ( ! selectedClientId ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Check if the selected block itself is a footnotes block.\n\t\t\t\tif (\n\t\t\t\t\t_getBlockName( selectedClientId ) === FOOTNOTES_BLOCK_NAME\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst parentCoreBlocks = _getBlockParentsByBlockName(\n\t\t\t\t\tselectedClientId,\n\t\t\t\t\tSYNCED_PATTERN_BLOCK_NAME\n\t\t\t\t);\n\t\t\t\treturn ! parentCoreBlocks || parentCoreBlocks.length === 0;\n\t\t\t},\n\t\t\t[ postType, postId ]\n\t\t);\n\n\t\tconst { selectionChange, insertBlock } =\n\t\t\tuseDispatch( blockEditorStore );\n\n\t\tif ( ! isFootnotesSupported ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tregistry.batch( () => {\n\t\t\t\tlet id;\n\t\t\t\tif ( isObjectActive ) {\n\t\t\t\t\tconst object = value.replacements[ value.start ];\n\t\t\t\t\tid = object?.attributes?.[ 'data-fn' ];\n\t\t\t\t} else {\n\t\t\t\t\t// The ID doubles as the anchor target of the footnote link.\n\t\t\t\t\t// A CSS identifier cannot start with a digit, so a bare UUID\n\t\t\t\t\t// (which often does) breaks `querySelector( '#' + id )` and\n\t\t\t\t\t// `#id` style rules on the front end. Prefix it with a letter.\n\t\t\t\t\tid = `fn-${ createId() }`;\n\t\t\t\t\tconst newValue = insertObject(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: formatName,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t'data-fn': id,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinnerHTML: `<a href=\"#${ id }\" id=\"${ id }-link\">*</a>`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalue.end,\n\t\t\t\t\t\tvalue.end\n\t\t\t\t\t);\n\t\t\t\t\tnewValue.start = newValue.end - 1;\n\t\t\t\t\tonChange( newValue );\n\t\t\t\t}\n\n\t\t\t\tconst selectedClientId = getSelectedBlockClientId();\n\n\t\t\t\t/*\n\t\t\t\t * Attempts to find a common parent post content block.\n\t\t\t\t * This allows for locating blocks within a page edited in the site editor.\n\t\t\t\t */\n\t\t\t\tconst parentPostContent = getBlockParentsByBlockName(\n\t\t\t\t\tselectedClientId,\n\t\t\t\t\tPOST_CONTENT_BLOCK_NAME\n\t\t\t\t);\n\n\t\t\t\t// When called with a post content block, getBlocks will return\n\t\t\t\t// the block with controlled inner blocks included.\n\t\t\t\tconst blocks = parentPostContent.length\n\t\t\t\t\t? getBlocks( parentPostContent[ 0 ] )\n\t\t\t\t\t: getBlocks();\n\n\t\t\t\t// BFS search to find the first footnote block.\n\t\t\t\tlet fnBlock = null;\n\t\t\t\t{\n\t\t\t\t\tconst queue = [ ...blocks ];\n\t\t\t\t\twhile ( queue.length ) {\n\t\t\t\t\t\tconst block = queue.shift();\n\t\t\t\t\t\tif ( block.name === 'core/footnotes' ) {\n\t\t\t\t\t\t\tfnBlock = block;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqueue.push( ...block.innerBlocks );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Maybe this should all also be moved to the entity provider.\n\t\t\t\t// When there is no footnotes block in the post, create one and\n\t\t\t\t// insert it at the bottom.\n\t\t\t\tif ( ! fnBlock ) {\n\t\t\t\t\tlet rootClientId = getBlockRootClientId( selectedClientId );\n\n\t\t\t\t\twhile (\n\t\t\t\t\t\trootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) !== POST_CONTENT_BLOCK_NAME\n\t\t\t\t\t) {\n\t\t\t\t\t\trootClientId = getBlockRootClientId( rootClientId );\n\t\t\t\t\t}\n\n\t\t\t\t\tfnBlock = createBlock( 'core/footnotes' );\n\n\t\t\t\t\tinsertBlock( fnBlock, undefined, rootClientId );\n\t\t\t\t}\n\n\t\t\t\tselectionChange( fnBlock.clientId, id, 0, 0 );\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ icon }\n\t\t\t\ttitle={ __( 'Footnote' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isObjectActive }\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/block-library/src/gallery/dynamic-gallery.jsx
|
|
2
2
|
import { __, sprintf } from "@wordpress/i18n";
|
|
3
|
-
import { useState } from "@wordpress/element";
|
|
3
|
+
import { useMemo, useState } from "@wordpress/element";
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
6
|
Notice,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
__experimentalUseBlockPreview as useBlockPreview
|
|
21
21
|
} from "@wordpress/block-editor";
|
|
22
22
|
import { sharedIcon } from "./shared-icon.mjs";
|
|
23
|
+
import { isGalleryFlexLayout } from "./shared.mjs";
|
|
23
24
|
import { Caption } from "../utils/caption.mjs";
|
|
24
25
|
import { DEFAULT_ORDERBY, DEFAULT_ORDER, MAX_IMAGES } from "./dynamic-source.mjs";
|
|
25
26
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -172,15 +173,18 @@ function GallerySourcePanel({
|
|
|
172
173
|
return null;
|
|
173
174
|
}
|
|
174
175
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
175
|
-
/* @__PURE__ */ jsx(PanelBody, { title: __("Source"), children: /* @__PURE__ */
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
/* @__PURE__ */ jsx(PanelBody, { title: __("Source"), children: /* @__PURE__ */ jsxs("div", { className: "wp-block-gallery__source-settings", children: [
|
|
177
|
+
/* @__PURE__ */ jsx("p", { className: "wp-block-gallery__source-description", children: __("Images added to the gallery.") }),
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
Button,
|
|
180
|
+
{
|
|
181
|
+
__next40pxDefaultSize: true,
|
|
182
|
+
variant: "secondary",
|
|
183
|
+
onClick: requestEnableDynamicMode,
|
|
184
|
+
children: __("Use attached images")
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }) }),
|
|
184
188
|
isConfirming && /* @__PURE__ */ jsx(
|
|
185
189
|
ConfirmDialog,
|
|
186
190
|
{
|
|
@@ -201,9 +205,10 @@ function GallerySourcePanel({
|
|
|
201
205
|
)
|
|
202
206
|
] });
|
|
203
207
|
}
|
|
204
|
-
function GalleryImagesPreview({ imageBlocks }) {
|
|
208
|
+
function GalleryImagesPreview({ imageBlocks, layout }) {
|
|
205
209
|
const { children, ref, className } = useBlockPreview({
|
|
206
|
-
blocks: imageBlocks
|
|
210
|
+
blocks: imageBlocks,
|
|
211
|
+
layout
|
|
207
212
|
});
|
|
208
213
|
return /* @__PURE__ */ jsx(
|
|
209
214
|
"div",
|
|
@@ -235,6 +240,10 @@ function GalleryDynamicView({
|
|
|
235
240
|
} = dynamic;
|
|
236
241
|
const blockEditingMode = useBlockEditingMode();
|
|
237
242
|
const [isConfirmingDetach, setIsConfirmingDetach] = useState(false);
|
|
243
|
+
const previewLayout = useMemo(
|
|
244
|
+
() => isGalleryFlexLayout(attributes.layout) ? { ...attributes.layout, type: "flex" } : attributes.layout,
|
|
245
|
+
[attributes.layout]
|
|
246
|
+
);
|
|
238
247
|
const emptyInstructions = isResolvingDynamic ? __("Loading images…") : sourceDescriptor?.emptyMessage ?? __("Dynamic images will appear here.");
|
|
239
248
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
240
249
|
blockEditingMode === "default" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -261,7 +270,8 @@ function GalleryDynamicView({
|
|
|
261
270
|
dynamicImageBlocks.length ? /* @__PURE__ */ jsx(BlockContextProvider, { value: galleryContext, children: /* @__PURE__ */ jsx(
|
|
262
271
|
GalleryImagesPreview,
|
|
263
272
|
{
|
|
264
|
-
imageBlocks: dynamicImageBlocks
|
|
273
|
+
imageBlocks: dynamicImageBlocks,
|
|
274
|
+
layout: previewLayout
|
|
265
275
|
}
|
|
266
276
|
) }) : /* @__PURE__ */ jsx(
|
|
267
277
|
Placeholder,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/gallery/dynamic-gallery.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tNotice,\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl,\n\tSpinner,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport {\n\tBlockContextProvider,\n\tBlockControls,\n\tuseBlockEditingMode,\n\t__experimentalUseBlockPreview as useBlockPreview,\n} from '@wordpress/block-editor';\nimport { sharedIcon } from './shared-icon';\nimport { Caption } from '../utils/caption';\nimport { DEFAULT_ORDERBY, DEFAULT_ORDER, MAX_IMAGES } from './dynamic-source';\n\n/**\n * Ordering options for a dynamic gallery source. Each value is a composite\n * `\"orderby/order\"` string mapping to the matching `/wp/v2/media` collection\n * params. `menu_order` is deliberately omitted — it isn't a valid REST `orderby`\n * value, so the editor preview couldn't reproduce it (see `dynamic-source.js`).\n */\nconst ORDER_OPTIONS = [\n\t{ label: __( 'Newest to oldest' ), value: 'date/desc' },\n\t{ label: __( 'Oldest to newest' ), value: 'date/asc' },\n\t{\n\t\t/* translators: Label for ordering images by title in ascending order. */\n\t\tlabel: __( 'A → Z' ),\n\t\tvalue: 'title/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering images by title in descending order. */\n\t\tlabel: __( 'Z → A' ),\n\t\tvalue: 'title/desc',\n\t},\n];\n\n/**\n * \"Order by\" control for a dynamic gallery, mirroring the Query Loop block's\n * `OrderControl`: a single `SelectControl` whose value composites `orderby` and\n * `order`, split apart again on change.\n *\n * @param {Object} props\n * @param {string} props.orderby Current `orderby` value.\n * @param {string} props.order Current `order` value (`asc`/`desc`).\n * @param {Function} props.onChange Called with `{ orderby, order }` on change.\n */\nfunction OrderControl( { orderby, order, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Order by' ) }\n\t\t\tvalue={ `${ orderby }/${ order }` }\n\t\t\toptions={ ORDER_OPTIONS }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tconst [ newOrderby, newOrder ] = value.split( '/' );\n\t\t\t\tonChange( { orderby: newOrderby, order: newOrder } );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\n/**\n * Confirmation for leaving dynamic mode, shown from both the block toolbar and\n * the Source panel so the two entry points explain the change identically.\n *\n * Detaching keeps the images the gallery currently shows but breaks the link to\n * its source, so it's worth confirming — mirroring the dialog `GallerySourcePanel`\n * shows for the opposite direction.\n *\n * @param {Object} props\n * @param {Function} props.onConfirm Called when the user confirms detaching.\n * @param {Function} props.onCancel Called when the user dismisses the dialog.\n */\nfunction DetachGalleryDialog( { onConfirm, onCancel } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\ttitle={ __( 'Detach Gallery' ) }\n\t\t\t__experimentalHideHeader={ false }\n\t\t\tconfirmButtonText={ __( 'Detach' ) }\n\t\t\tonConfirm={ onConfirm }\n\t\t\tonCancel={ onCancel }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'The gallery displays the images attached to the post. Detaching will enable you to add, delete, or reorder images. However, new attachments will no longer be added automatically.'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n\n/**\n * The Gallery block's \"Source\" inspector panel.\n *\n * In dynamic mode it shows the resolved source, a control to detach the gallery\n * from it, and the source ordering. In static mode it offers the entry point\n * into dynamic mode. Either direction is a one-way change, so both are behind a\n * confirmation dialog this panel owns. Rendered inside the block's\n * `InspectorControls`, alongside the Settings panel.\n *\n * @param {Object} props\n * @param {Object} props.dynamic The `useDynamicGallery` result.\n * @param {Object} props.dropdownMenuProps Shared ToolsPanel dropdown menu props.\n * @param {boolean} props.hasImages Whether the gallery has manually-added images.\n */\nexport function GallerySourcePanel( {\n\tdynamic,\n\tdropdownMenuProps,\n\thasImages,\n} ) {\n\tconst {\n\t\tdynamicContent,\n\t\tcanUseDynamicSource,\n\t\tsourceDescriptor,\n\t\tsourceOrderby,\n\t\tsourceOrder,\n\t\tsetSourceOrder,\n\t\tconvertToStatic,\n\t\tenableDynamicMode,\n\t\tresetSource,\n\t\tisResolvingDynamic,\n\t\thasMoreImagesThanCap,\n\t\tdynamicMediaTotal,\n\t} = dynamic;\n\tconst isDynamic = !! dynamicContent;\n\n\tconst [ isConfirming, setIsConfirming ] = useState( false );\n\tconst [ isConfirmingDetach, setIsConfirmingDetach ] = useState( false );\n\n\t// Entering dynamic mode discards any hand-added images, so confirm first\n\t// when there are images to lose; otherwise switch straight away.\n\tfunction requestEnableDynamicMode() {\n\t\tif ( hasImages ) {\n\t\t\tsetIsConfirming( true );\n\t\t} else {\n\t\t\tenableDynamicMode();\n\t\t}\n\t}\n\n\tif ( isDynamic ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Source' ) }\n\t\t\t\t\tresetAll={ resetSource }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-gallery__source-settings\">\n\t\t\t\t\t\t<p className=\"wp-block-gallery__source-description\">\n\t\t\t\t\t\t\t{ sourceDescriptor?.description ??\n\t\t\t\t\t\t\t\t__( 'Dynamic images.' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () => setIsConfirmingDetach( true ) }\n\t\t\t\t\t\t\t// Guard the race where the media is still resolving:\n\t\t\t\t\t\t\t// detaching now would map over an incomplete (or\n\t\t\t\t\t\t\t// empty) list and produce a gallery missing images.\n\t\t\t\t\t\t\tdisabled={ isResolvingDynamic }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Detach Gallery' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ hasMoreImagesThanCap && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"wp-block-gallery__source-notice\"\n\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: number of images shown. 2: total number of matching images. */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Only the first %1$d of %2$d images will be displayed.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tMAX_IMAGES,\n\t\t\t\t\t\t\t\tdynamicMediaTotal\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\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\tsourceOrderby !== DEFAULT_ORDERBY ||\n\t\t\t\t\t\t\tsourceOrder !== DEFAULT_ORDER\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetSourceOrder( undefined, undefined )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\torderby={ sourceOrderby }\n\t\t\t\t\t\t\torder={ sourceOrder }\n\t\t\t\t\t\t\tonChange={ ( { orderby, order } ) =>\n\t\t\t\t\t\t\t\tsetSourceOrder( orderby, order )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t\t{ isConfirmingDetach && (\n\t\t\t\t\t<DetachGalleryDialog\n\t\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\t\tconvertToStatic();\n\t\t\t\t\t\t\tsetIsConfirmingDetach( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonCancel={ () => setIsConfirmingDetach( false ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\n\t// In static mode this panel is just an entry into dynamic mode, so hide it\n\t// when there's no post type to preview against. This is intentionally\n\t// stricter than the placeholder's entry button (see `edit.jsx`), which stays\n\t// available anywhere because the source resolves at render time.\n\tif ( ! canUseDynamicSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelBody title={ __( 'Source' ) }>\n\t\t\t\t<div className=\"wp-block-gallery__source-settings\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Hardcoded on purpose: this single-source entry button (and\n\t\t\t\t\t * its confirm dialog below) is temporary. Once more sources\n\t\t\t\t\t * exist it becomes a \"Choose source\" select whose options read\n\t\t\t\t\t * from each source descriptor's `title`, with help text\n\t\t\t\t\t * carrying the per-source explanation this string does today.\n\t\t\t\t\t */ }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ requestEnableDynamicMode }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use images attached to the post' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</PanelBody>\n\t\t\t{ isConfirming && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen\n\t\t\t\t\ttitle={ __( 'Use images attached to the post?' ) }\n\t\t\t\t\t__experimentalHideHeader={ false }\n\t\t\t\t\tconfirmButtonText={ __( 'Use attached images' ) }\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\tenableDynamicMode();\n\t\t\t\t\t\tsetIsConfirming( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => setIsConfirming( false ) }\n\t\t\t\t\tsize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'The images in this gallery will be replaced, but will remain in the media library.'\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Renders the resolved image blocks as a read-only preview.\n *\n * `useBlockPreview` returns a `useDisabled` ref that makes its subtree inert, so\n * previewed images (including any links) aren't interactive in the editor. The\n * ref needs a real element, yet the images must stay flex children of the gallery\n * `<figure>` and sit beside an editable caption. `display: contents` resolves\n * this: the wrapper carries the ref but generates no box, so the image figures\n * remain the figure's flex items and only they are disabled — the caption sibling\n * stays editable. This relies on the gallery's image styles using descendant\n * (not direct-child) selectors, which the box-less wrapper leaves intact.\n *\n * @param {Object} props\n * @param {Object[]} props.imageBlocks Non-persisted `core/image` blocks to preview.\n */\nfunction GalleryImagesPreview( { imageBlocks } ) {\n\tconst { children, ref, className } = useBlockPreview( {\n\t\tblocks: imageBlocks,\n\t} );\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { display: 'contents' } }\n\t\t>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\n/**\n * Renders a dynamic-mode gallery on the canvas:\n *\n * - a block-toolbar control to detach the gallery from its source, confirmed in\n * a dialog;\n * - the gallery `<figure>` wrapper holding a non-editable preview of the\n * resolved media (or a placeholder while resolving / when nothing is found),\n * with the gallery's provided context so the previewed images inherit\n * gallery-wide settings;\n * - an editable gallery-level caption, alongside the read-only preview;\n * - the (empty) inner blocks kept mounted so the container's `allowedBlocks: []`\n * keeps syncing to block list settings (which blocks insertion and hides the\n * List View).\n *\n * @param {Object} props\n * @param {Object} props.dynamic The `useDynamicGallery` result.\n * @param {Object} props.blockProps The gallery's `useBlockProps()` result.\n * @param {Object} props.innerBlocksProps The gallery's `useInnerBlocksProps()` result.\n * @param {Object} props.attributes The gallery block attributes.\n * @param {Function} props.setAttributes The block's `setAttributes`.\n * @param {boolean} props.isSelected Whether the gallery block is selected.\n * @param {Function} props.insertBlocksAfter Inserts blocks after the gallery.\n * @param {boolean} props.isContentLocked Whether the gallery is content-locked.\n * @param {boolean} props.multiGallerySelection Whether multiple galleries are selected.\n */\nexport function GalleryDynamicView( {\n\tdynamic,\n\tblockProps,\n\tinnerBlocksProps,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tisContentLocked,\n\tmultiGallerySelection,\n} ) {\n\tconst {\n\t\tsourceDescriptor,\n\t\tdynamicImageBlocks,\n\t\tgalleryContext,\n\t\tisResolvingDynamic,\n\t\tconvertToStatic,\n\t} = dynamic;\n\n\t// Detaching the gallery materializes editable inner blocks, which is a\n\t// structural change. Only offer it when the block is fully editable:\n\t// under a content lock (e.g. inside a `contentOnly` group) the editing mode\n\t// is `'contentOnly'`/`'disabled'`, where structural toolbar controls are\n\t// hidden and the conversion shouldn't be possible.\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isConfirmingDetach, setIsConfirmingDetach ] = useState( false );\n\n\t// Empty-state copy for the preview. Framed as forward-looking (\"… will appear\n\t// here\") rather than as an error, since the same empty result covers both a\n\t// post with no matching images and a template with no post in context yet —\n\t// in either case the source simply resolves to nothing right now. The per-\n\t// source wording comes from the source descriptor.\n\tconst emptyInstructions = isResolvingDynamic\n\t\t? __( 'Loading images…' )\n\t\t: sourceDescriptor?.emptyMessage ??\n\t\t __( 'Dynamic images will appear here.' );\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ () => setIsConfirmingDetach( true ) }\n\t\t\t\t\t\t\t// Same guard as the inspector's \"Detach Gallery\": both end in\n\t\t\t\t\t\t\t// `convertToStatic`, which would map over a\n\t\t\t\t\t\t\t// still-resolving (or empty) media list.\n\t\t\t\t\t\t\t// (`ToolbarButton` stays focusable when disabled by\n\t\t\t\t\t\t\t// default.)\n\t\t\t\t\t\t\tdisabled={ isResolvingDynamic }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t{ isConfirmingDetach && (\n\t\t\t\t\t\t<DetachGalleryDialog\n\t\t\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\t\t\tconvertToStatic();\n\t\t\t\t\t\t\t\tsetIsConfirmingDetach( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ () => setIsConfirmingDetach( false ) }\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\t<figure { ...blockProps }>\n\t\t\t\t{ dynamicImageBlocks.length ? (\n\t\t\t\t\t<BlockContextProvider value={ galleryContext }>\n\t\t\t\t\t\t<GalleryImagesPreview\n\t\t\t\t\t\t\timageBlocks={ dynamicImageBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ sharedIcon }\n\t\t\t\t\t\tlabel={ __( 'Gallery' ) }\n\t\t\t\t\t\tinstructions={ emptyInstructions }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isResolvingDynamic && <Spinner /> }\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\t! multiGallerySelection && ! isContentLocked\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"blocks-gallery-caption\"\n\t\t\t\t\tlabel={ __( 'Gallery caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add gallery caption' ) }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{ /*\n\t\t\t * Dynamic mode shows a preview instead of real inner blocks, but the\n\t\t\t * empty inner blocks are still rendered here for their side effect:\n\t\t\t * the `allowedBlocks: []` passed to `useInnerBlocksProps` only syncs\n\t\t\t * to block list settings while the inner blocks are mounted (via\n\t\t\t * `useNestedSettingsUpdate`). That setting is what blocks insertion\n\t\t\t * (`canInsertBlockType`) and hides the now-unusable List View\n\t\t\t * (`shouldRenderBlockListView`). With no inner blocks and no appender,\n\t\t\t * this renders no output of its own.\n\t\t\t */ }\n\t\t\t{ innerBlocksProps.children }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;
|
|
4
|
+
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tNotice,\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl,\n\tSpinner,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport {\n\tBlockContextProvider,\n\tBlockControls,\n\tuseBlockEditingMode,\n\t__experimentalUseBlockPreview as useBlockPreview,\n} from '@wordpress/block-editor';\nimport { sharedIcon } from './shared-icon';\nimport { isGalleryFlexLayout } from './shared';\nimport { Caption } from '../utils/caption';\nimport { DEFAULT_ORDERBY, DEFAULT_ORDER, MAX_IMAGES } from './dynamic-source';\n\n/**\n * Ordering options for a dynamic gallery source. Each value is a composite\n * `\"orderby/order\"` string mapping to the matching `/wp/v2/media` collection\n * params. `menu_order` is deliberately omitted — it isn't a valid REST `orderby`\n * value, so the editor preview couldn't reproduce it (see `dynamic-source.js`).\n */\nconst ORDER_OPTIONS = [\n\t{ label: __( 'Newest to oldest' ), value: 'date/desc' },\n\t{ label: __( 'Oldest to newest' ), value: 'date/asc' },\n\t{\n\t\t/* translators: Label for ordering images by title in ascending order. */\n\t\tlabel: __( 'A → Z' ),\n\t\tvalue: 'title/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering images by title in descending order. */\n\t\tlabel: __( 'Z → A' ),\n\t\tvalue: 'title/desc',\n\t},\n];\n\n/**\n * \"Order by\" control for a dynamic gallery, mirroring the Query Loop block's\n * `OrderControl`: a single `SelectControl` whose value composites `orderby` and\n * `order`, split apart again on change.\n *\n * @param {Object} props\n * @param {string} props.orderby Current `orderby` value.\n * @param {string} props.order Current `order` value (`asc`/`desc`).\n * @param {Function} props.onChange Called with `{ orderby, order }` on change.\n */\nfunction OrderControl( { orderby, order, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Order by' ) }\n\t\t\tvalue={ `${ orderby }/${ order }` }\n\t\t\toptions={ ORDER_OPTIONS }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tconst [ newOrderby, newOrder ] = value.split( '/' );\n\t\t\t\tonChange( { orderby: newOrderby, order: newOrder } );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\n/**\n * Confirmation for leaving dynamic mode, shown from both the block toolbar and\n * the Source panel so the two entry points explain the change identically.\n *\n * Detaching keeps the images the gallery currently shows but breaks the link to\n * its source, so it's worth confirming — mirroring the dialog `GallerySourcePanel`\n * shows for the opposite direction.\n *\n * @param {Object} props\n * @param {Function} props.onConfirm Called when the user confirms detaching.\n * @param {Function} props.onCancel Called when the user dismisses the dialog.\n */\nfunction DetachGalleryDialog( { onConfirm, onCancel } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\ttitle={ __( 'Detach Gallery' ) }\n\t\t\t__experimentalHideHeader={ false }\n\t\t\tconfirmButtonText={ __( 'Detach' ) }\n\t\t\tonConfirm={ onConfirm }\n\t\t\tonCancel={ onCancel }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'The gallery displays the images attached to the post. Detaching will enable you to add, delete, or reorder images. However, new attachments will no longer be added automatically.'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n\n/**\n * The Gallery block's \"Source\" inspector panel.\n *\n * In dynamic mode it shows the resolved source, a control to detach the gallery\n * from it, and the source ordering. In static mode it offers the entry point\n * into dynamic mode. Either direction is a one-way change, so both are behind a\n * confirmation dialog this panel owns. Rendered inside the block's\n * `InspectorControls`, alongside the Settings panel.\n *\n * @param {Object} props\n * @param {Object} props.dynamic The `useDynamicGallery` result.\n * @param {Object} props.dropdownMenuProps Shared ToolsPanel dropdown menu props.\n * @param {boolean} props.hasImages Whether the gallery has manually-added images.\n */\nexport function GallerySourcePanel( {\n\tdynamic,\n\tdropdownMenuProps,\n\thasImages,\n} ) {\n\tconst {\n\t\tdynamicContent,\n\t\tcanUseDynamicSource,\n\t\tsourceDescriptor,\n\t\tsourceOrderby,\n\t\tsourceOrder,\n\t\tsetSourceOrder,\n\t\tconvertToStatic,\n\t\tenableDynamicMode,\n\t\tresetSource,\n\t\tisResolvingDynamic,\n\t\thasMoreImagesThanCap,\n\t\tdynamicMediaTotal,\n\t} = dynamic;\n\tconst isDynamic = !! dynamicContent;\n\n\tconst [ isConfirming, setIsConfirming ] = useState( false );\n\tconst [ isConfirmingDetach, setIsConfirmingDetach ] = useState( false );\n\n\t// Entering dynamic mode discards any hand-added images, so confirm first\n\t// when there are images to lose; otherwise switch straight away.\n\tfunction requestEnableDynamicMode() {\n\t\tif ( hasImages ) {\n\t\t\tsetIsConfirming( true );\n\t\t} else {\n\t\t\tenableDynamicMode();\n\t\t}\n\t}\n\n\tif ( isDynamic ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Source' ) }\n\t\t\t\t\tresetAll={ resetSource }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-gallery__source-settings\">\n\t\t\t\t\t\t<p className=\"wp-block-gallery__source-description\">\n\t\t\t\t\t\t\t{ sourceDescriptor?.description ??\n\t\t\t\t\t\t\t\t__( 'Dynamic images.' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () => setIsConfirmingDetach( true ) }\n\t\t\t\t\t\t\t// Guard the race where the media is still resolving:\n\t\t\t\t\t\t\t// detaching now would map over an incomplete (or\n\t\t\t\t\t\t\t// empty) list and produce a gallery missing images.\n\t\t\t\t\t\t\tdisabled={ isResolvingDynamic }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Detach Gallery' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ hasMoreImagesThanCap && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"wp-block-gallery__source-notice\"\n\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: number of images shown. 2: total number of matching images. */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Only the first %1$d of %2$d images will be displayed.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tMAX_IMAGES,\n\t\t\t\t\t\t\t\tdynamicMediaTotal\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\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\tsourceOrderby !== DEFAULT_ORDERBY ||\n\t\t\t\t\t\t\tsourceOrder !== DEFAULT_ORDER\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetSourceOrder( undefined, undefined )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\torderby={ sourceOrderby }\n\t\t\t\t\t\t\torder={ sourceOrder }\n\t\t\t\t\t\t\tonChange={ ( { orderby, order } ) =>\n\t\t\t\t\t\t\t\tsetSourceOrder( orderby, order )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t\t{ isConfirmingDetach && (\n\t\t\t\t\t<DetachGalleryDialog\n\t\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\t\tconvertToStatic();\n\t\t\t\t\t\t\tsetIsConfirmingDetach( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonCancel={ () => setIsConfirmingDetach( false ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\n\t// In static mode this panel is just an entry into dynamic mode, so hide it\n\t// when there's no post type to preview against. This is intentionally\n\t// stricter than the placeholder's entry button (see `edit.jsx`), which stays\n\t// available anywhere because the source resolves at render time.\n\tif ( ! canUseDynamicSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelBody title={ __( 'Source' ) }>\n\t\t\t\t<div className=\"wp-block-gallery__source-settings\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Hardcoded on purpose: this single-source entry button (and\n\t\t\t\t\t * its confirm dialog below) is temporary. Once more sources\n\t\t\t\t\t * exist it becomes a \"Choose source\" select whose options read\n\t\t\t\t\t * from each source descriptor's `title`, with help text\n\t\t\t\t\t * carrying the per-source explanation these strings do today.\n\t\t\t\t\t */ }\n\t\t\t\t\t<p className=\"wp-block-gallery__source-description\">\n\t\t\t\t\t\t{ __( 'Images added to the gallery.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ requestEnableDynamicMode }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use attached images' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</PanelBody>\n\t\t\t{ isConfirming && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen\n\t\t\t\t\ttitle={ __( 'Use images attached to the post?' ) }\n\t\t\t\t\t__experimentalHideHeader={ false }\n\t\t\t\t\tconfirmButtonText={ __( 'Use attached images' ) }\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\tenableDynamicMode();\n\t\t\t\t\t\tsetIsConfirming( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => setIsConfirming( false ) }\n\t\t\t\t\tsize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'The images in this gallery will be replaced, but will remain in the media library.'\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Renders the resolved image blocks as a read-only preview.\n *\n * `useBlockPreview` returns a `useDisabled` ref that makes its subtree inert, so\n * previewed images (including any links) aren't interactive in the editor. The\n * ref needs a real element, yet the images must stay flex children of the gallery\n * `<figure>` and sit beside an editable caption. `display: contents` resolves\n * this: the wrapper carries the ref but generates no box, so the image figures\n * remain the figure's flex items and only they are disabled — the caption sibling\n * stays editable. This relies on the gallery's image styles using descendant\n * (not direct-child) selectors, which the box-less wrapper leaves intact.\n *\n * The gallery's layout is passed through so the previewed images see the same\n * parent layout that real inner blocks would (`useBlockPreview` provides it to\n * their layout context). Without it they resolve to the default flow layout and\n * behave as if they weren't in a gallery — most visibly, an image inside a\n * cropped gallery would keep its baseline `height: auto` and defeat the\n * gallery's cropping CSS.\n *\n * @param {Object} props\n * @param {Object[]} props.imageBlocks Non-persisted `core/image` blocks to preview.\n * @param {Object} props.layout The gallery's layout, for the preview's layout context.\n */\nfunction GalleryImagesPreview( { imageBlocks, layout } ) {\n\tconst { children, ref, className } = useBlockPreview( {\n\t\tblocks: imageBlocks,\n\t\tlayout,\n\t} );\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ className }\n\t\t\tstyle={ { display: 'contents' } }\n\t\t>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\n/**\n * Renders a dynamic-mode gallery on the canvas:\n *\n * - a block-toolbar control to detach the gallery from its source, confirmed in\n * a dialog;\n * - the gallery `<figure>` wrapper holding a non-editable preview of the\n * resolved media (or a placeholder while resolving / when nothing is found),\n * with the gallery's provided context so the previewed images inherit\n * gallery-wide settings;\n * - an editable gallery-level caption, alongside the read-only preview;\n * - the (empty) inner blocks kept mounted so the container's `allowedBlocks: []`\n * keeps syncing to block list settings (which blocks insertion and hides the\n * List View).\n *\n * @param {Object} props\n * @param {Object} props.dynamic The `useDynamicGallery` result.\n * @param {Object} props.blockProps The gallery's `useBlockProps()` result.\n * @param {Object} props.innerBlocksProps The gallery's `useInnerBlocksProps()` result.\n * @param {Object} props.attributes The gallery block attributes.\n * @param {Function} props.setAttributes The block's `setAttributes`.\n * @param {boolean} props.isSelected Whether the gallery block is selected.\n * @param {Function} props.insertBlocksAfter Inserts blocks after the gallery.\n * @param {boolean} props.isContentLocked Whether the gallery is content-locked.\n * @param {boolean} props.multiGallerySelection Whether multiple galleries are selected.\n */\nexport function GalleryDynamicView( {\n\tdynamic,\n\tblockProps,\n\tinnerBlocksProps,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tisContentLocked,\n\tmultiGallerySelection,\n} ) {\n\tconst {\n\t\tsourceDescriptor,\n\t\tdynamicImageBlocks,\n\t\tgalleryContext,\n\t\tisResolvingDynamic,\n\t\tconvertToStatic,\n\t} = dynamic;\n\n\t// Detaching the gallery materializes editable inner blocks, which is a\n\t// structural change. Only offer it when the block is fully editable:\n\t// under a content lock (e.g. inside a `contentOnly` group) the editing mode\n\t// is `'contentOnly'`/`'disabled'`, where structural toolbar controls are\n\t// hidden and the conversion shouldn't be possible.\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ isConfirmingDetach, setIsConfirmingDetach ] = useState( false );\n\n\t// The layout the previewed images sit in. Normalized the same way the\n\t// gallery's own classes are (`isGalleryFlexLayout`), so a layout that the\n\t// wrapper treats as flex — including a missing or typeless one — is reported\n\t// as flex to the images rather than resolving to the default flow layout.\n\t// Memoized because it becomes the preview's layout context value.\n\tconst previewLayout = useMemo(\n\t\t() =>\n\t\t\tisGalleryFlexLayout( attributes.layout )\n\t\t\t\t? { ...attributes.layout, type: 'flex' }\n\t\t\t\t: attributes.layout,\n\t\t[ attributes.layout ]\n\t);\n\n\t// Empty-state copy for the preview. Framed as forward-looking (\"… will appear\n\t// here\") rather than as an error, since the same empty result covers both a\n\t// post with no matching images and a template with no post in context yet —\n\t// in either case the source simply resolves to nothing right now. The per-\n\t// source wording comes from the source descriptor.\n\tconst emptyInstructions = isResolvingDynamic\n\t\t? __( 'Loading images…' )\n\t\t: sourceDescriptor?.emptyMessage ??\n\t\t __( 'Dynamic images will appear here.' );\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ () => setIsConfirmingDetach( true ) }\n\t\t\t\t\t\t\t// Same guard as the inspector's \"Detach Gallery\": both end in\n\t\t\t\t\t\t\t// `convertToStatic`, which would map over a\n\t\t\t\t\t\t\t// still-resolving (or empty) media list.\n\t\t\t\t\t\t\t// (`ToolbarButton` stays focusable when disabled by\n\t\t\t\t\t\t\t// default.)\n\t\t\t\t\t\t\tdisabled={ isResolvingDynamic }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t{ isConfirmingDetach && (\n\t\t\t\t\t\t<DetachGalleryDialog\n\t\t\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\t\t\tconvertToStatic();\n\t\t\t\t\t\t\t\tsetIsConfirmingDetach( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ () => setIsConfirmingDetach( false ) }\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\t<figure { ...blockProps }>\n\t\t\t\t{ dynamicImageBlocks.length ? (\n\t\t\t\t\t<BlockContextProvider value={ galleryContext }>\n\t\t\t\t\t\t<GalleryImagesPreview\n\t\t\t\t\t\t\timageBlocks={ dynamicImageBlocks }\n\t\t\t\t\t\t\tlayout={ previewLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ sharedIcon }\n\t\t\t\t\t\tlabel={ __( 'Gallery' ) }\n\t\t\t\t\t\tinstructions={ emptyInstructions }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isResolvingDynamic && <Spinner /> }\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\t! multiGallerySelection && ! isContentLocked\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"blocks-gallery-caption\"\n\t\t\t\t\tlabel={ __( 'Gallery caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add gallery caption' ) }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{ /*\n\t\t\t * Dynamic mode shows a preview instead of real inner blocks, but the\n\t\t\t * empty inner blocks are still rendered here for their side effect:\n\t\t\t * the `allowedBlocks: []` passed to `useInnerBlocksProps` only syncs\n\t\t\t * to block list settings while the inner blocks are mounted (via\n\t\t\t * `useNestedSettingsUpdate`). That setting is what blocks insertion\n\t\t\t * (`canInsertBlockType`) and hides the now-unusable List View\n\t\t\t * (`shouldRenderBlockListView`). With no inner blocks and no appender,\n\t\t\t * this renders no output of its own.\n\t\t\t */ }\n\t\t\t{ innerBlocksProps.children }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// packages/block-library/src/heading/index.js
|
|
2
2
|
import { heading as icon } from "@wordpress/icons";
|
|
3
3
|
import { __, sprintf } from "@wordpress/i18n";
|
|
4
|
-
import {
|
|
5
|
-
privateApis as blocksPrivateApis,
|
|
6
|
-
getBlockType,
|
|
7
|
-
unregisterBlockVariation
|
|
8
|
-
} from "@wordpress/blocks";
|
|
4
|
+
import { getBlockType, unregisterBlockVariation } from "@wordpress/blocks";
|
|
9
5
|
import initBlock from "../utils/init-block.mjs";
|
|
10
6
|
import deprecated from "./deprecated.mjs";
|
|
11
7
|
import edit from "./edit.mjs";
|
|
@@ -13,8 +9,6 @@ import metadata from "./block.json";
|
|
|
13
9
|
import save from "./save.mjs";
|
|
14
10
|
import transforms from "./transforms.mjs";
|
|
15
11
|
import variations from "./variations.mjs";
|
|
16
|
-
import { unlock } from "../lock-unlock.mjs";
|
|
17
|
-
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
18
12
|
var { name } = metadata;
|
|
19
13
|
var settings = {
|
|
20
14
|
icon,
|
|
@@ -63,20 +57,6 @@ var settings = {
|
|
|
63
57
|
save,
|
|
64
58
|
variations
|
|
65
59
|
};
|
|
66
|
-
if (window.__experimentalContentOnlyInspectorFields) {
|
|
67
|
-
settings[fieldsKey] = [
|
|
68
|
-
{
|
|
69
|
-
id: "content",
|
|
70
|
-
label: __("Content"),
|
|
71
|
-
type: "text",
|
|
72
|
-
Edit: "rich-text"
|
|
73
|
-
// TODO: replace with custom component
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
settings[formKey] = {
|
|
77
|
-
fields: ["content"]
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
60
|
var init = () => {
|
|
81
61
|
const block = initBlock({ name, metadata, settings });
|
|
82
62
|
const levelOptions = getBlockType(name)?.attributes?.levelOptions?.default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/heading/index.js"],
|
|
4
|
-
"sourcesContent": ["import { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {
|
|
5
|
-
"mappings": ";AAAA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;AAC5B
|
|
4
|
+
"sourcesContent": ["import { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockType, unregisterBlockVariation } from '@wordpress/blocks';\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Code is Poetry' ),\n\t\t\tlevel: 2,\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content, level } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasContent\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: heading level. */\n\t\t\t\t\t\t__( 'Level %s. Empty.' ),\n\t\t\t\t\t\tlevel\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. 1: heading level. 2: heading content. */\n\t\t\t\t\t\t__( 'Level %1$s. %2$s' ),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t\tcontent\n\t\t\t\t );\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => {\n\tconst block = initBlock( { name, metadata, settings } );\n\n\t// Unregister heading level variations based on `levelOptions` attribute.\n\t// This is for backwards compatibility, as extenders can now unregister the\n\t// variation directly: `wp.blocks.unregisterBlockVariation( 'core/heading', 'h1' )`.\n\tconst levelOptions =\n\t\tgetBlockType( name )?.attributes?.levelOptions?.default;\n\tif ( levelOptions ) {\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tif ( ! levelOptions.includes( level ) ) {\n\t\t\t\tunregisterBlockVariation( name, `h${ level }` );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn block;\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc,gCAAgC;AACvD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS,GAAI,gBAAiB;AAAA,MAC9B,OAAO;AAAA,MACP,OAAO;AAAA,QACN,YAAY;AAAA,UACX,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,SAAS,MAAM,IAAI;AAE3B,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,SAAS,KAAK,EAAE,SAAS;AAI5C,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,YAAY,gBAAgB,YAAa;AAC7C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,aAAO,CAAE,aACN;AAAA;AAAA,QAEA,GAAI,kBAAmB;AAAA,QACvB;AAAA,MACA,IACA;AAAA;AAAA,QAEA,GAAI,kBAAmB;AAAA,QACvB;AAAA,QACA;AAAA,MACA;AAAA,IACJ;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,UACG,WAAW,WAAW,OACtB,kBAAkB,WAAW;AAAA,IACjC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM;AACzB,QAAM,QAAQ,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;AAKtD,QAAM,eACL,aAAc,IAAK,GAAG,YAAY,cAAc;AACjD,MAAK,cAAe;AACnB,KAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAE,EAAE,QAAS,CAAE,UAAW;AAC1C,UAAK,CAAE,aAAa,SAAU,KAAM,GAAI;AACvC,iCAA0B,MAAM,IAAK,KAAM,EAAG;AAAA,MAC/C;AAAA,IACD,CAAE;AAAA,EACH;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -291,7 +291,8 @@ function Image({
|
|
|
291
291
|
setOffsetTop(imageElement?.offsetTop ?? 0);
|
|
292
292
|
}, [imageElement]);
|
|
293
293
|
const setRefs = useMergeRefs([setImageElement, setResizeObserved]);
|
|
294
|
-
const { allowResize = true } = context;
|
|
294
|
+
const { allowResize = true, imageCrop = false } = context;
|
|
295
|
+
const isCroppedGalleryImage = imageCrop && parentLayoutType === "flex";
|
|
295
296
|
const { image, attachmentResolutionError } = useSelect(
|
|
296
297
|
(select) => {
|
|
297
298
|
const imageRecord = id && isSingleSelected ? select(coreStore).getEntityRecord(
|
|
@@ -717,7 +718,6 @@ function Image({
|
|
|
717
718
|
variant: "toolbar"
|
|
718
719
|
}
|
|
719
720
|
) }) });
|
|
720
|
-
const hasDataFormBlockFields = window?.__experimentalContentOnlyInspectorFields;
|
|
721
721
|
const controls = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
722
722
|
showBlockControls && /* @__PURE__ */ jsxs(BlockControls, { group: "block", children: [
|
|
723
723
|
showUrlInput && /* @__PURE__ */ jsx(
|
|
@@ -779,7 +779,7 @@ function Image({
|
|
|
779
779
|
lockTitleControlsMessage
|
|
780
780
|
}
|
|
781
781
|
) }),
|
|
782
|
-
|
|
782
|
+
isSingleSelected && /* @__PURE__ */ jsx(InspectorControls, { group: "content", children: /* @__PURE__ */ jsxs(
|
|
783
783
|
ToolsPanel,
|
|
784
784
|
{
|
|
785
785
|
label: __("Media"),
|
|
@@ -1015,10 +1015,12 @@ function Image({
|
|
|
1015
1015
|
} else if (width !== void 0 && width !== null) {
|
|
1016
1016
|
style.width = typeof width === "number" ? `${width}px` : width;
|
|
1017
1017
|
}
|
|
1018
|
-
if (height === "auto"
|
|
1018
|
+
if (height === "auto") {
|
|
1019
1019
|
style.height = "auto";
|
|
1020
|
-
} else {
|
|
1020
|
+
} else if (height !== void 0 && height !== null) {
|
|
1021
1021
|
style.height = typeof height === "number" ? `${height}px` : height;
|
|
1022
|
+
} else if (!isCroppedGalleryImage) {
|
|
1023
|
+
style.height = "auto";
|
|
1022
1024
|
}
|
|
1023
1025
|
return style;
|
|
1024
1026
|
})(),
|