@wordpress/block-library 9.6.1 → 9.7.1-next.5368f64a9.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 +2 -0
- package/build/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +2 -1
- package/build/audio/edit.js.map +1 -1
- package/build/block/edit.js +5 -8
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/index.js +1 -1
- package/build/categories/index.js +1 -0
- package/build/categories/index.js.map +1 -1
- package/build/comment-edit-link/index.js +13 -2
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +13 -2
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +1 -0
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/cover/deprecated.js +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +4 -2
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/index.js +6 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +4 -12
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/index.js +3 -1
- package/build/details/index.js.map +1 -1
- package/build/details/transforms.js +24 -0
- package/build/details/transforms.js.map +1 -0
- package/build/embed/edit.js +5 -11
- package/build/embed/edit.js.map +1 -1
- package/build/embed/embed-placeholder.js +2 -0
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/embed-preview.js +16 -4
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/edit.js +12 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/transforms.js +18 -4
- package/build/file/transforms.js.map +1 -1
- package/build/freeform/edit.js +4 -4
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/modal.js +3 -0
- package/build/freeform/modal.js.map +1 -1
- package/build/home-link/edit.js +3 -9
- package/build/home-link/edit.js.map +1 -1
- package/build/image/edit.js +95 -45
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +39 -24
- package/build/image/image.js.map +1 -1
- package/build/image/transforms.js +0 -13
- package/build/image/transforms.js.map +1 -1
- package/build/image/use-max-width-observer.js +35 -0
- package/build/image/use-max-width-observer.js.map +1 -0
- package/build/image/utils.js +11 -0
- package/build/image/utils.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/deprecated.js +144 -3
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +5 -5
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/image-fill.js +12 -0
- package/build/media-text/image-fill.js.map +1 -0
- package/build/media-text/media-container.js +21 -18
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js +0 -7
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +5 -6
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.js +3 -2
- package/build/missing/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +14 -7
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +1 -0
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +2 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +1 -0
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +2 -0
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation-link/link-ui.js +2 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +2 -0
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +4 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -0
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +6 -8
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -4
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-title/index.js +4 -1
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +3 -2
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -10
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +9 -3
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +2 -0
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/site-logo/edit.js +9 -13
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/index.js +4 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +4 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.js +10 -9
- package/build/social-links/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +10 -1
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/placeholder.js +2 -0
- package/build/template-part/edit/placeholder.js.map +1 -1
- package/build/utils/hooks.js +10 -10
- package/build/utils/hooks.js.map +1 -1
- package/build/video/edit.js +16 -12
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +3 -0
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/block/edit.js +6 -9
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/index.js +1 -1
- package/build-module/categories/index.js +1 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +13 -2
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +13 -2
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +1 -0
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/cover/deprecated.js +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +4 -2
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +6 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +5 -13
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/index.js +3 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/transforms.js +18 -0
- package/build-module/details/transforms.js.map +1 -0
- package/build-module/embed/edit.js +6 -12
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +2 -0
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/embed-preview.js +16 -4
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/file/edit.js +12 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/transforms.js +18 -4
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/freeform/edit.js +4 -4
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/modal.js +3 -0
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/home-link/edit.js +3 -9
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/image/edit.js +99 -48
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +40 -25
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/transforms.js +0 -13
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/use-max-width-observer.js +29 -0
- package/build-module/image/use-max-width-observer.js.map +1 -0
- package/build-module/image/utils.js +11 -1
- package/build-module/image/utils.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/deprecated.js +144 -3
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +5 -5
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/image-fill.js +6 -0
- package/build-module/media-text/image-fill.js.map +1 -0
- package/build-module/media-text/media-container.js +21 -17
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +0 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +5 -6
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.js +3 -2
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +15 -8
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -0
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +2 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +1 -0
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +2 -0
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +4 -3
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +2 -0
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +4 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +1 -0
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +6 -8
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +3 -5
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-title/index.js +4 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +3 -2
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -10
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -4
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +2 -0
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/site-logo/edit.js +10 -14
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/index.js +4 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +4 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.js +11 -10
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +10 -1
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +2 -0
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/utils/hooks.js +10 -10
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/edit.js +16 -13
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +3 -0
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/editor-rtl.css +0 -4
- package/build-style/button/editor.css +0 -4
- package/build-style/buttons/editor-rtl.css +2 -5
- package/build-style/buttons/editor.css +2 -5
- package/build-style/buttons/style-rtl.css +2 -2
- package/build-style/buttons/style.css +2 -2
- package/build-style/comment-edit-link/style-rtl.css +94 -0
- package/build-style/comment-edit-link/style.css +94 -0
- package/build-style/comment-reply-link/style-rtl.css +94 -0
- package/build-style/comment-reply-link/style.css +94 -0
- package/build-style/comments-pagination/editor-rtl.css +2 -2
- package/build-style/comments-pagination/editor.css +2 -2
- package/build-style/common-rtl.css +2 -2
- package/build-style/common.css +2 -2
- package/build-style/cover/editor-rtl.css +0 -6
- package/build-style/cover/editor.css +0 -6
- package/build-style/editor-rtl.css +35 -99
- package/build-style/editor.css +35 -101
- package/build-style/group/editor-rtl.css +0 -1
- package/build-style/group/editor.css +0 -1
- package/build-style/image/editor-rtl.css +6 -27
- package/build-style/image/editor.css +6 -27
- package/build-style/media-text/editor-rtl.css +3 -1
- package/build-style/media-text/editor.css +3 -1
- package/build-style/media-text/style-rtl.css +20 -0
- package/build-style/media-text/style.css +20 -0
- package/build-style/navigation/editor-rtl.css +1 -2
- package/build-style/navigation/editor.css +1 -2
- package/build-style/post-featured-image/style-rtl.css +1 -1
- package/build-style/post-featured-image/style.css +1 -1
- package/build-style/post-title/style-rtl.css +21 -0
- package/build-style/post-title/style.css +21 -0
- package/build-style/query-pagination/editor-rtl.css +2 -16
- package/build-style/query-pagination/editor.css +2 -18
- package/build-style/query-pagination/style-rtl.css +0 -11
- package/build-style/query-pagination/style.css +0 -13
- package/build-style/site-title/editor-rtl.css +0 -4
- package/build-style/site-title/editor.css +0 -4
- package/build-style/site-title/style-rtl.css +21 -0
- package/build-style/site-title/style.css +21 -0
- package/build-style/social-links/editor-rtl.css +17 -0
- package/build-style/social-links/editor.css +17 -0
- package/build-style/style-rtl.css +75 -16
- package/build-style/style.css +75 -18
- package/build-style/video/editor-rtl.css +0 -29
- package/build-style/video/editor.css +0 -29
- package/package.json +42 -35
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +1 -0
- package/src/block/edit.js +9 -11
- package/src/button/edit.js +1 -1
- package/src/button/editor.scss +0 -5
- package/src/buttons/block.json +1 -1
- package/src/buttons/editor.scss +2 -8
- package/src/buttons/style.scss +2 -2
- package/src/categories/block.json +1 -0
- package/src/categories/index.php +13 -2
- package/src/comment-edit-link/block.json +13 -2
- package/src/comment-edit-link/style.scss +4 -0
- package/src/comment-reply-link/block.json +13 -2
- package/src/comment-reply-link/style.scss +4 -0
- package/src/comments/edit/comments-legacy.js +1 -0
- package/src/comments-pagination/editor.scss +1 -1
- package/src/cover/deprecated.js +3 -2
- package/src/cover/edit/block-controls.js +2 -0
- package/src/cover/edit/index.js +6 -1
- package/src/cover/edit/inspector-controls.js +3 -15
- package/src/cover/editor.scss +0 -5
- package/src/cover/test/edit.js +30 -26
- package/src/details/index.js +2 -0
- package/src/details/transforms.js +26 -0
- package/src/embed/edit.js +0 -7
- package/src/embed/embed-placeholder.js +10 -2
- package/src/embed/embed-preview.js +22 -2
- package/src/file/edit.js +11 -0
- package/src/file/index.php +1 -1
- package/src/file/transforms.js +26 -6
- package/src/freeform/edit.js +4 -4
- package/src/freeform/editor.scss +1 -1
- package/src/freeform/modal.js +7 -1
- package/src/gallery/editor.scss +1 -1
- package/src/group/editor.scss +0 -1
- package/src/home-link/edit.js +4 -7
- package/src/image/edit.js +130 -47
- package/src/image/editor.scss +7 -41
- package/src/image/image.js +100 -67
- package/src/image/index.php +1 -1
- package/src/image/transforms.js +0 -23
- package/src/image/use-max-width-observer.js +32 -0
- package/src/image/utils.js +13 -1
- package/src/latest-posts/edit.js +1 -1
- package/src/media-text/deprecated.js +159 -3
- package/src/media-text/edit.js +5 -5
- package/src/media-text/editor.scss +3 -1
- package/src/media-text/image-fill.js +11 -0
- package/src/media-text/index.php +53 -43
- package/src/media-text/media-container.js +25 -25
- package/src/media-text/media-container.native.js +0 -2
- package/src/media-text/save.js +9 -13
- package/src/media-text/style.scss +21 -0
- package/src/media-text/test/image-fill.js +19 -0
- package/src/missing/edit.js +8 -3
- package/src/navigation/edit/deleted-navigation-warning.js +23 -13
- package/src/navigation/edit/index.js +1 -0
- package/src/navigation/edit/menu-inspector-controls.js +3 -1
- package/src/navigation/edit/navigation-menu-delete-control.js +1 -0
- package/src/navigation/edit/placeholder/index.js +1 -0
- package/src/navigation/edit/responsive-wrapper.js +2 -0
- package/src/navigation/edit/unsaved-inner-blocks.js +4 -4
- package/src/navigation/editor.scss +11 -4
- package/src/navigation/index.php +1 -1
- package/src/navigation-link/link-ui.js +4 -3
- package/src/page-list/convert-to-links-modal.js +6 -1
- package/src/page-list/edit.js +6 -1
- package/src/page-list/index.php +3 -1
- package/src/post-comments-form/form.js +1 -0
- package/src/post-featured-image/dimension-controls.js +4 -4
- package/src/post-featured-image/edit.js +3 -6
- package/src/post-featured-image/style.scss +1 -1
- package/src/post-title/block.json +4 -1
- package/src/post-title/style.scss +24 -0
- package/src/query/edit/enhanced-pagination-modal.js +7 -3
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -3
- package/src/query/edit/inspector-controls/index.js +2 -9
- package/src/query/edit/query-content.js +7 -0
- package/src/query/edit/query-placeholder.js +2 -0
- package/src/query/index.php +1 -1
- package/src/query-pagination/editor.scss +1 -21
- package/src/query-pagination/style.scss +0 -15
- package/src/search/index.php +1 -1
- package/src/site-logo/edit.js +11 -20
- package/src/site-title/block.json +4 -1
- package/src/site-title/editor.scss +0 -4
- package/src/site-title/style.scss +24 -0
- package/src/social-link/edit.js +2 -0
- package/src/social-links/edit.js +17 -10
- package/src/social-links/editor.scss +24 -5
- package/src/style.scss +2 -0
- package/src/tag-cloud/index.php +7 -2
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/index.js +12 -10
- package/src/template-part/edit/inner-blocks.js +20 -1
- package/src/template-part/edit/placeholder.js +6 -1
- package/src/utils/hooks.js +11 -11
- package/src/video/edit.js +24 -21
- package/src/video/editor.scss +0 -45
- package/src/video/tracks-editor.js +3 -0
- package/src/media-text/test/media-container.js +0 -24
package/src/image/editor.scss
CHANGED
|
@@ -1,47 +1,8 @@
|
|
|
1
1
|
// Provide special styling for the placeholder.
|
|
2
2
|
// @todo this particular minimal style of placeholder could be componentized further.
|
|
3
3
|
.wp-block-image.wp-block-image {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
&.is-selected .block-editor-media-placeholder {
|
|
7
|
-
// Block UI appearance.
|
|
8
|
-
color: $gray-900;
|
|
9
|
-
background-color: $white;
|
|
10
|
-
box-shadow: inset 0 0 0 $border-width $gray-900;
|
|
11
|
-
border: none;
|
|
12
|
-
|
|
13
|
-
// Disable any duotone filter applied in the selected state.
|
|
14
|
-
filter: none !important;
|
|
15
|
-
|
|
16
|
-
// @todo this should eventually be overridden by a custom border-radius set in the inspector.
|
|
17
|
-
border-radius: $radius-block-ui;
|
|
18
|
-
|
|
19
|
-
> svg {
|
|
20
|
-
opacity: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.components-placeholder__illustration {
|
|
24
|
-
display: none;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&::before {
|
|
28
|
-
opacity: 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
.block-bindings-media-placeholder-message {
|
|
32
|
-
opacity: 0;
|
|
33
|
-
}
|
|
34
|
-
&.is-selected .block-bindings-media-placeholder-message {
|
|
35
|
-
opacity: 1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Remove the transition while we still have a legacy placeholder style.
|
|
39
|
-
// Otherwise the content jumps between the 1px placeholder border, and any inherited custom
|
|
40
|
-
// parent border that may get applied when you deselect.
|
|
41
|
-
.components-placeholder__label,
|
|
42
|
-
.components-placeholder__instructions,
|
|
43
|
-
.components-button {
|
|
44
|
-
transition: none;
|
|
4
|
+
.block-editor-media-placeholder.is-small {
|
|
5
|
+
min-height: 60px;
|
|
45
6
|
}
|
|
46
7
|
}
|
|
47
8
|
|
|
@@ -152,6 +113,11 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
152
113
|
text-align: center;
|
|
153
114
|
}
|
|
154
115
|
|
|
116
|
+
// Relatively position the alignment container to support the content resizer.
|
|
117
|
+
.wp-block[data-align]:has(> .wp-block-image) {
|
|
118
|
+
position: relative;
|
|
119
|
+
}
|
|
120
|
+
|
|
155
121
|
.wp-block-image__crop-area {
|
|
156
122
|
position: relative;
|
|
157
123
|
max-width: 100%;
|
package/src/image/image.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { isBlobURL } from '@wordpress/blob';
|
|
5
5
|
import {
|
|
6
|
-
MenuItem,
|
|
7
6
|
ExternalLink,
|
|
8
7
|
ResizableBox,
|
|
9
8
|
Spinner,
|
|
@@ -109,6 +108,7 @@ export default function Image( {
|
|
|
109
108
|
clientId,
|
|
110
109
|
blockEditingMode,
|
|
111
110
|
parentLayoutType,
|
|
111
|
+
maxContentWidth,
|
|
112
112
|
} ) {
|
|
113
113
|
const {
|
|
114
114
|
url = '',
|
|
@@ -357,7 +357,11 @@ export default function Image( {
|
|
|
357
357
|
}, [ isSingleSelected ] );
|
|
358
358
|
|
|
359
359
|
const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
|
|
360
|
-
const allowCrop =
|
|
360
|
+
const allowCrop =
|
|
361
|
+
isSingleSelected &&
|
|
362
|
+
canEditImage &&
|
|
363
|
+
! isEditingImage &&
|
|
364
|
+
! isContentOnlyMode;
|
|
361
365
|
|
|
362
366
|
function switchToCover() {
|
|
363
367
|
replaceBlocks(
|
|
@@ -552,6 +556,24 @@ export default function Image( {
|
|
|
552
556
|
|
|
553
557
|
const showBlockControls = showUrlInput || allowCrop || showCoverControls;
|
|
554
558
|
|
|
559
|
+
const mediaReplaceFlow = isSingleSelected &&
|
|
560
|
+
! isEditingImage &&
|
|
561
|
+
! lockUrlControls && (
|
|
562
|
+
<BlockControls group="other">
|
|
563
|
+
<MediaReplaceFlow
|
|
564
|
+
mediaId={ id }
|
|
565
|
+
mediaURL={ url }
|
|
566
|
+
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
567
|
+
accept="image/*"
|
|
568
|
+
onSelect={ onSelectImage }
|
|
569
|
+
onSelectURL={ onSelectURL }
|
|
570
|
+
onError={ onUploadError }
|
|
571
|
+
name={ ! url ? __( 'Add image' ) : __( 'Replace' ) }
|
|
572
|
+
onReset={ () => onSelectImage( undefined ) }
|
|
573
|
+
/>
|
|
574
|
+
</BlockControls>
|
|
575
|
+
);
|
|
576
|
+
|
|
555
577
|
const controls = (
|
|
556
578
|
<>
|
|
557
579
|
{ showBlockControls && (
|
|
@@ -588,23 +610,6 @@ export default function Image( {
|
|
|
588
610
|
) }
|
|
589
611
|
</BlockControls>
|
|
590
612
|
) }
|
|
591
|
-
{ isSingleSelected && ! isEditingImage && ! lockUrlControls && (
|
|
592
|
-
<BlockControls group="other">
|
|
593
|
-
<MediaReplaceFlow
|
|
594
|
-
mediaId={ id }
|
|
595
|
-
mediaURL={ url }
|
|
596
|
-
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
597
|
-
accept="image/*"
|
|
598
|
-
onSelect={ onSelectImage }
|
|
599
|
-
onSelectURL={ onSelectURL }
|
|
600
|
-
onError={ onUploadError }
|
|
601
|
-
>
|
|
602
|
-
<MenuItem onClick={ () => onSelectImage( undefined ) }>
|
|
603
|
-
{ __( 'Reset' ) }
|
|
604
|
-
</MenuItem>
|
|
605
|
-
</MediaReplaceFlow>
|
|
606
|
-
</BlockControls>
|
|
607
|
-
) }
|
|
608
613
|
{ isSingleSelected && externalBlob && (
|
|
609
614
|
<BlockControls>
|
|
610
615
|
<ToolbarGroup>
|
|
@@ -636,7 +641,7 @@ export default function Image( {
|
|
|
636
641
|
} }
|
|
637
642
|
>
|
|
638
643
|
{ _x(
|
|
639
|
-
'
|
|
644
|
+
'Alternative text',
|
|
640
645
|
'Alternative text for an image. Block toolbar label, a low character count is preferred.'
|
|
641
646
|
) }
|
|
642
647
|
</ToolbarButton>
|
|
@@ -676,51 +681,56 @@ export default function Image( {
|
|
|
676
681
|
/>
|
|
677
682
|
) }
|
|
678
683
|
/>
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
684
|
+
{ title && (
|
|
685
|
+
<Dropdown
|
|
686
|
+
popoverProps={ { position: 'bottom right' } }
|
|
687
|
+
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
688
|
+
<ToolbarButton
|
|
689
|
+
onClick={ onToggle }
|
|
690
|
+
aria-haspopup="true"
|
|
691
|
+
aria-expanded={ isOpen }
|
|
692
|
+
onKeyDown={ ( event ) => {
|
|
693
|
+
if (
|
|
694
|
+
! isOpen &&
|
|
695
|
+
event.keyCode === DOWN
|
|
696
|
+
) {
|
|
697
|
+
event.preventDefault();
|
|
698
|
+
onToggle();
|
|
699
|
+
}
|
|
700
|
+
} }
|
|
701
|
+
>
|
|
702
|
+
{ __( 'Title' ) }
|
|
703
|
+
</ToolbarButton>
|
|
704
|
+
) }
|
|
705
|
+
renderContent={ () => (
|
|
706
|
+
<TextControl
|
|
707
|
+
__next40pxDefaultSize
|
|
708
|
+
className="wp-block-image__toolbar_content_textarea"
|
|
709
|
+
__nextHasNoMarginBottom
|
|
710
|
+
label={ __( 'Title attribute' ) }
|
|
711
|
+
value={ title || '' }
|
|
712
|
+
onChange={ onSetTitle }
|
|
713
|
+
disabled={ lockTitleControls }
|
|
714
|
+
help={
|
|
715
|
+
lockTitleControls ? (
|
|
716
|
+
<>{ lockTitleControlsMessage }</>
|
|
717
|
+
) : (
|
|
718
|
+
<>
|
|
714
719
|
{ __(
|
|
715
|
-
'
|
|
720
|
+
'Describe the role of this image on the page.'
|
|
716
721
|
) }
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
<ExternalLink href="https://www.w3.org/TR/html52/dom.html#the-title-attribute">
|
|
723
|
+
{ __(
|
|
724
|
+
'(Note: many devices and browsers do not display this text.)'
|
|
725
|
+
) }
|
|
726
|
+
</ExternalLink>
|
|
727
|
+
</>
|
|
728
|
+
)
|
|
729
|
+
}
|
|
730
|
+
/>
|
|
731
|
+
) }
|
|
732
|
+
/>
|
|
733
|
+
) }
|
|
724
734
|
</BlockControls>
|
|
725
735
|
) }
|
|
726
736
|
<InspectorControls>
|
|
@@ -928,6 +938,7 @@ export default function Image( {
|
|
|
928
938
|
// @todo It would be good to revisit this once a content-width variable
|
|
929
939
|
// becomes available.
|
|
930
940
|
const maxWidthBuffer = maxWidth * 2.5;
|
|
941
|
+
const maxResizeWidth = maxContentWidth || maxWidthBuffer;
|
|
931
942
|
|
|
932
943
|
let showRightHandle = false;
|
|
933
944
|
let showLeftHandle = false;
|
|
@@ -973,9 +984,9 @@ export default function Image( {
|
|
|
973
984
|
} }
|
|
974
985
|
showHandle={ isSingleSelected }
|
|
975
986
|
minWidth={ minWidth }
|
|
976
|
-
maxWidth={
|
|
987
|
+
maxWidth={ maxResizeWidth }
|
|
977
988
|
minHeight={ minHeight }
|
|
978
|
-
maxHeight={
|
|
989
|
+
maxHeight={ maxResizeWidth / ratio }
|
|
979
990
|
lockAspectRatio={ ratio }
|
|
980
991
|
enable={ {
|
|
981
992
|
top: false,
|
|
@@ -986,6 +997,22 @@ export default function Image( {
|
|
|
986
997
|
onResizeStart={ onResizeStart }
|
|
987
998
|
onResizeStop={ ( event, direction, elt ) => {
|
|
988
999
|
onResizeStop();
|
|
1000
|
+
|
|
1001
|
+
// Clear hardcoded width if the resized width is close to the max-content width.
|
|
1002
|
+
if (
|
|
1003
|
+
maxContentWidth &&
|
|
1004
|
+
// Only do this if the image is bigger than the container to prevent it from being squished.
|
|
1005
|
+
// TODO: Remove this check if the image support setting 100% width.
|
|
1006
|
+
naturalWidth >= maxContentWidth &&
|
|
1007
|
+
Math.abs( elt.offsetWidth - maxContentWidth ) < 10
|
|
1008
|
+
) {
|
|
1009
|
+
setAttributes( {
|
|
1010
|
+
width: undefined,
|
|
1011
|
+
height: undefined,
|
|
1012
|
+
} );
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
989
1016
|
// Since the aspect ratio is locked when resizing, we can
|
|
990
1017
|
// use the width of the resized element to calculate the
|
|
991
1018
|
// height in CSS to prevent stretching when the max-width
|
|
@@ -1007,12 +1034,18 @@ export default function Image( {
|
|
|
1007
1034
|
}
|
|
1008
1035
|
|
|
1009
1036
|
if ( ! url && ! temporaryURL ) {
|
|
1010
|
-
|
|
1011
|
-
|
|
1037
|
+
return (
|
|
1038
|
+
<>
|
|
1039
|
+
{ mediaReplaceFlow }
|
|
1040
|
+
{ /* Add all controls if the image attributes are connected. */ }
|
|
1041
|
+
{ metadata?.bindings ? controls : sizeControls }
|
|
1042
|
+
</>
|
|
1043
|
+
);
|
|
1012
1044
|
}
|
|
1013
1045
|
|
|
1014
1046
|
return (
|
|
1015
1047
|
<>
|
|
1048
|
+
{ mediaReplaceFlow }
|
|
1016
1049
|
{ controls }
|
|
1017
1050
|
{ img }
|
|
1018
1051
|
|
package/src/image/index.php
CHANGED
|
@@ -72,7 +72,7 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
72
72
|
) {
|
|
73
73
|
$suffix = wp_scripts_get_suffix();
|
|
74
74
|
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
75
|
-
$module_url = gutenberg_url( '/build/
|
|
75
|
+
$module_url = gutenberg_url( '/build-module/block-library/image/view.min.js' );
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
wp_register_script_module(
|
package/src/image/transforms.js
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createBlobURL, isBlobURL } from '@wordpress/blob';
|
|
5
5
|
import { createBlock, getBlockAttributes } from '@wordpress/blocks';
|
|
6
|
-
import { dispatch } from '@wordpress/data';
|
|
7
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
6
|
|
|
10
7
|
export function stripFirstImage( attributes, { shortcode } ) {
|
|
11
8
|
const { body } = document.implementation.createHTMLDocument( '' );
|
|
@@ -138,26 +135,6 @@ const transforms = {
|
|
|
138
135
|
// creating a new gallery.
|
|
139
136
|
type: 'files',
|
|
140
137
|
isMatch( files ) {
|
|
141
|
-
// The following check is intended to catch non-image files when dropped together with images.
|
|
142
|
-
if (
|
|
143
|
-
files.some(
|
|
144
|
-
( file ) => file.type.indexOf( 'image/' ) === 0
|
|
145
|
-
) &&
|
|
146
|
-
files.some(
|
|
147
|
-
( file ) => file.type.indexOf( 'image/' ) !== 0
|
|
148
|
-
)
|
|
149
|
-
) {
|
|
150
|
-
const { createErrorNotice } = dispatch( noticesStore );
|
|
151
|
-
createErrorNotice(
|
|
152
|
-
__(
|
|
153
|
-
'If uploading to a gallery all files need to be image formats'
|
|
154
|
-
),
|
|
155
|
-
{
|
|
156
|
-
id: 'gallery-transform-invalid-file',
|
|
157
|
-
type: 'snackbar',
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
138
|
return files.every(
|
|
162
139
|
( file ) => file.type.indexOf( 'image/' ) === 0
|
|
163
140
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { useResizeObserver } from '@wordpress/compose';
|
|
6
|
+
|
|
7
|
+
function useMaxWidthObserver() {
|
|
8
|
+
const [ contentResizeListener, { width } ] = useResizeObserver();
|
|
9
|
+
const observerRef = useRef();
|
|
10
|
+
|
|
11
|
+
const maxWidthObserver = (
|
|
12
|
+
<div
|
|
13
|
+
// Some themes set max-width on blocks.
|
|
14
|
+
className="wp-block"
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
style={ {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
inset: 0,
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: 0,
|
|
21
|
+
margin: 0,
|
|
22
|
+
} }
|
|
23
|
+
ref={ observerRef }
|
|
24
|
+
>
|
|
25
|
+
{ contentResizeListener }
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return [ maxWidthObserver, width ];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { useMaxWidthObserver };
|
package/src/image/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { NEW_TAB_REL } from './constants';
|
|
4
|
+
import { NEW_TAB_REL, ALLOWED_MEDIA_TYPES } from './constants';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Evaluates a CSS aspect-ratio property value as a number.
|
|
@@ -81,3 +81,15 @@ export function getImageSizeAttributes( image, size ) {
|
|
|
81
81
|
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Checks if the file has a valid file type.
|
|
87
|
+
*
|
|
88
|
+
* @param {File} file - The file to check.
|
|
89
|
+
* @return {boolean} - Returns true if the file has a valid file type, otherwise false.
|
|
90
|
+
*/
|
|
91
|
+
export function isValidFileType( file ) {
|
|
92
|
+
return ALLOWED_MEDIA_TYPES.some(
|
|
93
|
+
( mediaType ) => file.type.indexOf( mediaType ) === 0
|
|
94
|
+
);
|
|
95
|
+
}
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -243,7 +243,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
243
243
|
{ displayPostContent && (
|
|
244
244
|
<RadioControl
|
|
245
245
|
className="wp-block-latest-posts__post-content-radio"
|
|
246
|
-
label={ __( 'Show
|
|
246
|
+
label={ __( 'Show' ) }
|
|
247
247
|
selected={ displayPostContentRadio }
|
|
248
248
|
options={ [
|
|
249
249
|
{ label: __( 'Excerpt' ), value: 'excerpt' },
|
|
@@ -30,7 +30,7 @@ const v1ToV5ImageFillStyles = ( url, focalPoint ) => {
|
|
|
30
30
|
: {};
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const v6ToV7ImageFillStyles = ( url, focalPoint ) => {
|
|
34
34
|
return url
|
|
35
35
|
? {
|
|
36
36
|
backgroundImage: `url(${ url })`,
|
|
@@ -198,6 +198,20 @@ const v6Attributes = {
|
|
|
198
198
|
},
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
+
const v7Attributes = {
|
|
202
|
+
...v6Attributes,
|
|
203
|
+
align: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
// v7 changed the default for the `align` attribute.
|
|
206
|
+
default: 'none',
|
|
207
|
+
},
|
|
208
|
+
// New attribute.
|
|
209
|
+
useFeaturedImage: {
|
|
210
|
+
type: 'boolean',
|
|
211
|
+
default: false,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
201
215
|
const v4ToV5Supports = {
|
|
202
216
|
anchor: true,
|
|
203
217
|
align: [ 'wide', 'full' ],
|
|
@@ -237,6 +251,148 @@ const v6Supports = {
|
|
|
237
251
|
},
|
|
238
252
|
};
|
|
239
253
|
|
|
254
|
+
const v7Supports = {
|
|
255
|
+
...v6Supports,
|
|
256
|
+
__experimentalBorder: {
|
|
257
|
+
color: true,
|
|
258
|
+
radius: true,
|
|
259
|
+
style: true,
|
|
260
|
+
width: true,
|
|
261
|
+
__experimentalDefaultControls: {
|
|
262
|
+
color: true,
|
|
263
|
+
radius: true,
|
|
264
|
+
style: true,
|
|
265
|
+
width: true,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
color: {
|
|
269
|
+
gradients: true,
|
|
270
|
+
heading: true,
|
|
271
|
+
link: true,
|
|
272
|
+
__experimentalDefaultControls: {
|
|
273
|
+
background: true,
|
|
274
|
+
text: true,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
interactivity: {
|
|
278
|
+
clientNavigation: true,
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// Version with 'none' as the default alignment.
|
|
283
|
+
// See: https://github.com/WordPress/gutenberg/pull/64981
|
|
284
|
+
const v7 = {
|
|
285
|
+
attributes: v7Attributes,
|
|
286
|
+
supports: v7Supports,
|
|
287
|
+
usesContext: [ 'postId', 'postType' ],
|
|
288
|
+
save( { attributes } ) {
|
|
289
|
+
const {
|
|
290
|
+
isStackedOnMobile,
|
|
291
|
+
mediaAlt,
|
|
292
|
+
mediaPosition,
|
|
293
|
+
mediaType,
|
|
294
|
+
mediaUrl,
|
|
295
|
+
mediaWidth,
|
|
296
|
+
mediaId,
|
|
297
|
+
verticalAlignment,
|
|
298
|
+
imageFill,
|
|
299
|
+
focalPoint,
|
|
300
|
+
linkClass,
|
|
301
|
+
href,
|
|
302
|
+
linkTarget,
|
|
303
|
+
rel,
|
|
304
|
+
} = attributes;
|
|
305
|
+
const mediaSizeSlug =
|
|
306
|
+
attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
|
|
307
|
+
const newRel = ! rel ? undefined : rel;
|
|
308
|
+
|
|
309
|
+
const imageClasses = clsx( {
|
|
310
|
+
[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',
|
|
311
|
+
[ `size-${ mediaSizeSlug }` ]: mediaId && mediaType === 'image',
|
|
312
|
+
} );
|
|
313
|
+
|
|
314
|
+
let image = mediaUrl ? (
|
|
315
|
+
<img
|
|
316
|
+
src={ mediaUrl }
|
|
317
|
+
alt={ mediaAlt }
|
|
318
|
+
className={ imageClasses || null }
|
|
319
|
+
/>
|
|
320
|
+
) : null;
|
|
321
|
+
|
|
322
|
+
if ( href ) {
|
|
323
|
+
image = (
|
|
324
|
+
<a
|
|
325
|
+
className={ linkClass }
|
|
326
|
+
href={ href }
|
|
327
|
+
target={ linkTarget }
|
|
328
|
+
rel={ newRel }
|
|
329
|
+
>
|
|
330
|
+
{ image }
|
|
331
|
+
</a>
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const mediaTypeRenders = {
|
|
336
|
+
image: () => image,
|
|
337
|
+
video: () => <video controls src={ mediaUrl } />,
|
|
338
|
+
};
|
|
339
|
+
const className = clsx( {
|
|
340
|
+
'has-media-on-the-right': 'right' === mediaPosition,
|
|
341
|
+
'is-stacked-on-mobile': isStackedOnMobile,
|
|
342
|
+
[ `is-vertically-aligned-${ verticalAlignment }` ]:
|
|
343
|
+
verticalAlignment,
|
|
344
|
+
'is-image-fill': imageFill,
|
|
345
|
+
} );
|
|
346
|
+
const backgroundStyles = imageFill
|
|
347
|
+
? v6ToV7ImageFillStyles( mediaUrl, focalPoint )
|
|
348
|
+
: {};
|
|
349
|
+
|
|
350
|
+
let gridTemplateColumns;
|
|
351
|
+
if ( mediaWidth !== DEFAULT_MEDIA_WIDTH ) {
|
|
352
|
+
gridTemplateColumns =
|
|
353
|
+
'right' === mediaPosition
|
|
354
|
+
? `auto ${ mediaWidth }%`
|
|
355
|
+
: `${ mediaWidth }% auto`;
|
|
356
|
+
}
|
|
357
|
+
const style = {
|
|
358
|
+
gridTemplateColumns,
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
if ( 'right' === mediaPosition ) {
|
|
362
|
+
return (
|
|
363
|
+
<div { ...useBlockProps.save( { className, style } ) }>
|
|
364
|
+
<div
|
|
365
|
+
{ ...useInnerBlocksProps.save( {
|
|
366
|
+
className: 'wp-block-media-text__content',
|
|
367
|
+
} ) }
|
|
368
|
+
/>
|
|
369
|
+
<figure
|
|
370
|
+
className="wp-block-media-text__media"
|
|
371
|
+
style={ backgroundStyles }
|
|
372
|
+
>
|
|
373
|
+
{ ( mediaTypeRenders[ mediaType ] || noop )() }
|
|
374
|
+
</figure>
|
|
375
|
+
</div>
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
return (
|
|
379
|
+
<div { ...useBlockProps.save( { className, style } ) }>
|
|
380
|
+
<figure
|
|
381
|
+
className="wp-block-media-text__media"
|
|
382
|
+
style={ backgroundStyles }
|
|
383
|
+
>
|
|
384
|
+
{ ( mediaTypeRenders[ mediaType ] || noop )() }
|
|
385
|
+
</figure>
|
|
386
|
+
<div
|
|
387
|
+
{ ...useInnerBlocksProps.save( {
|
|
388
|
+
className: 'wp-block-media-text__content',
|
|
389
|
+
} ) }
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
392
|
+
);
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
240
396
|
// Version with wide as the default alignment.
|
|
241
397
|
// See: https://github.com/WordPress/gutenberg/pull/48404
|
|
242
398
|
const v6 = {
|
|
@@ -301,7 +457,7 @@ const v6 = {
|
|
|
301
457
|
'is-image-fill': imageFill,
|
|
302
458
|
} );
|
|
303
459
|
const backgroundStyles = imageFill
|
|
304
|
-
?
|
|
460
|
+
? v6ToV7ImageFillStyles( mediaUrl, focalPoint )
|
|
305
461
|
: {};
|
|
306
462
|
|
|
307
463
|
let gridTemplateColumns;
|
|
@@ -902,4 +1058,4 @@ const v1 = {
|
|
|
902
1058
|
},
|
|
903
1059
|
};
|
|
904
1060
|
|
|
905
|
-
export default [ v6, v5, v4, v3, v2, v1 ];
|
|
1061
|
+
export default [ v7, v6, v5, v4, v3, v2, v1 ];
|
package/src/media-text/edit.js
CHANGED
|
@@ -213,11 +213,11 @@ function MediaTextEdit( {
|
|
|
213
213
|
[ isSelected, mediaId ]
|
|
214
214
|
);
|
|
215
215
|
|
|
216
|
-
const
|
|
216
|
+
const refMedia = useRef();
|
|
217
217
|
const imperativeFocalPointPreview = ( value ) => {
|
|
218
|
-
const { style } =
|
|
218
|
+
const { style } = refMedia.current;
|
|
219
219
|
const { x, y } = value;
|
|
220
|
-
style.
|
|
220
|
+
style.objectPosition = `${ x * 100 }% ${ y * 100 }%`;
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
const [ temporaryMediaWidth, setTemporaryMediaWidth ] = useState( null );
|
|
@@ -243,7 +243,7 @@ function MediaTextEdit( {
|
|
|
243
243
|
'is-selected': isSelected,
|
|
244
244
|
'is-stacked-on-mobile': isStackedOnMobile,
|
|
245
245
|
[ `is-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,
|
|
246
|
-
'is-image-fill': imageFill,
|
|
246
|
+
'is-image-fill-element': imageFill,
|
|
247
247
|
} );
|
|
248
248
|
const widthString = `${ temporaryMediaWidth || mediaWidth }%`;
|
|
249
249
|
const gridTemplateColumns =
|
|
@@ -480,7 +480,7 @@ function MediaTextEdit( {
|
|
|
480
480
|
onSelectMedia={ onSelectMedia }
|
|
481
481
|
onWidthChange={ onWidthChange }
|
|
482
482
|
commitWidthChange={ commitWidthChange }
|
|
483
|
-
|
|
483
|
+
refMedia={ refMedia }
|
|
484
484
|
enableResize={ blockEditingMode === 'default' }
|
|
485
485
|
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
486
486
|
{ ...{
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.wp-block-media-text.is-image-fill .editor-media-container__resizer,
|
|
30
|
-
.wp-block-media-text.is-image-fill .components-placeholder.has-illustration
|
|
30
|
+
.wp-block-media-text.is-image-fill .components-placeholder.has-illustration,
|
|
31
|
+
.wp-block-media-text.is-image-fill-element .editor-media-container__resizer,
|
|
32
|
+
.wp-block-media-text.is-image-fill-element .components-placeholder.has-illustration {
|
|
31
33
|
// The resizer sets an inline height but for the image fill we set it to full height.
|
|
32
34
|
height: 100% !important;
|
|
33
35
|
}
|