Changeset 162392
- Timestamp:
- 02/09/2022 05:48:11 PM (4 years ago)
- Location:
- generatepress/3.1.3
- Files:
-
- 7 edited
- 1 copied
-
. (copied) (copied from generatepress/3.1.2)
-
assets/css/admin/block-editor.css (modified) (1 diff)
-
assets/css/admin/editor-typography.css (modified) (6 diffs)
-
functions.php (modified) (2 diffs)
-
inc/block-editor.php (modified) (11 diffs)
-
inc/class-typography.php (modified) (11 diffs)
-
readme.txt (modified) (2 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
generatepress/3.1.3/assets/css/admin/block-editor.css
r156762 r162392 68 68 margin-top: 40px; 69 69 width: auto; 70 }71 72 body .block-editor-block-list__block,73 body .block-editor-block-list__block p {74 font-size: inherit;75 70 } 76 71 -
generatepress/3.1.3/assets/css/admin/editor-typography.css
r156762 r162392 1 .editor-styles-wrapper{1 body { 2 2 font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 3 3 font-weight: normal; … … 7 7 } 8 8 9 .editor-styles-wrapper p { 10 line-height: 1.5; 9 p { 10 line-height: inherit; 11 font-size: inherit; 11 12 margin-top: 0; 12 13 margin-bottom: 1.5em; 13 14 } 14 15 15 .editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapperh6 {16 h1, h2, h3, h4, h5, h6 { 16 17 font-family: inherit; 17 18 font-size: 100%; … … 20 21 } 21 22 22 .editor-styles-wrapperh1,23 .editor- styles-wrapper .editor-post-title__input {23 h1, 24 .editor-post-title__input { 24 25 font-family: inherit; 25 26 font-size: 42px; … … 31 32 } 32 33 33 .editor-styles-wrapperh2 {34 h2 { 34 35 font-family: inherit; 35 36 font-size: 35px; … … 41 42 } 42 43 43 .editor-styles-wrapperh3 {44 h3 { 44 45 font-family: inherit; 45 46 font-size: 29px; … … 51 52 } 52 53 53 .editor-styles-wrapperh4 {54 h4 { 54 55 font-size: 24px; 55 56 } 56 57 57 .editor-styles-wrapperh5 {58 h5 { 58 59 font-size: 20px; 59 60 } 60 61 61 .editor-styles-wrapperh4,62 .editor-styles-wrapperh5,63 .editor-styles-wrapperh6 {62 h4, 63 h5, 64 h6 { 64 65 font-family: inherit; 65 66 margin-bottom: 20px; -
generatepress/3.1.3/functions.php
r161670 r162392 13 13 14 14 // Set our theme version. 15 define( 'GENERATE_VERSION', '3.1. 2' );15 define( 'GENERATE_VERSION', '3.1.3' ); 16 16 17 17 if ( ! function_exists( 'generate_setup' ) ) { … … 69 69 } 70 70 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 ); 73 82 } 74 83 } -
generatepress/3.1.3/inc/block-editor.php
r161670 r162392 93 93 } 94 94 95 add_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 */ 101 function 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 95 123 add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' ); 96 124 add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' ); … … 101 129 */ 102 130 function 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' );104 131 wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true ); 105 132 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 ); … … 108 135 109 136 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() ) ); 111 139 112 140 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' ) ) ); 115 142 } 116 143 } … … 213 240 } 214 241 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' ); 216 243 217 244 if ( 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ) { … … 282 309 } 283 310 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' ); 285 312 286 313 if ( ! generate_is_using_dynamic_typography() ) { … … 304 331 305 332 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' ); 307 334 $css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) ); 308 335 309 $css->set_selector( ' .editor-styles-wrapper p' );336 $css->set_selector( 'html .editor-styles-wrapper p' ); 310 337 $css->add_property( 'margin-top', '0px' ); 311 338 $css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' ); 312 339 } 313 340 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' ); 315 342 316 343 if ( ! generate_is_using_dynamic_typography() ) { … … 337 364 } 338 365 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' ); 340 367 341 368 if ( ! generate_is_using_dynamic_typography() ) { … … 357 384 } 358 385 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' ); 360 387 361 388 if ( ! generate_is_using_dynamic_typography() ) { … … 377 404 } 378 405 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' ); 380 407 381 408 if ( ! generate_is_using_dynamic_typography() ) { … … 405 432 } 406 433 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' ); 408 435 409 436 if ( ! generate_is_using_dynamic_typography() ) { … … 433 460 } 434 461 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' ); 436 463 437 464 if ( ! generate_is_using_dynamic_typography() ) { -
generatepress/3.1.3/inc/class-typography.php
r156762 r162392 37 37 public function __construct() { 38 38 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() { 50 51 $fonts = generate_get_option( 'font_manager' ); 51 52 … … 54 55 } 55 56 57 $google_fonts_uri = ''; 56 58 $data = array(); 57 59 … … 93 95 94 96 $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 ) { 95 113 wp_enqueue_style( 'generate-google-fonts', $google_fonts_uri, array(), GENERATE_VERSION ); 96 114 } … … 119 137 $body_selector = 'body'; 120 138 $paragraph_selector = 'p'; 121 $tablet_prefix = '';122 $mobile_prefix = '';123 139 124 140 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'; 129 143 } 130 144 … … 161 175 } 162 176 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' ) ); 173 178 174 179 $css->set_selector( $selector ); … … 180 185 $css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] ); 181 186 } else { 182 $css->set_selector( $ tablet_prefix . $body_selector );187 $css->set_selector( $body_selector ); 183 188 $css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] ); 184 189 185 $css->set_selector( $ tablet_prefix . $paragraph_selector );190 $css->set_selector( $paragraph_selector ); 186 191 $css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] ); 187 192 } 188 193 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' ) ); 200 197 201 198 $css->set_selector( $selector ); … … 207 204 $css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] ); 208 205 } else { 209 $css->set_selector( $ mobile_prefix . $body_selector );206 $css->set_selector( $body_selector ); 210 207 $css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] ); 211 208 212 $css->set_selector( $ mobile_prefix . $paragraph_selector );209 $css->set_selector( $paragraph_selector ); 213 210 $css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] ); 214 211 } 215 212 216 if ( 'frontend' === $type ) { 217 $css->stop_media_query(); 218 } 213 $css->stop_media_query(); 219 214 } 220 215 … … 289 284 switch ( $selector ) { 290 285 case 'body': 291 $selector = ' body.editor-styles-wrapper';286 $selector = 'html .editor-styles-wrapper'; 292 287 break; 293 288 … … 297 292 298 293 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'; 300 295 break; 301 296 302 297 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'; 304 299 break; 305 300 306 301 case 'single-content-title': 307 $selector = ' .editor-styles-wrapper .editor-post-title__input';302 $selector = 'html .editor-styles-wrapper .editor-post-title__input'; 308 303 break; 309 304 … … 313 308 case 'h5': 314 309 case 'h6': 315 $selector = ' .editor-styles-wrapper ' . $selector;310 $selector = 'html .editor-styles-wrapper ' . $selector; 316 311 break; 317 312 } … … 379 374 ); 380 375 } 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 } 381 389 } 382 390 -
generatepress/3.1.3/readme.txt
r161670 r162392 7 7 Requires at least: 5.2 8 8 Tested up to: 5.9 9 Stable tag: 3.1. 29 Stable tag: 3.1.3 10 10 11 11 GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. … … 99 99 100 100 == Changelog == 101 102 = 3.1.3 = 103 104 Release 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 101 109 102 110 = 3.1.2 = -
generatepress/3.1.3/style.css
r161670 r162392 5 5 Author URI: https://tomusborne.com 6 6 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 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. 27 Version: 3.1.3 8 8 Requires at least: 5.2 9 9 Tested up to: 5.9
Note: See TracChangeset
for help on using the changeset viewer.