Skip to content

Commit

Permalink
Add Justify styles inline rather than by enqueuing (props @kwight)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtr committed Dec 17, 2019
1 parent 8dd8ada commit b035deb
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,27 +347,9 @@ public function enqueue_block_editor_assets() {
* Enqueues the WordPress.com block editor integration assets for both editor and front-end.
*/
public function enqueue_block_assets() {
// Enqueue only for the block editor in WP Admin.
global $pagenow;
if ( is_admin() && ! in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
return;
}

// Enqueue on the front-end only if justified blocks are present.
if ( ! is_admin() && ! $this->has_justified_block() ) {
return;
}

$debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;

wp_enqueue_style(
'wpcom-block-editor-default-view-styles',
$debug
? '//widgets.wp.com/wpcom-block-editor/default.view.css?minify=false'
: '//widgets.wp.com/wpcom-block-editor/default.view.min.css',
array(),
gmdate( 'Ymd' )
);
// These styles are manually copied from //widgets.wp.com/wpcom-block-editor/default.view.css in order to
// improve the performance by avoiding an extra network request to download the CSS file on every page.
wp_add_inline_style( 'wp-block-library', '.has-text-align-justify{text-align:justify;}' );
}

/**
Expand Down

0 comments on commit b035deb

Please sign in to comment.