Skip to content

Commit

Permalink
Merge pull request #47 from wearerequired/fix/default-block-styles
Browse files Browse the repository at this point in the history
Enqueue the default block styles if content is using blocks
  • Loading branch information
markjaquith authored Aug 3, 2020
2 parents cfaee10 + 5dc6f13 commit aa8193f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions classes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,19 @@ public function enqueue() {
wp_enqueue_style( 'cws-wp-help', $this->get_url() . "dist/wp-help.css", array(), self::CSS_JS_VERSION );
$asset = $this->include_file( '/dist/index.asset.php' );
wp_enqueue_script( 'cws-wp-help', $this->get_url() . "dist/index.js", array_merge( [ 'jquery', 'jquery-ui-sortable' ], $asset['dependencies'] ), $asset['version'] );

if ( function_exists( 'has_blocks' ) ) {
$document_id = $this->get_default_doc();
if ( isset( $_GET['document'] ) ) {
$document_id = absint( $_GET['document'] );
}

if ( has_blocks( $document_id ) ) {
wp_enqueue_style( 'wp-block-library' );
wp_enqueue_style( 'wp-block-library-theme' );
}
}

do_action( 'cws_wp_help_load' ); // Use this to enqueue your own styles for things like shortcodes.
}

Expand Down

0 comments on commit aa8193f

Please sign in to comment.