Skip to content

Commit

Permalink
Image: Disable lightbox editor UI for linked images (#55141)
Browse files Browse the repository at this point in the history
* Disable lightbox UI and add help text for linked images

* Update help text
  • Loading branch information
artemiomorales authored Oct 11, 2023
1 parent 75ea690 commit 9e11bfc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ export default function Image( {
const lightboxChecked =
!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );

const lightboxToggleDisabled = linkDestination !== 'none';

const dimensionsControl = (
<DimensionsTool
value={ { width, height, scale, aspectRatio } }
Expand Down Expand Up @@ -555,6 +557,14 @@ export default function Image( {
lightbox: { enabled: newValue },
} );
} }
disabled={ lightboxToggleDisabled }
help={
lightboxToggleDisabled
? __(
'“Expand on click” scales the image up, and can’t be combined with a link.'
)
: ''
}
/>
</ToolsPanelItem>
) }
Expand Down

0 comments on commit 9e11bfc

Please sign in to comment.