[wp-trac] [WordPress Trac] #45407: Add block attributes to `wp_calculate_image_sizes` to allow for proper handling of `sizes` attribute
WordPress Trac
noreply at wordpress.org
Tue Jan 8 09:14:18 UTC 2019
#45407: Add block attributes to `wp_calculate_image_sizes` to allow for proper
handling of `sizes` attribute
--------------------------+---------------------
Reporter: mor10 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.1
Component: Media | Version:
Severity: major | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------+---------------------
Comment (by youknowriad):
Good thoughts @mor10 I missed this originally.
I'd add that ideally, it's not the responsibility of the theme or plugin
to control the output but the theme should be able to provide the
necessary information (like you suggested) to the editor in order to
produce the correct output.
I think there are more use-cases than the ones you highlighted, If you
consider a sidebar block, and a main content block side by side. You'd end
up with questions like:
- Do we allow wide alignments in the sidebar area?
- How can we define with alignments are allowed in which areas?
- What is the default image size used for each alignment in each area?
So coming up with the API that answers all these use-cases is not an easy
task. A suggestion could be that each `InnerBlocks` area has a config prop
that could look like this:
{
alignments: {
// available alignment => default image size
left: "large",
right: "large",
wide: "very-large"
}
}
Now the question remains, how does a theme provides this config to the
global canvas for a post type (which may not make sense anymore in phase2,
or make less sense), and how does a theme extends this prop for a given
block.
If there's someone willing to explore these, please go for it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45407#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list