jQuery( document ).ready( function( $ ) {
var container_width_elements = 'body .wp-block,\
html body.gutenberg-editor-page .editor-post-title__block,\
html body.gutenberg-editor-page .editor-default-block-appender,\
html body.gutenberg-editor-page .editor-block-list__block,\
.edit-post-visual-editor .editor-block-list__block[data-align=wide]';
$( 'select[name="_generate-full-width-content"]' ).on( 'change', function() {
if ( 'true' === this.value ) {
$( 'style#container_width' ).remove();
$( 'head' ).append( '' );
} else {
$( 'style#container_width' ).remove();
}
} );
$( 'select[name="_generate-sidebar-layout-meta"]' ).on( 'change', function() {
if ( 'true' !== $( this ).val() ) {
var this_value = this.value,
content_width = '',
calc = '',
container_width = generate_block_editor.container_width,
right_sidebar_width = generate_block_editor.right_sidebar_width,
left_sidebar_width = generate_block_editor.left_sidebar_width,
right_content_padding = generate_block_editor.content_padding_right,
left_content_padding = generate_block_editor.content_padding_left;
if ( '' === this_value ) {
this_value = generate_block_editor.global_sidebar_layout;
}
if ( 'left-sidebar' == this_value ) {
content_width = container_width * ( ( 100 - left_sidebar_width ) / 100 );
} else if ( 'right-sidebar' == this_value ) {
content_width = container_width * ( ( 100 - right_sidebar_width ) / 100 );
} else if ( 'no-sidebar' == this_value ) {
content_width = container_width;
} else {
content_width = container_width * ( ( 100 - ( Number( left_sidebar_width ) + Number( right_sidebar_width ) ) ) / 100 );
}
calc = 'max-width: calc(' + content_width + 'px - ' + right_content_padding + ' - ' + left_content_padding + ')';
$( 'style#content-width' ).remove();
$( 'head' ).append( '' );
$( 'style#wide-width' ).remove();
$( 'head' ).append( '