updated theme `GeneratePress` version 3.1.3

This commit is contained in:
KawaiiPunk 2022-03-21 13:35:22 +00:00 committed by Gitium
parent 71c1e3409e
commit b69b3e9ad3
12 changed files with 157 additions and 90 deletions

View File

@ -69,11 +69,6 @@ body .block-editor-block-list__block hr {
width: auto;
}
body .block-editor-block-list__block,
body .block-editor-block-list__block p {
font-size: inherit;
}
body .block-editor-default-block-appender input[type=text].editor-default-block-appender__content,
body .block-editor-default-block-appender textarea.editor-default-block-appender__content {
font-family: inherit;

View File

@ -1,4 +1,4 @@
.editor-styles-wrapper {
body {
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: normal;
text-transform: none;
@ -6,21 +6,22 @@
line-height: 1.5;
}
.editor-styles-wrapper p {
line-height: 1.5;
p {
line-height: inherit;
font-size: inherit;
margin-top: 0;
margin-bottom: 1.5em;
}
.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6 {
h1, h2, h3, h4, h5, h6 {
font-family: inherit;
font-size: 100%;
font-style: inherit;
font-weight: inherit;
}
.editor-styles-wrapper h1,
.editor-styles-wrapper .editor-post-title__input {
h1,
.editor-post-title__input {
font-family: inherit;
font-size: 42px;
margin-bottom: 20px;
@ -30,7 +31,7 @@
text-transform: none;
}
.editor-styles-wrapper h2 {
h2 {
font-family: inherit;
font-size: 35px;
margin-bottom: 20px;
@ -40,7 +41,7 @@
text-transform: none;
}
.editor-styles-wrapper h3 {
h3 {
font-family: inherit;
font-size: 29px;
margin-bottom: 20px;
@ -50,17 +51,17 @@
text-transform: none;
}
.editor-styles-wrapper h4 {
h4 {
font-size: 24px;
}
.editor-styles-wrapper h5 {
h5 {
font-size: 20px;
}
.editor-styles-wrapper h4,
.editor-styles-wrapper h5,
.editor-styles-wrapper h6 {
h4,
h5,
h6 {
font-family: inherit;
margin-bottom: 20px;
margin-top: 0;

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'cce88a99e1e77f1e8791fa8ad107481c');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'da1908e9e6ce0313d16a77f4eee7c763');

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
.components-base-control__help{margin-top:2px;margin-bottom:0}.components-base-control__label{display:block;margin-bottom:10px}.generate-customize-control-wrapper{display:flex}.generate-customize-control-wrapper[data-wrapper-type=color]>div:first-child{flex-grow:1}.generate-customize-control-wrapper[data-wrapper-type=color]>div:not(:first-child):not(:empty){margin-left:5px}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div{flex-basis:calc(50% - 5px)}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div:nth-child(odd){margin-right:5px}.generate-customize-control-wrapper[data-wrapper-type=two-col]>div:nth-child(even){margin-left:5px}.generate-customize-control--popover>.components-popover__content{padding:15px;width:280px;box-sizing:border-box}.generate-customize-control--popover .components-base-control:not(:last-child){margin-bottom:15px}.customize-control[data-toggleid]{display:none}#customize-control-generate_settings-google_font_display{margin-top:10px;display:flex;flex-direction:column}#customize-control-generate_settings-google_font_display .description{order:10;margin-bottom:0;margin-top:5px}
.generate-component-color-picker .components-color-picker{box-sizing:border-box}.generate-component-color-picker .components-color-picker__inputs-wrapper{display:none}.generate-component-color-picker .generate-color-input-wrapper{display:flex;padding:0}.generate-component-color-picker .generate-color-input-wrapper .generate-color-input{flex-grow:1}.generate-component-color-picker .generate-color-input-wrapper .components-color-clear-color{margin-left:5px}.generate-component-color-picker .generate-color-input-wrapper input{margin-right:5px}.generate-component-color-picker .generate-color-input-wrapper .components-base-control__field{margin-bottom:0}.generate-component-color-picker>.components-base-control:first-child{margin-bottom:0}.generate-component-color-picker .components-color-picker__inputs-wrapper{min-width:auto}.generate-component-color-picker .generate-component-color-picker-palette{padding:16px 0 0}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker{display:flex;flex-wrap:wrap}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker .components-circular-option-picker__option-wrapper{margin:0 8px 8px 0}.generate-component-color-picker .components-color-palette{margin:0}.generate-component-color-picker .components-color-picker{padding:5px}.generate-component-color-picker .components-color-picker__body{padding-bottom:0}.generate-component-color-picker .components-popover__content{padding:10px;width:295px;box-sizing:border-box}.generate-component-color-picker .components-color-clear-color{height:auto}.generate-component-color-picker .components-circular-option-picker__option.is-pressed+svg{fill:#fff;background:#000;transform:scale(0.6)}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-customize-control-wrapper{display:flex}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:first-child{flex-grow:1}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:not(:last-child){margin-right:5px}.generate-component-color-picker-wrapper>.components-base-control__field{position:relative;display:flex;align-items:center;justify-content:space-between}.generate-component-color-picker-wrapper>.components-base-control__field .components-color-palette__item-wrapper{margin:0}.generate-component-color-picker-palette button,.generate-color-picker-area button{width:28px;height:28px;position:relative}.generate-component-color-picker-palette button:hover,.generate-color-picker-area button:hover{background-color:inherit}.generate-component-color-picker-palette button:focus:after,.generate-color-picker-area button:focus:after{width:28px;height:28px}.generate-customize-control--popover .components-color-picker{box-sizing:border-box}.generate-customize-control--popover .components-color-picker__inputs-wrapper{display:none}.generate-customize-control--popover>.components-base-control:first-child{margin-bottom:0}.generate-customize-control--popover .components-color-picker__inputs-wrapper{min-width:auto}.generate-customize-control--popover .components-color-picker{padding:5px}.generate-customize-control--popover .components-color-picker__body{padding-bottom:0}.generate-customize-control--popover .components-color-clear-color{height:auto}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-color-input--icon{align-items:center;justify-content:center;display:flex;padding:5px;border:1px solid currentColor;border-right:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.generate-color-input--icon svg{height:1em;width:1em;transform:scale(1.3)}.generate-color-option-area{padding:16px 16px 0}.generate-color-input--css-var-name-wrapper{position:relative}.generate-color-input--css-var-name-wrapper button{position:absolute;bottom:0;right:0;padding:0 8px;min-height:30px;height:auto}.generate-color-input--css-var-name-wrapper button svg{width:1em;height:1em;fill:none}
.generate-component-color-picker .components-color-picker{box-sizing:border-box}.generate-component-color-picker .components-color-picker__inputs-wrapper{display:none}.generate-component-color-picker .react-colorful{width:100% !important}.generate-component-color-picker .react-colorful .react-colorful__saturation{height:150px}.generate-component-color-picker .react-colorful .react-colorful__hue,.generate-component-color-picker .react-colorful .react-colorful__alpha{width:calc(100% - 40px)}.generate-component-color-picker .react-colorful+div{display:none}.generate-component-color-picker .generate-color-input-wrapper{display:flex;padding:0}.generate-component-color-picker .generate-color-input-wrapper .generate-color-input{flex-grow:1}.generate-component-color-picker .generate-color-input-wrapper .components-color-clear-color{margin-left:5px}.generate-component-color-picker .generate-color-input-wrapper input{margin-right:5px}.generate-component-color-picker .generate-color-input-wrapper .components-base-control__field{margin-bottom:0}.generate-component-color-picker>.components-base-control:first-child{margin-bottom:0}.generate-component-color-picker .components-color-picker__inputs-wrapper{min-width:auto}.generate-component-color-picker .generate-component-color-picker-palette{padding:16px 0 0}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker{display:flex;flex-wrap:wrap}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker .components-circular-option-picker__swatches{display:flex;flex-wrap:wrap;gap:6px}.generate-component-color-picker .generate-component-color-picker-palette .components-circular-option-picker .components-circular-option-picker__swatches .components-circular-option-picker__option-wrapper{margin:0}.generate-component-color-picker .components-color-palette{margin:0}.generate-component-color-picker .components-color-picker{padding:5px;width:100%}.generate-component-color-picker .components-color-picker__body{padding-bottom:0}.generate-component-color-picker .components-popover__content{padding:10px;width:295px;box-sizing:border-box}.generate-component-color-picker .components-color-clear-color{height:auto}.generate-component-color-picker .components-circular-option-picker__option.is-pressed+svg{fill:#fff;background:#000;transform:scale(0.6)}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-customize-control-wrapper{display:flex}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:first-child{flex-grow:1}.generate-customize-control-wrapper.generate-customize-color-control-wrapper>div:not(:last-child){margin-right:5px}.generate-component-color-picker-wrapper>.components-base-control__field{position:relative;display:flex;align-items:center;justify-content:space-between}.generate-component-color-picker-wrapper>.components-base-control__field .components-color-palette__item-wrapper{margin:0}.generate-component-color-picker-palette button,.generate-color-picker-area button{width:28px;height:28px;position:relative}.generate-component-color-picker-palette button:hover,.generate-color-picker-area button:hover{background-color:inherit}.generate-component-color-picker-palette button:focus:after,.generate-color-picker-area button:focus:after{width:28px;height:28px}.generate-customize-control--popover .components-color-picker{box-sizing:border-box}.generate-customize-control--popover .components-color-picker__inputs-wrapper{display:none}.generate-customize-control--popover>.components-base-control:first-child{margin-bottom:0}.generate-customize-control--popover .components-color-picker__inputs-wrapper{min-width:auto}.generate-customize-control--popover .components-color-picker{padding:5px}.generate-customize-control--popover .components-color-picker__body{padding-bottom:0}.generate-customize-control--popover .components-color-clear-color{height:auto}.generate-component-color-picker[data-x-axis=left] .components-popover__content{margin-right:-35px !important}.generate-color-input--icon{align-items:center;justify-content:center;display:flex;padding:5px;border:1px solid currentColor;border-right:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.generate-color-input--icon svg{height:1em;width:1em;transform:scale(1.3)}.generate-color-option-area{padding:16px 16px 0}.generate-color-input--css-var-name-wrapper{position:relative}.generate-color-input--css-var-name-wrapper button{position:absolute;bottom:0;right:0;padding:0 8px;min-height:30px;height:auto}.generate-color-input--css-var-name-wrapper button svg{width:1em;height:1em;fill:none}
.generate-font-manager--item{margin-bottom:10px}.generate-font-manager--item .generate-font-manager--header{display:flex;align-items:center}.generate-font-manager--item .generate-font-manager--header .generate-font-manager--label{flex-grow:1;padding-left:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label){background:#fff;border:1px solid #777;padding:0;display:flex;justify-content:center;align-items:center;width:30px;height:30px;min-width:30px;margin-left:5px;border-radius:100%;flex-shrink:0}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label) svg{margin-right:0;width:1em;height:1em}.generate-font-manager--item .generate-font-manager--header .components-button:not(.generate-font-manager--label).generate-font-manager--open svg{fill:none}.generate-font-manager--item .generate-font-manager--options{margin-top:15px}.generate-font-manager--item .generate-font-manager--footer{margin-top:15px;padding-top:15px;border-top:1px solid #ddd}.generate-font-manager--item .generate-font-manager-google-font--field{margin-top:10px}.generate-font-manager--item .generate-font-manager--google-font-options{display:flex;flex-wrap:wrap;margin-top:15px}.generate-font-manager--item .generate-font-manager--google-font-options>div{flex-basis:calc(50% - 10px);margin-bottom:0}.generate-font-manager--item .generate-font-manager--google-font-options>div:nth-child(even){margin-left:5px}.generate-font-manager--item .generate-font-manager--google-font-options>div:nth-child(odd){margin-right:5px}.generate-font-manager--item .generate-font-manager--google-font-options .components-base-control__field{margin-bottom:0 !important}.generate-font-manager--item .generate-font-manager--select-options{display:flex;flex-wrap:wrap}.generate-font-manager--item .generate-font-manager--select-options>div{flex-basis:calc(50% - 5px)}.generate-font-manager--item .generate-font-manager--select-options>div:nth-child(even){margin-left:5px}.generate-font-manager--item .generate-font-manager--select-options>div:nth-child(odd){margin-right:5px}.generate-font-manager--item .components-select-control__input--generate-fontfamily{margin-bottom:3px}.generate-font-manager--item .generate-advanced-select__menu{position:relative !important}.generate-font-manager-group{margin-top:10px;margin-bottom:20px}.generate-font-manager-group__label{margin-top:0;color:#000;text-transform:uppercase;font-size:11px;margin-bottom:10px}.generate-font-manager-group .generate-font-manager--item:last-child{margin-bottom:0}.generate-customize-control--font-dropdown{background:#fff;padding:15px;margin-top:10px;position:relative}.generate-customize-control--font-dropdown:before{content:"";position:absolute;left:11px;top:-10px;width:0;height:0;border-style:solid;border-width:0 10px 10px 10px;border-color:transparent transparent #fff transparent;z-index:10}.generate-customize-control--font-dropdown>.components-base-control:not(:last-child){margin-bottom:15px}.generate-customize-control--font-dropdown>.components-base-control:last-child .components-base-control__field{margin-bottom:0}
.generate-advanced-select__control{margin-bottom:12px}.generate-advanced-select__value-container{padding:0 6px !important}.generate-advanced-select__value-container>div{padding:0;margin:0}.generate-advanced-select__input input[type=text]:focus{box-shadow:none}.generate-advanced-select__option--is-selected{color:rgba(255,255,255,.5) !important}
.components-generate-units-control-header__units{display:flex;justify-content:space-between;margin-bottom:5px;align-items:center}.components-generate-control__units .components-generate-control-buttons__units button.components-button{background:#fff;box-shadow:none !important;color:#929da7;font-size:10px;padding:0 5px;position:relative;text-align:center;text-shadow:none;border:0;border-radius:0 !important;line-height:20px;padding:0 5px;height:auto}.components-generate-control__units .components-generate-control-buttons__units button.components-button.is-primary{background:#fff !important;color:#000 !important;cursor:default;z-index:1;font-weight:bold}.generate-component-device-field[data-device=desktop],.generate-component-device-field[data-device=tablet],.generate-component-device-field[data-device=mobile]{display:none}.preview-desktop .generate-component-device-field[data-device=desktop]{display:block}.preview-desktop .components-generate-control__units button.components-generate-control-button__units--desktop{color:#000}.preview-tablet .generate-component-device-field[data-device=tablet]{display:block}.preview-tablet .components-generate-control__units button.components-generate-control-button__units--tablet{color:#000}.preview-mobile .generate-component-device-field[data-device=mobile]{display:block}.preview-mobile .components-generate-control__units button.components-generate-control-button__units--mobile{color:#000}

View File

@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Set our theme version.
define( 'GENERATE_VERSION', '3.1.0' );
define( 'GENERATE_VERSION', '3.1.3' );
if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
@ -68,8 +68,17 @@ if ( ! function_exists( 'generate_setup' ) ) {
$content_width = 1200; /* pixels */
}
// This theme styles the visual editor to resemble the theme style.
add_editor_style( 'assets/css/admin/editor-style.css' );
// Add editor styles to the block editor.
add_theme_support( 'editor-styles' );
$editor_styles = apply_filters(
'generate_editor_styles',
array(
'assets/css/admin/block-editor.css',
)
);
add_editor_style( $editor_styles );
}
}

View File

@ -92,6 +92,34 @@ function generate_get_block_editor_content_width() {
return apply_filters( 'generate_block_editor_content_width', $content_width );
}
add_filter( 'block_editor_settings_all', 'generate_add_inline_block_editor_styles' );
/**
* Add dynamic inline styles to the block editor content.
*
* @param array $editor_settings The existing editor settings.
*/
function generate_add_inline_block_editor_styles( $editor_settings ) {
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
if ( $show_editor_styles ) {
if ( generate_is_using_dynamic_typography() ) {
$google_fonts_uri = GeneratePress_Typography::get_google_fonts_uri();
if ( $google_fonts_uri ) {
// Need to use @import for now until this is ready: https://github.com/WordPress/gutenberg/pull/35950.
$google_fonts_import = sprintf(
'@import "%s";',
$google_fonts_uri
);
$editor_settings['styles'][] = array( 'css' => $google_fonts_import );
}
}
}
return $editor_settings;
}
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' );
add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' );
/**
@ -100,18 +128,17 @@ add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_edito
* @since 2.2
*/
function generate_enqueue_backend_block_editor_assets() {
wp_enqueue_style( 'generate-block-editor-styles', get_template_directory_uri() . '/assets/css/admin/block-editor.css', false, GENERATE_VERSION, 'all' );
wp_enqueue_script( 'generate-block-editor-tinycolor', get_template_directory_uri() . '/assets/js/admin/tinycolor.js', false, GENERATE_VERSION, true );
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 );
$show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true );
if ( $show_editor_styles ) {
wp_add_inline_style( 'generate-block-editor-styles', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
// Using wp-edit-blocks for now until we do this: https://github.com/tomusborne/generatepress/pull/343.
wp_add_inline_style( 'wp-edit-blocks', wp_strip_all_tags( generate_do_inline_block_editor_css() ) );
if ( generate_is_using_dynamic_typography() ) {
wp_enqueue_style( 'generate-editor-typography', get_template_directory_uri() . '/assets/css/admin/editor-typography.css', false, GENERATE_VERSION, 'all' );
wp_add_inline_style( 'generate-editor-typography', wp_strip_all_tags( GeneratePress_Typography::get_css( 'core', 'editor' ) ) );
wp_add_inline_style( 'wp-edit-blocks', wp_strip_all_tags( GeneratePress_Typography::get_css( 'core', 'editor' ) ) );
}
}
@ -220,7 +247,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'max-width', $content_width_calc );
}
$css->set_selector( 'html body.gutenberg-editor-page .block-editor-block-list__block[data-align="full"]' );
$css->set_selector( '.editor-styles-wrapper .wp-block[data-align="full"]' );
$css->add_property( 'max-width', 'none' );
$css->set_selector( '.wp-block[data-align="wide"]' );
@ -281,7 +308,7 @@ function generate_do_inline_block_editor_css() {
$buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() );
}
$css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, body .editor-styles-wrapper' );
$css->set_selector( 'body.gutenberg-editor-page .block-editor-block-list__block, html .editor-styles-wrapper' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $body_family );
@ -303,15 +330,15 @@ function generate_do_inline_block_editor_css() {
}
if ( ! generate_is_using_dynamic_typography() ) {
$css->set_selector( 'body .editor-styles-wrapper, body .editor-styles-wrapper p, body .editor-styles-wrapper .mce-content-body' );
$css->set_selector( 'html .editor-styles-wrapper, html .editor-styles-wrapper p, html .editor-styles-wrapper .mce-content-body' );
$css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) );
$css->set_selector( 'body .editor-styles-wrapper p' );
$css->set_selector( 'html .editor-styles-wrapper p' );
$css->add_property( 'margin-top', '0px' );
$css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' );
}
$css->set_selector( 'body .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .editor-post-title__input' );
$css->set_selector( 'html .editor-styles-wrapper h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .editor-post-title__input' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', 'inherit' === $h1_family || '' === $h1_family ? $body_family : $h1_family );
@ -336,7 +363,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'color', $color_settings['content_title_color'] );
}
$css->set_selector( 'body .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
$css->set_selector( 'html .editor-styles-wrapper h2, .wp-block-heading h2.editor-rich-text__tinymce' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $h2_family );
@ -356,7 +383,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
$css->set_selector( 'html .editor-styles-wrapper h3, .wp-block-heading h3.editor-rich-text__tinymce' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $h3_family );
@ -376,7 +403,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
$css->set_selector( 'html .editor-styles-wrapper h4, .wp-block-heading h4.editor-rich-text__tinymce' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $h4_family );
@ -404,7 +431,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
$css->set_selector( 'html .editor-styles-wrapper h5, .wp-block-heading h5.editor-rich-text__tinymce' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $h5_family );
@ -432,7 +459,7 @@ function generate_do_inline_block_editor_css() {
$css->add_property( 'color', generate_get_option( 'text_color' ) );
}
$css->set_selector( 'body .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
$css->set_selector( 'html .editor-styles-wrapper h6, .wp-block-heading h6.editor-rich-text__tinymce' );
if ( ! generate_is_using_dynamic_typography() ) {
$css->add_property( 'font-family', $h6_family );

View File

@ -220,7 +220,7 @@ class GeneratePress_Dashboard {
'siteIdentitySection' => admin_url( 'customize.php?autofocus[section]=title_tagline' ),
'colorsSection' => admin_url( 'customize.php?autofocus[section]=generate_colors_section' ),
'typographySection' => admin_url( 'customize.php?autofocus[section]=generate_typography_section' ),
'layoutSection' => admin_url( 'customize.php?autofocus[section]=generate_layout_panel' ),
'layoutSection' => admin_url( 'customize.php?autofocus[panel]=generate_layout_panel' ),
),
)
);

View File

@ -36,23 +36,25 @@ class GeneratePress_Typography {
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ) );
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_google_fonts' ) );
add_filter( 'generate_editor_styles', array( $this, 'add_editor_styles' ) );
// Load fonts the old way in versions before 5.8 as block_editor_settings_all didn't exist.
if ( version_compare( $GLOBALS['wp_version'], '5.8', '<' ) ) {
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_google_fonts' ) );
}
}
/**
* Enqueue Google Fonts if they're set.
* Generate our Google Fonts URI.
*/
public function enqueue_google_fonts() {
if ( ! generate_is_using_dynamic_typography() ) {
return;
}
public static function get_google_fonts_uri() {
$fonts = generate_get_option( 'font_manager' );
if ( empty( $fonts ) ) {
return;
}
$google_fonts_uri = '';
$data = array();
foreach ( $fonts as $font ) {
@ -92,6 +94,22 @@ class GeneratePress_Typography {
);
$google_fonts_uri = add_query_arg( $font_args, 'https://fonts.googleapis.com/css' );
}
return $google_fonts_uri;
}
/**
* Enqueue Google Fonts if they're set.
*/
public function enqueue_google_fonts() {
if ( ! generate_is_using_dynamic_typography() ) {
return;
}
$google_fonts_uri = self::get_google_fonts_uri();
if ( $google_fonts_uri ) {
wp_enqueue_style( 'generate-google-fonts', $google_fonts_uri, array(), GENERATE_VERSION );
}
}
@ -118,14 +136,10 @@ class GeneratePress_Typography {
$body_selector = 'body';
$paragraph_selector = 'p';
$tablet_prefix = '';
$mobile_prefix = '';
if ( 'editor' === $type ) {
$body_selector = '.editor-styles-wrapper';
$paragraph_selector = '.editor-styles-wrapper p';
$tablet_prefix = '.gp-is-device-tablet ';
$mobile_prefix = '.gp-is-device-mobile ';
$body_selector = 'html .editor-styles-wrapper';
$paragraph_selector = 'html .editor-styles-wrapper p';
}
foreach ( $typography as $key => $data ) {
@ -160,16 +174,7 @@ class GeneratePress_Typography {
$css->add_property( 'margin-bottom', $options['marginBottom'], false, $options['marginBottomUnit'] );
}
if ( 'frontend' === $type ) {
$css->start_media_query( generate_get_media_query( 'tablet' ) );
}
if ( 'editor' === $type ) {
// Add the tablet prefix to each class.
$selector = explode( ', ', $selector );
$selector = preg_filter( '/^/', $tablet_prefix, $selector );
$selector = implode( ', ', $selector );
}
$css->start_media_query( generate_get_media_query( 'tablet' ) );
$css->set_selector( $selector );
$css->add_property( 'font-size', $options['fontSizeTablet'], false, $options['fontSizeUnit'] );
@ -179,24 +184,16 @@ class GeneratePress_Typography {
$css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] );
$css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
} else {
$css->set_selector( $tablet_prefix . $body_selector );
$css->set_selector( $body_selector );
$css->add_property( 'line-height', $options['lineHeightTablet'], false, $options['lineHeightUnit'] );
$css->set_selector( $tablet_prefix . $paragraph_selector );
$css->set_selector( $paragraph_selector );
$css->add_property( 'margin-bottom', $options['marginBottomTablet'], false, $options['marginBottomUnit'] );
}
if ( 'frontend' === $type ) {
$css->stop_media_query();
}
$css->stop_media_query();
if ( 'frontend' === $type ) {
$css->start_media_query( generate_get_media_query( 'mobile' ) );
}
if ( 'editor' === $type ) {
$selector = str_replace( '.gp-is-device-tablet', '.gp-is-device-mobile', $selector );
}
$css->start_media_query( generate_get_media_query( 'mobile' ) );
$css->set_selector( $selector );
$css->add_property( 'font-size', $options['fontSizeMobile'], false, $options['fontSizeUnit'] );
@ -206,16 +203,14 @@ class GeneratePress_Typography {
$css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] );
$css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
} else {
$css->set_selector( $mobile_prefix . $body_selector );
$css->set_selector( $body_selector );
$css->add_property( 'line-height', $options['lineHeightMobile'], false, $options['lineHeightUnit'] );
$css->set_selector( $mobile_prefix . $paragraph_selector );
$css->set_selector( $paragraph_selector );
$css->add_property( 'margin-bottom', $options['marginBottomMobile'], false, $options['marginBottomUnit'] );
}
if ( 'frontend' === $type ) {
$css->stop_media_query();
}
$css->stop_media_query();
}
return $css->css_output();
@ -288,7 +283,7 @@ class GeneratePress_Typography {
if ( 'editor' === $type ) {
switch ( $selector ) {
case 'body':
$selector = 'body .editor-styles-wrapper';
$selector = 'html .editor-styles-wrapper';
break;
case 'buttons':
@ -296,15 +291,15 @@ class GeneratePress_Typography {
break;
case 'all-headings':
$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';
$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';
break;
case 'h1':
$selector = '.editor-styles-wrapper h1, .editor-styles-wrapper .editor-post-title__input';
$selector = 'html .editor-styles-wrapper h1, html .editor-styles-wrapper .editor-post-title__input';
break;
case 'single-content-title':
$selector = '.editor-styles-wrapper .editor-post-title__input';
$selector = 'html .editor-styles-wrapper .editor-post-title__input';
break;
case 'h2':
@ -312,7 +307,7 @@ class GeneratePress_Typography {
case 'h4':
case 'h5':
case 'h6':
$selector = '.editor-styles-wrapper ' . $selector;
$selector = 'html .editor-styles-wrapper ' . $selector;
break;
}
}
@ -378,6 +373,19 @@ class GeneratePress_Typography {
'marginBottomUnit' => 'px',
);
}
/**
* Add editor styles to the block editor.
*
* @param array $editor_styles Existing styles.
*/
public function add_editor_styles( $editor_styles ) {
if ( generate_is_using_dynamic_typography() ) {
$editor_styles[] = 'assets/css/admin/editor-typography.css';
}
return $editor_styles;
}
}
GeneratePress_Typography::get_instance();

View File

@ -328,6 +328,10 @@ function generate_do_control_inline_scripts() {
true
);
if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( 'generate-customizer-controls', 'generatepress' );
}
$color_palette = get_theme_support( 'editor-color-palette' );
$colors = array();

View File

@ -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: 5.2
Tested up to: 5.8
Stable tag: 3.1.0
Tested up to: 5.9
Stable tag: 3.1.3
GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
@ -99,6 +99,29 @@ MIT License: https://github.com/JedWatson/react-select/blob/master/LICENSE
== Changelog ==
= 3.1.3 =
Release date: February 9, 2022
* Fix: Adjust editor block width selector to fix compatibility with GP Premium
* Fix: Missing editor styles when viewing tablet/mobile previews in Firefox
* Fix: Missing Google Fonts API request when viewing tablet/mobile previews in the editor
= 3.1.2 =
Release date: January 31, 2022
* Fix: Align-full alignment in the editor
* Fix: Missing editor text colors in responsive views
= 3.1.1 =
Release date: January 17, 2022
* Fix: Color picker UI in WP 5.9
* Fix: Translations using javascript
* Fix: Layout panel link inside the Start Customizing Dashboard
= 3.1.0 =
Release date: October 26, 2021

View File

@ -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 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
Version: 3.1.0
Version: 3.1.3
Requires at least: 5.2
Tested up to: 5.8
Tested up to: 5.9
Requires PHP: 5.6
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-2021 EDGE22 Studios LTD.
GeneratePress, Copyright 2014-2022 EDGE22 Studios LTD.
GeneratePress is distributed under the terms of the GNU GPL
GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2021 Automattic, Inc.
GeneratePress is based on Underscores http://underscores.me/, (C) 2012-2022 Automattic, Inc.
Actual CSS can be found in /assets/css/ folder.
*/