Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: Disable lightbox editor UI for linked images #55141

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
michalczaplinski marked this conversation as resolved.
Show resolved Hide resolved

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={
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the best way to add the help text — any thoughts on this appreciated!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this is indeed the appropriate way 👍

lightboxToggleDisabled
? __(
'“Expand on click” scales the image up, and can’t be combined with a link.'
)
: ''
}
/>
</ToolsPanelItem>
) }
Expand Down
Loading