@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
package/src/image/image.js
CHANGED
|
@@ -64,6 +64,12 @@ import { isExternalImage } from './edit';
|
|
|
64
64
|
import { Caption } from '../utils/caption';
|
|
65
65
|
import { MediaControl } from '../utils/media-control';
|
|
66
66
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
67
|
+
import {
|
|
68
|
+
getActiveDimensionValue,
|
|
69
|
+
getDimensionResetAttributes,
|
|
70
|
+
getDimensionUpdateAttributes,
|
|
71
|
+
getStyleStateKey,
|
|
72
|
+
} from '../utils/style-state';
|
|
67
73
|
import { useOpenImageMediaEditorModal } from './use-open-image-media-editor-modal';
|
|
68
74
|
import {
|
|
69
75
|
MIN_SIZE,
|
|
@@ -73,9 +79,12 @@ import {
|
|
|
73
79
|
} from './constants';
|
|
74
80
|
import { evalAspectRatio, mediaPosition } from './utils';
|
|
75
81
|
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
const {
|
|
83
|
+
DimensionsTool,
|
|
84
|
+
isDefaultBlockStyleState,
|
|
85
|
+
ResolutionTool,
|
|
86
|
+
mediaEditKey,
|
|
87
|
+
} = unlock( blockEditorPrivateApis );
|
|
79
88
|
|
|
80
89
|
const scaleOptions = [
|
|
81
90
|
{
|
|
@@ -227,7 +236,6 @@ function ContentOnlyControls( {
|
|
|
227
236
|
>
|
|
228
237
|
<div className="wp-block-image__toolbar_content_textarea__container">
|
|
229
238
|
<TextControl
|
|
230
|
-
__next40pxDefaultSize
|
|
231
239
|
className="wp-block-image__toolbar_content_textarea"
|
|
232
240
|
label={ __( 'Title attribute' ) }
|
|
233
241
|
value={ attributes.title || '' }
|
|
@@ -644,7 +652,8 @@ export default function Image( {
|
|
|
644
652
|
isSingleSelected &&
|
|
645
653
|
canEditImage &&
|
|
646
654
|
! isEditingImage &&
|
|
647
|
-
! isContentOnlyMode
|
|
655
|
+
! isContentOnlyMode &&
|
|
656
|
+
! isUploading;
|
|
648
657
|
|
|
649
658
|
function switchToCover() {
|
|
650
659
|
replaceBlocks(
|
|
@@ -673,14 +682,67 @@ export default function Image( {
|
|
|
673
682
|
|
|
674
683
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
675
684
|
|
|
685
|
+
const selectedStyleState = useSelect(
|
|
686
|
+
( select ) => {
|
|
687
|
+
if ( ! isSingleSelected ) {
|
|
688
|
+
return undefined;
|
|
689
|
+
}
|
|
690
|
+
const { getSelectedBlockStyleState } = unlock(
|
|
691
|
+
select( blockEditorStore )
|
|
692
|
+
);
|
|
693
|
+
return getSelectedBlockStyleState( clientId );
|
|
694
|
+
},
|
|
695
|
+
[ clientId, isSingleSelected ]
|
|
696
|
+
);
|
|
697
|
+
const hasSelectedStyleState =
|
|
698
|
+
! isDefaultBlockStyleState( selectedStyleState );
|
|
699
|
+
const selectedStyleStateKey = getStyleStateKey( selectedStyleState );
|
|
700
|
+
const activeWidth = getActiveDimensionValue( {
|
|
701
|
+
attributes,
|
|
702
|
+
selectedState: selectedStyleState,
|
|
703
|
+
hasSelectedStyleState,
|
|
704
|
+
attributeKey: 'width',
|
|
705
|
+
} );
|
|
706
|
+
const activeHeight = getActiveDimensionValue( {
|
|
707
|
+
attributes,
|
|
708
|
+
selectedState: selectedStyleState,
|
|
709
|
+
hasSelectedStyleState,
|
|
710
|
+
attributeKey: 'height',
|
|
711
|
+
} );
|
|
712
|
+
const activeAspectRatio = getActiveDimensionValue( {
|
|
713
|
+
attributes,
|
|
714
|
+
selectedState: selectedStyleState,
|
|
715
|
+
hasSelectedStyleState,
|
|
716
|
+
attributeKey: 'aspectRatio',
|
|
717
|
+
} );
|
|
718
|
+
const activeScale = getActiveDimensionValue( {
|
|
719
|
+
attributes,
|
|
720
|
+
selectedState: selectedStyleState,
|
|
721
|
+
hasSelectedStyleState,
|
|
722
|
+
attributeKey: 'scale',
|
|
723
|
+
styleKey: 'objectFit',
|
|
724
|
+
} );
|
|
725
|
+
const setDimensionAttributes = ( nextDimensions ) => {
|
|
726
|
+
setAttributes(
|
|
727
|
+
getDimensionUpdateAttributes( {
|
|
728
|
+
style: attributes.style,
|
|
729
|
+
selectedState: selectedStyleState,
|
|
730
|
+
hasSelectedStyleState,
|
|
731
|
+
nextDimensions,
|
|
732
|
+
dimensionKeyMap: { scale: 'objectFit' },
|
|
733
|
+
} )
|
|
734
|
+
);
|
|
735
|
+
};
|
|
736
|
+
|
|
676
737
|
const dimensionsControl =
|
|
677
738
|
showDimensionsControls &&
|
|
678
739
|
( SIZED_LAYOUTS.includes( parentLayoutType ) ? (
|
|
679
740
|
<DimensionsTool
|
|
741
|
+
key={ selectedStyleStateKey }
|
|
680
742
|
panelId={ clientId }
|
|
681
|
-
value={ { aspectRatio } }
|
|
743
|
+
value={ { aspectRatio: activeAspectRatio, scale: activeScale } }
|
|
682
744
|
onChange={ ( { aspectRatio: newAspectRatio } ) => {
|
|
683
|
-
|
|
745
|
+
setDimensionAttributes( {
|
|
684
746
|
aspectRatio: newAspectRatio,
|
|
685
747
|
scale: 'cover',
|
|
686
748
|
} );
|
|
@@ -690,26 +752,29 @@ export default function Image( {
|
|
|
690
752
|
/>
|
|
691
753
|
) : (
|
|
692
754
|
<DimensionsTool
|
|
755
|
+
key={ selectedStyleStateKey }
|
|
693
756
|
panelId={ clientId }
|
|
694
|
-
value={ {
|
|
757
|
+
value={ {
|
|
758
|
+
width: activeWidth,
|
|
759
|
+
height: activeHeight,
|
|
760
|
+
scale: activeScale,
|
|
761
|
+
aspectRatio: activeAspectRatio,
|
|
762
|
+
} }
|
|
695
763
|
onChange={ ( {
|
|
696
764
|
width: newWidth,
|
|
697
765
|
height: newHeight,
|
|
698
766
|
scale: newScale,
|
|
699
767
|
aspectRatio: newAspectRatio,
|
|
700
768
|
} ) => {
|
|
701
|
-
|
|
702
|
-
// for values that are removed since setAttributes
|
|
703
|
-
// doesn't do anything with keys that aren't set.
|
|
704
|
-
setAttributes( {
|
|
769
|
+
setDimensionAttributes( {
|
|
705
770
|
// CSS includes `height: auto`, but we need
|
|
706
771
|
// `width: auto` to fix the aspect ratio when
|
|
707
772
|
// only height is set due to the width and
|
|
708
773
|
// height attributes set via the server.
|
|
709
774
|
width: ! newWidth && newHeight ? 'auto' : newWidth,
|
|
710
775
|
height: newHeight,
|
|
711
|
-
scale: newScale,
|
|
712
776
|
aspectRatio: newAspectRatio,
|
|
777
|
+
scale: newScale,
|
|
713
778
|
} );
|
|
714
779
|
} }
|
|
715
780
|
defaultScale="cover"
|
|
@@ -742,14 +807,11 @@ export default function Image( {
|
|
|
742
807
|
lockTitleControls = false,
|
|
743
808
|
lockTitleControlsMessage,
|
|
744
809
|
hideCaptionControls = false,
|
|
745
|
-
hasSelectedStyleState = false,
|
|
746
810
|
} = useSelect(
|
|
747
811
|
( select ) => {
|
|
748
812
|
if ( ! isSingleSelected ) {
|
|
749
813
|
return {};
|
|
750
814
|
}
|
|
751
|
-
const { hasSelectedStyleState: hasSelectedBlockStyleState } =
|
|
752
|
-
unlock( select( blockEditorStore ) );
|
|
753
815
|
const {
|
|
754
816
|
url: urlBinding,
|
|
755
817
|
alt: altBinding,
|
|
@@ -767,7 +829,6 @@ export default function Image( {
|
|
|
767
829
|
titleBinding?.source
|
|
768
830
|
);
|
|
769
831
|
return {
|
|
770
|
-
hasSelectedStyleState: hasSelectedBlockStyleState( clientId ),
|
|
771
832
|
lockUrlControls:
|
|
772
833
|
!! urlBinding &&
|
|
773
834
|
! urlBindingSource?.canUserEditValue?.( {
|
|
@@ -812,7 +873,6 @@ export default function Image( {
|
|
|
812
873
|
},
|
|
813
874
|
[
|
|
814
875
|
arePatternOverridesEnabled,
|
|
815
|
-
clientId,
|
|
816
876
|
context,
|
|
817
877
|
isSingleSelected,
|
|
818
878
|
metadata?.bindings,
|
|
@@ -1018,47 +1078,52 @@ export default function Image( {
|
|
|
1018
1078
|
</ToolsPanel>
|
|
1019
1079
|
</InspectorControls>
|
|
1020
1080
|
) }
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1081
|
+
<InspectorControls
|
|
1082
|
+
group="dimensions"
|
|
1083
|
+
resetAllFilter={ ( attrs ) => {
|
|
1084
|
+
return getDimensionResetAttributes( {
|
|
1085
|
+
attributes: attrs,
|
|
1086
|
+
selectedState: selectedStyleState,
|
|
1087
|
+
hasSelectedStyleState,
|
|
1088
|
+
keys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],
|
|
1089
|
+
defaultAttributes: {
|
|
1090
|
+
aspectRatio: undefined,
|
|
1091
|
+
width: undefined,
|
|
1092
|
+
height: undefined,
|
|
1093
|
+
scale: undefined,
|
|
1094
|
+
focalPoint: undefined,
|
|
1095
|
+
},
|
|
1096
|
+
} );
|
|
1097
|
+
} }
|
|
1098
|
+
>
|
|
1099
|
+
{ dimensionsControl }
|
|
1100
|
+
{ ! hasSelectedStyleState && url && scale && (
|
|
1101
|
+
<ToolsPanelItem
|
|
1102
|
+
label={ __( 'Focal point' ) }
|
|
1103
|
+
isShownByDefault
|
|
1104
|
+
hasValue={ () => !! focalPoint }
|
|
1105
|
+
onDeselect={ () =>
|
|
1106
|
+
setAttributes( {
|
|
1107
|
+
focalPoint: undefined,
|
|
1108
|
+
} )
|
|
1109
|
+
}
|
|
1110
|
+
panelId={ clientId }
|
|
1111
|
+
>
|
|
1112
|
+
<FocalPointPicker
|
|
1036
1113
|
label={ __( 'Focal point' ) }
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1114
|
+
url={ url }
|
|
1115
|
+
value={ focalPoint }
|
|
1116
|
+
onDragStart={ imperativeFocalPointPreview }
|
|
1117
|
+
onDrag={ imperativeFocalPointPreview }
|
|
1118
|
+
onChange={ ( newFocalPoint ) =>
|
|
1040
1119
|
setAttributes( {
|
|
1041
|
-
focalPoint:
|
|
1120
|
+
focalPoint: newFocalPoint,
|
|
1042
1121
|
} )
|
|
1043
1122
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
url={ url }
|
|
1049
|
-
value={ focalPoint }
|
|
1050
|
-
onDragStart={ imperativeFocalPointPreview }
|
|
1051
|
-
onDrag={ imperativeFocalPointPreview }
|
|
1052
|
-
onChange={ ( newFocalPoint ) =>
|
|
1053
|
-
setAttributes( {
|
|
1054
|
-
focalPoint: newFocalPoint,
|
|
1055
|
-
} )
|
|
1056
|
-
}
|
|
1057
|
-
/>
|
|
1058
|
-
</ToolsPanelItem>
|
|
1059
|
-
) }
|
|
1060
|
-
</InspectorControls>
|
|
1061
|
-
) }
|
|
1123
|
+
/>
|
|
1124
|
+
</ToolsPanelItem>
|
|
1125
|
+
) }
|
|
1126
|
+
</InspectorControls>
|
|
1062
1127
|
{ !! imageSizeOptions.length && (
|
|
1063
1128
|
<InspectorControls>
|
|
1064
1129
|
<ToolsPanel
|
|
@@ -1077,7 +1142,6 @@ export default function Image( {
|
|
|
1077
1142
|
) }
|
|
1078
1143
|
<InspectorControls group="advanced">
|
|
1079
1144
|
<TextControl
|
|
1080
|
-
__next40pxDefaultSize
|
|
1081
1145
|
label={ __( 'Title attribute' ) }
|
|
1082
1146
|
value={ title || '' }
|
|
1083
1147
|
onChange={ onSetTitle }
|
package/src/image/index.php
CHANGED
|
@@ -390,7 +390,6 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
390
390
|
data-wp-bind--style="state.imgStyles"
|
|
391
391
|
data-wp-bind--src="state.enlargedSrc"
|
|
392
392
|
data-wp-bind--srcset="state.enlargedSrcset"
|
|
393
|
-
data-wp-bind--srcset="state.enlargedSrcset"
|
|
394
393
|
sizes="100vw"
|
|
395
394
|
>
|
|
396
395
|
</figure>
|
|
@@ -45,8 +45,7 @@ jest.mock( '../../lock-unlock', () => ( {
|
|
|
45
45
|
|
|
46
46
|
function createRegistry( {
|
|
47
47
|
getEditedEntityRecord = () => false,
|
|
48
|
-
|
|
49
|
-
resolveGetEntityRecord = getEntityRecord,
|
|
48
|
+
resolveGetEntityRecord = () => undefined,
|
|
50
49
|
} = {} ) {
|
|
51
50
|
const actions = {
|
|
52
51
|
invalidateResolution: jest.fn(),
|
|
@@ -54,7 +53,6 @@ function createRegistry( {
|
|
|
54
53
|
return {
|
|
55
54
|
select: jest.fn( () => ( {
|
|
56
55
|
getEditedEntityRecord,
|
|
57
|
-
getEntityRecord,
|
|
58
56
|
} ) ),
|
|
59
57
|
dispatch: jest.fn( () => actions ),
|
|
60
58
|
resolveSelect: jest.fn( () => ( {
|
|
@@ -169,11 +167,8 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
169
167
|
caption: 'Original caption',
|
|
170
168
|
},
|
|
171
169
|
registryOptions: {
|
|
172
|
-
|
|
173
|
-
resolveGetEntityRecord: (
|
|
174
|
-
query?.context === 'edit'
|
|
175
|
-
? updatedAttachment
|
|
176
|
-
: originalAttachment,
|
|
170
|
+
getEditedEntityRecord: () => originalAttachment,
|
|
171
|
+
resolveGetEntityRecord: () => updatedAttachment,
|
|
177
172
|
},
|
|
178
173
|
} );
|
|
179
174
|
|
|
@@ -181,13 +176,15 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
181
176
|
alt: 'Updated alt',
|
|
182
177
|
caption: 'Updated caption',
|
|
183
178
|
} );
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
// A single, query-less resolution is invalidated: the hook reads,
|
|
180
|
+
// resolves, and invalidates the attachment through the entity's default
|
|
181
|
+
// (edit) context rather than an explicitly-keyed query.
|
|
182
|
+
expect( registry.actions.invalidateResolution ).toHaveBeenCalledTimes(
|
|
183
|
+
1
|
|
187
184
|
);
|
|
188
185
|
expect( registry.actions.invalidateResolution ).toHaveBeenCalledWith(
|
|
189
186
|
'getEntityRecord',
|
|
190
|
-
[ 'postType', 'attachment', 1
|
|
187
|
+
[ 'postType', 'attachment', 1 ]
|
|
191
188
|
);
|
|
192
189
|
} );
|
|
193
190
|
|
|
@@ -220,8 +217,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
220
217
|
1,
|
|
221
218
|
'postType',
|
|
222
219
|
'attachment',
|
|
223
|
-
1
|
|
224
|
-
{ context: 'edit' }
|
|
220
|
+
1
|
|
225
221
|
);
|
|
226
222
|
expect( openMediaEditorModal ).toHaveBeenCalledWith( {
|
|
227
223
|
id: 1,
|
|
@@ -263,8 +259,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
263
259
|
1,
|
|
264
260
|
'postType',
|
|
265
261
|
'attachment',
|
|
266
|
-
1
|
|
267
|
-
{ context: 'edit' }
|
|
262
|
+
1
|
|
268
263
|
);
|
|
269
264
|
expect( openMediaEditorModal ).toHaveBeenCalledWith( {
|
|
270
265
|
id: 1,
|
|
@@ -299,7 +294,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
299
294
|
caption: undefined,
|
|
300
295
|
},
|
|
301
296
|
registryOptions: {
|
|
302
|
-
|
|
297
|
+
getEditedEntityRecord: () => ( {
|
|
303
298
|
id: 1,
|
|
304
299
|
alt_text: '',
|
|
305
300
|
caption: {
|
|
@@ -314,8 +309,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
314
309
|
1,
|
|
315
310
|
'postType',
|
|
316
311
|
'attachment',
|
|
317
|
-
1
|
|
318
|
-
{ context: 'edit' }
|
|
312
|
+
1
|
|
319
313
|
);
|
|
320
314
|
expect( setAttributes ).toHaveBeenCalledWith( {
|
|
321
315
|
caption: 'Updated attachment caption',
|
|
@@ -341,7 +335,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
341
335
|
caption: '',
|
|
342
336
|
},
|
|
343
337
|
registryOptions: {
|
|
344
|
-
|
|
338
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
345
339
|
attachmentId === 1 ? originalAttachment : undefined,
|
|
346
340
|
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
347
341
|
attachmentId === 2 ? updatedAttachment : undefined,
|
|
@@ -371,7 +365,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
371
365
|
};
|
|
372
366
|
const deferredAttachment = createDeferred();
|
|
373
367
|
const registry = createRegistry( {
|
|
374
|
-
|
|
368
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
375
369
|
attachmentId === 1 ? originalAttachment : undefined,
|
|
376
370
|
resolveGetEntityRecord: ( kind, name, attachmentId ) =>
|
|
377
371
|
attachmentId === 2 ? deferredAttachment.promise : undefined,
|
|
@@ -437,7 +431,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
437
431
|
caption: '',
|
|
438
432
|
},
|
|
439
433
|
registryOptions: {
|
|
440
|
-
|
|
434
|
+
getEditedEntityRecord: ( kind, name, attachmentId ) =>
|
|
441
435
|
attachmentId === 1
|
|
442
436
|
? originalAttachment
|
|
443
437
|
: {
|
|
@@ -469,7 +463,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
469
463
|
caption: undefined,
|
|
470
464
|
},
|
|
471
465
|
registryOptions: {
|
|
472
|
-
|
|
466
|
+
getEditedEntityRecord: () => ( {
|
|
473
467
|
id: 1,
|
|
474
468
|
alt_text: '',
|
|
475
469
|
caption: { raw: 'Existing caption' },
|
|
@@ -526,7 +520,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
526
520
|
caption: undefined,
|
|
527
521
|
},
|
|
528
522
|
registryOptions: {
|
|
529
|
-
|
|
523
|
+
getEditedEntityRecord: () => ( {
|
|
530
524
|
id: 1,
|
|
531
525
|
alt_text: 'Original alt',
|
|
532
526
|
caption: { raw: 'Existing caption' },
|
|
@@ -556,7 +550,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
556
550
|
caption: { toString: () => '' },
|
|
557
551
|
},
|
|
558
552
|
registryOptions: {
|
|
559
|
-
|
|
553
|
+
getEditedEntityRecord: () => ( {
|
|
560
554
|
id: 1,
|
|
561
555
|
alt_text: 'Original alt',
|
|
562
556
|
caption: { raw: 'Existing caption' },
|
|
@@ -603,7 +597,7 @@ describe( 'useOpenImageMediaEditorModal', () => {
|
|
|
603
597
|
};
|
|
604
598
|
const deferredAttachment = createDeferred();
|
|
605
599
|
const registry = createRegistry( {
|
|
606
|
-
|
|
600
|
+
getEditedEntityRecord: () => ( {
|
|
607
601
|
id: 1,
|
|
608
602
|
alt_text: '',
|
|
609
603
|
caption: { raw: '' },
|
package/src/image/transforms.js
CHANGED
|
@@ -52,10 +52,10 @@ const imageSchema = {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
55
|
+
// Normalise an `<img>` pixel dimension attribute to the `<value>px` form the
|
|
56
|
+
// Image block stores in its `width`/`height` attributes. Non-integer values
|
|
57
|
+
// (e.g. `50%`) are dropped because the attribute round-trips through inline
|
|
58
|
+
// styles that expect pixel units.
|
|
59
59
|
function parsePixelDimension( value ) {
|
|
60
60
|
return value && /^\d+$/.test( value ) ? `${ value }px` : undefined;
|
|
61
61
|
}
|
|
@@ -114,14 +114,39 @@ const transforms = {
|
|
|
114
114
|
anchorElement && anchorElement.className
|
|
115
115
|
? anchorElement.className
|
|
116
116
|
: undefined;
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
117
|
+
// Pin only one dimension and let the other follow the aspect
|
|
118
|
+
// ratio via `auto`. Pinning both as fixed pixels stretches the
|
|
119
|
+
// image when a theme caps the width while the height stays
|
|
120
|
+
// fixed. So width sources use `height: 'auto'`; height-only
|
|
121
|
+
// sources use `width: 'auto'`.
|
|
122
|
+
const widthValue = parsePixelDimension(
|
|
120
123
|
img.getAttribute( 'width' )
|
|
121
124
|
);
|
|
122
|
-
const
|
|
125
|
+
const heightValue = parsePixelDimension(
|
|
123
126
|
img.getAttribute( 'height' )
|
|
124
127
|
);
|
|
128
|
+
// When both dimensions are declared, preserve the source's
|
|
129
|
+
// shape via `aspectRatio` (mirroring the resize handle). CSS
|
|
130
|
+
// `aspect-ratio` needs no fixed dimensions, so the image keeps
|
|
131
|
+
// its proportions even when the `src` can't resolve to natural
|
|
132
|
+
// dimensions (e.g. an empty or blob `src`) — without it the
|
|
133
|
+
// `height: 'auto'` would collapse to `0`.
|
|
134
|
+
// `parseInt` is `NaN` for an absent dimension and `0` for a
|
|
135
|
+
// zero one (both falsy), so a bogus ratio is never stored.
|
|
136
|
+
const widthNumber = parseInt( widthValue, 10 );
|
|
137
|
+
const heightNumber = parseInt( heightValue, 10 );
|
|
138
|
+
const aspectRatio =
|
|
139
|
+
widthNumber && heightNumber
|
|
140
|
+
? String( widthNumber / heightNumber )
|
|
141
|
+
: undefined;
|
|
142
|
+
// A height-only source declares a single dimension, so it can't
|
|
143
|
+
// carry an aspect ratio: `width: 'auto'` is capped by
|
|
144
|
+
// `max-width: 100%` while the fixed height can still stretch a
|
|
145
|
+
// wide source. This is a known edge case (a panoramic image
|
|
146
|
+
// pinned by height only) left unsolved here.
|
|
147
|
+
const width =
|
|
148
|
+
widthValue || ( heightValue ? 'auto' : undefined );
|
|
149
|
+
const height = widthValue ? 'auto' : heightValue;
|
|
125
150
|
const attributes = getBlockAttributes(
|
|
126
151
|
'core/image',
|
|
127
152
|
node.outerHTML,
|
|
@@ -135,6 +160,7 @@ const transforms = {
|
|
|
135
160
|
anchor,
|
|
136
161
|
width,
|
|
137
162
|
height,
|
|
163
|
+
aspectRatio,
|
|
138
164
|
}
|
|
139
165
|
);
|
|
140
166
|
|
|
@@ -104,9 +104,6 @@ export function getSyncedImageBlockAttributes(
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );
|
|
107
|
-
// Caption sync needs `caption.raw`; view/default attachment records can contain
|
|
108
|
-
// only rendered caption data or be tied to an in-flight stale resolution.
|
|
109
|
-
const ATTACHMENT_EDIT_QUERY = { context: 'edit' };
|
|
110
107
|
|
|
111
108
|
function getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {
|
|
112
109
|
const attachment = {};
|
|
@@ -177,25 +174,23 @@ export function useOpenImageMediaEditorModal( {
|
|
|
177
174
|
};
|
|
178
175
|
}, [ alt, caption, id, url ] );
|
|
179
176
|
|
|
177
|
+
// Reads the cached attachment record. The `attachment` postType entity
|
|
178
|
+
// fetches with `context: 'edit'` by default, so `getEditedEntityRecord`
|
|
179
|
+
// returns the edit-context record — carrying `caption` as `{ raw }` and a
|
|
180
|
+
// usable `alt_text` — without us specifying a context. It is resolver-
|
|
181
|
+
// backed, so on a cold cache this also kicks off the fetch and returns a
|
|
182
|
+
// falsy value synchronously; that resolution shares its cache key with the
|
|
183
|
+
// `resolveAttachmentRecord` call below (both keyed on the no-query
|
|
184
|
+
// `getEntityRecord`), so the two dedupe into a single request.
|
|
180
185
|
const getCachedAttachmentRecord = useCallback(
|
|
181
|
-
( attachmentId ) =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
getEditedEntityRecord(
|
|
186
|
+
( attachmentId ) =>
|
|
187
|
+
registry
|
|
188
|
+
.select( coreStore )
|
|
189
|
+
.getEditedEntityRecord(
|
|
186
190
|
'postType',
|
|
187
191
|
'attachment',
|
|
188
192
|
attachmentId
|
|
189
|
-
)
|
|
190
|
-
getEntityRecord(
|
|
191
|
-
'postType',
|
|
192
|
-
'attachment',
|
|
193
|
-
attachmentId,
|
|
194
|
-
ATTACHMENT_EDIT_QUERY
|
|
195
|
-
) ||
|
|
196
|
-
getEntityRecord( 'postType', 'attachment', attachmentId )
|
|
197
|
-
);
|
|
198
|
-
},
|
|
193
|
+
),
|
|
199
194
|
[ registry ]
|
|
200
195
|
);
|
|
201
196
|
|
|
@@ -204,18 +199,10 @@ export function useOpenImageMediaEditorModal( {
|
|
|
204
199
|
const resolveSelect = registry.resolveSelect( coreStore );
|
|
205
200
|
|
|
206
201
|
try {
|
|
207
|
-
return (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
attachmentId,
|
|
212
|
-
ATTACHMENT_EDIT_QUERY
|
|
213
|
-
) ) ||
|
|
214
|
-
( await resolveSelect.getEntityRecord(
|
|
215
|
-
'postType',
|
|
216
|
-
'attachment',
|
|
217
|
-
attachmentId
|
|
218
|
-
) )
|
|
202
|
+
return await resolveSelect.getEntityRecord(
|
|
203
|
+
'postType',
|
|
204
|
+
'attachment',
|
|
205
|
+
attachmentId
|
|
219
206
|
);
|
|
220
207
|
} catch {
|
|
221
208
|
return undefined;
|
|
@@ -226,8 +213,9 @@ export function useOpenImageMediaEditorModal( {
|
|
|
226
213
|
|
|
227
214
|
const resolveFreshAttachmentRecord = useCallback(
|
|
228
215
|
async ( attachmentId ) => {
|
|
229
|
-
//
|
|
230
|
-
// server state that reflects the media editor's
|
|
216
|
+
// Invalidate the cached resolution so resolveAttachmentRecord
|
|
217
|
+
// re-fetches the server state that reflects the media editor's
|
|
218
|
+
// saved changes.
|
|
231
219
|
const { invalidateResolution } = registry.dispatch( coreStore );
|
|
232
220
|
|
|
233
221
|
invalidateResolution( 'getEntityRecord', [
|
|
@@ -235,12 +223,6 @@ export function useOpenImageMediaEditorModal( {
|
|
|
235
223
|
'attachment',
|
|
236
224
|
attachmentId,
|
|
237
225
|
] );
|
|
238
|
-
invalidateResolution( 'getEntityRecord', [
|
|
239
|
-
'postType',
|
|
240
|
-
'attachment',
|
|
241
|
-
attachmentId,
|
|
242
|
-
ATTACHMENT_EDIT_QUERY,
|
|
243
|
-
] );
|
|
244
226
|
return resolveAttachmentRecord( attachmentId );
|
|
245
227
|
},
|
|
246
228
|
[ registry, resolveAttachmentRecord ]
|
|
@@ -321,10 +303,10 @@ export function useOpenImageMediaEditorModal( {
|
|
|
321
303
|
}
|
|
322
304
|
|
|
323
305
|
// Snapshot the attachment's current metadata before the user makes
|
|
324
|
-
// any changes so handleMediaUpdate can compare against it later.
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
// the block's own attributes
|
|
306
|
+
// any changes so handleMediaUpdate can compare against it later. Use
|
|
307
|
+
// the cached record when it's already present; only resolve when
|
|
308
|
+
// nothing is cached yet, then fall back to a minimal object derived
|
|
309
|
+
// from the block's own attributes.
|
|
328
310
|
const cachedAttachmentRecord = getCachedAttachmentRecord( id );
|
|
329
311
|
const fallbackAttachmentRecord =
|
|
330
312
|
getAttachmentFallbackForEmptyBlockMetadata(
|
package/src/index.js
CHANGED
|
@@ -23,15 +23,10 @@ import HtmlRenderer from './utils/html-renderer';
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
// const experimentalBlock = null;
|
|
31
|
-
// This enables webpack to eliminate the experimental blocks code from the
|
|
32
|
-
// production build to make the final bundle smaller.
|
|
33
|
-
//
|
|
34
|
-
// See https://github.com/WordPress/gutenberg/pull/40655 for more context.
|
|
26
|
+
// Experimental blocks are only registered in the Gutenberg plugin (see
|
|
27
|
+
// `__experimentalRegisterExperimentalCoreBlocks`). `registerCoreBlocks`
|
|
28
|
+
// filters them out via `isBlockMetadataExperimental`, so they are never
|
|
29
|
+
// available in WordPress core regardless of what ends up in the bundle.
|
|
35
30
|
import * as accordion from './accordion';
|
|
36
31
|
import * as accordionItem from './accordion-item';
|
|
37
32
|
import * as accordionHeading from './accordion-heading';
|
|
@@ -135,7 +130,6 @@ import * as siteTitle from './site-title';
|
|
|
135
130
|
import * as socialLink from './social-link';
|
|
136
131
|
import * as socialLinks from './social-links';
|
|
137
132
|
import * as spacer from './spacer';
|
|
138
|
-
import * as tab from './tab';
|
|
139
133
|
import * as tabPanel from './tab-panel';
|
|
140
134
|
import * as tabPanels from './tab-panels';
|
|
141
135
|
import * as table from './table';
|
|
@@ -287,7 +281,6 @@ const getAllBlocks = () => {
|
|
|
287
281
|
}
|
|
288
282
|
|
|
289
283
|
if ( window?.__experimentalEnableBlockExperiments ) {
|
|
290
|
-
blocks.push( tab );
|
|
291
284
|
blocks.push( tabList );
|
|
292
285
|
blocks.push( tabs );
|
|
293
286
|
blocks.push( tabPanel );
|