-
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
Gutenberg: Tiled gallery block #27458
Conversation
I'd definitely go for style picker for the variations β that's what it's meant for. It ensures it's accessible even with sidebar collapsed. |
It depends. If the order of images allows the user to rearrange them, then we should probably not randomize them. However, if in any of the layouts, we can't allow dragging to rearrange, then random order would be good.
I agree with you. Let's drop those in favor of the way core gallery handles captions.
Let's definitely go with the style picker for variations. I think they're better at conveying meaning than a 20x20 icon and, as Matias mentioned, it's what they're designed for.
I think we should likely disable captions on the circles altogether. I'm not sure we want to mess with the blue border, though. @mtias what do you think?
How easy is that to do? Is the mosaic script fast enough for that to work well?
This was from the earlier rounds of design, but might work. |
Seems sensible to me. |
By the way, there's an idea about duplicating block styles in a panel on the sidebar that would automatically make these available in both places, which I think would be great. |
bd64ef2
to
ae54a1b
Compare
I tried testing this today, but couldn't get it to show up in Jurassic Ninja (I did connect Jetpack). Ideas? |
5fbd0ff
to
9c78e41
Compare
df45582
to
348851c
Compare
Looks like the JN link was a bit outdated (this now requires a branch from Jetpack, too). I updated and tested it works now. π Thanks for the heads up. I fixed a couple smaller bugs with circle -layout, rebased+squashed commits so this would be good for code review now. This is not ready block but I'd like to leave following work to different PRs to make reviewing them easier & more focused. |
π₯ I found some issues with |
348851c
to
92b170b
Compare
This is an automated check which relies on Generated by π« dangerJS |
Good call. I just rebased to confirm that shrinkwrap file is still up to date. |
e3f65a7
to
3407901
Compare
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 shouldn't be included anywhere now. Let's merge and iterate π
Tests are all green now even though GH doesn't reflect that. Reporting mechanism hasn't been working well recently. |
π’ IT π |
Load Tiled Gallery Gutenberg block assets. ## Testing - Apply the commit 9e27e59 to fix loading block assets at appropiate loading order. (PR #10739) - In Calypso, switch to branch `update/tiled-gallery-updates` (PR Automattic/wp-calypso#27458) and build the blocks to get `_inc/blocks/tiled-gallery/view*` files: ``` npm run sdk -- gutenberg client/gutenberg/extensions/presets/jetpack/ \ --output-dir=~/jetpack/_inc/blocks/ ``` - Insert tiled gallery block in the editor, add some awesome images and publish the post - Check the post frontend, you should observe `tiled-gallery/view.*` files load and the gallery shouldn't look too broken. It might look just a tad bit broken because it's work in progress. ;-)
* Throttled resize event | ||
* Compares gallery width to its previous width to decide if to resize it. | ||
*/ | ||
const throttleOnResize = throttle( entries => { |
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.
I'm wondering if we would get better performance by using debounce
and how that would look visually when resizing the window.
Differences: https://css-tricks.com/debouncing-throttling-explained-examples/
Also if we don't have to import this from lodash
, we could ditch one required dependency since in WordPress we would just enqueue the whole lodash
which is kinda wasteful. Another consideration is to change how SDK externalizes that library; perhaps only for editor.js
?
Load Tiled Gallery Gutenberg block assets. ## Testing - Apply the commit 9e27e59 to fix loading block assets at appropiate loading order. (PR #10739) - In Calypso, switch to branch `update/tiled-gallery-updates` (PR Automattic/wp-calypso#27458) and build the blocks to get `_inc/blocks/tiled-gallery/view*` files: ``` npm run sdk -- gutenberg client/gutenberg/extensions/presets/jetpack/ \ --output-dir=~/jetpack/_inc/blocks/ ``` - Insert tiled gallery block in the editor, add some awesome images and publish the post - Check the post frontend, you should observe `tiled-gallery/view.*` files load and the gallery shouldn't look too broken. It might look just a tad bit broken because it's work in progress. ;-)
I am but a humble user putting in my opinion (with zero experience on Github, so apologies for any faux pas). If you are talking about how captions are rendered on the delivered page, then no, please do not do what the core gallery does. But if you are only talking about within the block editor, that's fine. The way the Core gallery handles the display of captions on the rendered page is unusable. (I don't know how it got past testing). I've tried it on several sites, and it is a responsive nightmare. In many cases the captions completely cover the images. Generally, I want visitors to be able to see all of the image, not have large portions of it obscured by text. But, I do want the caption text to be available for the curious (and search engines). On the other hand, the way the captions are currently handled in Jetpack with an animation is perfect, and shouldn't be changed. (Sorry for butting in here). |
Thanks for the feedback, @gsallman. It's helpful. Responsiveness of the Tiled gallery block is definitely on top of our priorities. |
Rewrite of the Tiled gallery block.
Apologies for a huge PR. πββοΈ This is quite a beast of a block! Complete rewrites are a bit tricky to do in portions. Probably good if you review files without the diff.
(I updated the description here so comments below might seem a bit out of context)
Screenshots
Testing & features
npm install
first since this adds new deps.Confirm that these work as expected:
Known issues
[gallery]
block-code and I'm not sure why. Might be colliding with core-gallery since these share the same shortcode.Technical specs
Requires Jetpack side PR: Automattic/jetpack#10375
gallery-image.js
exactly as it's Gutenberg so that we could use it as a component from Gutenberg later on. AlsogetActiveStyle()
helper is directly from Gutenberg.ResizeObserver
to fire events when the gallery's wrapper element has size changes. Changes could be caused by mobile screen orientation changes, changes in the browser window, by appearing elements such as Gutenberg sidebar etc.ResizeObserver
API is really simple and it's performance is great because it doesn't need to be polling for size changes or fire on everywindow.onResize
. Read more from Google and or check out the spec.view.js
does not rely on React. I purposefully choose to implement it as vanilla JS to keep payload smaller, albeit causing a bit more maintenance for us. I explored rendering with React as well so if we decide so, it would be quick enough change to that implementation instead.Missing two layouts
So Mosaic and Columns is missing. Squares and circles are in.
We could decide to: