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 Blocks: Adding an image thumbnail selector #2435

Merged
merged 2 commits into from
Aug 22, 2017

Conversation

youknowriad
Copy link
Contributor

closes #1727

This adds an inspector selector to pick the desired thumbnail size.

@youknowriad youknowriad added the [Feature] Media Anything that impacts the experience of managing media label Aug 16, 2017
@youknowriad youknowriad self-assigned this Aug 16, 2017
@codecov
Copy link

codecov bot commented Aug 16, 2017

Codecov Report

Merging #2435 into master will decrease coverage by 0.1%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2435      +/-   ##
==========================================
- Coverage   26.98%   26.87%   -0.11%     
==========================================
  Files         159      160       +1     
  Lines        4903     4923      +20     
  Branches      817      820       +3     
==========================================
  Hits         1323     1323              
- Misses       3035     3052      +17     
- Partials      545      548       +3
Impacted Files Coverage Δ
blocks/library/gallery/index.js 33.33% <ø> (ø) ⬆️
blocks/library/image/index.js 60% <ø> (+45%) ⬆️
blocks/library/image/block.js 0% <0%> (ø)
blocks/inspector-controls/select-control/index.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccf991a...605bf9d. Read the comment docs.

@jasmussen
Copy link
Contributor

Thank you for working on this! This implementation seems right on, though it does sort of present some questions around the idea itself, for which we might need some input by @karmatosed and/or @joemcgill. For example, what size image is inserted by default? Also should you be able to set a thumbnail to be full-wide?

Noticed some issues with selecting the size in the dropdown, btw:

img thumb

@youknowriad
Copy link
Contributor Author

Good catch @jasmussen The selected size issue should be fixed now.


// Disable reason: A select with an onchange throws a warning
Copy link
Member

Choose a reason for hiding this comment

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

This isn't so much a reason as it is stating a fact. The rule exists because onChange and onBlur have accessibility impacts when used in select elements. See also #2227

@aduth
Copy link
Member

aduth commented Aug 16, 2017

For example, what size image is inserted by default? Also should you be able to set a thumbnail to be full-wide?

IIRC the current editor remembers this as a preference when making a selection.

@youknowriad
Copy link
Contributor Author

Still waiting for input for the next steps here: whether we should go this route or not? and if we should do anything about the block alignments when selecting a thumbnail size?

@jasmussen
Copy link
Contributor

Let's do this:

  • When you insert an image from the media library, default to "full size"
  • In the sidebar, you can choose to use medium or thumbnail instead.

That will let us move forward, and revisit any issues that come up as a result of this. A future enhancement to potentially explore (perhaps with some srcset stuff in mind #869) would be to have some automated smarts in which size was picked. For example for wide and fullwide, pick full size. For resized images, perhaps pick a thumbnail.

@karmatosed
Copy link
Member

karmatosed commented Aug 22, 2017

I do wonder if we should have full at the top though. For example this is how my drop down looks:

2017-08-22 at 10 57

Maybe just have it alphabetically sorted for ease?

@youknowriad
Copy link
Contributor Author

youknowriad commented Aug 22, 2017

@karmatosed What logical order are you proposing? biggest size to smallest?

Edit: Sorry, just saw the alphabetical order note :)

@karmatosed
Copy link
Member

Hmm maybe that works in reverse because we are setting to fullest? Lets go with biggest to smallest.

@youknowriad
Copy link
Contributor Author

@karmatosed Just pushed the alphabetical order :)

When you insert an image from the media library, default to "full size"

@jasmussen It's already the case for me. we're taking the default url which corresponds to the full size in my testing.

@jasmussen
Copy link
Contributor

@jasmussen It's already the case for me. we're taking the default url which corresponds to the full size in my testing.

That's cool! Unable to test the branch this time, but if you fixed the issue where the choice wasn't sticky (dropdown reverted) then 👍 👍 from me!

@youknowriad youknowriad merged commit b483af9 into master Aug 22, 2017
@youknowriad youknowriad deleted the add/image-thumbnails branch August 22, 2017 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image: Address UI for picking thumbnail sizes
4 participants