@wordpress/block-library 11.0.0 → 11.0.2-next.v.202609171837.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 +18 -0
- package/README.md +7 -7
- package/build/archives/edit.cjs.map +3 -3
- package/build/audio/edit.cjs.map +3 -3
- package/build/avatar/hooks.cjs.map +2 -2
- package/build/button/edit.cjs.map +2 -2
- package/build/categories/edit.cjs.map +3 -3
- package/build/code/block.json +1 -0
- package/build/code/save.cjs.map +2 -2
- package/build/comment-template/hooks.cjs.map +2 -2
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/cover/transforms.cjs.map +2 -2
- package/build/details/block.json +1 -0
- package/build/details/index.cjs.map +2 -2
- package/build/embed/embed-controls.cjs.map +2 -2
- package/build/file/deprecated.cjs.map +2 -2
- package/build/file/edit.cjs.map +2 -2
- package/build/file/inspector.cjs.map +3 -3
- package/build/file/save.cjs.map +2 -2
- package/build/footnotes/block.json +1 -0
- package/build/footnotes/edit.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +64 -37
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/{flex-styles.cjs → gallery-styles.cjs} +31 -32
- package/build/gallery/gallery-styles.cjs.map +7 -0
- package/build/gallery/responsive-styles.cjs +27 -5
- package/build/gallery/responsive-styles.cjs.map +2 -2
- package/build/heading/block.json +2 -0
- package/build/heading/index.cjs.map +2 -2
- package/build/html/modal.cjs +3 -6
- package/build/html/modal.cjs.map +2 -2
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs.map +2 -2
- package/build/index.cjs.map +2 -2
- package/build/latest-comments/edit.cjs.map +3 -3
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs.map +3 -3
- package/build/list-item/hooks/use-enter.cjs.map +2 -2
- package/build/math/block.json +2 -0
- package/build/math/deprecated.cjs +29 -12
- package/build/math/deprecated.cjs.map +2 -2
- package/build/math/edit.cjs +67 -46
- package/build/math/edit.cjs.map +2 -2
- package/build/math/save.cjs +2 -2
- package/build/math/save.cjs.map +2 -2
- package/build/media-text/constants.cjs +3 -0
- package/build/media-text/constants.cjs.map +2 -2
- package/build/media-text/deprecated.cjs.map +2 -2
- package/build/media-text/edit.cjs +40 -0
- package/build/media-text/edit.cjs.map +3 -3
- package/build/media-text/image-fill.cjs.map +2 -2
- package/build/media-text/media-container.cjs +3 -3
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/menu-inspector-controls.cjs.map +2 -2
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +3 -3
- package/build/navigation/edit/responsive-wrapper.cjs.map +2 -2
- package/build/navigation/edit/use-generate-default-navigation-title.cjs.map +2 -2
- package/build/navigation/view.cjs +2 -2
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/shared/invalid-draft-display.cjs.map +2 -2
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/paragraph/block.json +1 -0
- package/build/paragraph/edit.cjs.map +2 -2
- package/build/paragraph/index.cjs +6 -0
- package/build/paragraph/index.cjs.map +3 -3
- package/build/playlist/edit.cjs +2 -1
- package/build/playlist/edit.cjs.map +3 -3
- package/build/post-author/edit.cjs.map +3 -3
- package/build/post-author-name/edit.cjs.map +2 -2
- package/build/post-content/block.json +1 -0
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-excerpt/block.json +1 -0
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-time-to-read/edit.cjs.map +2 -2
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/deprecated.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/order-control.cjs.map +3 -3
- package/build/query/edit/inspector-controls/sticky-control.cjs.map +3 -3
- package/build/query/view.cjs.map +2 -2
- package/build/query-title/use-archive-label.cjs.map +2 -2
- package/build/quote/deprecated.cjs.map +2 -2
- package/build/quote/transforms.cjs.map +2 -2
- package/build/search/edit.cjs.map +3 -3
- package/build/separator/edit.cjs.map +3 -3
- package/build/social-links/edit.cjs.map +3 -3
- package/build/table/state.cjs.map +2 -2
- package/build/table-of-contents/edit.cjs.map +3 -3
- package/build/table-of-contents/utils.cjs.map +2 -2
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/tag-cloud/edit.cjs.map +3 -3
- package/build/template-part/edit/advanced-controls.cjs.map +3 -3
- package/build/template-part/edit/import-controls.cjs.map +3 -3
- package/build/template-part/edit/index.cjs.map +2 -2
- package/build/template-part/edit/inner-blocks.cjs.map +2 -2
- package/build/template-part/edit/placeholder.cjs.map +2 -2
- package/build/term-count/use-term-count.cjs.map +2 -2
- package/build/term-description/use-term-description.cjs.map +2 -2
- package/build/term-name/use-term-name.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +3 -3
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs.map +3 -3
- package/build/utils/hooks.cjs.map +2 -2
- package/build/utils/media-control.cjs +5 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build/utils/poster-image.cjs.map +2 -2
- package/build/verse/block.json +1 -0
- package/build/video/edit-common-settings.cjs.map +3 -3
- package/build/video/tracks-editor.cjs.map +3 -3
- package/build-module/archives/edit.mjs +2 -2
- package/build-module/archives/edit.mjs.map +2 -2
- package/build-module/audio/edit.mjs +2 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/hooks.mjs.map +2 -2
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/categories/edit.mjs +2 -2
- package/build-module/categories/edit.mjs.map +2 -2
- package/build-module/code/block.json +1 -0
- package/build-module/code/save.mjs.map +2 -2
- package/build-module/comment-template/hooks.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/cover/transforms.mjs.map +2 -2
- package/build-module/details/block.json +1 -0
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/embed/embed-controls.mjs.map +2 -2
- package/build-module/file/deprecated.mjs.map +2 -2
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/inspector.mjs +2 -2
- package/build-module/file/inspector.mjs.map +2 -2
- package/build-module/file/save.mjs.map +2 -2
- package/build-module/footnotes/block.json +1 -0
- package/build-module/footnotes/edit.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +2 -2
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +67 -40
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/{flex-styles.mjs → gallery-styles.mjs} +29 -30
- package/build-module/gallery/gallery-styles.mjs.map +7 -0
- package/build-module/gallery/responsive-styles.mjs +25 -4
- package/build-module/gallery/responsive-styles.mjs.map +2 -2
- package/build-module/heading/block.json +2 -0
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +3 -6
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-comments/edit.mjs +2 -2
- package/build-module/latest-comments/edit.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +2 -2
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/math/block.json +2 -0
- package/build-module/math/deprecated.mjs +29 -12
- package/build-module/math/deprecated.mjs.map +2 -2
- package/build-module/math/edit.mjs +68 -47
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/math/save.mjs +2 -2
- package/build-module/math/save.mjs.map +2 -2
- package/build-module/media-text/constants.mjs +2 -0
- package/build-module/media-text/constants.mjs.map +2 -2
- package/build-module/media-text/deprecated.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +42 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/media-text/image-fill.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +1 -1
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
- package/build-module/navigation/edit/use-generate-default-navigation-title.mjs.map +2 -2
- package/build-module/navigation/view.mjs +2 -2
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/shared/invalid-draft-display.mjs.map +2 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/paragraph/block.json +1 -0
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +6 -0
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +5 -4
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +2 -2
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-author-name/edit.mjs.map +2 -2
- package/build-module/post-content/block.json +1 -0
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-excerpt/block.json +1 -0
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/edit.mjs +2 -2
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/edit.mjs.map +2 -2
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/deprecated.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs.map +2 -2
- package/build-module/query/view.mjs.map +2 -2
- package/build-module/query-title/use-archive-label.mjs.map +2 -2
- package/build-module/quote/deprecated.mjs.map +2 -2
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/search/edit.mjs +3 -3
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/separator/edit.mjs +5 -2
- package/build-module/separator/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +2 -2
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/table/state.mjs.map +2 -2
- package/build-module/table-of-contents/edit.mjs +2 -2
- package/build-module/table-of-contents/edit.mjs.map +2 -2
- package/build-module/table-of-contents/utils.mjs.map +2 -2
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/tag-cloud/edit.mjs +2 -2
- package/build-module/tag-cloud/edit.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +5 -2
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/import-controls.mjs +2 -2
- package/build-module/template-part/edit/import-controls.mjs.map +2 -2
- package/build-module/template-part/edit/index.mjs.map +2 -2
- package/build-module/template-part/edit/inner-blocks.mjs.map +2 -2
- package/build-module/template-part/edit/placeholder.mjs.map +2 -2
- package/build-module/term-count/use-term-count.mjs.map +2 -2
- package/build-module/term-description/use-term-description.mjs.map +2 -2
- package/build-module/term-name/use-term-name.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs.map +2 -2
- package/build-module/utils/hooks.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +5 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-module/utils/poster-image.mjs.map +2 -2
- package/build-module/verse/block.json +1 -0
- package/build-module/video/edit-common-settings.mjs +2 -2
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +2 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/button/style-rtl.css +2 -1
- package/build-style/button/style.css +2 -1
- package/build-style/columns/style-rtl.css +1 -1
- package/build-style/columns/style.css +1 -1
- package/build-style/comments/editor-rtl.css +1 -1
- package/build-style/comments/editor.css +1 -1
- package/build-style/comments/style-rtl.css +1 -1
- package/build-style/comments/style.css +1 -1
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/style-rtl.css +6 -0
- package/build-style/cover/style.css +6 -0
- package/build-style/editor-rtl.css +9 -5
- package/build-style/editor.css +9 -5
- package/build-style/embed/editor-rtl.css +2 -1
- package/build-style/embed/editor.css +2 -1
- package/build-style/gallery/style-rtl.css +1 -2
- package/build-style/gallery/style.css +1 -2
- package/build-style/image/style-rtl.css +6 -9
- package/build-style/image/style.css +6 -9
- package/build-style/math/editor-rtl.css +5 -0
- package/build-style/math/editor.css +5 -0
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/navigation/style-rtl.css +1 -1
- package/build-style/navigation/style.css +1 -1
- package/build-style/post-title/style-rtl.css +2 -2
- package/build-style/post-title/style.css +2 -2
- package/build-style/query-pagination/editor-rtl.css +0 -3
- package/build-style/query-pagination/editor.css +0 -3
- package/build-style/search/theme-rtl.css +1 -1
- package/build-style/search/theme.css +1 -1
- package/build-style/style-rtl.css +23 -19
- package/build-style/style.css +23 -19
- package/build-style/theme-rtl.css +1 -1
- package/build-style/theme.css +1 -1
- package/build-style/verse/style-rtl.css +2 -1
- package/build-style/verse/style.css +2 -1
- package/package.json +40 -40
- package/src/archives/edit.jsx +2 -2
- package/src/audio/edit.jsx +2 -2
- package/src/avatar/hooks.js +2 -2
- package/src/button/edit.jsx +1 -1
- package/src/button/style.scss +2 -2
- package/src/calendar/index.php +1 -1
- package/src/categories/edit.jsx +2 -2
- package/src/code/README.md +1 -0
- package/src/code/block.json +1 -0
- package/src/code/save.jsx +1 -1
- package/src/columns/style.scss +2 -3
- package/src/comment-template/hooks.js +1 -1
- package/src/comments/style.scss +1 -1
- package/src/common.scss +1 -2
- package/src/cover/edit/index.jsx +2 -2
- package/src/cover/edit/inspector-controls.jsx +2 -2
- package/src/cover/style.scss +10 -0
- package/src/cover/test/{edit.jsdom.test.js → edit.browser.test.js} +104 -145
- package/src/cover/transforms.js +3 -3
- package/src/details/README.md +1 -0
- package/src/details/block.json +1 -0
- package/src/details/index.js +1 -1
- package/src/embed/editor.scss +2 -2
- package/src/embed/embed-controls.jsx +2 -2
- package/src/file/deprecated.jsx +3 -3
- package/src/file/edit.jsx +5 -3
- package/src/file/inspector.jsx +3 -3
- package/src/file/save.jsx +2 -2
- package/src/footnotes/README.md +1 -0
- package/src/footnotes/block.json +1 -0
- package/src/footnotes/edit.jsx +1 -1
- package/src/gallery/dynamic-gallery.jsx +4 -4
- package/src/gallery/edit.jsx +121 -68
- package/src/gallery/gallery-styles.js +117 -0
- package/src/gallery/index.php +181 -67
- package/src/gallery/responsive-styles.js +59 -5
- package/src/gallery/test/edit.jsdom.test.js +71 -3
- package/src/gallery/test/responsive-styles.js +59 -5
- package/src/heading/README.md +2 -0
- package/src/heading/block.json +2 -0
- package/src/heading/index.js +2 -2
- package/src/html/modal.jsx +0 -3
- package/src/image/edit.jsx +1 -1
- package/src/image/image.jsx +7 -7
- package/src/image/index.php +10 -4
- package/src/image/style.scss +1 -0
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +1 -1
- package/src/index.jsx +1 -1
- package/src/latest-comments/edit.jsx +2 -2
- package/src/latest-posts/edit.jsx +1 -1
- package/src/list/ordered-list-settings.jsx +2 -2
- package/src/list-item/hooks/use-enter.js +1 -1
- package/src/math/README.md +2 -2
- package/src/math/block.json +2 -0
- package/src/math/deprecated.jsx +38 -12
- package/src/math/edit.jsx +49 -20
- package/src/math/editor.scss +5 -0
- package/src/math/save.jsx +20 -4
- package/src/media-text/constants.js +1 -0
- package/src/media-text/deprecated.jsx +3 -3
- package/src/media-text/edit.jsx +48 -3
- package/src/media-text/image-fill.js +2 -2
- package/src/media-text/media-container.jsx +1 -1
- package/src/navigation/edit/index.jsx +1 -1
- package/src/navigation/edit/menu-inspector-controls.jsx +2 -2
- package/src/navigation/edit/overlay-template-part-selector.jsx +3 -3
- package/src/navigation/edit/responsive-wrapper.jsx +1 -1
- package/src/navigation/edit/use-generate-default-navigation-title.js +2 -2
- package/src/navigation/editor.scss +1 -0
- package/src/navigation/index.php +12 -0
- package/src/navigation/style.scss +1 -1
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +6 -28
- package/src/navigation/test/view.jsdom.test.js +23 -0
- package/src/navigation/view.js +9 -6
- package/src/navigation-link/edit.jsx +1 -1
- package/src/navigation-link/shared/invalid-draft-display.jsx +2 -2
- package/src/navigation-link/test/__snapshots__/hooks.jsdom.test.js.snap +41 -11
- package/src/navigation-submenu/edit.jsx +1 -1
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/edit.jsx +1 -1
- package/src/paragraph/index.js +7 -0
- package/src/pattern/index.php +2 -2
- package/src/playlist/edit.jsx +6 -4
- package/src/playlist-track/test/edit.jsdom.test.jsx +2 -3
- package/src/post-author/edit.jsx +2 -2
- package/src/post-author-name/edit.jsx +1 -1
- package/src/post-content/README.md +1 -0
- package/src/post-content/block.json +1 -0
- package/src/post-date/edit.jsx +2 -2
- package/src/post-excerpt/README.md +1 -0
- package/src/post-excerpt/block.json +1 -0
- package/src/post-excerpt/edit.jsx +1 -1
- package/src/post-featured-image/edit.jsx +2 -2
- package/src/post-navigation-link/edit.jsx +4 -4
- package/src/post-time-to-read/edit.jsx +2 -2
- package/src/post-title/style.scss +2 -3
- package/src/pullquote/deprecated.jsx +1 -1
- package/src/query/deprecated.jsx +1 -1
- package/src/query/edit/inspector-controls/index.jsx +4 -4
- package/src/query/edit/inspector-controls/order-control.jsx +2 -2
- package/src/query/edit/inspector-controls/sticky-control.jsx +2 -2
- package/src/query/view.js +6 -9
- package/src/query-pagination/editor.scss +0 -3
- package/src/query-title/use-archive-label.js +1 -1
- package/src/quote/deprecated.jsx +2 -2
- package/src/quote/transforms.js +3 -3
- package/src/search/edit.jsx +6 -6
- package/src/search/theme.scss +1 -1
- package/src/separator/edit.jsx +7 -4
- package/src/social-links/edit.jsx +2 -2
- package/src/table/state.js +1 -1
- package/src/table-of-contents/edit.jsx +6 -6
- package/src/table-of-contents/utils.ts +2 -2
- package/src/tabs/use-tab-actions.js +1 -1
- package/src/tag-cloud/edit.jsx +2 -2
- package/src/template-part/edit/advanced-controls.jsx +5 -2
- package/src/template-part/edit/import-controls.jsx +2 -2
- package/src/template-part/edit/index.jsx +2 -2
- package/src/template-part/edit/inner-blocks.jsx +1 -1
- package/src/template-part/edit/placeholder.jsx +2 -2
- package/src/term-count/use-term-count.js +1 -1
- package/src/term-description/use-term-description.js +1 -1
- package/src/term-name/use-term-name.js +1 -1
- package/src/terms-query/edit/inspector-controls/index.jsx +2 -2
- package/src/terms-query/edit/inspector-controls/inherit-control.jsx +1 -1
- package/src/terms-query/edit/inspector-controls/order-control.jsx +2 -2
- package/src/terms-query/edit/inspector-controls/taxonomy-control.jsx +2 -2
- package/src/utils/hooks.js +1 -1
- package/src/utils/media-control.jsx +16 -10
- package/src/utils/poster-image.jsx +2 -2
- package/src/utils/test/waveform-player.jsdom.test.jsx +36 -38
- package/src/utils/test/{waveform-utils.jsdom.test.js → waveform-utils.browser.test.js} +64 -44
- package/src/verse/README.md +1 -0
- package/src/verse/block.json +1 -0
- package/src/verse/style.scss +2 -2
- package/src/video/edit-common-settings.jsx +3 -3
- package/src/video/tracks-editor.jsx +2 -2
- package/build/gallery/flex-styles.cjs.map +0 -7
- package/build-module/gallery/flex-styles.mjs.map +0 -7
- package/src/gallery/flex-styles.js +0 -99
package/build/file/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( { attributes, isSelected, setAttributes, clientId } ) {\n\tconst {\n\t\tid,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\tconst { media } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia: !! id\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA0B;AAC1B,wBAIO;AACP,kBAAuC;AACvC,0BASO;AACP,qBAAyB;AACzB,qBAAmC;AACnC,kBAAmB;AACnB,mBAA6B;AAC7B,uBAAmC;AACnC,qBAAsC;AACtC,iBAA4B;AAC5B,uBAA+B;AAC/B,mBAAoC;AACpC,+BAA4B;AAC5B,mBAA0C;AAexC;AAbK,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAElC,SAAS,uBAAwB,EAAE,MAAM,SAAS,GAAI;AACrD,QAAM,EAAE,aAAa,QAAI,yBAAa,eAAAA,KAAa;AACnD,QAAM,UAAM,mCAAoB,MAAM,MAAM;AAC3C,iBAAc,YAAQ,gBAAI,0BAA2B,GAAG;AAAA,MACvD,eAAe;AAAA,MACf,MAAM;AAAA,IACP,CAAE;AAAA,EACH,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA,MACA;AAAA,MAEE,8BAAI,UAAW;AAAA;AAAA,EAClB;AAEF;AAEA,SAAS,SAAU,EAAE,YAAY,YAAY,eAAe,SAAS,GAAI;AACxE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AACJ,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,WAAW,IAAK;AACpE,QAAM,EAAE,MAAM,QAAI;AAAA,IACjB,CAAE,YAAc;AAAA,MACf,OAAO,CAAC,CAAE,KACP,OAAQ,iBAAAC,KAAU,EAAE;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,SAAS,OAAO;AAAA,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( { attributes, isSelected, setAttributes, clientId } ) {\n\tconst {\n\t\tid,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\tconst { media } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia: !! id\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\t} ),\n\t\t[ id ]\n\t);\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tonChange: onSelectFile,\n\t\tonError: onUploadError,\n\t} );\n\n\tfunction onSelectFile( newMedia ) {\n\t\tif ( ! newMedia || ! newMedia.url ) {\n\t\t\t// Reset attributes.\n\t\t\tsetAttributes( {\n\t\t\t\thref: undefined,\n\t\t\t\tfileName: undefined,\n\t\t\t\ttextLinkHref: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tfileId: undefined,\n\t\t\t\tdisplayPreview: undefined,\n\t\t\t\tpreviewHeight: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( newMedia.url ) ) {\n\t\t\tsetTemporaryURL( newMedia.url );\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPdf =\n\t\t\t// Media Library and REST API use different properties for mime type.\n\t\t\t( newMedia.mime || newMedia.mime_type ) === 'application/pdf' ||\n\t\t\tgetFilename( newMedia.url ).toLowerCase().endsWith( '.pdf' );\n\t\tconst pdfAttributes = {\n\t\t\tdisplayPreview: isPdf\n\t\t\t\t? ( attributes.displayPreview ?? true )\n\t\t\t\t: undefined,\n\t\t\tpreviewHeight: isPdf\n\t\t\t\t? ( attributes.previewHeight ?? 600 )\n\t\t\t\t: undefined,\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\thref: newMedia.url,\n\t\t\tfileName: newMedia.title,\n\t\t\ttextLinkHref: newMedia.url,\n\t\t\tid: newMedia.id,\n\t\t\tfileId: `wp-block-file--media-${ clientId }`,\n\t\t\tblob: undefined,\n\t\t\t...pdfAttributes,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tsetAttributes( { href: undefined } );\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction changeLinkDestinationOption( newHref ) {\n\t\t// Choose Media File or Attachment Page (when file is in Media Library).\n\t\tsetAttributes( { textLinkHref: newHref } );\n\t}\n\n\tfunction changeOpenInNewWindow( newValue ) {\n\t\tsetAttributes( {\n\t\t\ttextLinkTarget: newValue ? '_blank' : false,\n\t\t} );\n\t}\n\n\tfunction changeShowDownloadButton( newValue ) {\n\t\tsetAttributes( { showDownloadButton: newValue } );\n\t}\n\n\tfunction changeDisplayPreview( newValue ) {\n\t\tsetAttributes( { displayPreview: newValue } );\n\t}\n\n\tfunction handleOnResizeStop( event, direction, elt, delta ) {\n\t\ttoggleSelection( true );\n\n\t\tconst newHeight = parseInt( previewHeight + delta.height, 10 );\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tfunction changePreviewHeight( newValue ) {\n\t\tconst newHeight = Math.max(\n\t\t\tparseInt( newValue, 10 ),\n\t\t\tMIN_PREVIEW_HEIGHT\n\t\t);\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tconst attachmentPage = media && media.link;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t!! temporaryURL && getAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-transient': !! temporaryURL,\n\t\t\t}\n\t\t),\n\t} );\n\n\tconst displayPreviewInEditor = browserSupportsPdfs() && displayPreview;\n\n\tif ( ! href && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'File' ),\n\t\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t\t'Drag and drop a file, upload, or choose from your library.'\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FileBlockInspector\n\t\t\t\threfs={ {\n\t\t\t\t\thref: href || temporaryURL,\n\t\t\t\t\ttextLinkHref,\n\t\t\t\t\tattachmentPage,\n\t\t\t\t} }\n\t\t\t\t{ ...{\n\t\t\t\t\topenInNewWindow: !! textLinkTarget,\n\t\t\t\t\tshowDownloadButton,\n\t\t\t\t\tchangeLinkDestinationOption,\n\t\t\t\t\tchangeOpenInNewWindow,\n\t\t\t\t\tchangeShowDownloadButton,\n\t\t\t\t\tdisplayPreview,\n\t\t\t\t\tchangeDisplayPreview,\n\t\t\t\t\tpreviewHeight,\n\t\t\t\t\tchangePreviewHeight,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ href }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tonReset={ () => onSelectFile( undefined ) }\n\t\t\t\t/>\n\t\t\t\t<ClipboardToolbarButton\n\t\t\t\t\ttext={ href }\n\t\t\t\t\tdisabled={ isBlobURL( href ) }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ displayPreviewInEditor && (\n\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\tsize={ { height: previewHeight, width: '100%' } }\n\t\t\t\t\t\tminHeight={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\tmaxHeight={ MAX_PREVIEW_HEIGHT }\n\t\t\t\t\t\t// The horizontal grid value must be 1 or else the width may snap during a\n\t\t\t\t\t\t// resize even though only vertical resizing is enabled.\n\t\t\t\t\t\tgrid={ [ 1, 10 ] }\n\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\tright: false,\n\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStart={ () => toggleSelection( false ) }\n\t\t\t\t\t\tonResizeStop={ handleOnResizeStop }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__preview\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'Embed of the selected PDF file.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isSelected && (\n\t\t\t\t\t\t\t<div className=\"wp-block-file__preview-overlay\" />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ResizableBox>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-file__content-wrapper\">\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"fileName\"\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\tvalue={ fileName }\n\t\t\t\t\t\tplaceholder={ __( 'Write file name…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tfileName: removeAnchorTag( text ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\t<div className=\"wp-block-file__button-richtext-wrapper\">\n\t\t\t\t\t\t\t{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\tidentifier=\"downloadButtonText\"\n\t\t\t\t\t\t\t\ttagName=\"div\" // Must be block-level or else cursor disappears.\n\t\t\t\t\t\t\t\taria-label={ __( 'Download button text' ) }\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t\t\t__experimentalGetElementClassName(\n\t\t\t\t\t\t\t\t\t\t'button'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ downloadButtonText }\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Add text…' ) }\n\t\t\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tdownloadButtonText:\n\t\t\t\t\t\t\t\t\t\t\tremoveAnchorTag( text ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default FileEdit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA0B;AAC1B,wBAIO;AACP,kBAAuC;AACvC,0BASO;AACP,qBAAyB;AACzB,qBAAmC;AACnC,kBAAmB;AACnB,mBAA6B;AAC7B,uBAAmC;AACnC,qBAAsC;AACtC,iBAA4B;AAC5B,uBAA+B;AAC/B,mBAAoC;AACpC,+BAA4B;AAC5B,mBAA0C;AAexC;AAbK,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAElC,SAAS,uBAAwB,EAAE,MAAM,SAAS,GAAI;AACrD,QAAM,EAAE,aAAa,QAAI,yBAAa,eAAAA,KAAa;AACnD,QAAM,UAAM,mCAAoB,MAAM,MAAM;AAC3C,iBAAc,YAAQ,gBAAI,0BAA2B,GAAG;AAAA,MACvD,eAAe;AAAA,MACf,MAAM;AAAA,IACP,CAAE;AAAA,EACH,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA,MACA;AAAA,MAEE,8BAAI,UAAW;AAAA;AAAA,EAClB;AAEF;AAEA,SAAS,SAAU,EAA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R,MAAM;AAAA,YACN,UAAU;AAAA,YACV,aAAa;AAAA,YACb,YAAY;AAAA,YACZ,SAAS;AAAA,UACV;AAAA,UACA,eAAgB,MAAM,gBAAiB,KAAM;AAAA,UAC7C,cAAe;AAAA,UACf,YAAa;AAAA,UAEb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAU;AAAA,gBACV,MAAO;AAAA,gBACP,MAAK;AAAA,gBACL,kBAAa;AAAA,kBACZ;AAAA,gBACD;AAAA;AAAA,YACD;AAAA,YACE,CAAE,cACH,4CAAC,SAAI,WAAU,kCAAiC;AAAA;AAAA;AAAA,MAElD;AAAA,MAED,6CAAC,SAAI,WAAU,kCACd;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,YAAW;AAAA,YACX,SAAQ;AAAA,YACR,OAAQ;AAAA,YACR,iBAAc,gBAAI,kBAAmB;AAAA,YACrC,8BAA4B;AAAA,YAC5B,UAAW,CAAE,SACZ,cAAe;AAAA,cACd,cAAU,yBAAAC,SAAiB,IAAK;AAAA,YACjC,CAAE;AAAA,YAEH,MAAO;AAAA;AAAA,QACR;AAAA,QACE,sBACD,4CAAC,SAAI,WAAU,0CAEd;AAAA,UAAC;AAAA;AAAA,YACA,YAAW;AAAA,YACX,SAAQ;AAAA,YACR,kBAAa,gBAAI,sBAAuB;AAAA,YACxC,eAAY,YAAAJ;AAAA,cACX;AAAA,kBACA;AAAA,gBACC;AAAA,cACD;AAAA,YACD;AAAA,YACA,OAAQ;AAAA,YACR,8BAA4B;AAAA,YAC5B,iBAAc,gBAAI,WAAY;AAAA,YAC9B,UAAW,CAAE,SACZ,cAAe;AAAA,cACd,wBACC,yBAAAI,SAAiB,IAAK;AAAA,YACxB,CAAE;AAAA;AAAA,QAEJ,GACD;AAAA,SAEF;AAAA,OACD;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["noticesStore", "coreStore", "blockEditorStore", "clsx", "getAnimateClassName", "icon", "FileBlockInspector", "removeAnchorTag"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file/inspector.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport {\n\tRangeControl,\n\tSelectControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { MIN_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT } from './edit';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function FileBlockInspector( {\n\threfs,\n\topenInNewWindow,\n\tshowDownloadButton,\n\tchangeLinkDestinationOption,\n\tchangeOpenInNewWindow,\n\tchangeShowDownloadButton,\n\tdisplayPreview,\n\tchangeDisplayPreview,\n\tpreviewHeight,\n\tchangePreviewHeight,\n} ) {\n\tconst { href, textLinkHref, attachmentPage } = hrefs;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet linkDestinationOptions = [ { value: href, label: __( 'URL' ) } ];\n\tif ( attachmentPage ) {\n\t\tlinkDestinationOptions = [\n\t\t\t{ value: href, label: __( 'Media file' ) },\n\t\t\t{ value: attachmentPage, label: __( 'Attachment page' ) },\n\t\t];\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ href.endsWith( '.pdf' ) && (\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'PDF settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tchangeDisplayPreview( true );\n\t\t\t\t\t\t\tchangePreviewHeight( 600 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show inline embed' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! displayPreview }\n\t\t\t\t\t\t\tonDeselect={ () => changeDisplayPreview( true ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Show inline embed' ) }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tdisplayPreview\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"Note: Most phone and tablet browsers won't display embedded PDFs.\"\n\t\t\t\t\t\t\t\t\t\t
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAMO;AACP,0BAAkC;AAClC,kBAAuD;AACvD,mBAA+C;AA0B7C;AAxBa,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,MAAM,cAAc,eAAe,IAAI;AAC/C,QAAM,wBAAoB,6CAA+B;AAEzD,MAAI,yBAAyB,CAAE,EAAE,OAAO,MAAM,WAAO,gBAAI,KAAM,EAAE,CAAE;AACnE,MAAK,gBAAiB;AACrB,6BAAyB;AAAA,MACxB,EAAE,OAAO,MAAM,WAAO,gBAAI,YAAa,EAAE;AAAA,MACzC,EAAE,OAAO,gBAAgB,WAAO,gBAAI,iBAAkB,EAAE;AAAA,IACzD;AAAA,EACD;AAEA,SACC,2EACC,uDAAC,yCACE;AAAA,SAAK,SAAU,MAAO,KACvB;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,cAAe;AAAA,QAC3B,UAAW,MAAM;AAChB,+BAAsB,IAAK;AAC3B,8BAAqB,GAAI;AAAA,QAC1B;AAAA,QACA;AAAA,QAEA;AAAA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACA,WAAQ,gBAAI,mBAAoB;AAAA,cAChC,kBAAgB;AAAA,cAChB,UAAW,MAAM,CAAE;AAAA,cACnB,YAAa,MAAM,qBAAsB,IAAK;AAAA,cAE9C;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAQ,gBAAI,mBAAoB;AAAA,kBAChC,MACC,qBACG;AAAA,oBACA;AAAA,
|
|
6
|
-
"names": ["ToolsPanel", "ToolsPanelItem"]
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport {\n\tRangeControl,\n\tSelectControl as WCSelectControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { MIN_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT } from './edit';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function FileBlockInspector( {\n\threfs,\n\topenInNewWindow,\n\tshowDownloadButton,\n\tchangeLinkDestinationOption,\n\tchangeOpenInNewWindow,\n\tchangeShowDownloadButton,\n\tdisplayPreview,\n\tchangeDisplayPreview,\n\tpreviewHeight,\n\tchangePreviewHeight,\n} ) {\n\tconst { href, textLinkHref, attachmentPage } = hrefs;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet linkDestinationOptions = [ { value: href, label: __( 'URL' ) } ];\n\tif ( attachmentPage ) {\n\t\tlinkDestinationOptions = [\n\t\t\t{ value: href, label: __( 'Media file' ) },\n\t\t\t{ value: attachmentPage, label: __( 'Attachment page' ) },\n\t\t];\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ href.endsWith( '.pdf' ) && (\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'PDF settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tchangeDisplayPreview( true );\n\t\t\t\t\t\t\tchangePreviewHeight( 600 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Show inline embed' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => ! displayPreview }\n\t\t\t\t\t\t\tonDeselect={ () => changeDisplayPreview( true ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Show inline embed' ) }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tdisplayPreview\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"Note: Most phone and tablet browsers won't display embedded PDFs.\"\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ !! displayPreview }\n\t\t\t\t\t\t\t\tonChange={ changeDisplayPreview }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t{ displayPreview && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Height in pixels' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => previewHeight !== 600 }\n\t\t\t\t\t\t\t\tonDeselect={ () => changePreviewHeight( 600 ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Height in pixels' ) }\n\t\t\t\t\t\t\t\t\tmin={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\t\t\t\tmax={ Math.max(\n\t\t\t\t\t\t\t\t\t\tMAX_PREVIEW_HEIGHT,\n\t\t\t\t\t\t\t\t\t\tpreviewHeight\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ previewHeight }\n\t\t\t\t\t\t\t\t\tonChange={ changePreviewHeight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t) }\n\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tchangeLinkDestinationOption( href );\n\t\t\t\t\t\tchangeOpenInNewWindow( false );\n\t\t\t\t\t\tchangeShowDownloadButton( true );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => textLinkHref !== href }\n\t\t\t\t\t\tonDeselect={ () => changeLinkDestinationOption( href ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<WCSelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t\t\t\t\tvalue={ textLinkHref }\n\t\t\t\t\t\t\toptions={ linkDestinationOptions }\n\t\t\t\t\t\t\tonChange={ changeLinkDestinationOption }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! openInNewWindow }\n\t\t\t\t\t\tonDeselect={ () => changeOpenInNewWindow( false ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewWindow }\n\t\t\t\t\t\t\tonChange={ changeOpenInNewWindow }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Show download button' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showDownloadButton }\n\t\t\t\t\t\tonDeselect={ () => changeShowDownloadButton( true ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show download button' ) }\n\t\t\t\t\t\t\tchecked={ showDownloadButton }\n\t\t\t\t\t\t\tonChange={ changeShowDownloadButton }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAMO;AACP,0BAAkC;AAClC,kBAAuD;AACvD,mBAA+C;AA0B7C;AAxBa,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,MAAM,cAAc,eAAe,IAAI;AAC/C,QAAM,wBAAoB,6CAA+B;AAEzD,MAAI,yBAAyB,CAAE,EAAE,OAAO,MAAM,WAAO,gBAAI,KAAM,EAAE,CAAE;AACnE,MAAK,gBAAiB;AACrB,6BAAyB;AAAA,MACxB,EAAE,OAAO,MAAM,WAAO,gBAAI,YAAa,EAAE;AAAA,MACzC,EAAE,OAAO,gBAAgB,WAAO,gBAAI,iBAAkB,EAAE;AAAA,IACzD;AAAA,EACD;AAEA,SACC,2EACC,uDAAC,yCACE;AAAA,SAAK,SAAU,MAAO,KACvB;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ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AClC,YAAa,MAAM,4BAA6B,IAAK;AAAA,cAErD;AAAA,gBAAC,kBAAAC;AAAA,gBAAA;AAAA,kBACA,WAAQ,gBAAI,SAAU;AAAA,kBACtB,OAAQ;AAAA,kBACR,SAAU;AAAA,kBACV,UAAW;AAAA;AAAA,cACZ;AAAA;AAAA,UACD;AAAA,UACA;AAAA,YAAC,kBAAAD;AAAA,YAAA;AAAA,cACA,WAAQ,gBAAI,iBAAkB;AAAA,cAC9B,kBAAgB;AAAA,cAChB,UAAW,MAAM,CAAC,CAAE;AAAA,cACpB,YAAa,MAAM,sBAAuB,KAAM;AAAA,cAEhD;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAQ,gBAAI,iBAAkB;AAAA,kBAC9B,SAAU;AAAA,kBACV,UAAW;AAAA;AAAA,cACZ;AAAA;AAAA,UACD;AAAA,UACA;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,WAAQ,gBAAI,sBAAuB;AAAA,cACnC,kBAAgB;AAAA,cAChB,UAAW,MAAM,CAAE;AAAA,cACnB,YAAa,MAAM,yBAA0B,IAAK;AAAA,cAElD;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAQ,gBAAI,sBAAuB;AAAA,kBACnC,SAAU;AAAA,kBACV,UAAW;AAAA;AAAA,cACZ;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;",
|
|
6
|
+
"names": ["ToolsPanel", "ToolsPanelItem", "WCSelectControl"]
|
|
7
7
|
}
|
package/build/file/save.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file/save.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\thref,\n\t\tfileId,\n\t\tfileName,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\n\tconst pdfEmbedLabel = RichText.isEmpty( fileName )\n\t\t? 'PDF embed'\n\t\t: // To do: use toPlainText, but we need ensure it's RichTextData. See\n\t\t
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,0BAIO;AA6BJ;AA3BY,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,gBAAgB,6BAAS,QAAS,QAAS,IAC9C;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\thref,\n\t\tfileId,\n\t\tfileName,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\n\tconst pdfEmbedLabel = RichText.isEmpty( fileName )\n\t\t? 'PDF embed'\n\t\t: // To do: use toPlainText, but we need ensure it's RichTextData. See\n\t\t\t// https://github.com/WordPress/gutenberg/pull/56710.\n\t\t\tfileName.toString();\n\n\tconst hasFilename = ! RichText.isEmpty( fileName );\n\n\t// Only output an `aria-describedby` when the element it's referring to is\n\t// actually rendered.\n\tconst describedById = hasFilename ? fileId : undefined;\n\n\treturn (\n\t\thref && (\n\t\t\t<div { ...useBlockProps.save() }>\n\t\t\t\t{ displayPreview && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__embed\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\theight: `${ previewHeight }px`,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-label={ pdfEmbedLabel }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ hasFilename && (\n\t\t\t\t\t<a\n\t\t\t\t\t\tid={ describedById }\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t\ttarget={ textLinkTarget }\n\t\t\t\t\t\trel={\n\t\t\t\t\t\t\ttextLinkTarget ? 'noreferrer noopener' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText.Content value={ fileName } />\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ href }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdownload\n\t\t\t\t\t\taria-describedby={ describedById }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText.Content value={ downloadButtonText } />\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t)\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,0BAIO;AA6BJ;AA3BY,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,gBAAgB,6BAAS,QAAS,QAAS,IAC9C;AAAA;AAAA;AAAA,IAGD,SAAS,SAAS;AAAA;AAEpB,QAAM,cAAc,CAAE,6BAAS,QAAS,QAAS;AAIjD,QAAM,gBAAgB,cAAc,SAAS;AAE7C,SACC,QACC,6CAAC,SAAM,GAAG,kCAAc,KAAK,GAC1B;AAAA,sBACD,2EACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO;AAAA,QACP,MAAK;AAAA,QACL,OAAQ;AAAA,UACP,OAAO;AAAA,UACP,QAAQ,GAAI,aAAc;AAAA,QAC3B;AAAA,QACA,cAAa;AAAA;AAAA,IACd,GACD;AAAA,IAEC,eACD;AAAA,MAAC;AAAA;AAAA,QACA,IAAK;AAAA,QACL,MAAO;AAAA,QACP,QAAS;AAAA,QACT,KACC,iBAAiB,wBAAwB;AAAA,QAG1C,sDAAC,6BAAS,SAAT,EAAiB,OAAQ,UAAW;AAAA;AAAA,IACtC;AAAA,IAEC,sBACD;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,eAAY,YAAAA;AAAA,UACX;AAAA,cACA,uDAAmC,QAAS;AAAA,QAC7C;AAAA,QACA,UAAQ;AAAA,QACR,oBAAmB;AAAA,QAEnB,sDAAC,6BAAS,SAAT,EAAiB,OAAQ,oBAAqB;AAAA;AAAA,IAChD;AAAA,KAEF;AAGH;",
|
|
6
6
|
"names": ["clsx"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/footnotes/edit.jsx"],
|
|
4
|
-
"sourcesContent": ["import { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { Placeholder } from '@wordpress/components';\nimport { formatListNumbered as icon } from '@wordpress/icons';\n\nexport default function FootnotesEdit( { context: { postType, postId } } ) {\n\tconst [ meta, updateMeta ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'meta',\n\t\tpostId\n\t);\n\tconst footnotesSupported = 'string' === typeof meta?.footnotes;\n\t// The meta is a string that something else may have written, so it can be\n\t// malformed or hold something other than an array. Treat anything\n\t// unreadable as no footnotes and fall through to the placeholder below.\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse( meta?.footnotes || '[]' );\n\t} catch {\n\t\t// Left undefined, which the check below treats as no footnotes, along\n\t\t// with a value of the wrong shape.\n\t}\n\tconst footnotes = Array.isArray( parsed ) ? parsed : [];\n\tconst blockProps = useBlockProps();\n\n\tif ( ! footnotesSupported ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes are not supported here. Add this block to post or page content.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! footnotes.length ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes found in blocks within this document will be displayed here.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ol { ...blockProps }>\n\t\t\t{ footnotes.map( ( { id, content } ) => (\n\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t<li\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// When clicking on the list item (not on descendants),\n\t\t\t\t\t\t// focus the rich text element since it's only 1px wide when\n\t\t\t\t\t\t// empty.\n\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\tevent.target.firstElementChild.focus();\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\tidentifier={ id }\n\t\t\t\t\t\t// To do: figure out why the browser is not scrolling\n\t\t\t\t\t\t// into view when it receives focus.\n\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\tif ( ! event.target.textContent.trim() ) {\n\t\t\t\t\t\t\t\tevent.target.scrollIntoView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( nextFootnote ) => {\n\t\t\t\t\t\t\tupdateMeta( {\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tfootnotes: JSON.stringify(\n\t\t\t\t\t\t\t\t\tfootnotes.map( ( footnote ) => {\n\t\t\t\t\t\t\t\t\t\treturn footnote.id === id\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontent: nextFootnote,\n\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAmD;AACnD,uBAA8B;AAC9B,kBAAmB;AACnB,wBAA4B;AAC5B,mBAA2C;AA2B/B;AAzBG,SAAR,cAAgC,EAAE,SAAS,EAAE,UAAU,OAAO,EAAE,GAAI;AAC1E,QAAM,CAAE,MAAM,UAAW,QAAI;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,qBAAqB,aAAa,OAAO,MAAM;AAIrD,MAA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ACf,UAAU,IAAK,CAAE,aAAc;AAC9B,6BAAO,SAAS,OAAO,KACpB;AAAA,wBACA,SAAS;AAAA,wBACT;AAAA,
|
|
4
|
+
"sourcesContent": ["import { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { Placeholder } from '@wordpress/components';\nimport { formatListNumbered as icon } from '@wordpress/icons';\n\nexport default function FootnotesEdit( { context: { postType, postId } } ) {\n\tconst [ meta, updateMeta ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'meta',\n\t\tpostId\n\t);\n\tconst footnotesSupported = 'string' === typeof meta?.footnotes;\n\t// The meta is a string that something else may have written, so it can be\n\t// malformed or hold something other than an array. Treat anything\n\t// unreadable as no footnotes and fall through to the placeholder below.\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse( meta?.footnotes || '[]' );\n\t} catch {\n\t\t// Left undefined, which the check below treats as no footnotes, along\n\t\t// with a value of the wrong shape.\n\t}\n\tconst footnotes = Array.isArray( parsed ) ? parsed : [];\n\tconst blockProps = useBlockProps();\n\n\tif ( ! footnotesSupported ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes are not supported here. Add this block to post or page content.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! footnotes.length ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes found in blocks within this document will be displayed here.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ol { ...blockProps }>\n\t\t\t{ footnotes.map( ( { id, content } ) => (\n\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t<li\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// When clicking on the list item (not on descendants),\n\t\t\t\t\t\t// focus the rich text element since it's only 1px wide when\n\t\t\t\t\t\t// empty.\n\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\tevent.target.firstElementChild.focus();\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\tidentifier={ id }\n\t\t\t\t\t\t// To do: figure out why the browser is not scrolling\n\t\t\t\t\t\t// into view when it receives focus.\n\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\tif ( ! event.target.textContent.trim() ) {\n\t\t\t\t\t\t\t\tevent.target.scrollIntoView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( nextFootnote ) => {\n\t\t\t\t\t\t\tupdateMeta( {\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tfootnotes: JSON.stringify(\n\t\t\t\t\t\t\t\t\tfootnotes.map( ( footnote ) => {\n\t\t\t\t\t\t\t\t\t\treturn footnote.id === id\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontent: nextFootnote,\n\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t: footnote;\n\t\t\t\t\t\t\t\t\t} )\n\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BAAU,IAAK,CAAE,EAAE,IAAI,QAAQ;AAAA;AAAA,IAEhC;AAAA,MAAC;AAAA;AAAA,QAEA,aAAc,CAAE,UAAW;AAI1B,cAAK,MAAM,WAAW,MAAM,eAAgB;AAC3C,kBAAM,OAAO,kBAAkB,MAAM;AACrC,kBAAM,eAAe;AAAA,UACtB;AAAA,QACD;AAAA,QAEA;AAAA;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA,SAAQ;AAAA,cACR,OAAQ;AAAA,cACR,YAAa;AAAA,cAGb,SAAU,CAAE,UAAW;AACtB,oBAAK,CAAE,MAAM,OAAO,YAAY,KAAK,GAAI;AACxC,wBAAM,OAAO,eAAe;AAAA,gBAC7B;AAAA,cACD;AAAA,cACA,UAAW,CAAE,iBAAkB;AAC9B,2BAAY;AAAA,kBACX,GAAG;AAAA,kBACH,WAAW,KAAK;AAAA,oBACf,UAAU,IAAK,CAAE,aAAc;AAC9B,6BAAO,SAAS,OAAO,KACpB;AAAA,wBACA,SAAS;AAAA,wBACT;AAAA,sBACD,IACC;AAAA,oBACJ,CAAE;AAAA,kBACH;AAAA,gBACD,CAAE;AAAA,cACH;AAAA;AAAA,UACD;AAAA,UAAI;AAAA,UACJ,4CAAC,OAAE,MAAO,IAAK,EAAG,SAAU,gBAAE;AAAA;AAAA;AAAA,MAvCxB;AAAA,IAwCP;AAAA,GACC,GACH;AAEF;",
|
|
6
6
|
"names": ["icon"]
|
|
7
7
|
}
|
|
@@ -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 { 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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,qBAAkC;AAClC,wBAWO;AACP,0BAKO;AACP,yBAA2B;AAC3B,oBAAoC;AACpC,qBAAwB;AACxB,4BAA2D;AAmCzD;AA3BF,IAAM,gBAAgB;AAAA,EACrB,EAAE,WAAO,gBAAI,kBAAmB,GAAG,OAAO,YAAY;AAAA,EACtD,EAAE,WAAO,gBAAI,kBAAmB,GAAG,OAAO,WAAW;AAAA,EACrD;AAAA;AAAA,IAEC,WAAO,gBAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,WAAO,gBAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AACD;AAYA,SAAS,aAAc,EAAE,SAAS,OAAO,SAAS,GAAI;AACrD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,OAAQ,GAAI,OAAQ,IAAK,KAAM;AAAA,MAC/B,SAAU;AAAA,MACV,UAAW,CAAE,UAAW;AACvB,cAAM,CAAE,YAAY,QAAS,IAAI,MAAM,MAAO,GAAI;AAClD,iBAAU,EAAE,SAAS,YAAY,OAAO,SAAS,CAAE;AAAA,MACpD;AAAA;AAAA,EACD;AAEF;AAcA,SAAS,oBAAqB,EAAE,WAAW,SAAS,GAAI;AACvD,SACC;AAAA,IAAC,
|
|
6
|
-
"names": ["ConfirmDialog", "ToolsPanel", "ToolsPanelItem", "useBlockPreview"]
|
|
4
|
+
"sourcesContent": ["import { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tNotice,\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl as WCSelectControl,\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<WCSelectControl\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\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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,qBAAkC;AAClC,wBAWO;AACP,0BAKO;AACP,yBAA2B;AAC3B,oBAAoC;AACpC,qBAAwB;AACxB,4BAA2D;AAmCzD;AA3BF,IAAM,gBAAgB;AAAA,EACrB,EAAE,WAAO,gBAAI,kBAAmB,GAAG,OAAO,YAAY;AAAA,EACtD,EAAE,WAAO,gBAAI,kBAAmB,GAAG,OAAO,WAAW;AAAA,EACrD;AAAA;AAAA,IAEC,WAAO,gBAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,WAAO,gBAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AACD;AAYA,SAAS,aAAc,EAAE,SAAS,OAAO,SAAS,GAAI;AACrD,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,OAAQ,GAAI,OAAQ,IAAK,KAAM;AAAA,MAC/B,SAAU;AAAA,MACV,UAAW,CAAE,UAAW;AACvB,cAAM,CAAE,YAAY,QAAS,IAAI,MAAM,MAAO,GAAI;AAClD,iBAAU,EAAE,S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AA,UAM5C,UAAW;AAAA,UAET,8BAAI,QAAS;AAAA;AAAA,MAChB,GACD;AAAA,MACE,sBACD;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,MAAM;AACjB,4BAAgB;AAChB,kCAAuB,KAAM;AAAA,UAC9B;AAAA,UACA,UAAW,MAAM,sBAAuB,KAAM;AAAA;AAAA,MAC/C;AAAA,OAEF;AAAA,IAED,6CAAC,YAAS,GAAG,YACV;AAAA,yBAAmB,SACpB,4CAAC,4CAAqB,OAAQ,gBAC7B;AAAA,QAAC;AAAA;AAAA,UACA,aAAc;AAAA,UACd,QAAS;AAAA;AAAA,MACV,GACD,IAEA;AAAA,QAAC;AAAA;AAAA,UACA,MAAO;AAAA,UACP,WAAQ,gBAAI,SAAU;AAAA,UACtB,cAAe;AAAA,UAEb,gCAAsB,4CAAC,6BAAQ;AAAA;AAAA,MAClC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,mBACC,CAAE,yBAAyB,CAAE;AAAA,UAE9B,WAAU;AAAA,UACV,WAAQ,gBAAI,sBAAuB;AAAA,UACnC,iBAAc,gBAAI,qBAAsB;AAAA;AAAA,MACzC;AAAA,OACD;AAAA,IAWE,iBAAiB;AAAA,KACpB;AAEF;",
|
|
6
|
+
"names": ["WCSelectControl", "ConfirmDialog", "ToolsPanel", "ToolsPanelItem", "useBlockPreview"]
|
|
7
7
|
}
|
package/build/gallery/edit.cjs
CHANGED
|
@@ -53,7 +53,7 @@ var import_constants = require("./constants.cjs");
|
|
|
53
53
|
var import_use_image_sizes = __toESM(require("./use-image-sizes.cjs"));
|
|
54
54
|
var import_use_get_new_images = __toESM(require("./use-get-new-images.cjs"));
|
|
55
55
|
var import_use_get_media = __toESM(require("./use-get-media.cjs"));
|
|
56
|
-
var
|
|
56
|
+
var import_gallery_styles = __toESM(require("./gallery-styles.cjs"));
|
|
57
57
|
var import_use_dynamic_gallery = __toESM(require("./use-dynamic-gallery.cjs"));
|
|
58
58
|
var import_dynamic_gallery = require("./dynamic-gallery.cjs");
|
|
59
59
|
var import_dynamic_source = require("./dynamic-source.cjs");
|
|
@@ -209,10 +209,13 @@ function GalleryEdit(props) {
|
|
|
209
209
|
) : {};
|
|
210
210
|
const baseColumns = (0, import_responsive_styles.isValidGalleryColumns)(columns) ? columns : void 0;
|
|
211
211
|
const baseImageCrop = typeof imageCrop === "boolean" ? imageCrop : true;
|
|
212
|
+
const baseAspectRatio = aspectRatio || "auto";
|
|
212
213
|
const hasViewportColumns = isViewportStyleState && Object.hasOwn(viewportStyle, "columns") && (0, import_responsive_styles.isValidGalleryColumns)(viewportStyle.columns);
|
|
213
214
|
const hasViewportImageCrop = isViewportStyleState && Object.hasOwn(viewportStyle, "imageCrop") && typeof viewportStyle.imageCrop === "boolean";
|
|
215
|
+
const hasViewportAspectRatio = isViewportStyleState && Object.hasOwn(viewportStyle, "aspectRatio") && typeof viewportStyle.aspectRatio === "string" && !!viewportStyle.aspectRatio;
|
|
214
216
|
const activeColumns = hasViewportColumns ? viewportStyle.columns : baseColumns;
|
|
215
217
|
const activeImageCrop = hasViewportImageCrop ? viewportStyle.imageCrop : baseImageCrop;
|
|
218
|
+
const activeAspectRatio = hasViewportAspectRatio ? viewportStyle.aspectRatio : baseAspectRatio;
|
|
216
219
|
const images = (0, import_element.useMemo)(
|
|
217
220
|
() => innerBlockImages?.map((block) => ({
|
|
218
221
|
clientId: block.clientId,
|
|
@@ -309,7 +312,8 @@ function GalleryEdit(props) {
|
|
|
309
312
|
sizeSlug,
|
|
310
313
|
caption: imageAttributes.caption.length > 0 ? imageAttributes.caption : image.caption?.raw,
|
|
311
314
|
alt: imageAttributes.alt || image.alt_text,
|
|
312
|
-
aspectRatio: aspectRatio === "auto" ? void 0 : aspectRatio
|
|
315
|
+
aspectRatio: aspectRatio === "auto" ? void 0 : aspectRatio,
|
|
316
|
+
scale: aspectRatio && aspectRatio !== "auto" ? "cover" : void 0
|
|
313
317
|
};
|
|
314
318
|
}
|
|
315
319
|
function isValidFileType(file) {
|
|
@@ -413,7 +417,7 @@ function GalleryEdit(props) {
|
|
|
413
417
|
}
|
|
414
418
|
);
|
|
415
419
|
}
|
|
416
|
-
function
|
|
420
|
+
function setGallerySettings(settings) {
|
|
417
421
|
if (!isViewportStyleState) {
|
|
418
422
|
setAttributes(settings);
|
|
419
423
|
return;
|
|
@@ -424,17 +428,18 @@ function GalleryEdit(props) {
|
|
|
424
428
|
viewport: selectedStyleState.viewport,
|
|
425
429
|
baseSettings: {
|
|
426
430
|
columns: baseColumns,
|
|
427
|
-
imageCrop: baseImageCrop
|
|
431
|
+
imageCrop: baseImageCrop,
|
|
432
|
+
aspectRatio: baseAspectRatio
|
|
428
433
|
},
|
|
429
434
|
settings
|
|
430
435
|
})
|
|
431
436
|
});
|
|
432
437
|
}
|
|
433
438
|
function setColumnsNumber(value) {
|
|
434
|
-
|
|
439
|
+
setGallerySettings({ columns: value });
|
|
435
440
|
}
|
|
436
441
|
function toggleImageCrop() {
|
|
437
|
-
|
|
442
|
+
setGallerySettings({ imageCrop: !activeImageCrop });
|
|
438
443
|
}
|
|
439
444
|
function toggleRandomOrder() {
|
|
440
445
|
setAttributes({ randomOrder: !randomOrder });
|
|
@@ -491,30 +496,42 @@ function GalleryEdit(props) {
|
|
|
491
496
|
);
|
|
492
497
|
}
|
|
493
498
|
function setAspectRatio(value) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
changedAttributes
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
499
|
+
if (isViewportStyleState) {
|
|
500
|
+
setGallerySettings({ aspectRatio: value });
|
|
501
|
+
} else {
|
|
502
|
+
const cleanValue = !value || value === "auto" ? void 0 : value;
|
|
503
|
+
setAttributes({ aspectRatio: value ?? "auto" });
|
|
504
|
+
const changedAttributes = {};
|
|
505
|
+
const blocks = [];
|
|
506
|
+
getBlock(clientId).innerBlocks.forEach((block) => {
|
|
507
|
+
blocks.push(block.clientId);
|
|
508
|
+
changedAttributes[block.clientId] = {
|
|
509
|
+
aspectRatio: cleanValue,
|
|
510
|
+
scale: cleanValue ? "cover" : void 0
|
|
511
|
+
};
|
|
512
|
+
});
|
|
513
|
+
updateBlockAttributes(blocks, changedAttributes, true);
|
|
514
|
+
}
|
|
515
|
+
const noticeValue = value ?? baseAspectRatio;
|
|
504
516
|
const aspectRatioText = aspectRatioOptions.find(
|
|
505
|
-
(option) => option.value ===
|
|
517
|
+
(option) => option.value === noticeValue
|
|
506
518
|
);
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
aspectRatioText?.label || value
|
|
519
|
+
const noticeText = isViewportStyleState ? (0, import_i18n.sprintf)(
|
|
520
|
+
/* translators: 1: viewport name, 2: aspect ratio setting */
|
|
521
|
+
(0, import_i18n.__)(
|
|
522
|
+
"Gallery images in the %1$s viewport updated to aspect ratio: %2$s"
|
|
512
523
|
),
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
524
|
+
selectedStyleState.viewport.replace("@", ""),
|
|
525
|
+
aspectRatioText?.label || noticeValue
|
|
526
|
+
) : (0, import_i18n.sprintf)(
|
|
527
|
+
/* translators: %s: aspect ratio setting */
|
|
528
|
+
(0, import_i18n.__)("All gallery images updated to aspect ratio: %s"),
|
|
529
|
+
aspectRatioText?.label || noticeValue
|
|
517
530
|
);
|
|
531
|
+
createSuccessNotice(noticeText, {
|
|
532
|
+
id: "gallery-attributes-aspectRatio",
|
|
533
|
+
type: "snackbar"
|
|
534
|
+
});
|
|
518
535
|
}
|
|
519
536
|
(0, import_element.useEffect)(() => {
|
|
520
537
|
if (!linkTo) {
|
|
@@ -604,11 +621,12 @@ function GalleryEdit(props) {
|
|
|
604
621
|
] });
|
|
605
622
|
}
|
|
606
623
|
const hasLinkTo = linkTo && linkTo !== "none";
|
|
624
|
+
const hasViewportSettings = isFlexLayout || aspectRatioOptions.length > 1;
|
|
607
625
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
608
626
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
609
627
|
import_block_editor.InspectorControls,
|
|
610
628
|
{
|
|
611
|
-
group: isViewportStyleState &&
|
|
629
|
+
group: isViewportStyleState && hasViewportSettings ? "viewport" : "default",
|
|
612
630
|
children: [
|
|
613
631
|
!isViewportStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
614
632
|
import_dynamic_gallery.GallerySourcePanel,
|
|
@@ -624,9 +642,10 @@ function GalleryEdit(props) {
|
|
|
624
642
|
label: (0, import_i18n.__)("Settings"),
|
|
625
643
|
resetAll: () => {
|
|
626
644
|
if (isViewportStyleState) {
|
|
627
|
-
|
|
645
|
+
setGallerySettings({
|
|
628
646
|
columns: void 0,
|
|
629
|
-
imageCrop: void 0
|
|
647
|
+
imageCrop: void 0,
|
|
648
|
+
aspectRatio: void 0
|
|
630
649
|
});
|
|
631
650
|
return;
|
|
632
651
|
}
|
|
@@ -701,7 +720,7 @@ function GalleryEdit(props) {
|
|
|
701
720
|
isShownByDefault: true,
|
|
702
721
|
label: (0, import_i18n.__)("Crop images to fit"),
|
|
703
722
|
hasValue: () => isViewportStyleState ? hasViewportImageCrop : !activeImageCrop,
|
|
704
|
-
onDeselect: () =>
|
|
723
|
+
onDeselect: () => setGallerySettings({
|
|
705
724
|
imageCrop: isViewportStyleState ? void 0 : true
|
|
706
725
|
}),
|
|
707
726
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -748,12 +767,19 @@ function GalleryEdit(props) {
|
|
|
748
767
|
)
|
|
749
768
|
}
|
|
750
769
|
),
|
|
751
|
-
|
|
770
|
+
aspectRatioOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
752
771
|
import_components.__experimentalToolsPanelItem,
|
|
753
772
|
{
|
|
754
|
-
hasValue: () =>
|
|
773
|
+
hasValue: () => isViewportStyleState ? hasViewportAspectRatio : activeAspectRatio !== "auto",
|
|
755
774
|
label: (0, import_i18n.__)("Aspect ratio"),
|
|
756
|
-
onDeselect: () =>
|
|
775
|
+
onDeselect: () => (
|
|
776
|
+
// In a viewport state this clears the override
|
|
777
|
+
// so the base ratio applies again, rather than
|
|
778
|
+
// overriding it with Original.
|
|
779
|
+
setAspectRatio(
|
|
780
|
+
isViewportStyleState ? void 0 : "auto"
|
|
781
|
+
)
|
|
782
|
+
),
|
|
757
783
|
isShownByDefault: true,
|
|
758
784
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
759
785
|
import_components.SelectControl,
|
|
@@ -762,7 +788,7 @@ function GalleryEdit(props) {
|
|
|
762
788
|
help: (0, import_i18n.__)(
|
|
763
789
|
"Set a consistent aspect ratio for all images in the gallery."
|
|
764
790
|
),
|
|
765
|
-
value:
|
|
791
|
+
value: activeAspectRatio,
|
|
766
792
|
options: aspectRatioOptions,
|
|
767
793
|
onChange: setAspectRatio
|
|
768
794
|
}
|
|
@@ -849,11 +875,12 @@ function GalleryEdit(props) {
|
|
|
849
875
|
variant: "toolbar"
|
|
850
876
|
}
|
|
851
877
|
) }),
|
|
852
|
-
|
|
853
|
-
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
879
|
+
import_gallery_styles.default,
|
|
854
880
|
{
|
|
855
881
|
style: attributes.style,
|
|
856
|
-
clientId
|
|
882
|
+
clientId,
|
|
883
|
+
isFlexLayout
|
|
857
884
|
}
|
|
858
885
|
)
|
|
859
886
|
] }),
|