[Resolved] Block Editor Width

Home Forums Support [Resolved] Block Editor Width

Home Forums Support Block Editor Width

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2101523
    Math

    Hi,

    After today’s update (GeneratePress 3.1.2) the block editor is now displaying the post content in (almost) full width. Previously, it was contained and you could tell the difference between full width and contained widths.

    The actual post when Previewing or Publishing works as intended. It’s only in the editor.

    Why was it changed?

    Thank you.

    #2101637
    David
    Staff
    Customer Support

    Hi there,

    WP 5.9 stopped the Full Width block options being displayed in the Post Editor. Which was patched in 3.1.2.
    So the only change should be related to blocks with that option selected.

    Are you seeing a change elsewhere ?

    #2101657
    Math

    Hi David,

    On one site I updated to the latest WP 5.9 and latest GP 3.1.2, and everything is showing up full width in Post. See below.
    https://www.dropbox.com/s/cp7t2mihvha5htu/Capture.PNG?dl=0

    On the other site, I updated to the latest WP 5.9, but didn’t update to the latest GP and the Post width is contained as it had been previously. See below.
    https://www.dropbox.com/s/qqdaxvo9rqkez5g/Capture2.PNG?dl=0

    Thank you.

    #2101686
    David
    Staff
    Customer Support

    Would it be possible to get temporary admin access to the problem site so we can take a look ?

    #2101716
    Math

    Login info provided.

    #2101995
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Sorry about this – looks like a bug when setting the content width in a Layout Element and our 3.1.2 update.

    As a quick fix until we release 3.1.3, you can do this:

    add_action( 'enqueue_block_editor_assets', function() {
    	global $generate_elements;
    
    	foreach ( $generate_elements as $element ) {
    		if ( 'layout' === $element['type'] ) {
    			$content_width = get_post_meta( $element['id'], '_generate_content_width', true );
    
    			if ( $content_width ) {
    				$admin_css = 'body .wp-block{max-width: ' . absint( $content_width ) . 'px !important;}';
    				wp_add_inline_style( 'generate-block-editor-styles', $admin_css );
    			}
    		}
    	}
    }, 100 );

    Let me know if that works or not 🙂

    #2102857
    Math

    Hi Tom,

    Seems to be working. Thanks for addressing this issue quickly!

    #2103437
    Tom
    Lead Developer
    Lead Developer

    No problem – sorry for the inconvenience!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.