Getbeans / Beans

Beans WordPress Theme Framework. The default branch is set to development, please switch to the master branch for production.
https://www.getbeans.io
Other
392 stars 61 forks source link

Gutenberg - Classes wp-block-image alignfull not respected #354

Open Bowriverstudio opened 5 years ago

Bowriverstudio commented 5 years ago

The css classes wp-block-image alignfull are not aligning full.

For example the image: This link (for now) is just an empty default child theme of getbeans - with the gutenberg plugin http://beanssandbox.devbrs.com/

The section "Media Rich" the full width images are not being respected.

I'd expect it to look like: https://weavertheme.com/welcome-to-the-gutenberg-editor/

download download-1

Tsquare17 commented 5 years ago

I've started looking into this, and added what I thought would fix the issue:

.wp-block-cover-image.alignfull,
.wp-block-gallery.alignfull,
.wp-block-image.alignfull img {
    clear: both;
    left: 50%;
    margin-left: ~"calc(50% - 50vw)";
    margin-right: ~"calc(50% - 50vw)";
    right: 50%;
    width: 100vw;
}

But it doesn't seem to be pulling the correct distance on margin-left. screenshot from 2018-12-08 15-10-32

@christophherr Any idea what might be causing this?

christophherr commented 5 years ago

@Tsquare17 We're not declaring any of the "Gutenberg theme supports". For wide and full images we have to add add_theme_support( 'align-wide' );

christophherr commented 5 years ago

More details in the GB handbook: https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/

Tsquare17 commented 5 years ago

I've added add_theme_support( 'align-wide' ); As well as add_theme_support( 'wp-block-styles' );

Tsquare17 commented 5 years ago

I was trying to pull halfway left from a point that wasn't center screen due to the sidebar layout.

Bowriverstudio commented 5 years ago

I've got it working, but only at the child theme level. Thank you Christophherr and Tsquare.

add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );

And css


wp-block-image.alignfull  {
  margin-left: ~"calc(50% - 50vw)";
  margin-right: ~"calc(50% - 50vw)";
  width: 100vw;
  max-width: 100vw;
 }

.wp-block-image.alignwide {
  margin-left: -25px;
  margin-right: -25px;
  max-width: calc(100% + 50px);
}