@wordpress/block-library 9.48.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/build/audio/edit.cjs +8 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +1 -2
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/edit.cjs +1 -2
- package/build/button/edit.cjs.map +2 -2
- package/build/categories/edit.cjs +1 -1
- package/build/categories/edit.cjs.map +1 -1
- package/build/code/edit.cjs +1 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/code/index.cjs +1 -1
- package/build/code/index.cjs.map +1 -1
- package/build/columns/transforms.cjs +65 -0
- package/build/columns/transforms.cjs.map +2 -2
- package/build/columns/utils.cjs.map +1 -1
- package/build/comments/edit/comments-legacy.cjs +1 -1
- package/build/comments/edit/comments-legacy.cjs.map +1 -1
- package/build/comments/edit/placeholder.cjs +4 -4
- package/build/comments/edit/placeholder.cjs.map +1 -1
- package/build/comments-pagination-next/edit.cjs +2 -2
- package/build/comments-pagination-next/edit.cjs.map +1 -1
- package/build/comments-pagination-previous/edit.cjs +2 -2
- package/build/comments-pagination-previous/edit.cjs.map +1 -1
- package/build/cover/deprecated.cjs +3 -3
- package/build/cover/deprecated.cjs.map +2 -2
- package/build/cover/edit/block-controls.cjs +13 -0
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +0 -1
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/cover/edit/index.cjs +61 -2
- package/build/cover/edit/index.cjs.map +3 -3
- package/build/cover/edit/inspector-controls.cjs +93 -35
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/edit.cjs +1 -2
- package/build/details/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -1
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/file/edit.cjs +3 -11
- package/build/file/edit.cjs.map +2 -2
- package/build/file/index.cjs +3 -1
- package/build/file/index.cjs.map +3 -3
- package/build/file/transforms.cjs +11 -32
- package/build/file/transforms.cjs.map +2 -2
- package/build/{freeform/convert-to-blocks-button.cjs → file/variations.cjs} +16 -18
- package/build/file/variations.cjs.map +7 -0
- package/build/footnotes/edit.cjs +1 -1
- package/build/footnotes/edit.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +1 -3
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +6 -15
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs.map +2 -2
- package/build/gallery/edit.cjs +212 -331
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/transforms.cjs +43 -0
- package/build/gallery/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +0 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/home-link/edit.cjs +1 -2
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/index.cjs +1 -1
- package/build/html/index.cjs.map +2 -2
- package/build/html/modal.cjs +9 -6
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/block.json +12 -0
- package/build/icon/edit.cjs +90 -41
- package/build/icon/edit.cjs.map +3 -3
- package/build/icon/index.cjs +3 -1
- package/build/icon/index.cjs.map +3 -3
- package/build/{tab/save.cjs → icon/variations.cjs} +14 -15
- package/build/icon/variations.cjs.map +7 -0
- package/build/image/block.json +1 -0
- package/build/image/edit.cjs +4 -3
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +91 -29
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +1 -1
- package/build/image/index.cjs.map +2 -2
- package/build/image/transforms.cjs +9 -3
- package/build/image/transforms.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +5 -25
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +1 -3
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +1 -1
- package/build/latest-posts/edit.cjs.map +1 -1
- package/build/list/edit.cjs +1 -8
- package/build/list/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +1 -45
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/list-item/hooks/use-merge.cjs +47 -24
- package/build/list-item/hooks/use-merge.cjs.map +2 -2
- package/build/math/edit.cjs +1 -1
- package/build/math/index.cjs +1 -1
- package/build/math/index.cjs.map +1 -1
- package/build/media-text/constants.cjs +1 -1
- package/build/media-text/constants.cjs.map +2 -2
- package/build/media-text/index.cjs +1 -1
- package/build/media-text/index.cjs.map +2 -2
- package/build/missing/edit.cjs +2 -2
- package/build/missing/edit.cjs.map +1 -1
- package/build/navigation/edit/index.cjs +34 -39
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
- package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-selector.cjs +1 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/navigation/edit/placeholder/index.cjs +1 -1
- package/build/navigation/edit/placeholder/index.cjs.map +2 -2
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/edit.cjs +1 -2
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs +0 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +0 -2
- package/build/navigation-link/shared/controls.cjs.map +2 -2
- package/build/navigation-submenu/block.json +7 -0
- package/build/navigation-submenu/edit.cjs +3 -2
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/page-list/block.json +2 -5
- package/build/page-list/edit.cjs +1 -11
- package/build/page-list/edit.cjs.map +2 -2
- package/build/paragraph/deprecated.cjs +1 -0
- package/build/paragraph/deprecated.cjs.map +2 -2
- package/build/paragraph/edit.cjs +10 -1
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/playlist/block.json +12 -0
- package/build/playlist/edit.cjs +27 -1
- package/build/playlist/edit.cjs.map +2 -2
- package/build/playlist/save.cjs +8 -1
- package/build/playlist/save.cjs.map +2 -2
- package/build/playlist/view.cjs +1 -0
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -3
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-author/edit.cjs +1 -1
- package/build/post-author/edit.cjs.map +2 -2
- package/build/post-author/utils.cjs +1 -1
- package/build/post-author/utils.cjs.map +2 -2
- package/build/post-comment/edit.cjs +0 -1
- package/build/post-comment/edit.cjs.map +2 -2
- package/build/post-date/edit.cjs +2 -2
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +2 -2
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/dimension-controls.cjs +90 -178
- package/build/post-featured-image/dimension-controls.cjs.map +3 -3
- package/build/post-featured-image/edit.cjs +47 -18
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs +2 -2
- package/build/post-navigation-link/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +0 -1
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-time-to-read/edit.cjs +1 -1
- package/build/post-time-to-read/edit.cjs.map +1 -1
- package/build/post-time-to-read/index.cjs +1 -1
- package/build/post-time-to-read/index.cjs.map +2 -2
- package/build/post-time-to-read/variations.cjs +1 -1
- package/build/post-time-to-read/variations.cjs.map +2 -2
- package/build/post-title/edit.cjs +0 -1
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +1 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/block.json +1 -3
- package/build/pullquote/deprecated.cjs +114 -9
- package/build/pullquote/deprecated.cjs.map +3 -3
- package/build/pullquote/edit.cjs +43 -66
- package/build/pullquote/edit.cjs.map +3 -3
- package/build/pullquote/save.cjs +5 -26
- package/build/pullquote/save.cjs.map +3 -3
- package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
- package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +1 -1
- package/build/query/edit/inspector-controls/index.cjs +0 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/query/utils.cjs +2 -2
- package/build/query/utils.cjs.map +2 -2
- package/build/query-pagination-next/edit.cjs +2 -2
- package/build/query-pagination-next/edit.cjs.map +1 -1
- package/build/query-pagination-previous/edit.cjs +2 -2
- package/build/query-pagination-previous/edit.cjs.map +1 -1
- package/build/query-title/edit.cjs +1 -1
- package/build/query-title/edit.cjs.map +2 -2
- package/build/query-total/edit.cjs +1 -1
- package/build/query-total/edit.cjs.map +2 -2
- package/build/quote/edit.cjs +4 -9
- package/build/quote/edit.cjs.map +2 -2
- package/build/quote/index.cjs +1 -1
- package/build/quote/index.cjs.map +2 -2
- package/build/read-more/edit.cjs +1 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/rss/edit.cjs +1 -2
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/block.json +4 -0
- package/build/search/edit.cjs +244 -206
- package/build/search/edit.cjs.map +2 -2
- package/build/shortcode/edit.cjs +1 -1
- package/build/shortcode/edit.cjs.map +2 -2
- package/build/shortcode/transforms.cjs +2 -2
- package/build/shortcode/transforms.cjs.map +2 -2
- package/build/site-logo/edit.cjs +2 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +1 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +1 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs +0 -3
- package/build/social-link/edit.cjs.map +2 -2
- package/build/tab-list/block.json +33 -20
- package/build/tab-list/edit.cjs +122 -12
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/init.cjs +28 -0
- package/build/tab-list/init.cjs.map +7 -0
- package/build/tab-list/save.cjs +33 -3
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panel/add-tab-toolbar-control.cjs +19 -8
- package/build/tab-panel/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panel/block.json +2 -6
- package/build/tab-panel/edit.cjs +0 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panel/remove-tab-toolbar-control.cjs +9 -14
- package/build/tab-panel/remove-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panel/save.cjs +2 -1
- package/build/tab-panel/save.cjs.map +2 -2
- package/build/tab-panels/block.json +2 -28
- package/build/tab-panels/init.cjs +28 -0
- package/build/tab-panels/init.cjs.map +7 -0
- package/build/table/edit.cjs +0 -2
- package/build/table/edit.cjs.map +2 -2
- package/build/table/index.cjs +1 -1
- package/build/table/index.cjs.map +2 -2
- package/build/tabs/block.json +3 -17
- package/build/tabs/edit.cjs +7 -21
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/index.cjs +6 -10
- package/build/tabs/index.cjs.map +2 -2
- package/build/tabs/use-tab-list-items-sync.cjs +53 -0
- package/build/tabs/use-tab-list-items-sync.cjs.map +7 -0
- package/build/tabs/view.cjs +22 -104
- package/build/tabs/view.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/title-modal.cjs +1 -2
- package/build/template-part/edit/title-modal.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/utils/style-state.cjs +164 -0
- package/build/utils/style-state.cjs.map +7 -0
- package/build/utils/waveform-player.cjs +42 -9
- package/build/utils/waveform-player.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +6 -4
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/edit.cjs +1 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/edit-common-settings.cjs +3 -6
- package/build/video/edit-common-settings.cjs.map +2 -2
- package/build/video/edit.cjs +3 -2
- package/build/video/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -2
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/audio/edit.mjs +8 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +1 -2
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/edit.mjs +1 -2
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/categories/edit.mjs +1 -1
- package/build-module/categories/edit.mjs.map +1 -1
- package/build-module/code/edit.mjs +1 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/code/index.mjs +1 -1
- package/build-module/code/index.mjs.map +1 -1
- package/build-module/columns/transforms.mjs +65 -0
- package/build-module/columns/transforms.mjs.map +2 -2
- package/build-module/columns/utils.mjs.map +1 -1
- package/build-module/comments/edit/comments-legacy.mjs +1 -1
- package/build-module/comments/edit/comments-legacy.mjs.map +1 -1
- package/build-module/comments/edit/placeholder.mjs +4 -4
- package/build-module/comments/edit/placeholder.mjs.map +1 -1
- package/build-module/comments-pagination-next/edit.mjs +2 -2
- package/build-module/comments-pagination-next/edit.mjs.map +1 -1
- package/build-module/comments-pagination-previous/edit.mjs +2 -2
- package/build-module/comments-pagination-previous/edit.mjs.map +1 -1
- package/build-module/cover/deprecated.mjs +3 -3
- package/build-module/cover/deprecated.mjs.map +2 -2
- package/build-module/cover/edit/block-controls.mjs +15 -2
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +64 -3
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +98 -35
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/edit.mjs +1 -2
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -1
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/edit.mjs +5 -13
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/index.mjs +3 -1
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/file/transforms.mjs +11 -32
- package/build-module/file/transforms.mjs.map +2 -2
- package/build-module/file/variations.mjs +17 -0
- package/build-module/file/variations.mjs.map +7 -0
- package/build-module/footnotes/edit.mjs +1 -1
- package/build-module/footnotes/edit.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +1 -3
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +6 -15
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +214 -334
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/transforms.mjs +43 -0
- package/build-module/gallery/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -2
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +1 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/index.mjs +1 -1
- package/build-module/html/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +9 -6
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +12 -0
- package/build-module/icon/edit.mjs +94 -42
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/icon/index.mjs +3 -1
- package/build-module/icon/index.mjs.map +2 -2
- package/build-module/icon/variations.mjs +13 -0
- package/build-module/icon/variations.mjs.map +7 -0
- package/build-module/image/block.json +1 -0
- package/build-module/image/edit.mjs +4 -3
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +96 -29
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +1 -1
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/transforms.mjs +9 -3
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +1 -3
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +1 -1
- package/build-module/latest-posts/edit.mjs.map +1 -1
- package/build-module/list/edit.mjs +2 -9
- package/build-module/list/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +1 -46
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +48 -25
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/math/edit.mjs +1 -1
- package/build-module/math/index.mjs +1 -1
- package/build-module/math/index.mjs.map +1 -1
- package/build-module/media-text/constants.mjs +1 -1
- package/build-module/media-text/constants.mjs.map +2 -2
- package/build-module/media-text/index.mjs +1 -1
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/missing/edit.mjs +2 -2
- package/build-module/missing/edit.mjs.map +1 -1
- package/build-module/navigation/edit/index.mjs +35 -46
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
- package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +1 -1
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/edit.mjs +1 -2
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +0 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-submenu/block.json +7 -0
- package/build-module/navigation-submenu/edit.mjs +3 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +2 -5
- package/build-module/page-list/edit.mjs +1 -11
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/paragraph/deprecated.mjs +1 -0
- package/build-module/paragraph/deprecated.mjs.map +2 -2
- package/build-module/paragraph/edit.mjs +12 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +12 -0
- package/build-module/playlist/edit.mjs +27 -1
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/save.mjs +8 -1
- package/build-module/playlist/save.mjs.map +2 -2
- package/build-module/playlist/view.mjs +1 -0
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -3
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +1 -1
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-author/utils.mjs +1 -1
- package/build-module/post-author/utils.mjs.map +2 -2
- package/build-module/post-comment/edit.mjs +0 -1
- package/build-module/post-comment/edit.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +2 -2
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +2 -2
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/dimension-controls.mjs +99 -187
- package/build-module/post-featured-image/dimension-controls.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +47 -18
- 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-terms/edit.mjs +0 -1
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/edit.mjs +1 -1
- package/build-module/post-time-to-read/edit.mjs.map +1 -1
- package/build-module/post-time-to-read/index.mjs +1 -1
- package/build-module/post-time-to-read/index.mjs.map +2 -2
- package/build-module/post-time-to-read/variations.mjs +2 -2
- package/build-module/post-time-to-read/variations.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +0 -1
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +1 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/block.json +1 -3
- package/build-module/pullquote/deprecated.mjs +114 -9
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +44 -72
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/pullquote/save.mjs +5 -16
- package/build-module/pullquote/save.mjs.map +2 -2
- package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +1 -1
- package/build-module/query/edit/inspector-controls/index.mjs +0 -1
- 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/utils.mjs +2 -2
- package/build-module/query/utils.mjs.map +2 -2
- package/build-module/query-pagination-next/edit.mjs +2 -2
- package/build-module/query-pagination-next/edit.mjs.map +1 -1
- package/build-module/query-pagination-previous/edit.mjs +2 -2
- package/build-module/query-pagination-previous/edit.mjs.map +1 -1
- package/build-module/query-title/edit.mjs +1 -1
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/query-total/edit.mjs +1 -1
- package/build-module/query-total/edit.mjs.map +2 -2
- package/build-module/quote/edit.mjs +5 -10
- package/build-module/quote/edit.mjs.map +2 -2
- package/build-module/quote/index.mjs +1 -1
- package/build-module/quote/index.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +1 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/rss/edit.mjs +1 -2
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/block.json +4 -0
- package/build-module/search/edit.mjs +244 -206
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/shortcode/edit.mjs +1 -1
- package/build-module/shortcode/edit.mjs.map +2 -2
- package/build-module/shortcode/transforms.mjs +2 -2
- package/build-module/shortcode/transforms.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +2 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +1 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +1 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +0 -3
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +33 -20
- package/build-module/tab-list/edit.mjs +128 -15
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/init.mjs +7 -0
- package/build-module/tab-list/init.mjs.map +7 -0
- package/build-module/tab-list/save.mjs +29 -4
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/add-tab-toolbar-control.mjs +19 -8
- package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panel/block.json +2 -6
- package/build-module/tab-panel/edit.mjs +1 -10
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs +9 -14
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panel/save.mjs +2 -1
- package/build-module/tab-panel/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +2 -28
- package/build-module/tab-panels/init.mjs +7 -0
- package/build-module/tab-panels/init.mjs.map +7 -0
- package/build-module/table/edit.mjs +0 -2
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/table/index.mjs +1 -1
- package/build-module/table/index.mjs.map +2 -2
- package/build-module/tabs/block.json +3 -17
- package/build-module/tabs/edit.mjs +7 -21
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +6 -10
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/use-tab-list-items-sync.mjs +32 -0
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +7 -0
- package/build-module/tabs/view.mjs +22 -104
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/title-modal.mjs +1 -2
- package/build-module/template-part/edit/title-modal.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/utils/style-state.mjs +132 -0
- package/build-module/utils/style-state.mjs.map +7 -0
- package/build-module/utils/waveform-player.mjs +44 -11
- package/build-module/utils/waveform-player.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +6 -4
- package/build-module/utils/waveform-utils.mjs.map +2 -2
- package/build-module/verse/edit.mjs +1 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/edit-common-settings.mjs +4 -7
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/edit.mjs +3 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/comment-template/style-rtl.css +1 -0
- package/build-style/comment-template/style.css +1 -0
- package/build-style/common-rtl.css +30 -10
- package/build-style/common.css +30 -10
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- package/build-style/editor-rtl.css +22 -30
- package/build-style/editor.css +22 -30
- package/build-style/form-input/style-rtl.css +2 -0
- package/build-style/form-input/style.css +2 -0
- package/build-style/gallery/style-rtl.css +4 -2
- package/build-style/gallery/style.css +4 -2
- package/build-style/icon/style-rtl.css +9 -0
- package/build-style/icon/style.css +9 -0
- package/build-style/media-text/style-rtl.css +2 -1
- package/build-style/media-text/style.css +2 -1
- package/build-style/playlist/style-rtl.css +3 -0
- package/build-style/playlist/style.css +3 -0
- package/build-style/query/editor-rtl.css +8 -4
- package/build-style/query/editor.css +8 -4
- package/build-style/read-more/style-rtl.css +1 -0
- package/build-style/read-more/style.css +1 -0
- package/build-style/reset-rtl.css +3 -1
- package/build-style/reset.css +3 -1
- package/build-style/search/style-rtl.css +3 -1
- package/build-style/search/style.css +3 -1
- package/build-style/site-logo/editor-rtl.css +2 -1
- package/build-style/site-logo/editor.css +2 -1
- package/build-style/style-rtl.css +64 -41
- package/build-style/style.css +64 -41
- package/build-style/{tab → tab-list}/style-rtl.css +5 -3
- package/build-style/{tab → tab-list}/style.css +5 -3
- package/build-style/tab-panel/style-rtl.css +0 -17
- package/build-style/tab-panel/style.css +0 -17
- package/build-style/template-part/editor-rtl.css +8 -4
- package/build-style/template-part/editor.css +8 -4
- package/build-style/video/style-rtl.css +2 -1
- package/build-style/video/style.css +2 -1
- package/package.json +55 -48
- package/src/accordion/README.md +97 -0
- package/src/accordion-heading/README.md +81 -0
- package/src/accordion-item/README.md +85 -0
- package/src/accordion-panel/README.md +74 -0
- package/src/archives/README.md +56 -0
- package/src/audio/README.md +55 -0
- package/src/audio/edit.js +5 -9
- package/src/avatar/README.md +74 -0
- package/src/avatar/index.php +2 -2
- package/src/block/README.md +56 -0
- package/src/block/index.php +2 -26
- package/src/breadcrumbs/README.md +67 -0
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/README.md +93 -0
- package/src/button/edit.js +0 -1
- package/src/buttons/README.md +80 -0
- package/src/calendar/README.md +51 -0
- package/src/categories/README.md +69 -0
- package/src/code/README.md +55 -0
- package/src/column/README.md +72 -0
- package/src/columns/README.md +90 -0
- package/src/columns/test/transforms.js +164 -0
- package/src/columns/transforms.js +74 -0
- package/src/comment-author-avatar/README.md +63 -0
- package/src/comment-author-avatar/index.php +3 -3
- package/src/comment-author-name/README.md +67 -0
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-content/README.md +61 -0
- package/src/comment-date/README.md +67 -0
- package/src/comment-date/index.php +1 -1
- package/src/comment-edit-link/README.md +67 -0
- package/src/comment-reply-link/README.md +63 -0
- package/src/comment-template/README.md +60 -0
- package/src/comments/README.md +88 -0
- package/src/comments-pagination/README.md +77 -0
- package/src/comments-pagination-next/README.md +64 -0
- package/src/comments-pagination-numbers/README.md +64 -0
- package/src/comments-pagination-previous/README.md +64 -0
- package/src/comments-title/README.md +70 -0
- package/src/common.scss +63 -10
- package/src/cover/README.md +111 -0
- package/src/cover/edit/block-controls.js +14 -2
- package/src/cover/edit/embed-video-url-input.js +0 -1
- package/src/cover/edit/index.js +86 -0
- package/src/cover/edit/inspector-controls.js +124 -54
- package/src/cover/test/edit.js +51 -2
- package/src/details/README.md +65 -0
- package/src/details/edit.js +0 -1
- package/src/editor.scss +0 -2
- package/src/embed/README.md +56 -0
- package/src/file/README.md +60 -0
- package/src/file/edit.js +3 -16
- package/src/file/index.js +2 -0
- package/src/file/transforms.js +12 -31
- package/src/file/variations.js +17 -0
- package/src/footnotes/README.md +64 -0
- package/src/form/README.md +90 -0
- package/src/form/edit.js +0 -2
- package/src/form-input/README.md +74 -0
- package/src/form-input/edit.js +0 -2
- package/src/form-submission-notification/README.md +50 -0
- package/src/form-submit-button/README.md +54 -0
- package/src/freeform/README.md +49 -0
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/gallery/README.md +115 -0
- package/src/gallery/edit.js +214 -351
- package/src/gallery/test/transforms.js +155 -0
- package/src/gallery/transforms.js +47 -0
- package/src/group/README.md +80 -0
- package/src/heading/README.md +60 -0
- package/src/heading/edit.js +1 -2
- package/src/home-link/README.md +66 -0
- package/src/home-link/edit.js +0 -1
- package/src/home-link/index.php +3 -15
- package/src/html/README.md +48 -0
- package/src/html/modal.js +3 -0
- package/src/icon/README.md +66 -0
- package/src/icon/block.json +12 -0
- package/src/icon/edit.js +85 -37
- package/src/icon/index.js +3 -1
- package/src/icon/index.php +23 -0
- package/src/icon/style.scss +12 -0
- package/src/icon/variations.js +9 -0
- package/src/image/README.md +103 -0
- package/src/image/block.json +1 -0
- package/src/image/edit.js +8 -3
- package/src/image/image.js +120 -56
- package/src/image/index.php +4 -5
- package/src/image/test/use-open-image-media-editor-modal.js +20 -26
- package/src/image/transforms.js +34 -8
- package/src/image/use-open-image-media-editor-modal.js +24 -42
- package/src/index.js +4 -11
- package/src/latest-comments/README.md +57 -0
- package/src/latest-posts/README.md +71 -0
- package/src/list/README.md +70 -0
- package/src/list/edit.js +2 -9
- package/src/list/ordered-list-settings.js +46 -93
- package/src/list-item/README.md +71 -0
- package/src/list-item/hooks/use-merge.js +53 -46
- package/src/loginout/README.md +56 -0
- package/src/math/README.md +50 -0
- package/src/media-text/README.md +92 -0
- package/src/missing/README.md +55 -0
- package/src/more/README.md +49 -0
- package/src/navigation/README.md +115 -0
- package/src/navigation/edit/index.js +35 -46
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation/index.php +58 -0
- package/src/navigation-link/README.md +93 -0
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/edit.js +0 -1
- package/src/navigation-link/index.php +1 -15
- package/src/navigation-link/link-ui/page-creator.js +0 -1
- package/src/navigation-link/shared/controls.js +0 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
- package/src/navigation-overlay-close/README.md +48 -0
- package/src/navigation-submenu/README.md +89 -0
- package/src/navigation-submenu/block.json +7 -0
- package/src/navigation-submenu/edit.js +1 -0
- package/src/navigation-submenu/index.php +1 -17
- package/src/nextpage/README.md +50 -0
- package/src/page-list/README.md +84 -0
- package/src/page-list/block.json +2 -5
- package/src/page-list/edit.js +0 -11
- package/src/page-list/index.php +4 -16
- package/src/page-list-item/README.md +77 -0
- package/src/paragraph/README.md +70 -0
- package/src/paragraph/deprecated.js +1 -0
- package/src/paragraph/edit.js +13 -1
- package/src/pattern/README.md +45 -0
- package/src/playlist/README.md +86 -0
- package/src/playlist/block.json +12 -0
- package/src/playlist/edit.js +27 -0
- package/src/playlist/index.php +10 -3
- package/src/playlist/save.js +9 -1
- package/src/playlist/style.scss +7 -0
- package/src/playlist/view.js +1 -0
- package/src/playlist-track/README.md +69 -0
- package/src/playlist-track/edit.js +0 -3
- package/src/post-author/README.md +78 -0
- package/src/post-author-biography/README.md +59 -0
- package/src/post-author-name/README.md +63 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-comment/README.md +61 -0
- package/src/post-comment/edit.js +0 -1
- package/src/post-comments-count/README.md +58 -0
- package/src/post-comments-form/README.md +59 -0
- package/src/post-comments-link/README.md +60 -0
- package/src/post-content/README.md +71 -0
- package/src/post-date/README.md +65 -0
- package/src/post-date/edit.js +2 -2
- package/src/post-date/index.php +1 -1
- package/src/post-excerpt/README.md +66 -0
- package/src/post-featured-image/README.md +86 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/dimension-controls.js +105 -184
- package/src/post-featured-image/edit.js +53 -22
- package/src/post-featured-image/index.php +25 -23
- package/src/post-navigation-link/README.md +63 -0
- package/src/post-template/README.md +71 -0
- package/src/post-terms/README.md +65 -0
- package/src/post-terms/edit.js +0 -1
- package/src/post-time-to-read/README.md +63 -0
- package/src/post-time-to-read/index.js +1 -1
- package/src/post-time-to-read/variations.js +2 -2
- package/src/post-title/README.md +69 -0
- package/src/post-title/edit.js +0 -1
- package/src/preformatted/README.md +50 -0
- package/src/pullquote/README.md +64 -0
- package/src/pullquote/block.json +1 -3
- package/src/pullquote/deprecated.js +121 -9
- package/src/pullquote/edit.js +8 -38
- package/src/pullquote/save.js +2 -13
- package/src/query/README.md +64 -0
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/query-no-results/README.md +65 -0
- package/src/query-pagination/README.md +79 -0
- package/src/query-pagination-next/README.md +67 -0
- package/src/query-pagination-numbers/README.md +65 -0
- package/src/query-pagination-previous/README.md +67 -0
- package/src/query-title/README.md +65 -0
- package/src/query-total/README.md +66 -0
- package/src/quote/README.md +75 -0
- package/src/quote/edit.js +3 -9
- package/src/read-more/README.md +61 -0
- package/src/read-more/index.php +2 -2
- package/src/rss/README.md +62 -0
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +67 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/separator/README.md +62 -0
- package/src/shortcode/README.md +44 -0
- package/src/shortcode/transforms.js +2 -2
- package/src/site-logo/README.md +72 -0
- package/src/site-logo/edit.js +3 -1
- package/src/site-tagline/README.md +56 -0
- package/src/site-title/README.md +57 -0
- package/src/social-link/README.md +64 -0
- package/src/social-link/edit.js +0 -3
- package/src/social-links/README.md +98 -0
- package/src/spacer/README.md +53 -0
- package/src/style.scss +1 -2
- package/src/tab-list/README.md +81 -0
- package/src/tab-list/block.json +33 -20
- package/src/tab-list/edit.js +153 -15
- package/src/tab-list/index.php +24 -33
- package/src/tab-list/init.js +6 -0
- package/src/tab-list/save.js +39 -4
- package/src/{tab → tab-list}/style.scss +2 -3
- package/src/tab-panel/README.md +72 -0
- package/src/tab-panel/add-tab-toolbar-control.js +24 -11
- package/src/tab-panel/block.json +2 -6
- package/src/tab-panel/edit.js +1 -14
- package/src/tab-panel/index.php +2 -25
- package/src/tab-panel/remove-tab-toolbar-control.js +10 -14
- package/src/tab-panel/save.js +1 -0
- package/src/tab-panel/style.scss +0 -17
- package/src/tab-panels/README.md +59 -0
- package/src/tab-panels/block.json +2 -28
- package/src/tab-panels/init.js +6 -0
- package/src/table/README.md +71 -0
- package/src/table/edit.js +0 -2
- package/src/table-of-contents/README.md +61 -0
- package/src/tabs/README.md +77 -0
- package/src/tabs/block.json +3 -17
- package/src/tabs/edit.js +8 -19
- package/src/tabs/index.js +6 -10
- package/src/tabs/index.php +12 -32
- package/src/tabs/use-tab-list-items-sync.js +49 -0
- package/src/tabs/view.js +22 -110
- package/src/tag-cloud/README.md +62 -0
- package/src/template-part/README.md +48 -0
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/term-count/README.md +59 -0
- package/src/term-description/README.md +60 -0
- package/src/term-name/README.md +65 -0
- package/src/term-template/README.md +65 -0
- package/src/terms-query/README.md +58 -0
- package/src/text-columns/README.md +51 -0
- package/src/utils/style-state.js +151 -0
- package/src/utils/test/style-state.js +307 -0
- package/src/utils/test/waveform-player.js +254 -0
- package/src/utils/waveform-player.js +90 -18
- package/src/utils/waveform-utils.js +15 -11
- package/src/verse/README.md +58 -0
- package/src/video/README.md +58 -0
- package/src/video/edit-common-settings.js +4 -7
- package/src/video/edit.js +9 -16
- package/src/video/tracks-editor.js +0 -2
- package/babel-plugin.cjs +0 -150
- package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
- package/build/list-item/utils.cjs +0 -57
- package/build/list-item/utils.cjs.map +0 -7
- package/build/tab/block.json +0 -56
- package/build/tab/controls.cjs +0 -46
- package/build/tab/controls.cjs.map +0 -7
- package/build/tab/edit.cjs +0 -135
- package/build/tab/edit.cjs.map +0 -7
- package/build/tab/index.cjs +0 -58
- package/build/tab/index.cjs.map +0 -7
- package/build/tab/save.cjs.map +0 -7
- package/build/tabs/use-tab-list-sync.cjs +0 -190
- package/build/tabs/use-tab-list-sync.cjs.map +0 -7
- package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
- package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
- package/build-module/list-item/utils.mjs +0 -32
- package/build-module/list-item/utils.mjs.map +0 -7
- package/build-module/tab/block.json +0 -56
- package/build-module/tab/controls.mjs +0 -15
- package/build-module/tab/controls.mjs.map +0 -7
- package/build-module/tab/edit.mjs +0 -108
- package/build-module/tab/edit.mjs.map +0 -7
- package/build-module/tab/index.mjs +0 -20
- package/build-module/tab/index.mjs.map +0 -7
- package/build-module/tab/save.mjs +0 -14
- package/build-module/tab/save.mjs.map +0 -7
- package/build-module/tabs/use-tab-list-sync.mjs +0 -169
- package/build-module/tabs/use-tab-list-sync.mjs.map +0 -7
- package/build-style/tab/editor-rtl.css +0 -11
- package/build-style/tab/editor.css +0 -11
- package/build-style/tab-list/editor-rtl.css +0 -6
- package/build-style/tab-list/editor.css +0 -6
- package/build-style/tab-panels/style-rtl.css +0 -4
- package/build-style/tab-panels/style.css +0 -4
- package/src/audio/edit.native.js +0 -250
- package/src/audio/style.native.scss +0 -13
- package/src/audio/test/__snapshots__/edit.native.js.snap +0 -546
- package/src/audio/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/audio/test/edit.native.js +0 -132
- package/src/audio/test/transforms.native.js +0 -43
- package/src/audio/transforms.native.js +0 -12
- package/src/block/edit-title.native.js +0 -67
- package/src/block/edit.native.js +0 -247
- package/src/block/editor.native.scss +0 -125
- package/src/block/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/block/test/edit.native.js +0 -262
- package/src/block/test/transforms.native.js +0 -40
- package/src/button/color-background.native.js +0 -41
- package/src/button/edit.native.js +0 -567
- package/src/button/editor.native.scss +0 -70
- package/src/button/rich-text.android.scss +0 -6
- package/src/button/rich-text.ios.scss +0 -6
- package/src/buttons/edit.native.js +0 -157
- package/src/buttons/editor.native.scss +0 -11
- package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -99
- package/src/buttons/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/buttons/test/edit.native.js +0 -485
- package/src/buttons/test/transforms.native.js +0 -48
- package/src/buttons/transforms.native.js +0 -12
- package/src/code/edit.native.js +0 -70
- package/src/code/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/code/test/edit.native.js +0 -65
- package/src/code/theme.native.scss +0 -22
- package/src/code/transforms.native.js +0 -12
- package/src/column/column-preview.native.js +0 -58
- package/src/column/edit.native.js +0 -273
- package/src/column/editor.native.scss +0 -75
- package/src/columns/columnCalculations.native.js +0 -178
- package/src/columns/edit.native.js +0 -507
- package/src/columns/editor.native.scss +0 -17
- package/src/columns/test/__snapshots__/edit.native.js.snap +0 -305
- package/src/columns/test/__snapshots__/transforms.native.js.snap +0 -61
- package/src/columns/test/edit.native.js +0 -496
- package/src/columns/test/transforms.native.js +0 -89
- package/src/columns/transforms.native.js +0 -12
- package/src/cover/controls.native.js +0 -307
- package/src/cover/edit.native.js +0 -708
- package/src/cover/focal-point-settings-button.native.js +0 -53
- package/src/cover/overlay-color-settings.native.js +0 -106
- package/src/cover/style.native.scss +0 -220
- package/src/cover/test/__snapshots__/edit.native.js.snap +0 -105
- package/src/cover/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/cover/test/edit.native.js +0 -701
- package/src/cover/test/transforms.native.js +0 -116
- package/src/cover/transforms.native.js +0 -12
- package/src/cover/use-cover-is-dark.native.js +0 -51
- package/src/embed/edit.native.js +0 -345
- package/src/embed/embed-controls.native.js +0 -65
- package/src/embed/embed-link-settings.native.js +0 -99
- package/src/embed/embed-loading.native.js +0 -29
- package/src/embed/embed-no-preview.native.js +0 -230
- package/src/embed/embed-placeholder.native.js +0 -178
- package/src/embed/embed-preview.native.js +0 -157
- package/src/embed/styles.native.scss +0 -196
- package/src/embed/test/__snapshots__/index.native.js.snap +0 -191
- package/src/embed/test/__snapshots__/transforms.native.js.snap +0 -23
- package/src/embed/test/index.native.js +0 -1125
- package/src/embed/test/transforms.native.js +0 -44
- package/src/embed/transforms.native.js +0 -12
- package/src/embed/wp-embed-preview.native.js +0 -80
- package/src/file/edit.native.js +0 -605
- package/src/file/style.native.scss +0 -79
- package/src/file/test/__snapshots__/edit.native.js.snap +0 -580
- package/src/file/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/file/test/edit.native.js +0 -93
- package/src/file/test/transforms.native.js +0 -43
- package/src/file/transforms.native.js +0 -12
- package/src/freeform/convert-to-blocks-button.js +0 -18
- package/src/freeform/edit.native.js +0 -13
- package/src/freeform/test/__snapshots__/index.native.js.snap +0 -7
- package/src/freeform/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/freeform/test/index.native.js +0 -57
- package/src/freeform/test/transforms.native.js +0 -39
- package/src/gallery/gallery-styles.native.scss +0 -8
- package/src/gallery/gallery.native.js +0 -124
- package/src/gallery/styles.native.scss +0 -7
- package/src/gallery/test/__snapshots__/index.native.js.snap +0 -177
- package/src/gallery/test/__snapshots__/transforms.native.js.snap +0 -53
- package/src/gallery/test/helpers.native.js +0 -106
- package/src/gallery/test/index.native.js +0 -700
- package/src/gallery/test/transforms.native.js +0 -53
- package/src/gallery/test/use-get-media.native.js +0 -24
- package/src/gallery/transforms.native.js +0 -12
- package/src/gallery/use-get-media.native.js +0 -49
- package/src/group/edit.native.js +0 -137
- package/src/group/editor.native.scss +0 -56
- package/src/group/test/__snapshots__/edit.native.js.snap +0 -19
- package/src/group/test/__snapshots__/transforms.native.js.snap +0 -35
- package/src/group/test/edit.native.js +0 -100
- package/src/group/test/transforms.native.js +0 -73
- package/src/heading/edit.native.js +0 -159
- package/src/heading/test/__snapshots__/index.native.js.snap +0 -43
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/heading/test/index.native.js +0 -257
- package/src/heading/test/transforms.native.js +0 -46
- package/src/heading/transforms.native.js +0 -12
- package/src/html/transforms.native.js +0 -11
- package/src/image/edit.native.js +0 -959
- package/src/image/styles.native.scss +0 -70
- package/src/image/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/image/test/edit.native.js +0 -459
- package/src/image/test/transforms.native.js +0 -49
- package/src/image/transforms.native.js +0 -12
- package/src/index.native.js +0 -274
- package/src/latest-posts/edit.native.js +0 -294
- package/src/latest-posts/style.native.scss +0 -47
- package/src/latest-posts/test/__snapshots__/edit.native.js.snap +0 -3
- package/src/latest-posts/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/latest-posts/test/edit.native.js +0 -49
- package/src/latest-posts/test/transforms.native.js +0 -61
- package/src/list/tag-name.native.js +0 -12
- package/src/list/test/__snapshots__/edit.native.js.snap +0 -121
- package/src/list/test/__snapshots__/transforms.native.js.snap +0 -85
- package/src/list/test/edit.native.js +0 -602
- package/src/list/test/transforms.native.js +0 -56
- package/src/list/transforms.native.js +0 -12
- package/src/list-item/edit.native.js +0 -175
- package/src/list-item/hooks/use-enter.native.js +0 -81
- package/src/list-item/icons.native.js +0 -34
- package/src/list-item/list-style-type.native.js +0 -146
- package/src/list-item/style.native.scss +0 -57
- package/src/list-item/utils.js +0 -34
- package/src/media-text/edit.native.js +0 -417
- package/src/media-text/icon-retry.native.js +0 -11
- package/src/media-text/media-container.native.js +0 -393
- package/src/media-text/style.native.scss +0 -191
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +0 -73
- package/src/media-text/test/edit.native.js +0 -58
- package/src/media-text/test/transforms.native.js +0 -116
- package/src/media-text/transforms.native.js +0 -12
- package/src/missing/edit.native.js +0 -294
- package/src/missing/style.native.scss +0 -79
- package/src/missing/test/__snapshots__/edit.native.js.snap +0 -110
- package/src/missing/test/edit-integration.native.js +0 -168
- package/src/missing/test/edit.native.js +0 -81
- package/src/more/edit.native.js +0 -36
- package/src/more/editor.native.scss +0 -21
- package/src/more/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/more/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/more/test/edit.native.js +0 -41
- package/src/more/test/transforms.native.js +0 -42
- package/src/more/transforms.native.js +0 -12
- package/src/navigation-link/shared/build-css-font-sizes.php +0 -43
- package/src/nextpage/edit.native.js +0 -58
- package/src/nextpage/editor.native.scss +0 -21
- package/src/nextpage/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/nextpage/test/transforms.native.js +0 -42
- package/src/nextpage/transforms.native.js +0 -12
- package/src/paragraph/edit.native.js +0 -116
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +0 -88
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -65
- package/src/paragraph/test/edit.native.js +0 -999
- package/src/paragraph/test/transforms.native.js +0 -51
- package/src/paragraph/transforms.native.js +0 -12
- package/src/preformatted/edit.native.js +0 -48
- package/src/preformatted/styles.native.scss +0 -30
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +0 -95
- package/src/preformatted/test/__snapshots__/transforms.native.js.snap +0 -37
- package/src/preformatted/test/edit.native.js +0 -111
- package/src/preformatted/test/transforms.native.js +0 -47
- package/src/preformatted/transforms.native.js +0 -12
- package/src/pullquote/blockquote.native.js +0 -39
- package/src/pullquote/blockquote.native.scss +0 -8
- package/src/pullquote/edit.native.js +0 -128
- package/src/pullquote/figure.native.js +0 -33
- package/src/pullquote/figure.native.scss +0 -16
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +0 -47
- package/src/pullquote/test/edit.native.js +0 -73
- package/src/pullquote/test/transforms.native.js +0 -46
- package/src/pullquote/transforms.native.js +0 -12
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -49
- package/src/quote/test/edit.native.js +0 -94
- package/src/quote/test/transforms.native.js +0 -69
- package/src/quote/transforms.native.js +0 -12
- package/src/search/edit.native.js +0 -486
- package/src/search/style.native.scss +0 -99
- package/src/search/test/__snapshots__/edit.native.js.snap +0 -827
- package/src/search/test/__snapshots__/transforms.native.js.snap +0 -15
- package/src/search/test/edit.native.js +0 -170
- package/src/search/test/transforms.native.js +0 -40
- package/src/separator/separator-settings.native.js +0 -3
- package/src/separator/test/__snapshots__/edit.native.js.snap +0 -7
- package/src/separator/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/separator/test/edit.native.js +0 -41
- package/src/separator/test/transforms.native.js +0 -42
- package/src/separator/transforms.native.js +0 -12
- package/src/shortcode/edit.native.js +0 -77
- package/src/shortcode/style.native.scss +0 -44
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +0 -9
- package/src/shortcode/test/__snapshots__/transforms.native.js.snap +0 -19
- package/src/shortcode/test/edit.native.js +0 -70
- package/src/shortcode/test/transforms.native.js +0 -42
- package/src/shortcode/transforms.native.js +0 -12
- package/src/social-link/edit.native.js +0 -219
- package/src/social-link/editor.native.scss +0 -18
- package/src/social-links/edit.native.js +0 -147
- package/src/social-links/editor.native.scss +0 -25
- package/src/social-links/test/__snapshots__/edit.native.js.snap +0 -57
- package/src/social-links/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/social-links/test/edit.native.js +0 -266
- package/src/social-links/test/transforms.native.js +0 -53
- package/src/spacer/controls.native.js +0 -86
- package/src/spacer/edit.native.js +0 -110
- package/src/spacer/editor.native.scss +0 -18
- package/src/spacer/save.native.js +0 -18
- package/src/spacer/test/__snapshots__/index.native.js.snap +0 -43
- package/src/spacer/test/__snapshots__/transforms.native.js.snap +0 -25
- package/src/spacer/test/index.native.js +0 -257
- package/src/spacer/test/transforms.native.js +0 -42
- package/src/tab/block.json +0 -56
- package/src/tab/controls.js +0 -19
- package/src/tab/edit.js +0 -141
- package/src/tab/editor.scss +0 -14
- package/src/tab/index.js +0 -24
- package/src/tab/index.php +0 -70
- package/src/tab/save.js +0 -13
- package/src/tab-list/editor.scss +0 -10
- package/src/tab-panels/style.scss +0 -4
- package/src/table/transforms.native.js +0 -11
- package/src/tabs/use-tab-list-sync.js +0 -237
- package/src/text-columns/transforms.native.js +0 -12
- package/src/utils/init-block.native.js +0 -40
- package/src/utils/transformation-categories.native.js +0 -47
- package/src/verse/test/__snapshots__/edit.native.js.snap +0 -13
- package/src/verse/test/__snapshots__/transforms.native.js.snap +0 -31
- package/src/verse/test/edit.native.js +0 -118
- package/src/verse/test/transforms.native.js +0 -46
- package/src/verse/transforms.native.js +0 -12
- package/src/video/edit.native.js +0 -406
- package/src/video/icon-retry.native.js +0 -11
- package/src/video/style.native.scss +0 -81
- package/src/video/test/__snapshots__/transforms.native.js.snap +0 -41
- package/src/video/test/edit.native.js +0 -53
- package/src/video/test/transforms.native.js +0 -49
- package/src/video/transforms.native.js +0 -12
|
@@ -100,12 +100,17 @@ var transforms = {
|
|
|
100
100
|
const href = anchorElement && anchorElement.href ? anchorElement.href : void 0;
|
|
101
101
|
const rel = anchorElement && anchorElement.rel ? anchorElement.rel : void 0;
|
|
102
102
|
const linkClass = anchorElement && anchorElement.className ? anchorElement.className : void 0;
|
|
103
|
-
const
|
|
103
|
+
const widthValue = parsePixelDimension(
|
|
104
104
|
img.getAttribute("width")
|
|
105
105
|
);
|
|
106
|
-
const
|
|
106
|
+
const heightValue = parsePixelDimension(
|
|
107
107
|
img.getAttribute("height")
|
|
108
108
|
);
|
|
109
|
+
const widthNumber = parseInt(widthValue, 10);
|
|
110
|
+
const heightNumber = parseInt(heightValue, 10);
|
|
111
|
+
const aspectRatio = widthNumber && heightNumber ? String(widthNumber / heightNumber) : void 0;
|
|
112
|
+
const width = widthValue || (heightValue ? "auto" : void 0);
|
|
113
|
+
const height = widthValue ? "auto" : heightValue;
|
|
109
114
|
const attributes = (0, import_blocks.getBlockAttributes)(
|
|
110
115
|
"core/image",
|
|
111
116
|
node.outerHTML,
|
|
@@ -118,7 +123,8 @@ var transforms = {
|
|
|
118
123
|
linkClass,
|
|
119
124
|
anchor,
|
|
120
125
|
width,
|
|
121
|
-
height
|
|
126
|
+
height,
|
|
127
|
+
aspectRatio
|
|
122
128
|
}
|
|
123
129
|
);
|
|
124
130
|
if ((0, import_blob.isBlobURL)(attributes.url)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/image/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlobURL, isBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockAttributes } from '@wordpress/blocks';\n\nexport function stripFirstImage( attributes, { shortcode } ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = shortcode.content;\n\n\tlet nodeToRemove = body.querySelector( 'img' );\n\n\t// If an image has parents, find the topmost node to remove.\n\twhile (\n\t\tnodeToRemove &&\n\t\tnodeToRemove.parentNode &&\n\t\tnodeToRemove.parentNode !== body\n\t) {\n\t\tnodeToRemove = nodeToRemove.parentNode;\n\t}\n\n\tif ( nodeToRemove ) {\n\t\tnodeToRemove.parentNode.removeChild( nodeToRemove );\n\t}\n\n\treturn body.innerHTML.trim();\n}\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif ( firstElementChild && firstElementChild.nodeName === 'A' ) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt', 'title', 'width', 'height' ],\n\t\tclasses: [\n\t\t\t'alignleft',\n\t\t\t'aligncenter',\n\t\t\t'alignright',\n\t\t\t'alignnone',\n\t\t\t/^wp-image-\\d+$/,\n\t\t],\n\t},\n};\n\n//
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyC;AACzC,oBAAgD;AAEzC,SAAS,gBAAiB,YAAY,EAAE,UAAU,GAAI;AAC5D,QAAM,EAAE,KAAK,IAAI,SAAS,eAAe,mBAAoB,EAAG;AAEhE,OAAK,YAAY,UAAU;AAE3B,MAAI,eAAe,KAAK,cAAe,KAAM;AAG7C,SACC,gBACA,aAAa,cACb,aAAa,eAAe,MAC3B;AACD,mBAAe,aAAa;AAAA,EAC7B;AAEA,MAAK,cAAe;AACnB,iBAAa,WAAW,YAAa,YAAa;AAAA,EACnD;AAEA,SAAO,KAAK,UAAU,KAAK;AAC5B;AAEA,SAAS,gCAAiC,MAAM,eAAgB;AAC/D,QAAM,EAAE,KAAK,IAAI,SAAS,eAAe,mBAAoB,EAAG;AAEhE,OAAK,YA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AAE,IAAI;AAClD,cAAM,gBAAgB,KAAK,cAAe,GAAI;AAC9C,cAAM,kBACL,iBAAiB,cAAc,OAAO,WAAW;AAClD,cAAM,OACL,iBAAiB,cAAc,OAC5B,cAAc,OACd;AACJ,cAAM,MACL,iBAAiB,cAAc,MAC5B,cAAc,MACd;AACJ,cAAM,YACL,iBAAiB,cAAc,YAC5B,cAAc,YACd;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlobURL, isBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockAttributes } from '@wordpress/blocks';\n\nexport function stripFirstImage( attributes, { shortcode } ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = shortcode.content;\n\n\tlet nodeToRemove = body.querySelector( 'img' );\n\n\t// If an image has parents, find the topmost node to remove.\n\twhile (\n\t\tnodeToRemove &&\n\t\tnodeToRemove.parentNode &&\n\t\tnodeToRemove.parentNode !== body\n\t) {\n\t\tnodeToRemove = nodeToRemove.parentNode;\n\t}\n\n\tif ( nodeToRemove ) {\n\t\tnodeToRemove.parentNode.removeChild( nodeToRemove );\n\t}\n\n\treturn body.innerHTML.trim();\n}\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif ( firstElementChild && firstElementChild.nodeName === 'A' ) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt', 'title', 'width', 'height' ],\n\t\tclasses: [\n\t\t\t'alignleft',\n\t\t\t'aligncenter',\n\t\t\t'alignright',\n\t\t\t'alignnone',\n\t\t\t/^wp-image-\\d+$/,\n\t\t],\n\t},\n};\n\n// Normalise an `<img>` pixel dimension attribute to the `<value>px` form the\n// Image block stores in its `width`/`height` attributes. Non-integer values\n// (e.g. `50%`) are dropped because the attribute round-trips through inline\n// styles that expect pixel units.\nfunction parsePixelDimension( value ) {\n\treturn value && /^\\d+$/.test( value ) ? `${ value }px` : undefined;\n}\n\nconst schema = ( { phrasingContentSchema } ) => ( {\n\tfigure: {\n\t\trequire: [ 'img' ],\n\t\tchildren: {\n\t\t\t...imageSchema,\n\t\t\ta: {\n\t\t\t\tattributes: [ 'href', 'rel', 'target' ],\n\t\t\t\tclasses: [ '*' ],\n\t\t\t\tchildren: imageSchema,\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tisMatch: ( node ) =>\n\t\t\t\tnode.nodeName === 'FIGURE' && !! node.querySelector( 'img' ),\n\t\t\tschema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst img = node.querySelector( 'img' );\n\t\t\t\t// Search both figure and image classes. Alignment could be\n\t\t\t\t// set on either. ID is set on the image.\n\t\t\t\tconst className = node.className + ' ' + img.className;\n\t\t\t\tconst alignMatches =\n\t\t\t\t\t/(?:^|\\s)align(left|center|right)(?:$|\\s)/.exec(\n\t\t\t\t\t\tclassName\n\t\t\t\t\t);\n\t\t\t\tconst anchor = node.id === '' ? undefined : node.id;\n\t\t\t\tconst align = alignMatches ? alignMatches[ 1 ] : undefined;\n\t\t\t\tconst idMatches = /(?:^|\\s)wp-image-(\\d+)(?:$|\\s)/.exec(\n\t\t\t\t\tclassName\n\t\t\t\t);\n\t\t\t\tconst id = idMatches ? Number( idMatches[ 1 ] ) : undefined;\n\t\t\t\tconst anchorElement = node.querySelector( 'a' );\n\t\t\t\tconst linkDestination =\n\t\t\t\t\tanchorElement && anchorElement.href ? 'custom' : undefined;\n\t\t\t\tconst href =\n\t\t\t\t\tanchorElement && anchorElement.href\n\t\t\t\t\t\t? anchorElement.href\n\t\t\t\t\t\t: undefined;\n\t\t\t\tconst rel =\n\t\t\t\t\tanchorElement && anchorElement.rel\n\t\t\t\t\t\t? anchorElement.rel\n\t\t\t\t\t\t: undefined;\n\t\t\t\tconst linkClass =\n\t\t\t\t\tanchorElement && anchorElement.className\n\t\t\t\t\t\t? anchorElement.className\n\t\t\t\t\t\t: undefined;\n\t\t\t\t// Pin only one dimension and let the other follow the aspect\n\t\t\t\t// ratio via `auto`. Pinning both as fixed pixels stretches the\n\t\t\t\t// image when a theme caps the width while the height stays\n\t\t\t\t// fixed. So width sources use `height: 'auto'`; height-only\n\t\t\t\t// sources use `width: 'auto'`.\n\t\t\t\tconst widthValue = parsePixelDimension(\n\t\t\t\t\timg.getAttribute( 'width' )\n\t\t\t\t);\n\t\t\t\tconst heightValue = parsePixelDimension(\n\t\t\t\t\timg.getAttribute( 'height' )\n\t\t\t\t);\n\t\t\t\t// When both dimensions are declared, preserve the source's\n\t\t\t\t// shape via `aspectRatio` (mirroring the resize handle). CSS\n\t\t\t\t// `aspect-ratio` needs no fixed dimensions, so the image keeps\n\t\t\t\t// its proportions even when the `src` can't resolve to natural\n\t\t\t\t// dimensions (e.g. an empty or blob `src`) — without it the\n\t\t\t\t// `height: 'auto'` would collapse to `0`.\n\t\t\t\t// `parseInt` is `NaN` for an absent dimension and `0` for a\n\t\t\t\t// zero one (both falsy), so a bogus ratio is never stored.\n\t\t\t\tconst widthNumber = parseInt( widthValue, 10 );\n\t\t\t\tconst heightNumber = parseInt( heightValue, 10 );\n\t\t\t\tconst aspectRatio =\n\t\t\t\t\twidthNumber && heightNumber\n\t\t\t\t\t\t? String( widthNumber / heightNumber )\n\t\t\t\t\t\t: undefined;\n\t\t\t\t// A height-only source declares a single dimension, so it can't\n\t\t\t\t// carry an aspect ratio: `width: 'auto'` is capped by\n\t\t\t\t// `max-width: 100%` while the fixed height can still stretch a\n\t\t\t\t// wide source. This is a known edge case (a panoramic image\n\t\t\t\t// pinned by height only) left unsolved here.\n\t\t\t\tconst width =\n\t\t\t\t\twidthValue || ( heightValue ? 'auto' : undefined );\n\t\t\t\tconst height = widthValue ? 'auto' : heightValue;\n\t\t\t\tconst attributes = getBlockAttributes(\n\t\t\t\t\t'core/image',\n\t\t\t\t\tnode.outerHTML,\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\thref,\n\t\t\t\t\t\trel,\n\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( isBlobURL( attributes.url ) ) {\n\t\t\t\t\tattributes.blob = attributes.url;\n\t\t\t\t\tdelete attributes.url;\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'core/image', attributes );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// Note: when dragging and dropping multiple files onto a gallery this overrides the\n\t\t\t// gallery transform in order to add new images to the gallery instead of\n\t\t\t// creating a new gallery.\n\t\t\ttype: 'files',\n\t\t\tisMatch( files ) {\n\t\t\t\treturn files.every(\n\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst blocks = files.map( ( file ) => {\n\t\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\treturn blocks;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'caption',\n\t\t\tattributes: {\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'src',\n\t\t\t\t\tselector: 'img',\n\t\t\t\t},\n\t\t\t\talt: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'alt',\n\t\t\t\t\tselector: 'img',\n\t\t\t\t},\n\t\t\t\tcaption: {\n\t\t\t\t\tshortcode: stripFirstImage,\n\t\t\t\t},\n\t\t\t\thref: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'href'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trel: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'rel'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlinkClass: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'class'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tshortcode: ( { named: { id } } ) => {\n\t\t\t\t\t\tif ( ! id ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn parseInt( id.replace( 'attachment_', '' ), 10 );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\talign: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: ( { named: { align = 'alignnone' } } ) => {\n\t\t\t\t\t\treturn align.replace( 'align', '' );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyC;AACzC,oBAAgD;AAEzC,SAAS,gBAAiB,YAAY,EAA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OAAO,EAAE,GAAG,EAAE,MAAO;AACnC,gBAAK,CAAE,IAAK;AACX;AAAA,YACD;AAEA,mBAAO,SAAU,GAAG,QAAS,eAAe,EAAG,GAAG,EAAG;AAAA,UACtD;AAAA,QACD;AAAA,QACA,OAAO;AAAA,UACN,MAAM;AAAA,UACN,WAAW,CAAE,EAAE,OAAO,EAAE,QAAQ,YAAY,EAAE,MAAO;AACpD,mBAAO,MAAM,QAAS,SAAS,EAAG;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -82,7 +82,6 @@ function getSyncedImageBlockAttributes(currentAttributes, originalAttachment, up
|
|
|
82
82
|
return syncedAttributes;
|
|
83
83
|
}
|
|
84
84
|
var { openMediaEditorModalKey } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
85
|
-
var ATTACHMENT_EDIT_QUERY = { context: "edit" };
|
|
86
85
|
function getAttachmentFallbackForEmptyBlockMetadata({ alt, caption }) {
|
|
87
86
|
const attachment = {};
|
|
88
87
|
if (!alt) {
|
|
@@ -129,19 +128,11 @@ function useOpenImageMediaEditorModal({
|
|
|
129
128
|
};
|
|
130
129
|
}, [alt, caption, id, url]);
|
|
131
130
|
const getCachedAttachmentRecord = (0, import_element.useCallback)(
|
|
132
|
-
(attachmentId) =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
attachmentId
|
|
138
|
-
) || getEntityRecord(
|
|
139
|
-
"postType",
|
|
140
|
-
"attachment",
|
|
141
|
-
attachmentId,
|
|
142
|
-
ATTACHMENT_EDIT_QUERY
|
|
143
|
-
) || getEntityRecord("postType", "attachment", attachmentId);
|
|
144
|
-
},
|
|
131
|
+
(attachmentId) => registry.select(import_core_data.store).getEditedEntityRecord(
|
|
132
|
+
"postType",
|
|
133
|
+
"attachment",
|
|
134
|
+
attachmentId
|
|
135
|
+
),
|
|
145
136
|
[registry]
|
|
146
137
|
);
|
|
147
138
|
const resolveAttachmentRecord = (0, import_element.useCallback)(
|
|
@@ -149,11 +140,6 @@ function useOpenImageMediaEditorModal({
|
|
|
149
140
|
const resolveSelect = registry.resolveSelect(import_core_data.store);
|
|
150
141
|
try {
|
|
151
142
|
return await resolveSelect.getEntityRecord(
|
|
152
|
-
"postType",
|
|
153
|
-
"attachment",
|
|
154
|
-
attachmentId,
|
|
155
|
-
ATTACHMENT_EDIT_QUERY
|
|
156
|
-
) || await resolveSelect.getEntityRecord(
|
|
157
143
|
"postType",
|
|
158
144
|
"attachment",
|
|
159
145
|
attachmentId
|
|
@@ -172,12 +158,6 @@ function useOpenImageMediaEditorModal({
|
|
|
172
158
|
"attachment",
|
|
173
159
|
attachmentId
|
|
174
160
|
]);
|
|
175
|
-
invalidateResolution("getEntityRecord", [
|
|
176
|
-
"postType",
|
|
177
|
-
"attachment",
|
|
178
|
-
attachmentId,
|
|
179
|
-
ATTACHMENT_EDIT_QUERY
|
|
180
|
-
]);
|
|
181
161
|
return resolveAttachmentRecord(attachmentId);
|
|
182
162
|
},
|
|
183
163
|
[registry, resolveAttachmentRecord]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/image/use-open-image-media-editor-modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nfunction normalizeImageBlockCaption( caption ) {\n\tif ( typeof caption !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tconst textContent = stripHTML( caption ).trim();\n\n\tif ( ! textContent ) {\n\t\treturn '';\n\t}\n\n\treturn caption.replace( /\\n/g, '<br>' );\n}\n\nfunction getAttachmentCaption( attachment ) {\n\tconst caption = attachment?.caption;\n\n\tif ( typeof caption === 'string' ) {\n\t\treturn normalizeImageBlockCaption( caption );\n\t}\n\n\tif (\n\t\tcaption &&\n\t\ttypeof caption === 'object' &&\n\t\tObject.hasOwn( caption, 'raw' )\n\t) {\n\t\treturn normalizeImageBlockCaption( caption.raw );\n\t}\n\n\treturn undefined;\n}\n\nexport function getImageBlockMetadataFromAttachment( attachment ) {\n\treturn {\n\t\talt:\n\t\t\ttypeof attachment?.alt_text === 'string'\n\t\t\t\t? attachment.alt_text\n\t\t\t\t: attachment?.alt || '',\n\t\tcaption: getAttachmentCaption( attachment ),\n\t};\n}\n\nfunction normalizeMetadataAttribute( value ) {\n\treturn value || '';\n}\n\nexport function getSyncedImageBlockAttributes(\n\tcurrentAttributes,\n\toriginalAttachment,\n\tupdatedAttachment\n) {\n\tif ( ! originalAttachment || ! updatedAttachment ) {\n\t\treturn {};\n\t}\n\n\tconst originalMetadata =\n\t\tgetImageBlockMetadataFromAttachment( originalAttachment );\n\tconst updatedMetadata =\n\t\tgetImageBlockMetadataFromAttachment( updatedAttachment );\n\tconst syncedAttributes = {};\n\n\tconst normalizedCurrentAlt = normalizeMetadataAttribute(\n\t\tcurrentAttributes.alt\n\t);\n\tif (\n\t\toriginalMetadata.alt !== updatedMetadata.alt &&\n\t\t( normalizedCurrentAlt === originalMetadata.alt ||\n\t\t\t! normalizedCurrentAlt )\n\t) {\n\t\tsyncedAttributes.alt = updatedMetadata.alt;\n\t}\n\n\tconst normalizedCurrentCaption = normalizeMetadataAttribute(\n\t\tcurrentAttributes.caption\n\t);\n\tif (\n\t\toriginalMetadata.caption !== undefined &&\n\t\tupdatedMetadata.caption !== undefined &&\n\t\toriginalMetadata.caption !== updatedMetadata.caption &&\n\t\t( normalizedCurrentCaption === originalMetadata.caption ||\n\t\t\t! normalizedCurrentCaption )\n\t) {\n\t\tsyncedAttributes.caption = updatedMetadata.caption || undefined;\n\t}\n\n\treturn syncedAttributes;\n}\n\nconst { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );\n// Caption sync needs `caption.raw`; view/default attachment records can contain\n// only rendered caption data or be tied to an in-flight stale resolution.\nconst ATTACHMENT_EDIT_QUERY = { context: 'edit' };\n\nfunction getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {\n\tconst attachment = {};\n\n\tif ( ! alt ) {\n\t\tattachment.alt_text = '';\n\t}\n\n\tif ( ! caption?.toString() ) {\n\t\tattachment.caption = '';\n\t}\n\n\treturn Object.keys( attachment ).length ? attachment : undefined;\n}\n\nfunction hasKnownAttachmentMetadata( attachment ) {\n\tif ( ! attachment ) {\n\t\treturn false;\n\t}\n\n\tconst hasKnownAlt =\n\t\ttypeof attachment.alt_text === 'string' ||\n\t\ttypeof attachment.alt === 'string';\n\tconst hasKnownCaption =\n\t\tgetImageBlockMetadataFromAttachment( attachment ).caption !== undefined;\n\n\treturn hasKnownAlt && hasKnownCaption;\n}\n\nexport function useOpenImageMediaEditorModal( {\n\tattributes,\n\tsetAttributes,\n\tonClose,\n} ) {\n\t// Keep this hook private to the Image block and pass the block attributes\n\t// object so the callsite stays compact. Destructure only the attributes\n\t// currently used for metadata sync; add more here if the sync policy grows.\n\tconst { id, url, alt, caption } = attributes;\n\tconst registry = useRegistry();\n\tconst openMediaEditorModal = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()[ openMediaEditorModalKey ],\n\t\t[]\n\t);\n\t// Track the block's current attachment and metadata in a ref so\n\t// handleMediaUpdate can read the latest values without being listed as\n\t// dependencies (which would recreate the callback and re-register the\n\t// onUpdate handler on every block change while the modal is open).\n\tconst blockAttributesRef = useRef( {\n\t\tid,\n\t\turl,\n\t\talt,\n\t\tcaption: caption?.toString(),\n\t} );\n\t// Snapshot of the attachment's metadata taken just before the modal opens,\n\t// used as the baseline for detecting what changed during the editing session.\n\tconst mediaEditorMetadataBaselineRef = useRef();\n\t// Incremented on every handleMediaUpdate call; stale async continuations\n\t// check against this to bail out if a newer update has since started.\n\tconst mediaEditorMetadataSyncRequestRef = useRef( 0 );\n\n\tuseEffect( () => {\n\t\tblockAttributesRef.current = {\n\t\t\tid,\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption: caption?.toString(),\n\t\t};\n\t}, [ alt, caption, id, url ] );\n\n\tconst getCachedAttachmentRecord = useCallback(\n\t\t( attachmentId ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecord } =\n\t\t\t\tregistry.select( coreStore );\n\t\t\treturn (\n\t\t\t\tgetEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t) ||\n\t\t\t\tgetEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId,\n\t\t\t\t\tATTACHMENT_EDIT_QUERY\n\t\t\t\t) ||\n\t\t\t\tgetEntityRecord( 'postType', 'attachment', attachmentId )\n\t\t\t);\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\tconst resolveSelect = registry.resolveSelect( coreStore );\n\n\t\t\ttry {\n\t\t\t\treturn (\n\t\t\t\t\t( await resolveSelect.getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tattachmentId,\n\t\t\t\t\t\tATTACHMENT_EDIT_QUERY\n\t\t\t\t\t) ) ||\n\t\t\t\t\t( await resolveSelect.getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tattachmentId\n\t\t\t\t\t) )\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveFreshAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\t// Bust cached records so resolveAttachmentRecord fetches the\n\t\t\t// server state that reflects the media editor's saved changes.\n\t\t\tconst { invalidateResolution } = registry.dispatch( coreStore );\n\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t] );\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t\tATTACHMENT_EDIT_QUERY,\n\t\t\t] );\n\t\t\treturn resolveAttachmentRecord( attachmentId );\n\t\t},\n\t\t[ registry, resolveAttachmentRecord ]\n\t);\n\n\tconst handleMediaUpdate = useCallback(\n\t\tasync ( { id: newId, url: newUrl } ) => {\n\t\t\tif ( typeof newId !== 'number' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Capture and clear the baseline so a rapid second save doesn't\n\t\t\t// reuse a stale snapshot.\n\t\t\tconst originalAttachment = mediaEditorMetadataBaselineRef.current;\n\t\t\tmediaEditorMetadataBaselineRef.current = undefined;\n\t\t\tconst syncRequest = ++mediaEditorMetadataSyncRequestRef.current;\n\t\t\tconst nextAttributes = {};\n\n\t\t\tconst currentBlockAttributes = blockAttributesRef.current;\n\n\t\t\tif ( newId !== currentBlockAttributes.id ) {\n\t\t\t\tnextAttributes.id = newId;\n\t\t\t\tnextAttributes.url = newUrl ?? currentBlockAttributes.url;\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\tid: nextAttributes.id,\n\t\t\t\t\turl: nextAttributes.url,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( originalAttachment ) {\n\t\t\t\t// Fetch fresh server state so the comparison reflects what\n\t\t\t\t// the media editor actually saved, not a potentially stale\n\t\t\t\t// cache.\n\t\t\t\tconst resolvedAttachment =\n\t\t\t\t\tawait resolveFreshAttachmentRecord( newId );\n\n\t\t\t\t// A newer update started while we were awaiting; discard\n\t\t\t\t// this one.\n\t\t\t\tif (\n\t\t\t\t\tsyncRequest !== mediaEditorMetadataSyncRequestRef.current\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Sync alt text and caption back to the block only when\n\t\t\t\t// they were changed in the media editor. Fields the user\n\t\t\t\t// has independently customised on the block (i.e. values\n\t\t\t\t// that don't match the pre-session attachment metadata)\n\t\t\t\t// are left untouched.\n\t\t\t\tconst latestBlockAttributes = blockAttributesRef.current;\n\t\t\t\tconst resolvedMetadataAttributes =\n\t\t\t\t\tgetSyncedImageBlockAttributes(\n\t\t\t\t\t\tlatestBlockAttributes,\n\t\t\t\t\t\toriginalAttachment,\n\t\t\t\t\t\tresolvedAttachment\n\t\t\t\t\t);\n\n\t\t\t\tif ( Object.keys( resolvedMetadataAttributes ).length ) {\n\t\t\t\t\tObject.assign( nextAttributes, resolvedMetadataAttributes );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( Object.keys( nextAttributes ).length ) {\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\t...nextAttributes,\n\t\t\t\t};\n\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t}\n\t\t},\n\t\t[ resolveFreshAttachmentRecord, setAttributes ]\n\t);\n\n\tconst openImageMediaEditorModal = useCallback( async () => {\n\t\tif ( ! id || ! openMediaEditorModal ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Snapshot the attachment's current metadata before the user makes\n\t\t// any changes so handleMediaUpdate can compare against it later.\n\t\t// Prefer a freshly resolved edit-context record for accuracy; fall\n\t\t// back to whatever is in the cache, or a minimal object derived from\n\t\t// the block's own attributes when nothing is cached yet.\n\t\tconst cachedAttachmentRecord = getCachedAttachmentRecord( id );\n\t\tconst fallbackAttachmentRecord =\n\t\t\tgetAttachmentFallbackForEmptyBlockMetadata(\n\t\t\t\tblockAttributesRef.current\n\t\t\t);\n\t\tconst resolvedAttachmentRecord = hasKnownAttachmentMetadata(\n\t\t\tcachedAttachmentRecord\n\t\t)\n\t\t\t? undefined\n\t\t\t: await resolveAttachmentRecord( id );\n\n\t\tmediaEditorMetadataBaselineRef.current =\n\t\t\tresolvedAttachmentRecord ||\n\t\t\t( hasKnownAttachmentMetadata( cachedAttachmentRecord )\n\t\t\t\t? cachedAttachmentRecord\n\t\t\t\t: fallbackAttachmentRecord ) ||\n\t\t\tcachedAttachmentRecord;\n\n\t\topenMediaEditorModal( {\n\t\t\tid,\n\t\t\tonUpdate: handleMediaUpdate,\n\t\t\tonClose,\n\t\t} );\n\t}, [\n\t\tgetCachedAttachmentRecord,\n\t\thandleMediaUpdate,\n\t\tid,\n\t\tonClose,\n\t\topenMediaEditorModal,\n\t\tresolveAttachmentRecord,\n\t] );\n\n\treturn id && openMediaEditorModal ? openImageMediaEditorModal : undefined;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AACnC,0BAGO;AACP,iBAAiD;AACjD,kBAAuC;AACvC,qBAA+C;AAK/C,yBAAuB;AAEvB,SAAS,2BAA4B,SAAU;AAC9C,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,kBAAc,WAAAA,qBAAW,OAAQ,EAAE,KAAK;AAE9C,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SAAO,QAAQ,QAAS,OAAO,MAAO;AACvC;AAEA,SAAS,qBAAsB,YAAa;AAC3C,QAAM,UAAU,YAAY;AAE5B,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO,2BAA4B,OAAQ;AAAA,EAC5C;AAEA,MACC,WACA,OAAO,YAAY,YACnB,OAAO,OAAQ,SAAS,KAAM,GAC7B;AACD,WAAO,2BAA4B,QAAQ,GAAI;AAAA,EAChD;AAEA,SAAO;AACR;AAEO,SAAS,oCAAqC,YAAa;AACjE,SAAO;AAAA,IACN,KACC,OAAO,YAAY,aAAa,WAC7B,WAAW,WACX,YAAY,OAAO;AAAA,IACvB,SAAS,qBAAsB,UAAW;AAAA,EAC3C;AACD;AAEA,SAAS,2BAA4B,OAAQ;AAC5C,SAAO,SAAS;AACjB;AAEO,SAAS,8BACf,mBACA,oBACA,mBACC;AACD,MAAK,CAAE,sBAAsB,CAAE,mBAAoB;AAClD,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,mBACL,oCAAqC,kBAAmB;AACzD,QAAM,kBACL,oCAAqC,iBAAkB;AACxD,QAAM,mBAAmB,CAAC;AAE1B,QAAM,uBAAuB;AAAA,IAC5B,kBAAkB;AAAA,EACnB;AACA,MACC,iBAAiB,QAAQ,gBAAgB,QACvC,yBAAyB,iBAAiB,OAC3C,CAAE,uBACF;AACD,qBAAiB,MAAM,gBAAgB;AAAA,EACxC;AAEA,QAAM,2BAA2B;AAAA,IAChC,kBAAkB;AAAA,EACnB;AACA,MACC,iBAAiB,YAAY,UAC7B,gBAAgB,YAAY,UAC5B,iBAAiB,YAAY,gBAAgB,YAC3C,6BAA6B,iBAAiB,WAC/C,CAAE,2BACF;AACD,qBAAiB,UAAU,gBAAgB,WAAW;AAAA,EACvD;AAEA,SAAO;AACR;AAEA,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,oBAAAC,WAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nfunction normalizeImageBlockCaption( caption ) {\n\tif ( typeof caption !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tconst textContent = stripHTML( caption ).trim();\n\n\tif ( ! textContent ) {\n\t\treturn '';\n\t}\n\n\treturn caption.replace( /\\n/g, '<br>' );\n}\n\nfunction getAttachmentCaption( attachment ) {\n\tconst caption = attachment?.caption;\n\n\tif ( typeof caption === 'string' ) {\n\t\treturn normalizeImageBlockCaption( caption );\n\t}\n\n\tif (\n\t\tcaption &&\n\t\ttypeof caption === 'object' &&\n\t\tObject.hasOwn( caption, 'raw' )\n\t) {\n\t\treturn normalizeImageBlockCaption( caption.raw );\n\t}\n\n\treturn undefined;\n}\n\nexport function getImageBlockMetadataFromAttachment( attachment ) {\n\treturn {\n\t\talt:\n\t\t\ttypeof attachment?.alt_text === 'string'\n\t\t\t\t? attachment.alt_text\n\t\t\t\t: attachment?.alt || '',\n\t\tcaption: getAttachmentCaption( attachment ),\n\t};\n}\n\nfunction normalizeMetadataAttribute( value ) {\n\treturn value || '';\n}\n\nexport function getSyncedImageBlockAttributes(\n\tcurrentAttributes,\n\toriginalAttachment,\n\tupdatedAttachment\n) {\n\tif ( ! originalAttachment || ! updatedAttachment ) {\n\t\treturn {};\n\t}\n\n\tconst originalMetadata =\n\t\tgetImageBlockMetadataFromAttachment( originalAttachment );\n\tconst updatedMetadata =\n\t\tgetImageBlockMetadataFromAttachment( updatedAttachment );\n\tconst syncedAttributes = {};\n\n\tconst normalizedCurrentAlt = normalizeMetadataAttribute(\n\t\tcurrentAttributes.alt\n\t);\n\tif (\n\t\toriginalMetadata.alt !== updatedMetadata.alt &&\n\t\t( normalizedCurrentAlt === originalMetadata.alt ||\n\t\t\t! normalizedCurrentAlt )\n\t) {\n\t\tsyncedAttributes.alt = updatedMetadata.alt;\n\t}\n\n\tconst normalizedCurrentCaption = normalizeMetadataAttribute(\n\t\tcurrentAttributes.caption\n\t);\n\tif (\n\t\toriginalMetadata.caption !== undefined &&\n\t\tupdatedMetadata.caption !== undefined &&\n\t\toriginalMetadata.caption !== updatedMetadata.caption &&\n\t\t( normalizedCurrentCaption === originalMetadata.caption ||\n\t\t\t! normalizedCurrentCaption )\n\t) {\n\t\tsyncedAttributes.caption = updatedMetadata.caption || undefined;\n\t}\n\n\treturn syncedAttributes;\n}\n\nconst { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );\n\nfunction getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {\n\tconst attachment = {};\n\n\tif ( ! alt ) {\n\t\tattachment.alt_text = '';\n\t}\n\n\tif ( ! caption?.toString() ) {\n\t\tattachment.caption = '';\n\t}\n\n\treturn Object.keys( attachment ).length ? attachment : undefined;\n}\n\nfunction hasKnownAttachmentMetadata( attachment ) {\n\tif ( ! attachment ) {\n\t\treturn false;\n\t}\n\n\tconst hasKnownAlt =\n\t\ttypeof attachment.alt_text === 'string' ||\n\t\ttypeof attachment.alt === 'string';\n\tconst hasKnownCaption =\n\t\tgetImageBlockMetadataFromAttachment( attachment ).caption !== undefined;\n\n\treturn hasKnownAlt && hasKnownCaption;\n}\n\nexport function useOpenImageMediaEditorModal( {\n\tattributes,\n\tsetAttributes,\n\tonClose,\n} ) {\n\t// Keep this hook private to the Image block and pass the block attributes\n\t// object so the callsite stays compact. Destructure only the attributes\n\t// currently used for metadata sync; add more here if the sync policy grows.\n\tconst { id, url, alt, caption } = attributes;\n\tconst registry = useRegistry();\n\tconst openMediaEditorModal = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()[ openMediaEditorModalKey ],\n\t\t[]\n\t);\n\t// Track the block's current attachment and metadata in a ref so\n\t// handleMediaUpdate can read the latest values without being listed as\n\t// dependencies (which would recreate the callback and re-register the\n\t// onUpdate handler on every block change while the modal is open).\n\tconst blockAttributesRef = useRef( {\n\t\tid,\n\t\turl,\n\t\talt,\n\t\tcaption: caption?.toString(),\n\t} );\n\t// Snapshot of the attachment's metadata taken just before the modal opens,\n\t// used as the baseline for detecting what changed during the editing session.\n\tconst mediaEditorMetadataBaselineRef = useRef();\n\t// Incremented on every handleMediaUpdate call; stale async continuations\n\t// check against this to bail out if a newer update has since started.\n\tconst mediaEditorMetadataSyncRequestRef = useRef( 0 );\n\n\tuseEffect( () => {\n\t\tblockAttributesRef.current = {\n\t\t\tid,\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption: caption?.toString(),\n\t\t};\n\t}, [ alt, caption, id, url ] );\n\n\t// Reads the cached attachment record. The `attachment` postType entity\n\t// fetches with `context: 'edit'` by default, so `getEditedEntityRecord`\n\t// returns the edit-context record — carrying `caption` as `{ raw }` and a\n\t// usable `alt_text` — without us specifying a context. It is resolver-\n\t// backed, so on a cold cache this also kicks off the fetch and returns a\n\t// falsy value synchronously; that resolution shares its cache key with the\n\t// `resolveAttachmentRecord` call below (both keyed on the no-query\n\t// `getEntityRecord`), so the two dedupe into a single request.\n\tconst getCachedAttachmentRecord = useCallback(\n\t\t( attachmentId ) =>\n\t\t\tregistry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t),\n\t\t[ registry ]\n\t);\n\n\tconst resolveAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\tconst resolveSelect = registry.resolveSelect( coreStore );\n\n\t\t\ttry {\n\t\t\t\treturn await resolveSelect.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveFreshAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\t// Invalidate the cached resolution so resolveAttachmentRecord\n\t\t\t// re-fetches the server state that reflects the media editor's\n\t\t\t// saved changes.\n\t\t\tconst { invalidateResolution } = registry.dispatch( coreStore );\n\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t] );\n\t\t\treturn resolveAttachmentRecord( attachmentId );\n\t\t},\n\t\t[ registry, resolveAttachmentRecord ]\n\t);\n\n\tconst handleMediaUpdate = useCallback(\n\t\tasync ( { id: newId, url: newUrl } ) => {\n\t\t\tif ( typeof newId !== 'number' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Capture and clear the baseline so a rapid second save doesn't\n\t\t\t// reuse a stale snapshot.\n\t\t\tconst originalAttachment = mediaEditorMetadataBaselineRef.current;\n\t\t\tmediaEditorMetadataBaselineRef.current = undefined;\n\t\t\tconst syncRequest = ++mediaEditorMetadataSyncRequestRef.current;\n\t\t\tconst nextAttributes = {};\n\n\t\t\tconst currentBlockAttributes = blockAttributesRef.current;\n\n\t\t\tif ( newId !== currentBlockAttributes.id ) {\n\t\t\t\tnextAttributes.id = newId;\n\t\t\t\tnextAttributes.url = newUrl ?? currentBlockAttributes.url;\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\tid: nextAttributes.id,\n\t\t\t\t\turl: nextAttributes.url,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( originalAttachment ) {\n\t\t\t\t// Fetch fresh server state so the comparison reflects what\n\t\t\t\t// the media editor actually saved, not a potentially stale\n\t\t\t\t// cache.\n\t\t\t\tconst resolvedAttachment =\n\t\t\t\t\tawait resolveFreshAttachmentRecord( newId );\n\n\t\t\t\t// A newer update started while we were awaiting; discard\n\t\t\t\t// this one.\n\t\t\t\tif (\n\t\t\t\t\tsyncRequest !== mediaEditorMetadataSyncRequestRef.current\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Sync alt text and caption back to the block only when\n\t\t\t\t// they were changed in the media editor. Fields the user\n\t\t\t\t// has independently customised on the block (i.e. values\n\t\t\t\t// that don't match the pre-session attachment metadata)\n\t\t\t\t// are left untouched.\n\t\t\t\tconst latestBlockAttributes = blockAttributesRef.current;\n\t\t\t\tconst resolvedMetadataAttributes =\n\t\t\t\t\tgetSyncedImageBlockAttributes(\n\t\t\t\t\t\tlatestBlockAttributes,\n\t\t\t\t\t\toriginalAttachment,\n\t\t\t\t\t\tresolvedAttachment\n\t\t\t\t\t);\n\n\t\t\t\tif ( Object.keys( resolvedMetadataAttributes ).length ) {\n\t\t\t\t\tObject.assign( nextAttributes, resolvedMetadataAttributes );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( Object.keys( nextAttributes ).length ) {\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\t...nextAttributes,\n\t\t\t\t};\n\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t}\n\t\t},\n\t\t[ resolveFreshAttachmentRecord, setAttributes ]\n\t);\n\n\tconst openImageMediaEditorModal = useCallback( async () => {\n\t\tif ( ! id || ! openMediaEditorModal ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Snapshot the attachment's current metadata before the user makes\n\t\t// any changes so handleMediaUpdate can compare against it later. Use\n\t\t// the cached record when it's already present; only resolve when\n\t\t// nothing is cached yet, then fall back to a minimal object derived\n\t\t// from the block's own attributes.\n\t\tconst cachedAttachmentRecord = getCachedAttachmentRecord( id );\n\t\tconst fallbackAttachmentRecord =\n\t\t\tgetAttachmentFallbackForEmptyBlockMetadata(\n\t\t\t\tblockAttributesRef.current\n\t\t\t);\n\t\tconst resolvedAttachmentRecord = hasKnownAttachmentMetadata(\n\t\t\tcachedAttachmentRecord\n\t\t)\n\t\t\t? undefined\n\t\t\t: await resolveAttachmentRecord( id );\n\n\t\tmediaEditorMetadataBaselineRef.current =\n\t\t\tresolvedAttachmentRecord ||\n\t\t\t( hasKnownAttachmentMetadata( cachedAttachmentRecord )\n\t\t\t\t? cachedAttachmentRecord\n\t\t\t\t: fallbackAttachmentRecord ) ||\n\t\t\tcachedAttachmentRecord;\n\n\t\topenMediaEditorModal( {\n\t\t\tid,\n\t\t\tonUpdate: handleMediaUpdate,\n\t\t\tonClose,\n\t\t} );\n\t}, [\n\t\tgetCachedAttachmentRecord,\n\t\thandleMediaUpdate,\n\t\tid,\n\t\tonClose,\n\t\topenMediaEditorModal,\n\t\tresolveAttachmentRecord,\n\t] );\n\n\treturn id && openMediaEditorModal ? openImageMediaEditorModal : undefined;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AACnC,0BAGO;AACP,iBAAiD;AACjD,kBAAuC;AACvC,qBAA+C;AAK/C,yBAAuB;AAEvB,SAAS,2BAA4B,SAAU;AAC9C,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,kBAAc,WAAAA,qBAAW,OAAQ,EAAE,KAAK;AAE9C,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SAAO,QAAQ,QAAS,OAAO,MAAO;AACvC;AAEA,SAAS,qBAAsB,YAAa;AAC3C,QAAM,UAAU,YAAY;AAE5B,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO,2BAA4B,OAAQ;AAAA,EAC5C;AAEA,MACC,WACA,OAAO,YAAY,YACnB,OAAO,OAAQ,SAAS,KAAM,GAC7B;AACD,WAAO,2BAA4B,QAAQ,GAAI;AAAA,EAChD;AAEA,SAAO;AACR;AAEO,SAAS,oCAAqC,YAAa;AACjE,SAAO;AAAA,IACN,KACC,OAAO,YAAY,aAAa,WAC7B,WAAW,WACX,YAAY,OAAO;AAAA,IACvB,SAAS,qBAAsB,UAAW;AAAA,EAC3C;AACD;AAEA,SAAS,2BAA4B,OAAQ;AAC5C,SAAO,SAAS;AACjB;AAEO,SAAS,8BACf,mBACA,oBACA,mBACC;AACD,MAAK,CAAE,sBAAsB,CAAE,mBAAoB;AAClD,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,mBACL,oCAAqC,kBAAmB;AACzD,QA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AA,IACA;AAAA,EACD,CAAE;AAEF,SAAO,MAAM,uBAAuB,4BAA4B;AACjE;",
|
|
6
6
|
"names": ["stripHTML", "blockEditorPrivateApis", "blockEditorStore", "coreStore"]
|
|
7
7
|
}
|
package/build/index.cjs
CHANGED
|
@@ -146,7 +146,6 @@ var siteTitle = __toESM(require("./site-title/index.cjs"));
|
|
|
146
146
|
var socialLink = __toESM(require("./social-link/index.cjs"));
|
|
147
147
|
var socialLinks = __toESM(require("./social-links/index.cjs"));
|
|
148
148
|
var spacer = __toESM(require("./spacer/index.cjs"));
|
|
149
|
-
var tab = __toESM(require("./tab/index.cjs"));
|
|
150
149
|
var tabPanel = __toESM(require("./tab-panel/index.cjs"));
|
|
151
150
|
var tabPanels = __toESM(require("./tab-panels/index.cjs"));
|
|
152
151
|
var table = __toESM(require("./table/index.cjs"));
|
|
@@ -291,7 +290,6 @@ var getAllBlocks = () => {
|
|
|
291
290
|
blocks.push(formSubmissionNotification);
|
|
292
291
|
}
|
|
293
292
|
if (window?.__experimentalEnableBlockExperiments) {
|
|
294
|
-
blocks.push(tab);
|
|
295
293
|
blocks.push(tabList);
|
|
296
294
|
blocks.push(tabs);
|
|
297
295
|
blocks.push(tabPanel);
|
|
@@ -331,7 +329,7 @@ var registerCoreBlocks = (blocks = __experimentalGetCoreBlocks()) => {
|
|
|
331
329
|
attributes
|
|
332
330
|
});
|
|
333
331
|
if (status === "loading") {
|
|
334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: (0, import_i18n.__)("Loading
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: (0, import_i18n.__)("Loading…") });
|
|
335
333
|
}
|
|
336
334
|
if (status === "error") {
|
|
337
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: (0, import_i18n.sprintf)(
|
package/build/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n\tregisterBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDisabled } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HtmlRenderer from './utils/html-renderer';\n\n/**\n * Internal dependencies\n */\n// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks\n// are transformed by packages/block-library/src/index.js as follows:\n// import * as experimentalBlock from './experimental-block'\n// becomes\n// const experimentalBlock = null;\n// This enables webpack to eliminate the experimental blocks code from the\n// production build to make the final bundle smaller.\n//\n// See https://github.com/WordPress/gutenberg/pull/40655 for more context.\nimport * as accordion from './accordion';\nimport * as accordionItem from './accordion-item';\nimport * as accordionHeading from './accordion-heading';\nimport * as accordionPanel from './accordion-panel';\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as breadcrumbs from './breadcrumbs';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as form from './form';\nimport * as formInput from './form-input';\nimport * as formSubmitButton from './form-submit-button';\nimport * as formSubmissionNotification from './form-submission-notification';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as icon from './icon';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as math from './math';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as navigationOverlayClose from './navigation-overlay-close';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as playlist from './playlist';\nimport * as playlistTrack from './playlist-track';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as queryTotal from './query-total';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as tab from './tab';\nimport * as tabPanel from './tab-panel';\nimport * as tabPanels from './tab-panels';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tabList from './tab-list';\nimport * as tabs from './tabs';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termCount from './term-count';\nimport * as termDescription from './term-description';\nimport * as termName from './term-name';\nimport * as termsQuery from './terms-query';\nimport * as termTemplate from './term-template';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\nimport { unlock } from './lock-unlock';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts \u2014 like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\taccordion,\n\t\taccordionItem,\n\t\taccordionHeading,\n\t\taccordionPanel,\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tmath,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\tqueryTotal,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\ticon,\n\t\tlogInOut,\n\t\tnavigationOverlayClose,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t\tbreadcrumbs,\n\t];\n\n\tif ( window?.__experimentalEnableFormBlocks ) {\n\t\tblocks.push( form );\n\t\tblocks.push( formInput );\n\t\tblocks.push( formSubmitButton );\n\t\tblocks.push( formSubmissionNotification );\n\t}\n\n\tif ( window?.__experimentalEnableBlockExperiments ) {\n\t\tblocks.push( tab );\n\t\tblocks.push( tabList );\n\t\tblocks.push( tabs );\n\t\tblocks.push( tabPanel );\n\t\tblocks.push( tabPanels );\n\t\tblocks.push( playlist );\n\t\tblocks.push( playlistTrack );\n\t}\n\n\t// Always register the classic block. Inserter availability is controlled\n\t// by the block's `supports.inserter` value in `freeform/init`.\n\tblocks.push( classic );\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\t// Auto-register PHP-only blocks with ServerSideRender\n\tif ( window.__unstableAutoRegisterBlocks ) {\n\t\twindow.__unstableAutoRegisterBlocks.forEach( ( blockName ) => {\n\t\t\tconst bootstrappedBlockType = unlock(\n\t\t\t\tselect( blocksStore )\n\t\t\t).getBootstrappedBlockType( blockName );\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\t// Use all metadata from PHP registration,\n\t\t\t\t// but fall back title to block name if not provided,\n\t\t\t\t// ensure minimum apiVersion 3 for block wrapper support,\n\t\t\t\t// and override with a ServerSideRender-based edit function.\n\t\t\t\t...bootstrappedBlockType,\n\t\t\t\ttitle: bootstrappedBlockType?.title || blockName,\n\t\t\t\t...( ( bootstrappedBlockType?.apiVersion ?? 0 ) < 3 && {\n\t\t\t\t\tapiVersion: 3,\n\t\t\t\t} ),\n\t\t\t\t// Inspector controls are rendered by the auto-register hook in block-editor\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst disabledRef = useDisabled();\n\t\t\t\t\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\t\t\t\t\tconst { content, status, error } = useServerSideRender( {\n\t\t\t\t\t\tblock: blockName,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( status === 'loading' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>{ __( 'Loading\u2026' ) }</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( status === 'error' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: error message describing the problem */\n\t\t\t\t\t\t\t\t\t__( 'Error loading block: %s' ),\n\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\t\twrapperProps={ blockProps }\n\t\t\t\t\t\t\thtml={ content }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tsave: () => null,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks =\n\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\t\tgetAllBlocks()\n\t\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t\t)\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t\t)\n\t\t\t\t\t.forEach( ( { init } ) => init() );\n\t\t }\n\t\t: undefined;\n\nexport { privateApis } from './private-apis';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAOO;AACP,qBAA4B;AAC5B,kBAAuB;AACvB,0BAA8B;AAC9B,gCAAoC;AACpC,kBAA4B;AAK5B,2BAAyB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n\tregisterBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDisabled } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HtmlRenderer from './utils/html-renderer';\n\n/**\n * Internal dependencies\n */\n// Experimental blocks are only registered in the Gutenberg plugin (see\n// `__experimentalRegisterExperimentalCoreBlocks`). `registerCoreBlocks`\n// filters them out via `isBlockMetadataExperimental`, so they are never\n// available in WordPress core regardless of what ends up in the bundle.\nimport * as accordion from './accordion';\nimport * as accordionItem from './accordion-item';\nimport * as accordionHeading from './accordion-heading';\nimport * as accordionPanel from './accordion-panel';\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as breadcrumbs from './breadcrumbs';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as comments from './comments';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as commentsTitle from './comments-title';\nimport * as cover from './cover';\nimport * as details from './details';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as form from './form';\nimport * as formInput from './form-input';\nimport * as formSubmitButton from './form-submit-button';\nimport * as formSubmissionNotification from './form-submission-notification';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as icon from './icon';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as math from './math';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as navigationOverlayClose from './navigation-overlay-close';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as pageListItem from './page-list-item';\nimport * as paragraph from './paragraph';\nimport * as playlist from './playlist';\nimport * as playlistTrack from './playlist-track';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTimeToRead from './post-time-to-read';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as queryTotal from './query-total';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as tabPanel from './tab-panel';\nimport * as tabPanels from './tab-panels';\nimport * as table from './table';\nimport * as tableOfContents from './table-of-contents';\nimport * as tabList from './tab-list';\nimport * as tabs from './tabs';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termCount from './term-count';\nimport * as termDescription from './term-description';\nimport * as termName from './term-name';\nimport * as termsQuery from './terms-query';\nimport * as termTemplate from './term-template';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\nimport * as footnotes from './footnotes';\n\nimport isBlockMetadataExperimental from './utils/is-block-metadata-experimental';\nimport { unlock } from './lock-unlock';\n\n/**\n * Function to get all the block-library blocks in an array\n */\nconst getAllBlocks = () => {\n\tconst blocks = [\n\t\t// Common blocks are grouped at the top to prioritize their display\n\t\t// in various contexts — like the inserter and auto-complete components.\n\t\tparagraph,\n\t\timage,\n\t\theading,\n\t\tgallery,\n\t\tlist,\n\t\tlistItem,\n\t\tquote,\n\n\t\t// Register all remaining core blocks.\n\t\taccordion,\n\t\taccordionItem,\n\t\taccordionHeading,\n\t\taccordionPanel,\n\t\tarchives,\n\t\taudio,\n\t\tbutton,\n\t\tbuttons,\n\t\tcalendar,\n\t\tcategories,\n\t\tcode,\n\t\tcolumn,\n\t\tcolumns,\n\t\tcommentAuthorAvatar,\n\t\tcover,\n\t\tdetails,\n\t\tembed,\n\t\tfile,\n\t\tgroup,\n\t\thtml,\n\t\tmath,\n\t\tlatestComments,\n\t\tlatestPosts,\n\t\tmediaText,\n\t\tmissing,\n\t\tmore,\n\t\tnextpage,\n\t\tpageList,\n\t\tpageListItem,\n\t\tpattern,\n\t\tpreformatted,\n\t\tpullquote,\n\t\treusableBlock,\n\t\trss,\n\t\tsearch,\n\t\tseparator,\n\t\tshortcode,\n\t\tsocialLink,\n\t\tsocialLinks,\n\t\tspacer,\n\t\ttable,\n\t\ttagCloud,\n\t\ttextColumns,\n\t\tverse,\n\t\tvideo,\n\t\tfootnotes,\n\n\t\t// theme blocks\n\t\tnavigation,\n\t\tnavigationLink,\n\t\tnavigationSubmenu,\n\t\tsiteLogo,\n\t\tsiteTitle,\n\t\tsiteTagline,\n\t\tquery,\n\t\ttemplatePart,\n\t\tavatar,\n\t\tpostTitle,\n\t\tpostExcerpt,\n\t\tpostFeaturedImage,\n\t\tpostContent,\n\t\tpostAuthor,\n\t\tpostAuthorName,\n\t\tpostComment,\n\t\tpostCommentsCount,\n\t\tpostCommentsLink,\n\t\tpostDate,\n\t\tpostTerms,\n\t\tpostNavigationLink,\n\t\tpostTemplate,\n\t\tpostTimeToRead,\n\t\tqueryPagination,\n\t\tqueryPaginationNext,\n\t\tqueryPaginationNumbers,\n\t\tqueryPaginationPrevious,\n\t\tqueryNoResults,\n\t\tqueryTotal,\n\t\treadMore,\n\t\tcomments,\n\t\tcommentAuthorName,\n\t\tcommentContent,\n\t\tcommentDate,\n\t\tcommentEditLink,\n\t\tcommentReplyLink,\n\t\tcommentTemplate,\n\t\tcommentsTitle,\n\t\tcommentsPagination,\n\t\tcommentsPaginationNext,\n\t\tcommentsPaginationNumbers,\n\t\tcommentsPaginationPrevious,\n\t\tpostCommentsForm,\n\t\ttableOfContents,\n\t\thomeLink,\n\t\ticon,\n\t\tlogInOut,\n\t\tnavigationOverlayClose,\n\t\ttermCount,\n\t\ttermDescription,\n\t\ttermName,\n\t\ttermsQuery,\n\t\ttermTemplate,\n\t\tqueryTitle,\n\t\tpostAuthorBiography,\n\t\tbreadcrumbs,\n\t];\n\n\tif ( window?.__experimentalEnableFormBlocks ) {\n\t\tblocks.push( form );\n\t\tblocks.push( formInput );\n\t\tblocks.push( formSubmitButton );\n\t\tblocks.push( formSubmissionNotification );\n\t}\n\n\tif ( window?.__experimentalEnableBlockExperiments ) {\n\t\tblocks.push( tabList );\n\t\tblocks.push( tabs );\n\t\tblocks.push( tabPanel );\n\t\tblocks.push( tabPanels );\n\t\tblocks.push( playlist );\n\t\tblocks.push( playlistTrack );\n\t}\n\n\t// Always register the classic block. Inserter availability is controlled\n\t// by the block's `supports.inserter` value in `freeform/init`.\n\tblocks.push( classic );\n\n\treturn blocks.filter( Boolean );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () =>\n\tgetAllBlocks().filter(\n\t\t( { metadata } ) => ! isBlockMetadataExperimental( metadata )\n\t);\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( ( { init } ) => init() );\n\n\t// Auto-register PHP-only blocks with ServerSideRender\n\tif ( window.__unstableAutoRegisterBlocks ) {\n\t\twindow.__unstableAutoRegisterBlocks.forEach( ( blockName ) => {\n\t\t\tconst bootstrappedBlockType = unlock(\n\t\t\t\tselect( blocksStore )\n\t\t\t).getBootstrappedBlockType( blockName );\n\n\t\t\tregisterBlockType( blockName, {\n\t\t\t\t// Use all metadata from PHP registration,\n\t\t\t\t// but fall back title to block name if not provided,\n\t\t\t\t// ensure minimum apiVersion 3 for block wrapper support,\n\t\t\t\t// and override with a ServerSideRender-based edit function.\n\t\t\t\t...bootstrappedBlockType,\n\t\t\t\ttitle: bootstrappedBlockType?.title || blockName,\n\t\t\t\t...( ( bootstrappedBlockType?.apiVersion ?? 0 ) < 3 && {\n\t\t\t\t\tapiVersion: 3,\n\t\t\t\t} ),\n\t\t\t\t// Inspector controls are rendered by the auto-register hook in block-editor\n\t\t\t\tedit: function Edit( { attributes } ) {\n\t\t\t\t\tconst disabledRef = useDisabled();\n\t\t\t\t\tconst blockProps = useBlockProps( { ref: disabledRef } );\n\t\t\t\t\tconst { content, status, error } = useServerSideRender( {\n\t\t\t\t\t\tblock: blockName,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( status === 'loading' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>{ __( 'Loading…' ) }</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( status === 'error' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: error message describing the problem */\n\t\t\t\t\t\t\t\t\t__( 'Error loading block: %s' ),\n\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\t\twrapperProps={ blockProps }\n\t\t\t\t\t\t\thtml={ content }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tsave: () => null,\n\t\t\t} );\n\t\t} );\n\t}\n\n\tsetDefaultBlockName( paragraph.name );\n\tif (\n\t\twindow.wp &&\n\t\twindow.wp.oldEditor &&\n\t\tblocks.some( ( { name } ) => name === classic.name )\n\t) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks =\n\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t\tconst enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];\n\t\t\t\tgetAllBlocks()\n\t\t\t\t\t.filter( ( { metadata } ) =>\n\t\t\t\t\t\tisBlockMetadataExperimental( metadata )\n\t\t\t\t\t)\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { metadata: { __experimental } } ) =>\n\t\t\t\t\t\t\t__experimental === true ||\n\t\t\t\t\t\t\tenabledExperiments.includes( __experimental )\n\t\t\t\t\t)\n\t\t\t\t\t.forEach( ( { init } ) => init() );\n\t\t }\n\t\t: undefined;\n\nexport { privateApis } from './private-apis';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAOO;AACP,qBAA4B;AAC5B,kBAAuB;AACvB,0BAA8B;AAC9B,gCAAoC;AACpC,kBAA4B;AAK5B,2BAAyB;AASzB,gBAA2B;AAC3B,oBAA+B;AAC/B,uBAAkC;AAClC,qBAAgC;AAChC,eAA0B;AAC1B,aAAwB;AACxB,YAAuB;AACvB,kBAA6B;AAC7B,aAAwB;AACxB,cAAyB;AACzB,eAA0B;AAC1B,iBAA4B;AAC5B,cAAyB;AACzB,WAAsB;AACtB,aAAwB;AACxB,cAAyB;AACzB,eAA0B;AAC1B,0BAAqC;AACrC,wBAAmC;AACnC,qBAAgC;AAChC,kBAA6B;AAC7B,sBAAiC;AACjC,uBAAkC;AAClC,sBAAiC;AACjC,iCAA4C;AAC5C,yBAAoC;AACpC,6BAAwC;AACxC,gCAA2C;AAC3C,oBAA+B;AAC/B,YAAuB;AACvB,cAAyB;AACzB,YAAuB;AACvB,WAAsB;AACtB,WAAsB;AACtB,gBAA2B;AAC3B,uBAAkC;AAClC,iCAA4C;AAC5C,cAAyB;AACzB,YAAuB;AACvB,cAAyB;AACzB,eAA0B;AAC1B,WAAsB;AACtB,WAAsB;AACtB,YAAuB;AACvB,qBAAgC;AAChC,kBAA6B;AAC7B,WAAsB;AACtB,WAAsB;AACtB,eAA0B;AAC1B,eAA0B;AAC1B,gBAA2B;AAC3B,cAAyB;AACzB,WAAsB;AACtB,iBAA4B;A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AA,YAAC,qBAAAC;AAAA,YAAA;AAAA,cACA,cAAe;AAAA,cACf,MAAO;AAAA;AAAA,UACR;AAAA,QAEF;AAAA,QACA,MAAM,MAAM;AAAA,MACb,CAAE;AAAA,IACH,CAAE;AAAA,EACH;AAEA,yCAA+B,cAAK;AACpC,MACC,OAAO,MACP,OAAO,GAAG,aACV,OAAO,KAAM,CAAE,EAAE,MAAAC,MAAK,MAAOA,UAAiB,YAAK,GAClD;AACD,qDAAuC,YAAK;AAAA,EAC7C;AACA,oDAAwC,YAAK;AAC7C,0CAA4B,UAAK;AAClC;AAaO,IAAM,+CACZ,WAAW,sBACR,CAAE,EAAE,gBAAgB,IAAI,CAAC,MAAO;AAChC,QAAM,qBAAqB,CAAE,kBAAkB,QAAQ,IAAK;AAC5D,eAAa,EACX;AAAA,IAAQ,CAAE,EAAE,SAAS,UACrB,sCAAAH,SAA6B,QAAS;AAAA,EACvC,EACC;AAAA,IACA,CAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAChC,mBAAmB,QACnB,mBAAmB,SAAU,cAAe;AAAA,EAC9C,EACC,QAAS,CAAE,EAAE,KAAK,MAAO,KAAK,CAAE;AAClC,IACA;",
|
|
6
6
|
"names": ["isBlockMetadataExperimental", "blocksStore", "HtmlRenderer", "name"]
|
|
7
7
|
}
|
|
@@ -629,7 +629,7 @@ function LatestPostsEdit({ attributes, setAttributes }) {
|
|
|
629
629
|
(0, import_i18n.sprintf)(
|
|
630
630
|
/* translators: 1: Hidden accessibility text: Post title */
|
|
631
631
|
(0, import_i18n.__)(
|
|
632
|
-
"
|
|
632
|
+
"… <a>Read more<span>: %1$s</span></a>"
|
|
633
633
|
),
|
|
634
634
|
titleTrimmed || (0, import_i18n.__)("(no title)")
|
|
635
635
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/latest-posts/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tpin,\n\tlist,\n\tgrid,\n\talignNone,\n\tpositionLeft,\n\tpositionCenter,\n\tpositionRight,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n\tDEFAULT_EXCERPT_LENGTH,\n} from './constants';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\nconst imageAlignmentOptions = [\n\t{\n\t\tvalue: 'none',\n\t\ticon: alignNone,\n\t\tlabel: __( 'None' ),\n\t},\n\t{\n\t\tvalue: 'left',\n\t\ticon: positionLeft,\n\t\tlabel: __( 'Left' ),\n\t},\n\t{\n\t\tvalue: 'center',\n\t\ticon: positionCenter,\n\t\tlabel: __( 'Center' ),\n\t},\n\t{\n\t\tvalue: 'right',\n\t\ticon: positionRight,\n\t\tlabel: __( 'Right' ),\n\t},\n];\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nfunction getCurrentAuthor( post ) {\n\treturn post._embedded?.author?.[ 0 ];\n}\n\nfunction Controls( { attributes, setAttributes, postCount } ) {\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[ featuredImageSizeSlug ]\n\t);\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayPostContent: false,\n\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostContent }\n\t\t\t\t\tlabel={ __( 'Display post content' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display post content' ) }\n\t\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => displayPostContentRadio !== 'excerpt' }\n\t\t\t\t\t\tlabel={ __( 'Content length' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\tlabel={ __( 'Content length' ) }\n\t\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\texcerptLength !== DEFAULT_EXCERPT_LENGTH\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post meta' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayAuthor: false,\n\t\t\t\t\t\tdisplayPostDate: false,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayAuthor }\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostDate }\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayFeaturedImage: false,\n\t\t\t\t\t\tfeaturedImageAlign: undefined,\n\t\t\t\t\t\tfeaturedImageSizeSlug: 'thumbnail',\n\t\t\t\t\t\tfeaturedImageSizeWidth: null,\n\t\t\t\t\t\tfeaturedImageSizeHeight: null,\n\t\t\t\t\t\taddLinkToFeaturedImage: false,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayFeaturedImage }\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tfeaturedImageSizeSlug !== 'thumbnail' ||\n\t\t\t\t\t\t\t\tfeaturedImageSizeWidth !== null ||\n\t\t\t\t\t\t\t\tfeaturedImageSizeHeight !== null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: 'thumbnail',\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: null,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: null,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\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</ToolsPanelItem>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! featuredImageAlign }\n\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageAlign: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tclassName=\"editor-latest-posts-image-alignment-control\"\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\t\tvalue={ featuredImageAlign || 'none' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageAlign:\n\t\t\t\t\t\t\t\t\t\t\tvalue !== 'none'\n\t\t\t\t\t\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\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\t\t{ imageAlignmentOptions.map(\n\t\t\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! addLinkToFeaturedImage }\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: false,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\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={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\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</ToolsPanelItem>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Sorting and filtering' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\tpostsToShow: 5,\n\t\t\t\t\t\tcategories: undefined,\n\t\t\t\t\t\tselectedAuthor: undefined,\n\t\t\t\t\t\tcolumns: 3,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\torder !== 'desc' ||\n\t\t\t\t\t\torderBy !== 'date' ||\n\t\t\t\t\t\tpostsToShow !== 5 ||\n\t\t\t\t\t\tcategories?.length > 0 ||\n\t\t\t\t\t\t!! selectedAuthor\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( 'Sort and filter' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tpostsToShow: 5,\n\t\t\t\t\t\t\tcategories: undefined,\n\t\t\t\t\t\t\tselectedAuthor: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<QueryControls\n\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => columns !== 3 }\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcolumns: 3,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t! postCount\n\t\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t\t: Math.min( MAX_POSTS_COLUMNS, postCount )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</>\n\t);\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst { latestPosts } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'author,wp:featuredmedia',\n\t\t\t\t\tignore_sticky: true,\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postsToShow, order, orderBy, categories, selectedAuthor ]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<Controls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tpostCount={ latestPosts?.length ?? 0 }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = getCurrentAuthor( post );\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = clsx( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Hidden accessibility text: Post title */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'\u2026 <a>Read more<span>: %1$s</span></a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-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</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tpin,\n\tlist,\n\tgrid,\n\talignNone,\n\tpositionLeft,\n\tpositionCenter,\n\tpositionRight,\n} from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n\tDEFAULT_EXCERPT_LENGTH,\n} from './constants';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\nconst imageAlignmentOptions = [\n\t{\n\t\tvalue: 'none',\n\t\ticon: alignNone,\n\t\tlabel: __( 'None' ),\n\t},\n\t{\n\t\tvalue: 'left',\n\t\ticon: positionLeft,\n\t\tlabel: __( 'Left' ),\n\t},\n\t{\n\t\tvalue: 'center',\n\t\ticon: positionCenter,\n\t\tlabel: __( 'Center' ),\n\t},\n\t{\n\t\tvalue: 'right',\n\t\ticon: positionRight,\n\t\tlabel: __( 'Right' ),\n\t},\n];\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nfunction getCurrentAuthor( post ) {\n\treturn post._embedded?.author?.[ 0 ];\n}\n\nfunction Controls( { attributes, setAttributes, postCount } ) {\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[ featuredImageSizeSlug ]\n\t);\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayPostContent: false,\n\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostContent }\n\t\t\t\t\tlabel={ __( 'Display post content' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display post content' ) }\n\t\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => displayPostContentRadio !== 'excerpt' }\n\t\t\t\t\t\tlabel={ __( 'Content length' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: 'excerpt',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\tlabel={ __( 'Content length' ) }\n\t\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\texcerptLength !== DEFAULT_EXCERPT_LENGTH\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\texcerptLength: DEFAULT_EXCERPT_LENGTH,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Post meta' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayAuthor: false,\n\t\t\t\t\t\tdisplayPostDate: false,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayAuthor }\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayPostDate }\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tdisplayFeaturedImage: false,\n\t\t\t\t\t\tfeaturedImageAlign: undefined,\n\t\t\t\t\t\tfeaturedImageSizeSlug: 'thumbnail',\n\t\t\t\t\t\tfeaturedImageSizeWidth: null,\n\t\t\t\t\t\tfeaturedImageSizeHeight: null,\n\t\t\t\t\t\taddLinkToFeaturedImage: false,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! displayFeaturedImage }\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tfeaturedImageSizeSlug !== 'thumbnail' ||\n\t\t\t\t\t\t\t\tfeaturedImageSizeWidth !== null ||\n\t\t\t\t\t\t\t\tfeaturedImageSizeHeight !== null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: 'thumbnail',\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: null,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: null,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\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</ToolsPanelItem>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! featuredImageAlign }\n\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageAlign: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tclassName=\"editor-latest-posts-image-alignment-control\"\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Image alignment' ) }\n\t\t\t\t\t\t\t\tvalue={ featuredImageAlign || 'none' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageAlign:\n\t\t\t\t\t\t\t\t\t\t\tvalue !== 'none'\n\t\t\t\t\t\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\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\t\t{ imageAlignmentOptions.map(\n\t\t\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! addLinkToFeaturedImage }\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: false,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\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={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\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</ToolsPanelItem>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Sorting and filtering' ) }\n\t\t\t\tresetAll={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\tpostsToShow: 5,\n\t\t\t\t\t\tcategories: undefined,\n\t\t\t\t\t\tselectedAuthor: undefined,\n\t\t\t\t\t\tcolumns: 3,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\torder !== 'desc' ||\n\t\t\t\t\t\torderBy !== 'date' ||\n\t\t\t\t\t\tpostsToShow !== 5 ||\n\t\t\t\t\t\tcategories?.length > 0 ||\n\t\t\t\t\t\t!! selectedAuthor\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( 'Sort and filter' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tpostsToShow: 5,\n\t\t\t\t\t\t\tcategories: undefined,\n\t\t\t\t\t\t\tselectedAuthor: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<QueryControls\n\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => columns !== 3 }\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcolumns: 3,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t! postCount\n\t\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t\t: Math.min( MAX_POSTS_COLUMNS, postCount )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</>\n\t);\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst { latestPosts } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'author,wp:featuredmedia',\n\t\t\t\t\tignore_sticky: true,\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postsToShow, order, orderBy, categories, selectedAuthor ]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<Controls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tpostCount={ latestPosts?.length ?? 0 }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Latest posts block display setting' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = getCurrentAuthor( post );\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = clsx( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Hidden accessibility text: Post title */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'… <a>Read more<span>: %1$s</span></a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-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</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAYO;AACP,kBAAgC;AAChC,kBAA8C;AAC9C,0BAMO;AACP,kBAAuC;AACvC,mBAQO;AACP,uBAAmC;AACnC,qBAAqC;AACrC,qBAA8B;AAC9B,qBAAyC;AAKzC,uBAKO;AACP,mBAA+C;AAiJ5C;AA5IH,IAAM,wBAAwB;AAAA,EAC7B,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AACV;AACA,IAAM,mBAAmB;AAAA,EACxB,UAAU;AAAA,EACV,qBAAqB,CAAE,MAAO;AAAA,EAC9B,SAAS;AACV;AACA,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAO,gBAAI,MAAO;AAAA,EACnB;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAO,gBAAI,MAAO;AAAA,EACnB;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAO,gBAAI,QAAS;AAAA,EACrB;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,EACp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KAAK;AAAA,YACZ,SACC;AAAA,YAGC;AAAA;AAAA,QACH,IAEA,eAEF;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,MAAO,KAAK;AAAA,YACZ,yBACC,CAAC,CAAE,eACA;AAAA,cACA,QAAQ;AAAA,YACR,IACA;AAAA,YAEJ,SAAU;AAAA,YAER,WAAE,mBAAe,gBAAI,YAAa,IAAI;AAAA;AAAA,QACzC;AAAA,QACE,iBAAiB,iBAClB,4CAAC,SAAI,WAAU,sCACZ;AAAA;AAAA,cAED,gBAAI,OAAQ;AAAA,UACZ,cAAc;AAAA,QACf,GACD;AAAA,QAEC,mBAAmB,KAAK,YACzB;AAAA,UAAC;AAAA;AAAA,YACA,cAAW,oBAAQ,KAAK,KAAK,QAAS;AAAA,YACtC,WAAU;AAAA,YAER,oCAAU,YAAY,KAAK,QAAS;AAAA;AAAA,QACvC;AAAA,QAEC,sBACD,4BAA4B,aAC3B,4CAAC,SAAI,WAAU,uCACZ,uBACH;AAAA,QAEA,sBACD,4BAA4B,eAC3B;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,yBAA0B;AAAA,cACzB,QAAQ,KAAK,QAAQ,IAAI,KAAK;AAAA,YAC/B;AAAA;AAAA,QACD;AAAA,WA7DO,KAAK,EA+Df;AAAA,IAEF,CAAE,GACH;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["coreStore", "blockEditorStore", "ToolsPanel", "ToolsPanelItem", "ImageSizeControl", "ToggleGroupControl", "ToggleGroupControlOptionIcon", "noticeStore", "clsx"]
|
|
7
7
|
}
|
package/build/list/edit.cjs
CHANGED
|
@@ -49,7 +49,6 @@ var DEFAULT_BLOCK = {
|
|
|
49
49
|
name: "core/list-item"
|
|
50
50
|
};
|
|
51
51
|
var TEMPLATE = [["core/list-item"]];
|
|
52
|
-
var NATIVE_MARGIN_SPACING = 8;
|
|
53
52
|
function useMigrateOnLoad(attributes, clientId) {
|
|
54
53
|
const registry = (0, import_data.useRegistry)();
|
|
55
54
|
const { updateBlockAttributes, replaceInnerBlocks } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
@@ -104,11 +103,10 @@ function IndentUI({ clientId }) {
|
|
|
104
103
|
}
|
|
105
104
|
) });
|
|
106
105
|
}
|
|
107
|
-
function Edit({ attributes, setAttributes, clientId
|
|
106
|
+
function Edit({ attributes, setAttributes, clientId }) {
|
|
108
107
|
const { ordered, type, reversed, start } = attributes;
|
|
109
108
|
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
110
109
|
style: {
|
|
111
|
-
...import_element.Platform.isNative && style,
|
|
112
110
|
listStyleType: ordered && type !== "decimal" ? type : void 0
|
|
113
111
|
}
|
|
114
112
|
});
|
|
@@ -118,11 +116,6 @@ function Edit({ attributes, setAttributes, clientId, style }) {
|
|
|
118
116
|
template: TEMPLATE,
|
|
119
117
|
templateLock: false,
|
|
120
118
|
templateInsertUpdatesSelection: true,
|
|
121
|
-
...import_element.Platform.isNative && {
|
|
122
|
-
marginVertical: NATIVE_MARGIN_SPACING,
|
|
123
|
-
marginHorizontal: NATIVE_MARGIN_SPACING,
|
|
124
|
-
renderAppender: false
|
|
125
|
-
},
|
|
126
119
|
__experimentalCaptureToolbars: true
|
|
127
120
|
});
|
|
128
121
|
useMigrateOnLoad(attributes, clientId);
|