Make WordPress Themes

Changeset 162392


Ignore:
Timestamp:
02/09/2022 05:48:11 PM (4 years ago)
Author:
themedropbox
Message:

New version of GeneratePress - 3.1.3

Location:
generatepress/3.1.3
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • generatepress/3.1.3/assets/css/admin/block-editor.css

    r156762 r162392  
    6868    margin-top: 40px;
    6969    width: auto;
    70 }
    71 
    72 body .block-editor-block-list__block,
    73 body .block-editor-block-list__block p {
    74     font-size: inherit;
    7570}
    7671
  • generatepress/3.1.3/assets/css/admin/editor-typography.css

    r156762 r162392  
    1 .editor-styles-wrapper {
     1body {
    22    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    33    font-weight: normal;
     
    77}
    88
    9 .editor-styles-wrapper p {
    10     line-height: 1.5;
     9p {
     10    line-height: inherit;
     11    font-size: inherit;
    1112    margin-top: 0;
    1213    margin-bottom: 1.5em;
    1314}
    1415
    15 .editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6 {
     16h1, h2, h3, h4, h5, h6 {
    1617    font-family: inherit;
    1718    font-size: 100%;
     
    2021}
    2122
    22 .editor-styles-wrapper h1,
    23 .editor-styles-wrapper .editor-post-title__input {
     23h1,
     24.editor-post-title__input {
    2425    font-family: inherit;
    2526    font-size: 42px;
     
    3132}
    3233
    33 .editor-styles-wrapper h2 {
     34h2 {
    3435    font-family: inherit;
    3536    font-size: 35px;
     
    4142}
    4243
    43 .editor-styles-wrapper h3 {
     44h3 {
    4445    font-family: inherit;
    4546    font-size: 29px;
     
    5152}
    5253
    53 .editor-styles-wrapper h4 {
     54h4 {
    5455    font-size: 24px;
    5556}
    5657
    57 .editor-styles-wrapper h5 {
     58h5 {
    5859    font-size: 20px;
    5960}
    6061
    61 .editor-styles-wrapper h4,
    62 .editor-styles-wrapper h5,
    63 .editor-styles-wrapper h6 {
     62h4,
     63h5,
     64h6 {
    6465    font-family: inherit;
    6566    margin-bottom: 20px;
  • generatepress/3.1.3/functions.php

    r161670 r162392  
    1313
    1414// Set our theme version.
    15 define( 'GENERATE_VERSION', '3.1.2' );
     15define( 'GENERATE_VERSION', '3.1.3' );
    1616
    1717if ( ! function_exists( 'generate_setup' ) ) {
     
    6969        }
    7070
    71         // This theme styles the visual editor to resemble the theme style.
    72         add_editor_style( 'assets/css/admin/editor-style.css' );
     71        // Add editor styles to the block editor.
     72        add_theme_support( 'editor-styles' );
     73
     74        $editor_styles = apply_filters(
     75            'generate_editor_styles',
     76            array(
     77                'assets/css/admin/block-editor.css',
     78            )
     79        );
     80
     81        add_editor_style( $editor_styles );
    7382    }
    7483}
  • generatepress/3.1.3/inc/block-editor.php

    r161670 r162392  
    9393}
    9494
     95add_filter( 'block_editor_settings_all', 'generate_add_inline_block_editor_styles' );
     96/**
     97 * Add dynamic inline styles to the block editor content.
     98 *
     99 * @param array $editor_settings The existing editor settings.
     100 */
     101function generate_add_inline_block_editor_styles( $editor_settings ) {
     102    $show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
     103
     104    if ( $show_editor_styles ) {
     105        if ( generate_is_using_dynamic_typography() ) {
     106            $google_fonts_uri = GeneratePress_Typography::get_google_fonts_uri();
     107
     108            if ( $google_fonts_uri ) {
     109                // Need to use @import for now until this is ready: https://github.com/WordPress/gutenberg/pull/35950.
     110                $google_fonts_import = sprintf(
     111                    '@import "%s";',
     112                    $google_fonts_uri
     113                );
     114
     115                $editor_settings['styles'][] = array( 'css' => $google_fonts_import );
     116            }
     117        }
     118    }
     119
     120    return $editor_settings;
     121}
     122
    95123add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' );
    96124add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' );
     
    101129 */
    102130function generate_enqueue_backend_block_editor_assets() {
    103     wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . '/assets/css/admin/block-editor.css', false, GENERATE_VERSION, 'all' );
    104131    wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true );
    105132    wp_enqueue_script( 'generate-block-editor-scripts', get_template_directory_uri() . '/assets/js/admin/block-editor.js', array( 'jquery', 'generate-block-editor-tinycolor' ), GENERATE_VERSION, true );
     
    108135
    109136    if ( $show_editor_styles ) {
    110         wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
     137        // Using wp-edit-blocks for now until we do this: https://github.com/tomusborne/generatepress/pull/343.
     138        wp_add_inline_style( 'wp-edit-blocks', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
    111139
    112140        if ( generate_is_using_dynamic_typography() ) {
    113             wp_enqueue_style( 'generate-editor-typography', get_template_directory_uri() . '/assets/css/admin/editor-typography.css', false, GENERATE_VERSION, 'all' );
    114             wp_add_inline_style( 'generate-editor-typography', wp_strip_all_tags( GeneratePress_Typography::get_css( 'core', 'editor' ) ) );
     141            wp_add_inline_style( 'wp-edit-blocks', wp_strip_all_tags( GeneratePress_Typography::get_css( 'core', 'editor' ) ) );
    115142        }
    116143    }
     
    213240    }
    214241
    215     $css->set_selector( '.editor-styles-wrapper .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' );
     242    $css->set_selector( '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' );
    216243
    217244    if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) {
     
    282309    }
    283310
    284     $css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, .editor-styles-wrapper' );
     311    $css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, html .editor-styles-wrapper' );
    285312
    286313    if ( ! generate_is_using_dynamic_typography() ) {
     
    304331
    305332    if ( ! generate_is_using_dynamic_typography() ) {
    306         $css->set_selector( '.editor-styles-wrapper, .editor-styles-wrapper p, .editor-styles-wrapper .mce-content-body' );
     333        $css->set_selector( 'html .editor-styles-wrapper, html .editor-styles-wrapper p, html .editor-styles-wrapper .mce-content-body' );
    307334        $css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) );
    308335
    309         $css->set_selector( '.editor-styles-wrapper p' );
     336        $css->set_selector( 'html .editor-styles-wrapper p' );
    310337        $css->add_property( 'margin-top', '0px' );
    311338        $css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' );
    312339    }
    313340
    314     $css->set_selector( '.editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .editor-post-title__input' );
     341    $css->set_selector( 'html .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .editor-post-title__input' );
    315342
    316343    if ( ! generate_is_using_dynamic_typography() ) {
     
    337364    }
    338365
    339     $css->set_selector( '.editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
     366    $css->set_selector( 'html .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
    340367
    341368    if ( ! generate_is_using_dynamic_typography() ) {
     
    357384    }
    358385
    359     $css->set_selector( '.editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
     386    $css->set_selector( 'html .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
    360387
    361388    if ( ! generate_is_using_dynamic_typography() ) {
     
    377404    }
    378405
    379     $css->set_selector( '.editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
     406    $css->set_selector( 'html .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
    380407
    381408    if ( ! generate_is_using_dynamic_typography() ) {
     
    405432    }
    406433
    407     $css->set_selector( '.editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
     434    $css->set_selector( 'html .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
    408435
    409436    if ( ! generate_is_using_dynamic_typography() ) {
     
    433460    }
    434461
    435     $css->set_selector( '.editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
     462    $css->set_selector( 'html .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
    436463
    437464    if ( ! generate_is_using_dynamic_typography() ) {
  • generatepress/3.1.3/inc/class-typography.php

    r156762 r162392  
    3737    public function __construct() {
    3838        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ) );
    39         add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_google_fonts' ) );
    40     }
    41 
    42     /**
    43      * Enqueue Google Fonts if they're set.
    44      */
    45     public function enqueue_google_fonts() {
    46         if ( ! generate_is_using_dynamic_typography() ) {
    47             return;
    48         }
    49 
     39        add_filter( 'generate_editor_styles', array( $this, 'add_editor_styles' ) );
     40
     41        // Load fonts the old way in versions before 5.8 as block_editor_settings_all didn't exist.
     42        if ( version_compare( $GLOBALS['wp_version'], '5.8', '<' ) ) {
     43            add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_google_fonts' ) );
     44        }
     45    }
     46
     47    /**
     48     * Generate our Google Fonts URI.
     49     */
     50    public static function get_google_fonts_uri() {
    5051        $fonts = generate_get_option( 'font_manager' );
    5152
     
    5455        }
    5556
     57        $google_fonts_uri = '';
    5658        $data = array();
    5759
     
    9395
    9496            $google_fonts_uri = add_query_arg( $font_args, 'https://fonts.googleapis.com/css' );
     97        }
     98
     99        return $google_fonts_uri;
     100    }
     101
     102    /**
     103     * Enqueue Google Fonts if they're set.
     104     */
     105    public function enqueue_google_fonts() {
     106        if ( ! generate_is_using_dynamic_typography() ) {
     107            return;
     108        }
     109
     110        $google_fonts_uri = self::get_google_fonts_uri();
     111
     112        if ( $google_fonts_uri ) {
    95113            wp_enqueue_style( 'generate-google-fonts', $google_fonts_uri, array(), GENERATE_VERSION );
    96114        }
     
    119137            $body_selector = 'body';
    120138            $paragraph_selector = 'p';
    121             $tablet_prefix = '';
    122             $mobile_prefix = '';
    123139
    124140            if ( 'editor' === $type ) {
    125                 $body_selector = '.editor-styles-wrapper';
    126                 $paragraph_selector = '.editor-styles-wrapper p';
    127                 $tablet_prefix = '.gp-is-device-tablet ';
    128                 $mobile_prefix = '.gp-is-device-mobile ';
     141                $body_selector = 'html .editor-styles-wrapper';
     142                $paragraph_selector = 'html .editor-styles-wrapper p';
    129143            }
    130144
     
    161175                }
    162176
    163                 if ( 'frontend' === $type ) {
    164                     $css->start_media_query( generate_get_media_query( 'tablet' ) );
    165                 }
    166 
    167                 if ( 'editor' === $type ) {
    168                     // Add the tablet prefix to each class.
    169                     $selector = explode( ', ', $selector );
    170                     $selector = preg_filter( '/^/', $tablet_prefix, $selector );
    171                     $selector = implode( ', ', $selector );
    172                 }
     177                $css->start_media_query( generate_get_media_query( 'tablet' ) );
    173178
    174179                $css->set_selector( $selector );
     
    180185                    $css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
    181186                } else {
    182                     $css->set_selector( $tablet_prefix . $body_selector );
     187                    $css->set_selector( $body_selector );
    183188                    $css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] );
    184189
    185                     $css->set_selector( $tablet_prefix . $paragraph_selector );
     190                    $css->set_selector( $paragraph_selector );
    186191                    $css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
    187192                }
    188193
    189                 if ( 'frontend' === $type ) {
    190                     $css->stop_media_query();
    191                 }
    192 
    193                 if ( 'frontend' === $type ) {
    194                     $css->start_media_query( generate_get_media_query( 'mobile' ) );
    195                 }
    196 
    197                 if ( 'editor' === $type ) {
    198                     $selector = str_replace( '.gp-is-device-tablet', '.gp-is-device-mobile', $selector );
    199                 }
     194                $css->stop_media_query();
     195
     196                $css->start_media_query( generate_get_media_query( 'mobile' ) );
    200197
    201198                $css->set_selector( $selector );
     
    207204                    $css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
    208205                } else {
    209                     $css->set_selector( $mobile_prefix . $body_selector );
     206                    $css->set_selector( $body_selector );
    210207                    $css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] );
    211208
    212                     $css->set_selector( $mobile_prefix . $paragraph_selector );
     209                    $css->set_selector( $paragraph_selector );
    213210                    $css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
    214211                }
    215212
    216                 if ( 'frontend' === $type ) {
    217                     $css->stop_media_query();
    218                 }
     213                $css->stop_media_query();
    219214            }
    220215
     
    289284            switch ( $selector ) {
    290285                case 'body':
    291                     $selector = 'body .editor-styles-wrapper';
     286                    $selector = 'html .editor-styles-wrapper';
    292287                    break;
    293288
     
    297292
    298293                case 'all-headings':
    299                     $selector = '.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6';
     294                    $selector = 'html .editor-styles-wrapper h1, html .editor-styles-wrapper h2, html .editor-styles-wrapper h3, html .editor-styles-wrapper h4, html .editor-styles-wrapper h5, html .editor-styles-wrapper h6';
    300295                    break;
    301296
    302297                case 'h1':
    303                     $selector = '.editor-styles-wrapper h1, .editor-styles-wrapper .editor-post-title__input';
     298                    $selector = 'html .editor-styles-wrapper h1, html .editor-styles-wrapper .editor-post-title__input';
    304299                    break;
    305300
    306301                case 'single-content-title':
    307                     $selector = '.editor-styles-wrapper .editor-post-title__input';
     302                    $selector = 'html .editor-styles-wrapper .editor-post-title__input';
    308303                    break;
    309304
     
    313308                case 'h5':
    314309                case 'h6':
    315                     $selector = '.editor-styles-wrapper ' . $selector;
     310                    $selector = 'html .editor-styles-wrapper ' . $selector;
    316311                    break;
    317312            }
     
    379374        );
    380375    }
     376
     377    /**
     378     * Add editor styles to the block editor.
     379     *
     380     * @param array $editor_styles Existing styles.
     381     */
     382    public function add_editor_styles( $editor_styles ) {
     383        if ( generate_is_using_dynamic_typography() ) {
     384            $editor_styles[] = 'assets/css/admin/editor-typography.css';
     385        }
     386
     387        return $editor_styles;
     388    }
    381389}
    382390
  • generatepress/3.1.3/readme.txt

    r161670 r162392  
    77Requires at least: 5.2
    88Tested up to: 5.9
    9 Stable tag: 3.1.2
     9Stable tag: 3.1.3
    1010
    1111GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
     
    9999
    100100== Changelog ==
     101
     102= 3.1.3 =
     103
     104Release date: February 9, 2022
     105
     106* Fix: Adjust editor block width selector to fix compatibility with GP Premium
     107* Fix: Missing editor styles when viewing tablet/mobile previews in Firefox
     108* Fix: Missing Google Fonts API request when viewing tablet/mobile previews in the editor
    101109
    102110= 3.1.2 =
  • generatepress/3.1.3/style.css

    r161670 r162392  
    55Author URI: https://tomusborne.com
    66Description: 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 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 60+ color controls, powerful dynamic typography, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover), and 9 widget areas. Learn more and check out our powerful premium version at https://generatepress.com
    7 Version: 3.1.2
     7Version: 3.1.3
    88Requires at least: 5.2
    99Tested up to: 5.9
Note: See TracChangeset for help on using the changeset viewer.