-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Tiled galleries: Consistent layouts #29559
Conversation
} = this.props; | ||
|
||
/* translators: %1$d is the order number of the image, %2$d is the total number of images. */ | ||
const ariaLabel = __( sprintf( 'image %1$d of %2$d in gallery', i + 1, images.length ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__
and sprintf
need to be another way around here so that we don't attempt to translate already sprintf'ied result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is straight from Gutenberg, so they would have this issue as well:
align={ align } | ||
className={ `wp-block-jetpack-tiled-gallery ${ className }` } | ||
<Layout | ||
className={ className } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be safe, we probably should set default rectangular layout class is-style-rectangular
here somehow on first render when className
is undefined
. (https://github.com/Automattic/wp-calypso/pull/29559/files#r242806286)
This won't affect functionality anyhow at editor side because is-style-rectangular
doesn't have any affect on styling, but on view side we pick the layout from that classname.
const size = Math.min( width, height ); | ||
return photon( url, { resize: `${ size },${ size }` } ); | ||
} | ||
return photon( url ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check for window.location.hostname === 'localhost'
and return the original URL in that case?
import GalleryImage from '../gallery-image'; | ||
|
||
export default class Layout extends Component { | ||
photonize( { height, width, url } ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never get width
and height
here: adding them to pickRelevantMediaFiles
fixes it:
imageProps.width = get( image, [ 'sizes', 'large', 'width' ] );
imageProps.height = get( image, [ 'sizes', 'large', 'height' ] );
in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do get them on already uploaded images. I suspect your suggestion will fix this todo, nice spot!
Get square-ish layouts working on upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more tricky things going on here, I'm going to hold off on any changes for now.
onSelect={ onSelectImage( i ) } | ||
setAttributes={ setImageAttributes( i ) } | ||
url={ this.photonize( img ) } | ||
width={ img.width } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This width
(and height
above) ends up always being undefined
, see https://github.com/Automattic/wp-calypso/pull/29559/files#r242816530
columns: { | ||
type: 'number', | ||
}, | ||
ids: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @jeherve You'll be interested in the image ID array in attributes for Automattic/jetpack#11000
e279cd2
to
8c557b1
Compare
0b05e84
to
cbc4012
Compare
a03c5ea
to
10f123a
Compare
e1f03f5
to
7bc3982
Compare
52ecb64
to
f60e1ae
Compare
import { IconButton, Spinner } from '@wordpress/components'; | ||
import { isBlobURL } from '@wordpress/blob'; // @TODO Add dep Jetpack-side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding in Automattic/jetpack#11043
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mighty good! 💪
...stop stop it causing empty margins inside outline when image is selected.
It's so pretty
This reverts commit 616460979d517b114ee144eb91580ac308487a29.
4a07e8c
to
d17b7b2
Compare
Adds `@wordpress/blob` dependency for Tiled gallery since the block depends to it as of Automattic/wp-calypso#29559 ## Testing - Switch to `update/g7g-tg-consistent-layout` branch in Calypso - Build blocks: `npm run sdk -- gutenberg ./client/gutenberg/extensions/presets/jetpack/ /PATH_TO_JETPACK/_inc/blocks/` - Insert tiled gallery block - **Upload** images to gallery. Blob URLs are URLs for images that are still uploading. - The block can feel little broken due other issues but it shouldn't complain about missing dependency. ✨ (both editor and when publishing and looking at the page/post)
Changes proposed in this Pull Request
Pulls in changes from Gutenberg gallery components.
Rethink how layouts should be approached.
Resolves #28962
Closes #29614 (supersedes)
Closes #29598 (supersedes)
Fixes #29544 "don't show full size image, use large image instead"
Resolves #29495 "photonize image URLs"
Resolves #28943 "clarify disabled columns control"
Fixes #28904 "captions visible right after adding images"
Currently:
images are not same w/h)To do:
@wordpress
deps are present Jetpack-sideTesting instructions
tbd…
cc: @simison