Skip to content

Commit

Permalink
Add ctfw_output_editor_color_styles() to output color palette styles …
Browse files Browse the repository at this point in the history
…in Gutenberg editor
  • Loading branch information
Steven Gliebe committed May 21, 2018
1 parent 8274f0e commit c441f89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 18 additions & 0 deletions includes/admin/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ function ctfw_editor_styles() {

// Load Gutenberg styles for Gutenberg editor.
if ( ! empty( $args['block_stylesheet'] ) ) {

// Block editor styles.
add_action( 'enqueue_block_editor_assets', 'ctfw_enqueue_block_editor_styles' );

// Gutenberg color palette styles.
add_action( 'admin_head', 'ctfw_output_editor_color_styles' );

}

// Apply Customizer fonts and colors CSS to editor.
Expand Down Expand Up @@ -320,6 +326,18 @@ function ctfw_enqueue_block_editor_fonts() {

}

/**
* Output Gutenberg editor color styles.
*
* @since 2.4.2
*/
function ctfw_output_editor_color_styles( $editor = false ) {

// Output styles if colors are defined.
echo ctfw_color_styles( 'editor' ); // prefix with .edit-post-visual-editor.

}

/*******************************************
* HELPERS
*******************************************/
Expand Down
2 changes: 0 additions & 2 deletions includes/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ function ctfw_color_styles( $editor = false ) {
* Related: This is done by 'ctfw-editor-styles' feature for Gutenberg editor.
*
* @since 2.4.2
* @param string $editor True if to be used in Gutenberg editor.
* @return string <style> HTML tag.
*/
function ctfw_output_color_styles( $editor = false ) {

Expand Down

0 comments on commit c441f89

Please sign in to comment.