From a366a73cba59d482c005351f968528c471067fbf Mon Sep 17 00:00:00 2001 From: Lai Power Date: Wed, 3 Mar 2021 13:57:37 +0000 Subject: [PATCH] updated theme `GeneratePress` version 3.0.3 --- .../assets/js/admin/block-editor.js | 23 ++++++++++------- wp-content/themes/generatepress/functions.php | 2 +- .../themes/generatepress/inc/block-editor.php | 25 ++++++++++++++----- .../themes/generatepress/inc/meta-box.php | 12 ++++----- wp-content/themes/generatepress/readme.txt | 11 ++++++-- wp-content/themes/generatepress/style.css | 8 +++--- 6 files changed, 53 insertions(+), 28 deletions(-) diff --git a/wp-content/themes/generatepress/assets/js/admin/block-editor.js b/wp-content/themes/generatepress/assets/js/admin/block-editor.js index bab816b..03dd8e0 100644 --- a/wp-content/themes/generatepress/assets/js/admin/block-editor.js +++ b/wp-content/themes/generatepress/assets/js/admin/block-editor.js @@ -76,15 +76,6 @@ jQuery( document ).ready( function( $ ) { body.addClass( 'content-title-hidden' ); } } ); - - if ( generate_block_editor.show_editor_styles ) { - var text_color = tinycolor( generate_block_editor.text_color ).toHex8(), - isTextDark = tinycolor( text_color ).isDark(); - - if ( ! isTextDark ) { - $( 'body' ).addClass( 'is-dark-theme' ); - } - } } ); jQuery( window ).on( 'load', function() { @@ -95,4 +86,18 @@ jQuery( window ).on( 'load', function() { post_title_block.append( '' ); post_title_block.append( '' ); } + + // This is a fallback in case the core editor check for the dark theme fails. + // If the background is using a gradient or rgba, the WP method can be wrong. + // So instead, we check for text color, as it's a better indicator of the true background color. + if ( generate_block_editor.show_editor_styles ) { + var text_color = tinycolor( generate_block_editor.text_color ).toHex8(), + isTextDark = tinycolor( text_color ).isDark(); + + if ( ! isTextDark ) { + document.body.classList.add( 'is-dark-theme' ); + } else { + document.body.classList.remove( 'is-dark-theme' ); + } + } } ); diff --git a/wp-content/themes/generatepress/functions.php b/wp-content/themes/generatepress/functions.php index a1212b0..fb97d97 100644 --- a/wp-content/themes/generatepress/functions.php +++ b/wp-content/themes/generatepress/functions.php @@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) { } // Set our theme version. -define( 'GENERATE_VERSION', '3.0.2' ); +define( 'GENERATE_VERSION', '3.0.3' ); if ( ! function_exists( 'generate_setup' ) ) { add_action( 'after_setup_theme', 'generate_setup' ); diff --git a/wp-content/themes/generatepress/inc/block-editor.php b/wp-content/themes/generatepress/inc/block-editor.php index c2d6dc5..f517e74 100644 --- a/wp-content/themes/generatepress/inc/block-editor.php +++ b/wp-content/themes/generatepress/inc/block-editor.php @@ -381,14 +381,27 @@ function generate_do_inline_block_editor_css() { $css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' ); } - $css->set_selector( 'body .editor-styles-wrapper' ); - $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); + if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) { + $css->set_selector( '.block-editor__container .edit-post-visual-editor' ); + $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); - if ( $color_settings['content_background_color'] ) { - $body_background = generate_get_option( 'background_color' ); - $content_background = $color_settings['content_background_color']; + $css->set_selector( '.block-editor__container .editor-styles-wrapper' ); - $css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' ); + if ( $color_settings['content_background_color'] ) { + $css->add_property( 'background-color', $color_settings['content_background_color'] ); + } else { + $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); + } + } else { + $css->set_selector( 'body .editor-styles-wrapper' ); + $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); + + if ( $color_settings['content_background_color'] ) { + $body_background = generate_get_option( 'background_color' ); + $content_background = $color_settings['content_background_color']; + + $css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' ); + } } $css->set_selector( '.block-editor-block-list__block a, .block-editor-block-list__block a:visited' ); diff --git a/wp-content/themes/generatepress/inc/meta-box.php b/wp-content/themes/generatepress/inc/meta-box.php index 659e427..9725cd4 100644 --- a/wp-content/themes/generatepress/inc/meta-box.php +++ b/wp-content/themes/generatepress/inc/meta-box.php @@ -160,12 +160,12 @@ function generate_do_layout_meta_box( $post ) { diff --git a/wp-content/themes/generatepress/readme.txt b/wp-content/themes/generatepress/readme.txt index 040fc2c..cf8cd2e 100644 --- a/wp-content/themes/generatepress/readme.txt +++ b/wp-content/themes/generatepress/readme.txt @@ -5,8 +5,8 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options Requires at least: 4.5 -Tested up to: 5.5 -Stable tag: 3.0.2 +Tested up to: 5.7 +Stable tag: 3.0.3 GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. @@ -95,6 +95,13 @@ MIT License: https://github.com/bgrins/TinyColor/blob/master/LICENSE == Changelog == += 3.0.3 = + +Release date: March 2, 2021 + +* Fix: is-dark-theme class in editor in WP 5.7 +* Fix: Saving footer widget post meta in editor + = 3.0.2 = Release date: October 14, 2020 diff --git a/wp-content/themes/generatepress/style.css b/wp-content/themes/generatepress/style.css index c4fe360..4310308 100644 --- a/wp-content/themes/generatepress/style.css +++ b/wp-content/themes/generatepress/style.css @@ -4,19 +4,19 @@ Theme URI: https://generatepress.com Author: Tom Usborne Author URI: https://tomusborne.com Description: GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 10kb (gzipped) to your page size. We take full advantage of the new block editor (Gutenberg), which gives you more control over creating your content. If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor. Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce. GeneratePress is fully responsive, uses valid HTML/CSS and is translated into over 25 languages by our amazing community of users. A few of our many features include microdata integration, 9 widget areas, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover) and navigation color presets. Learn more and check out our powerful premium version at https://generatepress.com -Version: 3.0.2 +Version: 3.0.3 Requires at least: 4.5.0 -Tested up to: 5.5 +Tested up to: 5.7 Requires PHP: 5.4.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: generatepress Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options -GeneratePress, Copyright 2014-2020 EDGE22 Studios LTD. +GeneratePress, Copyright 2014-2021 EDGE22 Studios LTD. GeneratePress is distributed under the terms of the GNU GPL -GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2020 Automattic, Inc. +GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc. Actual CSS can be found in /assets/css/ folder. */