diff --git a/lib/block-supports/background.php b/lib/block-supports/background.php index 7095789722959..8e3c06159a120 100644 --- a/lib/block-supports/background.php +++ b/lib/block-supports/background.php @@ -53,10 +53,10 @@ function gutenberg_render_background_support( $block_content, $block ) { } $background_styles = array(); - $background_styles['backgroundSize'] = isset( $block_attributes['style']['background']['backgroundSize'] ) ? $block_attributes['style']['background']['backgroundSize'] : 'cover'; $background_styles['backgroundImage'] = isset( $block_attributes['style']['background']['backgroundImage'] ) ? $block_attributes['style']['background']['backgroundImage'] : array(); - if ( isset( $background_styles['backgroundImage']['source'] ) && 'file' === $background_styles['backgroundImage']['source'] && isset( $background_styles['backgroundImage']['url'] ) ) { + if ( ! empty( $background_styles['backgroundImage'] ) ) { + $background_styles['backgroundSize'] = isset( $block_attributes['style']['background']['backgroundSize'] ) ? $block_attributes['style']['background']['backgroundSize'] : 'cover'; $background_styles['backgroundPosition'] = isset( $block_attributes['style']['background']['backgroundPosition'] ) ? $block_attributes['style']['background']['backgroundPosition'] : null; $background_styles['backgroundRepeat'] = isset( $block_attributes['style']['background']['backgroundRepeat'] ) ? $block_attributes['style']['background']['backgroundRepeat'] : null; diff --git a/packages/block-editor/src/components/global-styles/test/get-global-styles-changes.js b/packages/block-editor/src/components/global-styles/test/get-global-styles-changes.js index 6eb4974ec041a..9c220da7ead12 100644 --- a/packages/block-editor/src/components/global-styles/test/get-global-styles-changes.js +++ b/packages/block-editor/src/components/global-styles/test/get-global-styles-changes.js @@ -20,7 +20,6 @@ describe( 'getGlobalStylesChanges and utils', () => { background: { backgroundImage: { url: 'https://example.com/image.jpg', - source: 'file', }, backgroundSize: 'contain', backgroundPosition: '30% 30%', @@ -96,7 +95,6 @@ describe( 'getGlobalStylesChanges and utils', () => { background: { backgroundImage: { url: 'https://example.com/image_new.jpg', - source: 'file', }, backgroundSize: 'contain', backgroundPosition: '40% 77%', diff --git a/packages/block-editor/src/hooks/background.js b/packages/block-editor/src/hooks/background.js index 3d47f42645afc..3e23efcbf5fc9 100644 --- a/packages/block-editor/src/hooks/background.js +++ b/packages/block-editor/src/hooks/background.js @@ -59,7 +59,7 @@ export function setBackgroundStyleDefaults( backgroundStyle ) { let backgroundStylesWithDefaults; // Set block background defaults. - if ( backgroundImage?.source === 'file' && !! backgroundImage?.url ) { + if ( !! backgroundImage?.url ) { if ( ! backgroundStyle?.backgroundSize ) { backgroundStylesWithDefaults = { backgroundSize: 'cover', diff --git a/packages/block-library/src/embed/icons.js b/packages/block-library/src/embed/icons.js index 21a3b20ae278a..2e9386373f083 100644 --- a/packages/block-library/src/embed/icons.js +++ b/packages/block-library/src/embed/icons.js @@ -178,3 +178,12 @@ export const embedPocketCastsIcon = { ), }; + +export const embedBlueskyIcon = ( + + + +); diff --git a/packages/block-library/src/embed/variations.js b/packages/block-library/src/embed/variations.js index 6083ea1adc90b..e770c12ddfd97 100644 --- a/packages/block-library/src/embed/variations.js +++ b/packages/block-library/src/embed/variations.js @@ -27,6 +27,7 @@ import { embedPinterestIcon, embedWolframIcon, embedPocketCastsIcon, + embedBlueskyIcon, } from './icons'; /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ @@ -360,6 +361,14 @@ const variations = [ patterns: [ /^https?:\/\/(www\.)?wolframcloud\.com\/obj\/.+/i ], attributes: { providerNameSlug: 'wolfram-cloud', responsive: true }, }, + { + name: 'bluesky', + title: 'Bluesky', + icon: embedBlueskyIcon, + description: __( 'Embed a Bluesky post.' ), + patterns: [ /^https?:\/\/bsky\.app\/profile\/.+\/post\/.+/i ], + attributes: { providerNameSlug: 'bluesky' }, + }, ]; /** diff --git a/packages/style-engine/src/styles/background/index.ts b/packages/style-engine/src/styles/background/index.ts index 748cb15b4f309..a8c8679888e15 100644 --- a/packages/style-engine/src/styles/background/index.ts +++ b/packages/style-engine/src/styles/background/index.ts @@ -8,11 +8,7 @@ const backgroundImage = { name: 'backgroundImage', generate: ( style: Style, options: StyleOptions ) => { const _backgroundImage = style?.background?.backgroundImage; - if ( - typeof _backgroundImage === 'object' && - _backgroundImage?.source === 'file' && - _backgroundImage?.url - ) { + if ( typeof _backgroundImage === 'object' && _backgroundImage?.url ) { return [ { selector: options.selector, diff --git a/packages/style-engine/src/test/index.js b/packages/style-engine/src/test/index.js index 5869c4a349baa..fbccc8c48bc92 100644 --- a/packages/style-engine/src/test/index.js +++ b/packages/style-engine/src/test/index.js @@ -226,7 +226,6 @@ describe( 'getCSSRules', () => { { background: { backgroundImage: { - source: 'file', url: 'https://example.com/image.jpg', }, backgroundPosition: '50% 50%', diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index 8df33334e82d0..00799b7ba0b47 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -4812,8 +4812,7 @@ public function test_get_top_level_background_image_styles() { 'core/paragraph' => array( 'background' => array( 'backgroundImage' => array( - 'url' => 'http://example.org/image.png', - 'source' => 'file', + 'url' => 'http://example.org/image.png', ), 'backgroundSize' => 'cover', 'backgroundRepeat' => 'no-repeat', diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 755fb09e57e3c..773419d472f33 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -2331,12 +2331,6 @@ { "type": "object", "properties": { - "source": { - "description": "The origin of the image. 'file' denotes that the 'url' is a path to an image or other file.", - "type": "string", - "enum": [ "file" ], - "default": "file" - }, "url": { "description": "A URL to an image file.", "type": "string"