@wordpress/block-library 9.48.1 → 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 +12 -0
- 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/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 +2 -2
- package/build/gallery/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/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.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 +19 -13
- 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 -1
- 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 +1 -1
- 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/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-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 -61
- 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/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/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 +1 -1
- package/build/verse/edit.cjs +1 -1
- package/build/verse/edit.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/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 +2 -2
- package/build-module/gallery/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/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.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 +19 -13
- 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 -1
- 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 +1 -1
- 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/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-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 -67
- 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/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/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 +1 -1
- package/build-module/verse/edit.mjs +1 -1
- package/build-module/verse/edit.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/editor-rtl.css +0 -19
- package/build-style/editor.css +0 -19
- package/build-style/icon/style-rtl.css +9 -0
- package/build-style/icon/style.css +9 -0
- package/build-style/style-rtl.css +11 -24
- package/build-style/style.css +11 -24
- package/build-style/{tab → tab-list}/style-rtl.css +2 -2
- package/build-style/{tab → tab-list}/style.css +2 -2
- package/build-style/tab-panel/style-rtl.css +0 -17
- package/build-style/tab-panel/style.css +0 -17
- package/package.json +48 -45
- package/src/audio/edit.js +5 -9
- package/src/avatar/index.php +2 -2
- package/src/block/index.php +2 -26
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/edit.js +0 -1
- package/src/comment-author-avatar/index.php +3 -3
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-date/index.php +1 -1
- 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/edit.js +0 -1
- package/src/editor.scss +0 -2
- 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/form/edit.js +0 -2
- package/src/form-input/edit.js +0 -2
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/gallery/edit.js +13 -13
- package/src/home-link/edit.js +0 -1
- package/src/html/modal.js +3 -0
- package/src/icon/README.md +3 -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 +1 -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 +0 -1
- 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/list/ordered-list-settings.js +0 -1
- package/src/navigation/edit/index.js +25 -16
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation/index.php +58 -0
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/block.json +1 -1
- 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-submenu/README.md +5 -0
- package/src/navigation-submenu/block.json +7 -0
- package/src/page-list/README.md +1 -1
- package/src/page-list/block.json +2 -5
- package/src/page-list/edit.js +0 -11
- package/src/page-list/index.php +1 -1
- package/src/playlist-track/edit.js +0 -3
- package/src/post-comment/edit.js +0 -1
- package/src/post-date/edit.js +2 -2
- package/src/post-featured-image/README.md +1 -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 +24 -22
- package/src/post-terms/edit.js +0 -1
- package/src/post-title/edit.js +0 -1
- package/src/pullquote/README.md +1 -1
- package/src/pullquote/block.json +1 -3
- package/src/pullquote/deprecated.js +121 -9
- package/src/pullquote/edit.js +7 -31
- package/src/pullquote/save.js +2 -13
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +1 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/site-logo/edit.js +3 -1
- package/src/social-link/edit.js +0 -3
- package/src/style.scss +1 -2
- package/src/tab-list/README.md +19 -17
- 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 +0 -3
- 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 +0 -16
- package/src/tab-panels/block.json +2 -28
- package/src/tab-panels/init.js +6 -0
- package/src/table/edit.js +0 -2
- package/src/tabs/README.md +1 -7
- 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/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/utils/style-state.js +151 -0
- package/src/utils/test/style-state.js +307 -0
- 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/freeform/convert-to-blocks-button.js +0 -18
- package/src/list-item/utils.js +0 -34
- package/src/tab/README.md +0 -69
- 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/tabs/use-tab-list-sync.js +0 -237
|
@@ -5,10 +5,14 @@ import {
|
|
|
5
5
|
DropdownMenu,
|
|
6
6
|
TextControl,
|
|
7
7
|
ToolbarButton,
|
|
8
|
-
ToolbarGroup,
|
|
9
8
|
__experimentalToolsPanel as ToolsPanel,
|
|
10
9
|
__experimentalToolsPanelItem as ToolsPanelItem
|
|
11
10
|
} from "@wordpress/components";
|
|
11
|
+
import {
|
|
12
|
+
flipHorizontal as flipHorizontalIcon,
|
|
13
|
+
flipVertical as flipVerticalIcon,
|
|
14
|
+
rotateRight
|
|
15
|
+
} from "@wordpress/icons";
|
|
12
16
|
import {
|
|
13
17
|
BlockControls,
|
|
14
18
|
InspectorControls,
|
|
@@ -52,7 +56,7 @@ var IconPlaceholder = ({ className, style }) => /* @__PURE__ */ jsxs(
|
|
|
52
56
|
}
|
|
53
57
|
);
|
|
54
58
|
function Edit({ attributes, setAttributes }) {
|
|
55
|
-
const { icon, ariaLabel } = attributes;
|
|
59
|
+
const { icon, ariaLabel, flipHorizontal, flipVertical, rotation } = attributes;
|
|
56
60
|
const [isInserterOpen, setInserterOpen] = useState(false);
|
|
57
61
|
const isContentOnlyMode = useBlockEditingMode() === "contentOnly";
|
|
58
62
|
const colorProps = useColorProps(attributes);
|
|
@@ -70,42 +74,87 @@ function Edit({ attributes, setAttributes }) {
|
|
|
70
74
|
[isInserterOpen, icon]
|
|
71
75
|
);
|
|
72
76
|
const iconToDisplay = selectedIcon?.content || "";
|
|
77
|
+
const flipClasses = {
|
|
78
|
+
"is-flip-horizontal": flipHorizontal,
|
|
79
|
+
"is-flip-vertical": flipVertical
|
|
80
|
+
};
|
|
81
|
+
const rotationStyle = rotation ? { rotate: `${rotation}deg` } : {};
|
|
73
82
|
const blockControls = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
83
|
+
icon && /* @__PURE__ */ jsxs(BlockControls, { group: "block", children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
ToolbarButton,
|
|
86
|
+
{
|
|
87
|
+
icon: flipHorizontalIcon,
|
|
88
|
+
label: __("Flip horizontal"),
|
|
89
|
+
isPressed: flipHorizontal,
|
|
90
|
+
onClick: () => setAttributes({
|
|
91
|
+
flipHorizontal: !flipHorizontal
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
ToolbarButton,
|
|
97
|
+
{
|
|
98
|
+
icon: flipVerticalIcon,
|
|
99
|
+
label: __("Flip vertical"),
|
|
100
|
+
isPressed: flipVertical,
|
|
101
|
+
onClick: () => setAttributes({
|
|
102
|
+
flipVertical: !flipVertical
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
ToolbarButton,
|
|
108
|
+
{
|
|
109
|
+
icon: rotateRight,
|
|
110
|
+
label: __("Rotate"),
|
|
111
|
+
onClick: () => setAttributes({
|
|
112
|
+
rotation: ((rotation || 0) + 90) % 360
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsxs(BlockControls, { group: "other", children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
ToolbarButton,
|
|
120
|
+
{
|
|
121
|
+
onClick: () => {
|
|
122
|
+
setInserterOpen(true);
|
|
123
|
+
},
|
|
124
|
+
children: icon ? __("Replace") : __("Choose icon")
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
isContentOnlyMode && icon && // Add some extra controls for content attributes when content only mode is active.
|
|
128
|
+
// With content only mode active, the inspector is hidden, so users need another way
|
|
129
|
+
// to edit these attributes.
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
DropdownMenu,
|
|
132
|
+
{
|
|
133
|
+
icon: "",
|
|
134
|
+
toggleProps: {
|
|
135
|
+
as: ToolbarButton
|
|
136
|
+
},
|
|
137
|
+
popoverProps: {
|
|
138
|
+
className: "is-alternate"
|
|
139
|
+
},
|
|
140
|
+
text: __("Label"),
|
|
141
|
+
children: () => /* @__PURE__ */ jsx(
|
|
142
|
+
TextControl,
|
|
143
|
+
{
|
|
144
|
+
className: "wp-block-icon__toolbar-content",
|
|
145
|
+
label: __("Label"),
|
|
146
|
+
value: ariaLabel || "",
|
|
147
|
+
onChange: (value) => setAttributes({
|
|
148
|
+
ariaLabel: value
|
|
149
|
+
}),
|
|
150
|
+
help: __(
|
|
151
|
+
"Briefly describe the icon to help screen reader users. Leave blank for decorative icons."
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] })
|
|
109
158
|
] });
|
|
110
159
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
111
160
|
const inspectorControls = icon && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InspectorControls, { group: "settings", children: /* @__PURE__ */ jsx(
|
|
@@ -131,8 +180,7 @@ function Edit({ attributes, setAttributes }) {
|
|
|
131
180
|
"Briefly describe the icon to help screen reader users. Leave blank for decorative icons."
|
|
132
181
|
),
|
|
133
182
|
value: ariaLabel || "",
|
|
134
|
-
onChange: (value) => setAttributes({ ariaLabel: value })
|
|
135
|
-
__next40pxDefaultSize: true
|
|
183
|
+
onChange: (value) => setAttributes({ ariaLabel: value })
|
|
136
184
|
}
|
|
137
185
|
)
|
|
138
186
|
}
|
|
@@ -151,13 +199,15 @@ function Edit({ attributes, setAttributes }) {
|
|
|
151
199
|
colorProps.className,
|
|
152
200
|
borderProps.className,
|
|
153
201
|
spacingProps.className,
|
|
154
|
-
dimensionsProps.className
|
|
202
|
+
dimensionsProps.className,
|
|
203
|
+
flipClasses
|
|
155
204
|
),
|
|
156
205
|
style: {
|
|
157
206
|
...colorProps.style,
|
|
158
207
|
...borderProps.style,
|
|
159
208
|
...spacingProps.style,
|
|
160
|
-
...dimensionsProps.style
|
|
209
|
+
...dimensionsProps.style,
|
|
210
|
+
...rotationStyle
|
|
161
211
|
}
|
|
162
212
|
}
|
|
163
213
|
}
|
|
@@ -167,12 +217,14 @@ function Edit({ attributes, setAttributes }) {
|
|
|
167
217
|
className: clsx(
|
|
168
218
|
borderProps.className,
|
|
169
219
|
spacingProps.className,
|
|
170
|
-
dimensionsProps.className
|
|
220
|
+
dimensionsProps.className,
|
|
221
|
+
flipClasses
|
|
171
222
|
),
|
|
172
223
|
style: {
|
|
173
224
|
...borderProps.style,
|
|
174
225
|
...spacingProps.style,
|
|
175
226
|
...dimensionsProps.style,
|
|
227
|
+
...rotationStyle,
|
|
176
228
|
height: "auto"
|
|
177
229
|
}
|
|
178
230
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/icon/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tflipHorizontal as flipHorizontalIcon,\n\tflipVertical as flipVerticalIcon,\n\trotateRight,\n} from '@wordpress/icons';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel, flipHorizontal, flipVertical, rotation } =\n\t\tattributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst { selectedIcon, allIcons = [] } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\tselectedIcon: icon\n\t\t\t\t\t? getEntityRecord( 'root', 'icon', icon )\n\t\t\t\t\t: null,\n\t\t\t\tallIcons: isInserterOpen\n\t\t\t\t\t? getEntityRecords( 'root', 'icon' )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ isInserterOpen, icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst flipClasses = {\n\t\t'is-flip-horizontal': flipHorizontal,\n\t\t'is-flip-vertical': flipVertical,\n\t};\n\n\tconst rotationStyle = rotation ? { rotate: `${ rotation }deg` } : {};\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t{ icon && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ flipHorizontalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip horizontal' ) }\n\t\t\t\t\t\tisPressed={ flipHorizontal }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipHorizontal: ! flipHorizontal,\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<ToolbarButton\n\t\t\t\t\t\ticon={ flipVerticalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip vertical' ) }\n\t\t\t\t\t\tisPressed={ flipVertical }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipVertical: ! flipVertical,\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<ToolbarButton\n\t\t\t\t\t\ticon={ rotateRight }\n\t\t\t\t\t\tlabel={ __( 'Rotate' ) }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\trotation: ( ( rotation || 0 ) + 90 ) % 360,\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</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t\t// to edit these attributes.\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: ToolbarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\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\tariaLabel: 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\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\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</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ icon ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t\t...rotationStyle,\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) : (\n\t\t\t\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\ticons={ allIcons }\n\t\t\t\t\tsetInserterOpen={ setInserterOpen }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OA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AAW;AAAA,YACV,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,aAAa;AAAA,YACb,gBAAgB;AAAA,YAChB;AAAA,UACD;AAAA,UACA,OAAO;AAAA,YACN,GAAG,WAAW;AAAA,YACd,GAAG,YAAY;AAAA,YACf,GAAG,aAAa;AAAA,YAChB,GAAG,gBAAgB;AAAA,YACnB,GAAG;AAAA,UACJ;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,WAAY;AAAA,UACX,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,gBAAgB;AAAA,UAChB;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,YAAY;AAAA,UACf,GAAG,aAAa;AAAA,UAChB,GAAG,gBAAgB;AAAA,UACnB,GAAG;AAAA,UACH,QAAQ;AAAA,QACT;AAAA;AAAA,IACD,GAEF;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,12 +3,13 @@ import initBlock from "../utils/init-block.mjs";
|
|
|
3
3
|
import edit from "./edit.mjs";
|
|
4
4
|
import metadata from "./block.json";
|
|
5
5
|
import icon from "./icon.mjs";
|
|
6
|
+
import variations from "./variations.mjs";
|
|
6
7
|
var { name } = metadata;
|
|
7
8
|
var settings = {
|
|
8
9
|
icon,
|
|
9
10
|
example: {
|
|
10
11
|
attributes: {
|
|
11
|
-
icon: "core/
|
|
12
|
+
icon: "core/info",
|
|
12
13
|
style: {
|
|
13
14
|
dimensions: {
|
|
14
15
|
width: "48px"
|
|
@@ -16,6 +17,7 @@ var settings = {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
},
|
|
20
|
+
variations,
|
|
19
21
|
edit
|
|
20
22
|
};
|
|
21
23
|
var init = () => initBlock({ name, metadata, settings });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/icon/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport icon from './icon';\n\nconst { name } = metadata;\nexport { metadata, name };\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\ticon: 'core/
|
|
5
|
-
"mappings": ";AAGA,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport icon from './icon';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\ticon: 'core/info',\n\t\t\tstyle: {\n\t\t\t\tdimensions: {\n\t\t\t\t\twidth: '48px',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tvariations,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,eAAe;AACtB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAEV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,MAAM;AAAA,MACN,OAAO;AAAA,QACN,YAAY;AAAA,UACX,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/block-library/src/icon/variations.js
|
|
2
|
+
var variations = [
|
|
3
|
+
{
|
|
4
|
+
name: "default",
|
|
5
|
+
isDefault: true,
|
|
6
|
+
attributes: { icon: "core/info" }
|
|
7
|
+
}
|
|
8
|
+
];
|
|
9
|
+
var variations_default = variations;
|
|
10
|
+
export {
|
|
11
|
+
variations_default as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=variations.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/icon/variations.js"],
|
|
4
|
+
"sourcesContent": ["const variations = [\n\t{\n\t\tname: 'default',\n\t\tisDefault: true,\n\t\tattributes: { icon: 'core/info' },\n\t},\n];\n\nexport default variations;\n"],
|
|
5
|
+
"mappings": ";AAAA,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY,EAAE,MAAM,YAAY;AAAA,EACjC;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -141,6 +141,7 @@
|
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
143
|
"selectors": {
|
|
144
|
+
"dimensions": ".wp-block-image img",
|
|
144
145
|
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
|
145
146
|
"shadow": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
|
146
147
|
"filter": {
|
|
@@ -298,6 +298,7 @@ function ImageEdit({
|
|
|
298
298
|
},
|
|
299
299
|
[context, isSingleSelected, metadata?.bindings?.url]
|
|
300
300
|
);
|
|
301
|
+
const pinnedHeight = height === "auto" ? void 0 : height;
|
|
301
302
|
const placeholder = (content) => {
|
|
302
303
|
return /* @__PURE__ */ jsxs(
|
|
303
304
|
Placeholder,
|
|
@@ -312,9 +313,9 @@ function ImageEdit({
|
|
|
312
313
|
"Drag and drop an image, upload, or choose from your library."
|
|
313
314
|
),
|
|
314
315
|
style: {
|
|
315
|
-
aspectRatio: !(width &&
|
|
316
|
-
width:
|
|
317
|
-
height: width && aspectRatio ? "100%" :
|
|
316
|
+
aspectRatio: !(width && pinnedHeight) && aspectRatio ? aspectRatio : void 0,
|
|
317
|
+
width: pinnedHeight && aspectRatio ? "100%" : width,
|
|
318
|
+
height: width && aspectRatio ? "100%" : pinnedHeight,
|
|
318
319
|
objectFit: scale,
|
|
319
320
|
...borderProps.style,
|
|
320
321
|
...shadowProps.style
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/image/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL, createBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockBindingsSource } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tBlockIcon,\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { image as icon, plugins as pluginsIcon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\nimport { store as uploadStore } from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\nimport Image from './image';\nimport { isValidFileType } from './utils';\nimport { useMaxWidthObserver } from './use-max-width-observer';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = Object.fromEntries(\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\n\t\t)\n\t);\n\n\timageProps.url =\n\t\timage?.sizes?.[ size ]?.url ||\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated the specified image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} size\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasSize( image, size ) {\n\treturn (\n\t\t'url' in ( image?.sizes?.[ size ] ?? {} ) ||\n\t\t'source_url' in ( image?.media_details?.sizes?.[ size ] ?? {} )\n\t);\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected: isSingleSelected,\n\tclassName,\n\tinsertBlocksAfter,\n\tonReplace,\n\tcontext,\n\tclientId,\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst {\n\t\turl = '',\n\t\tcaption,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t\taspectRatio,\n\t\tscale,\n\t\talign,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tconst containerRef = useRef();\n\t// Only observe the max width from the parent container when the parent layout is not flex nor grid.\n\t// This won't work for them because the container width changes with the image.\n\t// TODO: Find a way to observe the container width for flex and grid layouts.\n\tconst layoutType = parentLayout?.type || parentLayout?.default?.type;\n\tconst isMaxWidthContainerWidth =\n\t\t! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );\n\tconst [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();\n\n\tconst [ placeholderResizeListener, { width: placeholderWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst isSmallContainer = placeholderWidth && placeholderWidth < 160;\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( [ 'wide', 'full' ].includes( align ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ __unstableMarkNextChangeAsNotPersistent, align, setAttributes ] );\n\n\tconst {\n\t\tgetSettings,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tblob: undefined,\n\t\t} );\n\t}\n\n\tfunction onFilesPreUpload( files ) {\n\t\tif ( files.length === 1 ) {\n\t\t\tsetTemporaryURL( createBlobURL( files[ 0 ] ) );\n\t\t}\n\t}\n\n\tfunction onSelectImagesList( images ) {\n\t\tconst win = containerRef.current?.ownerDocument.defaultView;\n\n\t\tif ( images.every( ( file ) => file instanceof win.File ) ) {\n\t\t\t/** @type {File[]} */\n\t\t\tconst files = images;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif ( files.some( ( file ) => ! isValidFileType( file ) ) ) {\n\t\t\t\t// Copied from the same notice in the gallery block.\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'If uploading to a gallery all files need to be image formats'\n\t\t\t\t\t),\n\t\t\t\t\t{ id: 'gallery-upload-invalid-file', type: 'snackbar' }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imageBlocks = files\n\t\t\t\t.filter( ( file ) => isValidFileType( file ) )\n\t\t\t\t.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\tif ( getBlockName( rootClientId ) === 'core/gallery' ) {\n\t\t\t\treplaceBlock( clientId, imageBlocks );\n\t\t\t} else if ( canInsertBlockType( 'core/gallery', rootClientId ) ) {\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{},\n\t\t\t\t\timageBlocks\n\t\t\t\t);\n\n\t\t\t\treplaceBlock( clientId, galleryBlock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( Array.isArray( media ) ) {\n\t\t\tonSelectImagesList( media );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t// Try to use the previous selected image size if its available\n\t\t// otherwise try the default image size or fallback to \"full\"\n\t\tlet newSize = DEFAULT_MEDIA_SIZE_SLUG;\n\t\tif ( sizeSlug && hasSize( media, sizeSlug ) ) {\n\t\t\tnewSize = sizeSlug;\n\t\t} else if ( hasSize( media, imageDefaultSize ) ) {\n\t\t\tnewSize = imageDefaultSize;\n\t\t}\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, newSize );\n\n\t\t// Normalize newline characters in caption to <br />\n\t\t// to preserve line breaks in both editor and frontend.\n\t\tif (\n\t\t\ttypeof mediaAttributes.caption === 'string' &&\n\t\t\tmediaAttributes.caption.includes( '\\n' )\n\t\t) {\n\t\t\tmediaAttributes.caption = mediaAttributes.caption.replace(\n\t\t\t\t/\\n/g,\n\t\t\t\t'<br>'\n\t\t\t);\n\t\t}\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! mediaAttributes.caption ) {\n\t\t\tconst { caption: omittedCaption, ...restMediaAttributes } =\n\t\t\t\tmediaAttributes;\n\t\t\tmediaAttributes = restMediaAttributes;\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\tsizeSlug: newSize,\n\t\t\t};\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\tswitch (\n\t\t\t\twindow?.wp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\t// Handle URLs without protocol.\n\t\tconst normalizedNewURL = getProtocol( newURL )\n\t\t\t? newURL\n\t\t\t: prependHTTPS( newURL );\n\t\tif ( normalizedNewURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\tblob: undefined,\n\t\t\t\turl: normalizedNewURL,\n\t\t\t\tid: undefined,\n\t\t\t\tsizeSlug: getSettings().imageDefaultSize,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectImage,\n\t\tonError: onUploadError,\n\t} );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\n\tconst isSideloading = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\t( ! window.__clientSideMediaProcessing &&\n\t\t\t\t\t! window.__heicUploadSupport ) ||\n\t\t\t\t! id\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( uploadStore ).isUploadingById( id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName=\"edit-image-preview\"\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL || isSideloading,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: containerRef,\n\t\tclassName: classes,\n\t} );\n\n\t// Much of this description is duplicated from MediaPlaceholder.\n\tconst { lockUrlControls = false, lockUrlControlsMessage } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockUrlControlsMessage: blockBindingsSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\tblockBindingsSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSingleSelected, metadata?.bindings?.url ]\n\t);\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx( 'block-editor-media-placeholder', {\n\t\t\t\t\t[ borderProps.className ]:\n\t\t\t\t\t\t!! borderProps.className && ! isSingleSelected,\n\t\t\t\t} ) }\n\t\t\t\ticon={\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t( lockUrlControls ? pluginsIcon : icon )\n\t\t\t\t}\n\t\t\t\twithIllustration={ ! isSingleSelected || isSmallContainer }\n\t\t\t\tlabel={ ! isSmallContainer && __( 'Image' ) }\n\t\t\t\tinstructions={\n\t\t\t\t\t! lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! ( width && height ) && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\twidth: height && aspectRatio ? '100%' : width,\n\t\t\t\t\theight: width && aspectRatio ? '100%' : height,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\tlockUrlControlsMessage }\n\n\t\t\t\t{ ! lockUrlControls && ! isSmallContainer && content }\n\t\t\t\t{ placeholderResizeListener }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tisSideloading={ isSideloading }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSingleSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\t\tparentLayoutType={ layoutType }\n\t\t\t\t\tmaxContentWidth={ maxContentWidth }\n\t\t\t\t/>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonFilesPreUpload={ onFilesPreUpload }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\thandleUpload={ ( files ) => files.length === 1 }\n\t\t\t\t\tvalue={ { id, src } }\n\t\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{\n\t\t\t\t// The listener cannot be placed as the first element as it will break the in-between inserter.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/blob/71134165868298fc15e22896d0c28b41b3755ff7/packages/block-editor/src/components/block-list/use-in-between-inserter.js#L120\n\t\t\t\tisSingleSelected && isMaxWidthContainerWidth && maxWidthObserver\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default ImageEdit;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,WAAW,qBAAqB;AACzC,SAAS,aAAa,8BAA8B;AACpD,SAAS,mBAAmB;AAC5B,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,gCAAgC;AAAA,EAChC,2CAA2C;AAAA,EAC3C;AAAA,OACM;AACP,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,MAAM,WAAW,mBAAmB;AACtD,SAAS,SAAS,oBAAoB;AACtC,SAAS,yBAAyB;AAClC,SAAS,aAAa,oBAAoB;AAC1C,SAAS,SAAS,mBAAmB;AAKrC,SAAS,iCAAiC;AAC1C,OAAO,WAAW;AAClB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AAKpC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAiUL,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL, createBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockBindingsSource } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tBlockIcon,\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { image as icon, plugins as pluginsIcon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\nimport { store as uploadStore } from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\nimport Image from './image';\nimport { isValidFileType } from './utils';\nimport { useMaxWidthObserver } from './use-max-width-observer';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = Object.fromEntries(\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\n\t\t)\n\t);\n\n\timageProps.url =\n\t\timage?.sizes?.[ size ]?.url ||\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated the specified image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} size\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasSize( image, size ) {\n\treturn (\n\t\t'url' in ( image?.sizes?.[ size ] ?? {} ) ||\n\t\t'source_url' in ( image?.media_details?.sizes?.[ size ] ?? {} )\n\t);\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected: isSingleSelected,\n\tclassName,\n\tinsertBlocksAfter,\n\tonReplace,\n\tcontext,\n\tclientId,\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst {\n\t\turl = '',\n\t\tcaption,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t\taspectRatio,\n\t\tscale,\n\t\talign,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tconst containerRef = useRef();\n\t// Only observe the max width from the parent container when the parent layout is not flex nor grid.\n\t// This won't work for them because the container width changes with the image.\n\t// TODO: Find a way to observe the container width for flex and grid layouts.\n\tconst layoutType = parentLayout?.type || parentLayout?.default?.type;\n\tconst isMaxWidthContainerWidth =\n\t\t! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );\n\tconst [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();\n\n\tconst [ placeholderResizeListener, { width: placeholderWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst isSmallContainer = placeholderWidth && placeholderWidth < 160;\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( [ 'wide', 'full' ].includes( align ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ __unstableMarkNextChangeAsNotPersistent, align, setAttributes ] );\n\n\tconst {\n\t\tgetSettings,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tblob: undefined,\n\t\t} );\n\t}\n\n\tfunction onFilesPreUpload( files ) {\n\t\tif ( files.length === 1 ) {\n\t\t\tsetTemporaryURL( createBlobURL( files[ 0 ] ) );\n\t\t}\n\t}\n\n\tfunction onSelectImagesList( images ) {\n\t\tconst win = containerRef.current?.ownerDocument.defaultView;\n\n\t\tif ( images.every( ( file ) => file instanceof win.File ) ) {\n\t\t\t/** @type {File[]} */\n\t\t\tconst files = images;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif ( files.some( ( file ) => ! isValidFileType( file ) ) ) {\n\t\t\t\t// Copied from the same notice in the gallery block.\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'If uploading to a gallery all files need to be image formats'\n\t\t\t\t\t),\n\t\t\t\t\t{ id: 'gallery-upload-invalid-file', type: 'snackbar' }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imageBlocks = files\n\t\t\t\t.filter( ( file ) => isValidFileType( file ) )\n\t\t\t\t.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\tif ( getBlockName( rootClientId ) === 'core/gallery' ) {\n\t\t\t\treplaceBlock( clientId, imageBlocks );\n\t\t\t} else if ( canInsertBlockType( 'core/gallery', rootClientId ) ) {\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{},\n\t\t\t\t\timageBlocks\n\t\t\t\t);\n\n\t\t\t\treplaceBlock( clientId, galleryBlock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( Array.isArray( media ) ) {\n\t\t\tonSelectImagesList( media );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t// Try to use the previous selected image size if its available\n\t\t// otherwise try the default image size or fallback to \"full\"\n\t\tlet newSize = DEFAULT_MEDIA_SIZE_SLUG;\n\t\tif ( sizeSlug && hasSize( media, sizeSlug ) ) {\n\t\t\tnewSize = sizeSlug;\n\t\t} else if ( hasSize( media, imageDefaultSize ) ) {\n\t\t\tnewSize = imageDefaultSize;\n\t\t}\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, newSize );\n\n\t\t// Normalize newline characters in caption to <br />\n\t\t// to preserve line breaks in both editor and frontend.\n\t\tif (\n\t\t\ttypeof mediaAttributes.caption === 'string' &&\n\t\t\tmediaAttributes.caption.includes( '\\n' )\n\t\t) {\n\t\t\tmediaAttributes.caption = mediaAttributes.caption.replace(\n\t\t\t\t/\\n/g,\n\t\t\t\t'<br>'\n\t\t\t);\n\t\t}\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! mediaAttributes.caption ) {\n\t\t\tconst { caption: omittedCaption, ...restMediaAttributes } =\n\t\t\t\tmediaAttributes;\n\t\t\tmediaAttributes = restMediaAttributes;\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\tsizeSlug: newSize,\n\t\t\t};\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\tswitch (\n\t\t\t\twindow?.wp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\t// Handle URLs without protocol.\n\t\tconst normalizedNewURL = getProtocol( newURL )\n\t\t\t? newURL\n\t\t\t: prependHTTPS( newURL );\n\t\tif ( normalizedNewURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\tblob: undefined,\n\t\t\t\turl: normalizedNewURL,\n\t\t\t\tid: undefined,\n\t\t\t\tsizeSlug: getSettings().imageDefaultSize,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectImage,\n\t\tonError: onUploadError,\n\t} );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\n\tconst isSideloading = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\t( ! window.__clientSideMediaProcessing &&\n\t\t\t\t\t! window.__heicUploadSupport ) ||\n\t\t\t\t! id\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( uploadStore ).isUploadingById( id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName=\"edit-image-preview\"\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL || isSideloading,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: containerRef,\n\t\tclassName: classes,\n\t} );\n\n\t// Much of this description is duplicated from MediaPlaceholder.\n\tconst { lockUrlControls = false, lockUrlControlsMessage } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockUrlControlsMessage: blockBindingsSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\tblockBindingsSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSingleSelected, metadata?.bindings?.url ]\n\t);\n\t// `height: 'auto'` is not a pinned dimension (it lets the height follow the\n\t// aspect ratio, e.g. for an image pasted with both width and height). Treat\n\t// it as absent so the placeholder box keeps its aspect ratio and pinned\n\t// width instead of collapsing to a 100%×100% fill.\n\tconst pinnedHeight = height === 'auto' ? undefined : height;\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx( 'block-editor-media-placeholder', {\n\t\t\t\t\t[ borderProps.className ]:\n\t\t\t\t\t\t!! borderProps.className && ! isSingleSelected,\n\t\t\t\t} ) }\n\t\t\t\ticon={\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t( lockUrlControls ? pluginsIcon : icon )\n\t\t\t\t}\n\t\t\t\twithIllustration={ ! isSingleSelected || isSmallContainer }\n\t\t\t\tlabel={ ! isSmallContainer && __( 'Image' ) }\n\t\t\t\tinstructions={\n\t\t\t\t\t! lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! ( width && pinnedHeight ) && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\twidth: pinnedHeight && aspectRatio ? '100%' : width,\n\t\t\t\t\theight: width && aspectRatio ? '100%' : pinnedHeight,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\tlockUrlControlsMessage }\n\n\t\t\t\t{ ! lockUrlControls && ! isSmallContainer && content }\n\t\t\t\t{ placeholderResizeListener }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tisSideloading={ isSideloading }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSingleSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\t\tparentLayoutType={ layoutType }\n\t\t\t\t\tmaxContentWidth={ maxContentWidth }\n\t\t\t\t/>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonFilesPreUpload={ onFilesPreUpload }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\thandleUpload={ ( files ) => files.length === 1 }\n\t\t\t\t\tvalue={ { id, src } }\n\t\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{\n\t\t\t\t// The listener cannot be placed as the first element as it will break the in-between inserter.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/blob/71134165868298fc15e22896d0c28b41b3755ff7/packages/block-editor/src/components/block-list/use-in-between-inserter.js#L120\n\t\t\t\tisSingleSelected && isMaxWidthContainerWidth && maxWidthObserver\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default ImageEdit;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,WAAW,qBAAqB;AACzC,SAAS,aAAa,8BAA8B;AACpD,SAAS,mBAAmB;AAC5B,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,gCAAgC;AAAA,EAChC,2CAA2C;AAAA,EAC3C;AAAA,OACM;AACP,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,MAAM,WAAW,mBAAmB;AACtD,SAAS,SAAS,oBAAoB;AACtC,SAAS,yBAAyB;AAClC,SAAS,aAAa,oBAAoB;AAC1C,SAAS,SAAS,mBAAmB;AAKrC,SAAS,iCAAiC;AAC1C,OAAO,WAAW;AAClB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AAKpC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAiUL,SAwGA,UAxGA,KA+DC,YA/DD;AA/TK,IAAM,yBAAyB,CAAE,OAAO,SAAU;AACxD,QAAM,aAAa,OAAO;AAAA,IACzB,OAAO,QAAS,SAAS,CAAC,CAAE,EAAE;AAAA,MAAQ,CAAE,CAAE,GAAI,MAC7C,CAAE,OAAO,MAAM,QAAQ,SAAU,EAAE,SAAU,GAAI;AAAA,IAClD;AAAA,EACD;AAEA,aAAW,MACV,OAAO,QAAS,IAAK,GAAG,OACxB,OAAO,eAAe,QAAS,IAAK,GA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