@wordpress/block-library 8.30.0 → 8.32.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 +4 -0
- package/build/block/edit.js +22 -16
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/code/save.js +3 -1
- package/build/code/save.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/details/edit.js +1 -0
- package/build/details/edit.js.map +1 -1
- package/build/file/edit.js +2 -0
- package/build/file/edit.js.map +1 -1
- package/build/heading/index.js +4 -3
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.js +10 -39
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +27 -6
- package/build/image/image.js.map +1 -1
- package/build/media-text/edit.js +33 -9
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +5 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.js +30 -11
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/save.js +2 -2
- package/build/media-text/save.js.map +1 -1
- package/build/navigation/edit/index.js +23 -29
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +24 -23
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -4
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +15 -12
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/view.js +12 -2
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +52 -27
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +31 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/edit.js +3 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js +1 -0
- package/build/post-author/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -0
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +16 -4
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +13 -2
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-featured-image/overlay-controls.js +82 -0
- package/build/post-featured-image/overlay-controls.js.map +1 -0
- package/build/post-featured-image/overlay.js +5 -54
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-navigation-link/edit.js +1 -0
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-terms/edit.js +2 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/quote/edit.js +18 -23
- package/build/quote/edit.js.map +1 -1
- package/build/read-more/edit.js +1 -0
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +2 -0
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +2 -2
- package/build/search/edit.native.js.map +1 -1
- package/build/site-tagline/edit.js +13 -4
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-tagline/index.js +4 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/icons/medium.js +1 -1
- package/build/social-link/icons/medium.js.map +1 -1
- package/build/social-link/icons/reddit.js +1 -1
- package/build/social-link/icons/reddit.js.map +1 -1
- package/build/table/deprecated.js +285 -175
- package/build/table/deprecated.js.map +1 -1
- package/build/table/index.js +1 -1
- package/build/template-part/edit/index.js +55 -47
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +106 -10
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +1 -9
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/utils/caption.js +19 -13
- package/build/utils/caption.js.map +1 -1
- package/build/utils/hooks.js +1 -0
- package/build/utils/hooks.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/block/edit.js +23 -17
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/code/save.js +3 -1
- package/build-module/code/save.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/details/edit.js +1 -0
- package/build-module/details/edit.js.map +1 -1
- package/build-module/file/edit.js +2 -0
- package/build-module/file/edit.js.map +1 -1
- package/build-module/heading/index.js +4 -3
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.js +11 -40
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +27 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/media-text/edit.js +34 -10
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +5 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.js +31 -12
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/save.js +2 -2
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/navigation/edit/index.js +24 -30
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -4
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +15 -12
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/view.js +12 -2
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +55 -30
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +31 -9
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/edit.js +3 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js +1 -0
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -0
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +17 -5
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +13 -2
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-featured-image/overlay-controls.js +75 -0
- package/build-module/post-featured-image/overlay-controls.js.map +1 -0
- package/build-module/post-featured-image/overlay.js +7 -56
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -0
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +2 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/quote/edit.js +20 -25
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/read-more/edit.js +1 -0
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -0
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +2 -2
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/site-tagline/edit.js +14 -5
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +4 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/icons/medium.js +1 -1
- package/build-module/social-link/icons/medium.js.map +1 -1
- package/build-module/social-link/icons/reddit.js +1 -1
- package/build-module/social-link/icons/reddit.js.map +1 -1
- package/build-module/table/deprecated.js +286 -176
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/index.js +1 -1
- package/build-module/template-part/edit/index.js +58 -50
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +108 -12
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +2 -10
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/utils/caption.js +19 -13
- package/build-module/utils/caption.js.map +1 -1
- package/build-module/utils/hooks.js +1 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/audio/theme-rtl.css +1 -1
- package/build-style/audio/theme.css +1 -1
- package/build-style/cover/style-rtl.css +5 -2
- package/build-style/cover/style.css +5 -2
- package/build-style/editor-rtl.css +22 -12
- package/build-style/editor.css +22 -12
- package/build-style/embed/theme-rtl.css +1 -1
- package/build-style/embed/theme.css +1 -1
- package/build-style/file/editor-rtl.css +3 -0
- package/build-style/file/editor.css +3 -0
- package/build-style/image/editor-rtl.css +0 -3
- package/build-style/image/editor.css +0 -3
- package/build-style/image/theme-rtl.css +1 -1
- package/build-style/image/theme.css +1 -1
- package/build-style/media-text/editor-rtl.css +7 -1
- package/build-style/media-text/editor.css +7 -1
- package/build-style/pullquote/theme-rtl.css +2 -1
- package/build-style/pullquote/theme.css +2 -1
- package/build-style/quote/theme-rtl.css +6 -6
- package/build-style/quote/theme.css +6 -6
- package/build-style/search/style-rtl.css +10 -0
- package/build-style/search/style.css +10 -0
- package/build-style/social-links/editor-rtl.css +0 -4
- package/build-style/social-links/editor.css +0 -4
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +17 -4
- package/build-style/style.css +17 -4
- package/build-style/table/theme-rtl.css +4 -3
- package/build-style/table/theme.css +4 -3
- package/build-style/template-part/editor-rtl.css +12 -4
- package/build-style/template-part/editor.css +12 -4
- package/build-style/template-part/theme-rtl.css +1 -1
- package/build-style/template-part/theme.css +1 -1
- package/build-style/theme-rtl.css +17 -15
- package/build-style/theme.css +17 -15
- package/build-style/video/theme-rtl.css +1 -1
- package/build-style/video/theme.css +1 -1
- package/package.json +34 -34
- package/src/archives/index.php +4 -0
- package/src/audio/theme.scss +1 -1
- package/src/avatar/index.php +6 -0
- package/src/block/edit.js +43 -32
- package/src/block/index.php +4 -0
- package/src/block/test/edit.native.js +67 -0
- package/src/button/edit.native.js +1 -1
- package/src/calendar/index.php +12 -0
- package/src/categories/index.php +6 -0
- package/src/code/save.js +7 -1
- package/src/comment-author-name/index.php +4 -0
- package/src/comment-content/index.php +4 -0
- package/src/comment-date/index.php +4 -0
- package/src/comment-edit-link/index.php +4 -0
- package/src/comment-reply-link/index.php +4 -0
- package/src/comment-template/index.php +4 -0
- package/src/comments/index.php +10 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-pagination-next/index.php +4 -0
- package/src/comments-pagination-numbers/index.php +4 -0
- package/src/comments-pagination-previous/index.php +4 -0
- package/src/comments-title/index.php +4 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/index.php +4 -0
- package/src/cover/style.scss +6 -2
- package/src/details/edit.js +1 -0
- package/src/embed/theme.scss +1 -1
- package/src/file/edit.js +2 -0
- package/src/file/editor.scss +3 -0
- package/src/file/index.php +4 -0
- package/src/gallery/editor.scss +1 -1
- package/src/gallery/index.php +7 -1
- package/src/heading/index.js +4 -3
- package/src/heading/index.php +4 -0
- package/src/home-link/index.php +10 -0
- package/src/image/edit.js +11 -40
- package/src/image/editor.scss +2 -7
- package/src/image/image.js +25 -7
- package/src/image/index.php +12 -1
- package/src/image/theme.scss +1 -1
- package/src/latest-comments/index.php +4 -0
- package/src/latest-posts/index.php +8 -0
- package/src/loginout/index.php +4 -0
- package/src/media-text/block.json +5 -0
- package/src/media-text/edit.js +70 -19
- package/src/media-text/editor.scss +7 -1
- package/src/media-text/index.php +70 -0
- package/src/media-text/media-container.js +49 -9
- package/src/media-text/save.js +2 -2
- package/src/navigation/edit/index.js +67 -71
- package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
- package/src/navigation/edit/navigation-menu-selector.js +39 -21
- package/src/navigation/edit/placeholder/index.js +4 -4
- package/src/navigation/edit/test/navigation-menu-selector.js +75 -53
- package/src/navigation/index.php +109 -26
- package/src/navigation/test/use-navigation-menu.js +21 -21
- package/src/navigation/use-navigation-menu.js +23 -9
- package/src/navigation/view.js +11 -2
- package/src/navigation-link/edit.js +64 -39
- package/src/navigation-link/index.php +14 -0
- package/src/navigation-submenu/edit.js +34 -10
- package/src/navigation-submenu/index.php +8 -0
- package/src/page-list/index.php +12 -0
- package/src/page-list-item/index.php +2 -0
- package/src/pattern/edit.js +4 -0
- package/src/pattern/index.php +2 -0
- package/src/post-author/edit.js +1 -0
- package/src/post-author/index.php +4 -0
- package/src/post-author-biography/index.php +4 -0
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/index.php +6 -0
- package/src/post-content/index.php +4 -0
- package/src/post-date/index.php +4 -0
- package/src/post-excerpt/edit.js +1 -0
- package/src/post-excerpt/index.php +4 -0
- package/src/post-featured-image/block.json +13 -2
- package/src/post-featured-image/edit.js +16 -1
- package/src/post-featured-image/editor.scss +1 -1
- package/src/post-featured-image/index.php +15 -0
- package/src/post-featured-image/overlay-controls.js +88 -0
- package/src/post-featured-image/overlay.js +17 -84
- package/src/post-navigation-link/edit.js +1 -0
- package/src/post-navigation-link/index.php +4 -0
- package/src/post-template/index.php +4 -0
- package/src/post-terms/edit.js +2 -0
- package/src/post-terms/index.php +6 -0
- package/src/post-title/index.php +2 -0
- package/src/pullquote/theme.scss +3 -1
- package/src/query/index.php +2 -0
- package/src/query-no-results/index.php +6 -0
- package/src/query-pagination/index.php +4 -0
- package/src/query-pagination-next/index.php +6 -0
- package/src/query-pagination-numbers/index.php +6 -0
- package/src/query-pagination-previous/index.php +4 -0
- package/src/query-title/index.php +4 -0
- package/src/quote/edit.js +27 -37
- package/src/quote/test/edit.native.js +4 -6
- package/src/quote/theme.scss +1 -2
- package/src/read-more/edit.js +1 -0
- package/src/read-more/index.php +4 -0
- package/src/rss/index.php +4 -0
- package/src/search/edit.js +2 -0
- package/src/search/edit.native.js +2 -2
- package/src/search/index.php +19 -1
- package/src/search/style.scss +11 -0
- package/src/shortcode/index.php +4 -0
- package/src/site-logo/editor.scss +2 -2
- package/src/site-logo/index.php +20 -0
- package/src/site-tagline/block.json +4 -0
- package/src/site-tagline/edit.js +16 -3
- package/src/site-tagline/index.php +13 -1
- package/src/site-title/index.php +4 -0
- package/src/social-link/edit.js +1 -1
- package/src/social-link/icons/medium.js +1 -1
- package/src/social-link/icons/reddit.js +1 -1
- package/src/social-link/index.php +22 -9
- package/src/social-link/socials-with-bg.scss +1 -1
- package/src/social-link/socials-without-bg.scss +1 -1
- package/src/social-links/editor.scss +1 -9
- package/src/table/block.json +1 -1
- package/src/table/deprecated.js +308 -175
- package/src/table/theme.scss +4 -2
- package/src/tag-cloud/index.php +4 -0
- package/src/template-part/edit/index.js +87 -79
- package/src/template-part/edit/inner-blocks.js +126 -13
- package/src/template-part/edit/selection-modal.js +1 -22
- package/src/template-part/editor.scss +11 -3
- package/src/template-part/index.php +12 -0
- package/src/template-part/theme.scss +1 -1
- package/src/term-description/index.php +4 -0
- package/src/utils/caption.js +19 -16
- package/src/utils/hooks.js +1 -0
- package/src/video/edit.native.js +2 -0
- package/src/video/editor.scss +2 -2
- package/src/video/theme.scss +1 -1
- package/tsconfig.json +1 -0
package/src/image/editor.scss
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
// Provide special styling for the placeholder.
|
|
2
|
-
// @todo
|
|
2
|
+
// @todo this particular minimal style of placeholder could be componentized further.
|
|
3
3
|
.wp-block-image.wp-block-image {
|
|
4
4
|
|
|
5
|
-
&:not(.is-selected) .components-placeholder__fieldset {
|
|
6
|
-
// Show only is selected.
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
5
|
// Show Placeholder style on-select.
|
|
11
6
|
&.is-selected .components-placeholder {
|
|
12
7
|
// Block UI appearance.
|
|
@@ -18,7 +13,7 @@
|
|
|
18
13
|
// Disable any duotone filter applied in the selected state.
|
|
19
14
|
filter: none !important;
|
|
20
15
|
|
|
21
|
-
// @todo
|
|
16
|
+
// @todo this should eventually be overridden by a custom border-radius set in the inspector.
|
|
22
17
|
border-radius: $radius-block-ui;
|
|
23
18
|
|
|
24
19
|
> svg {
|
package/src/image/image.js
CHANGED
|
@@ -83,8 +83,7 @@ const ImageWrapper = ( { href, children } ) => {
|
|
|
83
83
|
// When the Image block is linked,
|
|
84
84
|
// it's wrapped with a disabled <a /> tag.
|
|
85
85
|
// Restore cursor style so it doesn't appear 'clickable'
|
|
86
|
-
//
|
|
87
|
-
pointerEvents: 'none',
|
|
86
|
+
// Safari needs the display property.
|
|
88
87
|
cursor: 'default',
|
|
89
88
|
display: 'inline',
|
|
90
89
|
} }
|
|
@@ -274,6 +273,22 @@ export default function Image( {
|
|
|
274
273
|
}
|
|
275
274
|
}
|
|
276
275
|
|
|
276
|
+
function resetLightbox() {
|
|
277
|
+
// When deleting a link from an image while lightbox settings
|
|
278
|
+
// are enabled by default, we should disable the lightbox,
|
|
279
|
+
// otherwise the resulting UX looks like a mistake.
|
|
280
|
+
// See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123.
|
|
281
|
+
if ( lightboxSetting?.enabled && lightboxSetting?.allowEditing ) {
|
|
282
|
+
setAttributes( {
|
|
283
|
+
lightbox: { enabled: false },
|
|
284
|
+
} );
|
|
285
|
+
} else {
|
|
286
|
+
setAttributes( {
|
|
287
|
+
lightbox: undefined,
|
|
288
|
+
} );
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
277
292
|
function onSetTitle( value ) {
|
|
278
293
|
// This is the HTML title attribute, separate from the media object
|
|
279
294
|
// title.
|
|
@@ -348,7 +363,10 @@ export default function Image( {
|
|
|
348
363
|
const [ lightboxSetting ] = useSettings( 'lightbox' );
|
|
349
364
|
|
|
350
365
|
const showLightboxSetting =
|
|
351
|
-
|
|
366
|
+
// If a block-level override is set, we should give users the option to
|
|
367
|
+
// remove that override, even if the lightbox UI is disabled in the settings.
|
|
368
|
+
( !! lightbox && lightbox?.enabled !== lightboxSetting?.enabled ) ||
|
|
369
|
+
lightboxSetting?.allowEditing;
|
|
352
370
|
|
|
353
371
|
const lightboxChecked =
|
|
354
372
|
!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );
|
|
@@ -498,6 +516,7 @@ export default function Image( {
|
|
|
498
516
|
showLightboxSetting={ showLightboxSetting }
|
|
499
517
|
lightboxEnabled={ lightboxChecked }
|
|
500
518
|
onSetLightbox={ onSetLightbox }
|
|
519
|
+
resetLightbox={ resetLightbox }
|
|
501
520
|
/>
|
|
502
521
|
) }
|
|
503
522
|
{ allowCrop && (
|
|
@@ -692,6 +711,7 @@ export default function Image( {
|
|
|
692
711
|
<InspectorControls group="advanced">
|
|
693
712
|
<TextControl
|
|
694
713
|
__nextHasNoMarginBottom
|
|
714
|
+
__next40pxDefaultSize
|
|
695
715
|
label={ __( 'Title attribute' ) }
|
|
696
716
|
value={ title || '' }
|
|
697
717
|
onChange={ onSetTitle }
|
|
@@ -913,9 +933,7 @@ export default function Image( {
|
|
|
913
933
|
|
|
914
934
|
return (
|
|
915
935
|
<>
|
|
916
|
-
{
|
|
917
|
-
which causes duplicated image upload. */ }
|
|
918
|
-
{ ! temporaryURL && controls }
|
|
936
|
+
{ controls }
|
|
919
937
|
{ img }
|
|
920
938
|
|
|
921
939
|
<Caption
|
|
@@ -925,7 +943,7 @@ export default function Image( {
|
|
|
925
943
|
insertBlocksAfter={ insertBlocksAfter }
|
|
926
944
|
label={ __( 'Image caption text' ) }
|
|
927
945
|
showToolbarButton={ isSingleSelected && hasNonContentControls }
|
|
928
|
-
|
|
946
|
+
readOnly={ lockCaption }
|
|
929
947
|
/>
|
|
930
948
|
</>
|
|
931
949
|
);
|
package/src/image/index.php
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Renders the `core/image` block on the server,
|
|
10
10
|
* adding a data-id attribute to the element if core/gallery has added on pre-render.
|
|
11
11
|
*
|
|
12
|
+
* @since 5.9.0
|
|
13
|
+
*
|
|
12
14
|
* @param array $attributes The block attributes.
|
|
13
15
|
* @param string $content The block content.
|
|
14
16
|
* @param WP_Block $block The block object.
|
|
@@ -85,6 +87,8 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
85
87
|
*
|
|
86
88
|
* This is used to determine whether the lightbox should be rendered or not.
|
|
87
89
|
*
|
|
90
|
+
* @since 6.4.0
|
|
91
|
+
*
|
|
88
92
|
* @param array $block Block data.
|
|
89
93
|
*
|
|
90
94
|
* @return array Filtered block data.
|
|
@@ -115,6 +119,8 @@ function block_core_image_get_lightbox_settings( $block ) {
|
|
|
115
119
|
/**
|
|
116
120
|
* Adds the directives and layout needed for the lightbox behavior.
|
|
117
121
|
*
|
|
122
|
+
* @since 6.4.0
|
|
123
|
+
*
|
|
118
124
|
* @param string $block_content Rendered block content.
|
|
119
125
|
* @param array $block Block object.
|
|
120
126
|
*
|
|
@@ -219,6 +225,9 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
219
225
|
return $body_content;
|
|
220
226
|
}
|
|
221
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @since 6.5.0
|
|
230
|
+
*/
|
|
222
231
|
function block_core_image_print_lightbox_overlay() {
|
|
223
232
|
$close_button_label = esc_attr__( 'Close' );
|
|
224
233
|
|
|
@@ -238,7 +247,7 @@ function block_core_image_print_lightbox_overlay() {
|
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
echo <<<HTML
|
|
241
|
-
<div
|
|
250
|
+
<div
|
|
242
251
|
class="wp-lightbox-overlay zoom"
|
|
243
252
|
data-wp-interactive="core/image"
|
|
244
253
|
data-wp-context='{}'
|
|
@@ -278,6 +287,8 @@ HTML;
|
|
|
278
287
|
|
|
279
288
|
/**
|
|
280
289
|
* Registers the `core/image` block on server.
|
|
290
|
+
*
|
|
291
|
+
* @since 5.9.0
|
|
281
292
|
*/
|
|
282
293
|
function register_block_core_image() {
|
|
283
294
|
register_block_type_from_metadata(
|
package/src/image/theme.scss
CHANGED
|
@@ -36,6 +36,8 @@ function wp_latest_comments_draft_or_post_title( $post = 0 ) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Renders the `core/latest-comments` block on server.
|
|
38
38
|
*
|
|
39
|
+
* @since 5.1.0
|
|
40
|
+
*
|
|
39
41
|
* @param array $attributes The block attributes.
|
|
40
42
|
*
|
|
41
43
|
* @return string Returns the post content with latest comments added.
|
|
@@ -145,6 +147,8 @@ function render_block_core_latest_comments( $attributes = array() ) {
|
|
|
145
147
|
|
|
146
148
|
/**
|
|
147
149
|
* Registers the `core/latest-comments` block.
|
|
150
|
+
*
|
|
151
|
+
* @since 5.3.0
|
|
148
152
|
*/
|
|
149
153
|
function register_block_core_latest_comments() {
|
|
150
154
|
register_block_type_from_metadata(
|
|
@@ -18,6 +18,8 @@ $block_core_latest_posts_excerpt_length = 0;
|
|
|
18
18
|
* Callback for the excerpt_length filter used by
|
|
19
19
|
* the Latest Posts block at render time.
|
|
20
20
|
*
|
|
21
|
+
* @since 5.4.0
|
|
22
|
+
*
|
|
21
23
|
* @return int Returns the global $block_core_latest_posts_excerpt_length variable
|
|
22
24
|
* to allow the excerpt_length filter respect the Latest Block setting.
|
|
23
25
|
*/
|
|
@@ -29,6 +31,8 @@ function block_core_latest_posts_get_excerpt_length() {
|
|
|
29
31
|
/**
|
|
30
32
|
* Renders the `core/latest-posts` block on server.
|
|
31
33
|
*
|
|
34
|
+
* @since 5.0.0
|
|
35
|
+
*
|
|
32
36
|
* @param array $attributes The block attributes.
|
|
33
37
|
*
|
|
34
38
|
* @return string Returns the post content with latest posts added.
|
|
@@ -218,6 +222,8 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
218
222
|
|
|
219
223
|
/**
|
|
220
224
|
* Registers the `core/latest-posts` block on server.
|
|
225
|
+
*
|
|
226
|
+
* @since 5.0.0
|
|
221
227
|
*/
|
|
222
228
|
function register_block_core_latest_posts() {
|
|
223
229
|
register_block_type_from_metadata(
|
|
@@ -241,6 +247,8 @@ add_action( 'init', 'register_block_core_latest_posts' );
|
|
|
241
247
|
* TODO: Remove when and if the bottom client-side deprecation for this block
|
|
242
248
|
* is removed.
|
|
243
249
|
*
|
|
250
|
+
* @since 5.5.0
|
|
251
|
+
*
|
|
244
252
|
* @param array $block A single parsed block object.
|
|
245
253
|
*
|
|
246
254
|
* @return array The migrated block object.
|
package/src/loginout/index.php
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders the `core/loginout` block on server.
|
|
10
10
|
*
|
|
11
|
+
* @since 5.8.0
|
|
12
|
+
*
|
|
11
13
|
* @param array $attributes The block attributes.
|
|
12
14
|
*
|
|
13
15
|
* @return string Returns the login-out link or form.
|
|
@@ -39,6 +41,8 @@ function render_block_core_loginout( $attributes ) {
|
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Registers the `core/loginout` block on server.
|
|
44
|
+
*
|
|
45
|
+
* @since 5.8.0
|
|
42
46
|
*/
|
|
43
47
|
function register_block_core_loginout() {
|
|
44
48
|
register_block_type_from_metadata(
|
|
@@ -92,8 +92,13 @@
|
|
|
92
92
|
},
|
|
93
93
|
"allowedBlocks": {
|
|
94
94
|
"type": "array"
|
|
95
|
+
},
|
|
96
|
+
"useFeaturedImage": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"default": false
|
|
95
99
|
}
|
|
96
100
|
},
|
|
101
|
+
"usesContext": [ "postId", "postType" ],
|
|
97
102
|
"supports": {
|
|
98
103
|
"anchor": true,
|
|
99
104
|
"align": [ "wide", "full" ],
|
package/src/media-text/edit.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from '@wordpress/components';
|
|
32
32
|
import { isBlobURL, getBlobTypeByURL } from '@wordpress/blob';
|
|
33
33
|
import { pullLeft, pullRight } from '@wordpress/icons';
|
|
34
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
34
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Internal dependencies
|
|
@@ -127,7 +127,12 @@ function attributesFromMedia( {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function MediaTextEdit( {
|
|
130
|
+
function MediaTextEdit( {
|
|
131
|
+
attributes,
|
|
132
|
+
isSelected,
|
|
133
|
+
setAttributes,
|
|
134
|
+
context: { postId, postType },
|
|
135
|
+
} ) {
|
|
131
136
|
const {
|
|
132
137
|
focalPoint,
|
|
133
138
|
href,
|
|
@@ -145,9 +150,42 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
145
150
|
rel,
|
|
146
151
|
verticalAlignment,
|
|
147
152
|
allowedBlocks,
|
|
153
|
+
useFeaturedImage,
|
|
148
154
|
} = attributes;
|
|
149
155
|
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
|
|
150
156
|
|
|
157
|
+
const [ featuredImage ] = useEntityProp(
|
|
158
|
+
'postType',
|
|
159
|
+
postType,
|
|
160
|
+
'featured_media',
|
|
161
|
+
postId
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const featuredImageMedia = useSelect(
|
|
165
|
+
( select ) =>
|
|
166
|
+
featuredImage &&
|
|
167
|
+
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
168
|
+
[ featuredImage ]
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const featuredImageURL = useFeaturedImage
|
|
172
|
+
? featuredImageMedia?.source_url
|
|
173
|
+
: '';
|
|
174
|
+
const featuredImageAlt = useFeaturedImage
|
|
175
|
+
? featuredImageMedia?.alt_text
|
|
176
|
+
: '';
|
|
177
|
+
|
|
178
|
+
const toggleUseFeaturedImage = () => {
|
|
179
|
+
setAttributes( {
|
|
180
|
+
imageFill: false,
|
|
181
|
+
mediaType: 'image',
|
|
182
|
+
mediaId: undefined,
|
|
183
|
+
mediaUrl: undefined,
|
|
184
|
+
mediaAlt: undefined,
|
|
185
|
+
useFeaturedImage: ! useFeaturedImage,
|
|
186
|
+
} );
|
|
187
|
+
};
|
|
188
|
+
|
|
151
189
|
const { imageSizes, image } = useSelect(
|
|
152
190
|
( select ) => {
|
|
153
191
|
const { getSettings } = select( blockEditorStore );
|
|
@@ -261,25 +299,30 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
261
299
|
}
|
|
262
300
|
/>
|
|
263
301
|
) }
|
|
264
|
-
{ imageFill &&
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
302
|
+
{ imageFill &&
|
|
303
|
+
( mediaUrl || featuredImageURL ) &&
|
|
304
|
+
mediaType === 'image' && (
|
|
305
|
+
<FocalPointPicker
|
|
306
|
+
__nextHasNoMarginBottom
|
|
307
|
+
label={ __( 'Focal point' ) }
|
|
308
|
+
url={
|
|
309
|
+
useFeaturedImage && featuredImageURL
|
|
310
|
+
? featuredImageURL
|
|
311
|
+
: mediaUrl
|
|
312
|
+
}
|
|
313
|
+
value={ focalPoint }
|
|
314
|
+
onChange={ ( value ) =>
|
|
315
|
+
setAttributes( { focalPoint: value } )
|
|
316
|
+
}
|
|
317
|
+
onDragStart={ imperativeFocalPointPreview }
|
|
318
|
+
onDrag={ imperativeFocalPointPreview }
|
|
319
|
+
/>
|
|
320
|
+
) }
|
|
321
|
+
{ mediaType === 'image' && ( mediaUrl || featuredImageURL ) && (
|
|
279
322
|
<TextareaControl
|
|
280
323
|
__nextHasNoMarginBottom
|
|
281
324
|
label={ __( 'Alternative text' ) }
|
|
282
|
-
value={ mediaAlt }
|
|
325
|
+
value={ mediaAlt || featuredImageAlt }
|
|
283
326
|
onChange={ onMediaAltChange }
|
|
284
327
|
help={
|
|
285
328
|
<>
|
|
@@ -353,7 +396,11 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
353
396
|
onChangeUrl={ onSetHref }
|
|
354
397
|
linkDestination={ linkDestination }
|
|
355
398
|
mediaType={ mediaType }
|
|
356
|
-
mediaUrl={
|
|
399
|
+
mediaUrl={
|
|
400
|
+
useFeaturedImage && featuredImageURL
|
|
401
|
+
? featuredImageURL
|
|
402
|
+
: image && image.source_url
|
|
403
|
+
}
|
|
357
404
|
mediaLink={ image && image.link }
|
|
358
405
|
linkTarget={ linkTarget }
|
|
359
406
|
linkClass={ linkClass }
|
|
@@ -370,6 +417,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
370
417
|
commitWidthChange={ commitWidthChange }
|
|
371
418
|
ref={ refMediaContainer }
|
|
372
419
|
enableResize={ blockEditingMode === 'default' }
|
|
420
|
+
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
373
421
|
{ ...{
|
|
374
422
|
focalPoint,
|
|
375
423
|
imageFill,
|
|
@@ -381,6 +429,9 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
381
429
|
mediaType,
|
|
382
430
|
mediaUrl,
|
|
383
431
|
mediaWidth,
|
|
432
|
+
useFeaturedImage,
|
|
433
|
+
featuredImageURL,
|
|
434
|
+
featuredImageAlt,
|
|
384
435
|
} }
|
|
385
436
|
/>
|
|
386
437
|
{ mediaPosition !== 'right' && <div { ...innerBlocksProps } /> }
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
width: 100% !important;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.wp-block-media-text.is-image-fill .editor-media-container__resizer
|
|
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
31
|
// The resizer sets an inline height but for the image fill we set it to full height.
|
|
31
32
|
height: 100% !important;
|
|
32
33
|
}
|
|
@@ -34,3 +35,8 @@
|
|
|
34
35
|
.wp-block-media-text > .block-editor-block-list__layout > .block-editor-block-list__block {
|
|
35
36
|
max-width: unset;
|
|
36
37
|
}
|
|
38
|
+
|
|
39
|
+
/* Make the featured image placeholder the same height as the media selection area. */
|
|
40
|
+
.wp-block-media-text--placeholder-image {
|
|
41
|
+
min-height: 205px;
|
|
42
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Server-side rendering of the `core/media-text` block.
|
|
4
|
+
*
|
|
5
|
+
* @package WordPress
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders the `core/media-text` block on server.
|
|
10
|
+
*
|
|
11
|
+
* @since 6.6.0
|
|
12
|
+
*
|
|
13
|
+
* @param array $attributes The block attributes.
|
|
14
|
+
* @param string $content The block rendered content.
|
|
15
|
+
*
|
|
16
|
+
* @return string Returns the Media & Text block markup, if useFeaturedImage is true.
|
|
17
|
+
*/
|
|
18
|
+
function render_block_core_media_text( $attributes, $content ) {
|
|
19
|
+
if ( false === $attributes['useFeaturedImage'] ) {
|
|
20
|
+
return $content;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ( in_the_loop() ) {
|
|
24
|
+
update_post_thumbnail_cache();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$current_featured_image = get_the_post_thumbnail_url();
|
|
28
|
+
if ( ! $current_featured_image ) {
|
|
29
|
+
return $content;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$image_tag = '<figure class="wp-block-media-text__media"><img>';
|
|
33
|
+
$content = preg_replace( '/<figure\s+class="wp-block-media-text__media">/', $image_tag, $content );
|
|
34
|
+
|
|
35
|
+
$processor = new WP_HTML_Tag_Processor( $content );
|
|
36
|
+
if ( isset( $attributes['imageFill'] ) && $attributes['imageFill'] ) {
|
|
37
|
+
$position = '50% 50%';
|
|
38
|
+
if ( isset( $attributes['focalPoint'] ) ) {
|
|
39
|
+
$position = round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
|
|
40
|
+
}
|
|
41
|
+
$processor->next_tag( 'figure' );
|
|
42
|
+
$processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $position . ';' );
|
|
43
|
+
}
|
|
44
|
+
$processor->next_tag( 'img' );
|
|
45
|
+
$media_size_slug = 'full';
|
|
46
|
+
if ( isset( $attributes['mediaSizeSlug'] ) ) {
|
|
47
|
+
$media_size_slug = $attributes['mediaSizeSlug'];
|
|
48
|
+
}
|
|
49
|
+
$processor->set_attribute( 'src', esc_url( $current_featured_image ) );
|
|
50
|
+
$processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
|
|
51
|
+
|
|
52
|
+
$content = $processor->get_updated_html();
|
|
53
|
+
|
|
54
|
+
return $content;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Registers the `core/media-text` block renderer on server.
|
|
59
|
+
*
|
|
60
|
+
* @since 6.6.0
|
|
61
|
+
*/
|
|
62
|
+
function register_block_core_media_text() {
|
|
63
|
+
register_block_type_from_metadata(
|
|
64
|
+
__DIR__ . '/media-text',
|
|
65
|
+
array(
|
|
66
|
+
'render_callback' => 'render_block_core_media_text',
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
add_action( 'init', 'register_block_core_media_text' );
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { ResizableBox, Spinner } from '@wordpress/components';
|
|
9
|
+
import { ResizableBox, Spinner, Placeholder } from '@wordpress/components';
|
|
10
10
|
import {
|
|
11
11
|
BlockControls,
|
|
12
12
|
BlockIcon,
|
|
@@ -56,21 +56,39 @@ const ResizableBoxContainer = forwardRef(
|
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
|
|
59
|
-
function ToolbarEditButton( {
|
|
59
|
+
function ToolbarEditButton( {
|
|
60
|
+
mediaId,
|
|
61
|
+
mediaUrl,
|
|
62
|
+
onSelectMedia,
|
|
63
|
+
toggleUseFeaturedImage,
|
|
64
|
+
useFeaturedImage,
|
|
65
|
+
featuredImageURL,
|
|
66
|
+
} ) {
|
|
60
67
|
return (
|
|
61
68
|
<BlockControls group="other">
|
|
62
69
|
<MediaReplaceFlow
|
|
63
70
|
mediaId={ mediaId }
|
|
64
|
-
|
|
71
|
+
mediaUrl={
|
|
72
|
+
useFeaturedImage && featuredImageURL
|
|
73
|
+
? featuredImageURL
|
|
74
|
+
: mediaUrl
|
|
75
|
+
}
|
|
65
76
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
66
77
|
accept="image/*,video/*"
|
|
67
78
|
onSelect={ onSelectMedia }
|
|
79
|
+
onToggleFeaturedImage={ toggleUseFeaturedImage }
|
|
80
|
+
useFeaturedImage={ useFeaturedImage }
|
|
68
81
|
/>
|
|
69
82
|
</BlockControls>
|
|
70
83
|
);
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
function PlaceholderContainer( {
|
|
86
|
+
function PlaceholderContainer( {
|
|
87
|
+
className,
|
|
88
|
+
mediaUrl,
|
|
89
|
+
onSelectMedia,
|
|
90
|
+
toggleUseFeaturedImage,
|
|
91
|
+
} ) {
|
|
74
92
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
75
93
|
|
|
76
94
|
const onUploadError = ( message ) => {
|
|
@@ -86,6 +104,7 @@ function PlaceholderContainer( { className, mediaUrl, onSelectMedia } ) {
|
|
|
86
104
|
className={ className }
|
|
87
105
|
onSelect={ onSelectMedia }
|
|
88
106
|
accept="image/*,video/*"
|
|
107
|
+
onToggleFeaturedImage={ toggleUseFeaturedImage }
|
|
89
108
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
90
109
|
onError={ onUploadError }
|
|
91
110
|
disableMediaButtons={ mediaUrl }
|
|
@@ -110,13 +129,17 @@ function MediaContainer( props, ref ) {
|
|
|
110
129
|
onSelectMedia,
|
|
111
130
|
onWidthChange,
|
|
112
131
|
enableResize,
|
|
132
|
+
toggleUseFeaturedImage,
|
|
133
|
+
useFeaturedImage,
|
|
134
|
+
featuredImageURL,
|
|
135
|
+
featuredImageAlt,
|
|
113
136
|
} = props;
|
|
114
137
|
|
|
115
138
|
const isTemporaryMedia = ! mediaId && isBlobURL( mediaUrl );
|
|
116
139
|
|
|
117
140
|
const { toggleSelection } = useDispatch( blockEditorStore );
|
|
118
141
|
|
|
119
|
-
if ( mediaUrl ) {
|
|
142
|
+
if ( mediaUrl || featuredImageURL || useFeaturedImage ) {
|
|
120
143
|
const onResizeStart = () => {
|
|
121
144
|
toggleSelection( false );
|
|
122
145
|
};
|
|
@@ -134,11 +157,16 @@ function MediaContainer( props, ref ) {
|
|
|
134
157
|
|
|
135
158
|
const backgroundStyles =
|
|
136
159
|
mediaType === 'image' && imageFill
|
|
137
|
-
? imageFillStyles( mediaUrl, focalPoint )
|
|
160
|
+
? imageFillStyles( mediaUrl || featuredImageURL, focalPoint )
|
|
138
161
|
: {};
|
|
139
162
|
|
|
140
163
|
const mediaTypeRenderers = {
|
|
141
|
-
image: () =>
|
|
164
|
+
image: () =>
|
|
165
|
+
useFeaturedImage && featuredImageURL ? (
|
|
166
|
+
<img src={ featuredImageURL } alt={ featuredImageAlt } />
|
|
167
|
+
) : (
|
|
168
|
+
mediaUrl && <img src={ mediaUrl } alt={ mediaAlt } />
|
|
169
|
+
),
|
|
142
170
|
video: () => <video controls src={ mediaUrl } />,
|
|
143
171
|
};
|
|
144
172
|
|
|
@@ -165,12 +193,24 @@ function MediaContainer( props, ref ) {
|
|
|
165
193
|
>
|
|
166
194
|
<ToolbarEditButton
|
|
167
195
|
onSelectMedia={ onSelectMedia }
|
|
168
|
-
mediaUrl={
|
|
196
|
+
mediaUrl={
|
|
197
|
+
useFeaturedImage && featuredImageURL
|
|
198
|
+
? featuredImageURL
|
|
199
|
+
: mediaUrl
|
|
200
|
+
}
|
|
169
201
|
mediaId={ mediaId }
|
|
202
|
+
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
203
|
+
useFeaturedImage={ useFeaturedImage }
|
|
170
204
|
/>
|
|
171
205
|
{ ( mediaTypeRenderers[ mediaType ] || noop )() }
|
|
172
206
|
{ isTemporaryMedia && <Spinner /> }
|
|
173
|
-
<PlaceholderContainer { ...props } />
|
|
207
|
+
{ ! useFeaturedImage && <PlaceholderContainer { ...props } /> }
|
|
208
|
+
{ ! featuredImageURL && useFeaturedImage && (
|
|
209
|
+
<Placeholder
|
|
210
|
+
className="wp-block-media-text--placeholder-image"
|
|
211
|
+
withIllustration
|
|
212
|
+
/>
|
|
213
|
+
) }
|
|
174
214
|
</ResizableBoxContainer>
|
|
175
215
|
);
|
|
176
216
|
}
|
package/src/media-text/save.js
CHANGED
|
@@ -42,13 +42,13 @@ export default function save( { attributes } ) {
|
|
|
42
42
|
[ `size-${ mediaSizeSlug }` ]: mediaId && mediaType === 'image',
|
|
43
43
|
} );
|
|
44
44
|
|
|
45
|
-
let image = (
|
|
45
|
+
let image = mediaUrl ? (
|
|
46
46
|
<img
|
|
47
47
|
src={ mediaUrl }
|
|
48
48
|
alt={ mediaAlt }
|
|
49
49
|
className={ imageClasses || null }
|
|
50
50
|
/>
|
|
51
|
-
);
|
|
51
|
+
) : null;
|
|
52
52
|
|
|
53
53
|
if ( href ) {
|
|
54
54
|
image = (
|