diff --git a/packages/block-editor/src/components/inspector-controls-tabs/styles-tab.js b/packages/block-editor/src/components/inspector-controls-tabs/styles-tab.js index 9344cb94f8ef46..d42b3bffce4ebc 100644 --- a/packages/block-editor/src/components/inspector-controls-tabs/styles-tab.js +++ b/packages/block-editor/src/components/inspector-controls-tabs/styles-tab.js @@ -34,7 +34,7 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => { /> - + + { imgUrl && ( + + ) } + { imgLabel } + + { sprintf( + /* translators: %s: file name */ + __( 'Selected image: %s' ), + filename + ) } + @@ -232,7 +252,8 @@ function BackgroundImagePanelItem( props ) { onSelect={ onSelectMedia } name={ } @@ -254,11 +275,18 @@ function BackgroundImagePanelItem( props ) {
- +
) } /> diff --git a/packages/block-editor/src/hooks/background.scss b/packages/block-editor/src/hooks/background.scss index 0ac17181990191..a42679bfe27226 100644 --- a/packages/block-editor/src/hooks/background.scss +++ b/packages/block-editor/src/hooks/background.scss @@ -11,7 +11,7 @@ .block-editor-hooks__background__inspector-media-replace-container { button.components-button { color: $gray-900; - box-shadow: inset 0 0 0 1px $gray-400; + box-shadow: inset 0 0 0 $border-width $gray-300; width: 100%; display: block; height: $grid-unit-50; @@ -40,18 +40,37 @@ .components-dropdown { display: block; } +} - img { - width: 20px; - min-width: 20px; - aspect-ratio: 1; - box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); - border-radius: 50% !important; - } +.block-editor-hooks__background__inspector-image-indicator-wrapper { + background: #fff linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%); // Show a diagonal line (crossed out) for empty background image. + border-radius: $radius-round !important; // Override the default border-radius inherited from FlexItem. + box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2); + display: block; + width: 20px; + height: 20px; + flex: none; +} - .block-editor-hooks__background__inspector-readonly-logo-preview { - padding: 6px 12px; - display: flex; - height: $grid-unit-50; - } +.block-editor-hooks__background__inspector-image-indicator { + background-size: cover; + border-radius: $radius-round; + width: 20px; + height: 20px; + display: block; + position: relative; +} + +.block-editor-hooks__background__inspector-image-indicator::after { + content: ""; + position: absolute; + top: -1px; + left: -1px; + bottom: -1px; + right: -1px; + border-radius: $radius-round; + box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2); + // Show a thin outline in Windows high contrast mode, otherwise the button is invisible. + border: 1px solid transparent; + box-sizing: inherit; }