Load same stylesheets in the Site Editor as in the frontend (#36911)

This commit is contained in:
Néstor Soriano 2023-03-17 09:07:37 +01:00 committed by GitHub
commit 196c4f889c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 130 additions and 120 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Load same stylesheets in the Site Editor as in the frontend

View File

@ -365,63 +365,6 @@
}
// Description/Additional info/Reviews tabs.
.woocommerce-tabs {
padding-top: var(--wp--style--block-gap);
ul.wc-tabs {
padding: 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: #eae9eb;
li {
opacity: 0.5;
color: var(--wp--preset--color--contrast);
margin: 0;
padding: 0.5em 1em 0.5em 1em;
border-color: #eae9eb;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
float: left;
border-style: solid;
border-width: 1px;
font-weight: 600;
font-size: var(--wp--preset--font-size--medium);
&:first-child {
border-left-color: #eae9eb;
margin-left: 1em;
}
&.active {
background: var(--wp--preset--color--tertiary);
color: var(--wp--preset--color--contrast);
opacity: 1;
}
a {
text-decoration: none;
color: var(--wp--preset--color--contrast);
}
}
}
.woocommerce-Tabs-panel {
padding-top: var(--wp--style--block-gap);
font-size: var(--wp--preset--font-size--small);
margin-left: 1em;
h2 {
display: none;
}
table.woocommerce-product-attributes {
text-align: left;
}
}
}
// Reviews tab.
.woocommerce-Reviews {
ol.commentlist {
@ -593,6 +536,63 @@
}
// Description/Additional info/Reviews tabs.
.woocommerce-tabs {
padding-top: var(--wp--style--block-gap);
}
ul.wc-tabs {
padding: 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: #eae9eb;
li {
opacity: 0.5;
color: var(--wp--preset--color--contrast);
margin: 0;
padding: 0.5em 1em 0.5em 1em;
border-color: #eae9eb;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
float: left;
border-style: solid;
border-width: 1px;
font-weight: 600;
font-size: var(--wp--preset--font-size--medium);
&:first-child {
border-left-color: #eae9eb;
margin-left: 1em;
}
&.active {
background: var(--wp--preset--color--tertiary);
color: var(--wp--preset--color--contrast);
opacity: 1;
}
a {
text-decoration: none;
color: var(--wp--preset--color--contrast);
}
}
}
.woocommerce-Tabs-panel {
padding-top: var(--wp--style--block-gap);
font-size: var(--wp--preset--font-size--small);
margin-left: 1em;
h2 {
display: none;
}
table.woocommerce-product-attributes {
text-align: left;
}
}
.woocommerce-page {
.woocommerce-cart-form {

View File

@ -369,63 +369,6 @@ $tt2-gray: #f7f7f7;
}
}
.woocommerce-tabs {
padding-top: var(--wp--style--block-gap);
ul.wc-tabs {
padding: 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: #eae9eb;
li {
background: #eae9eb;
margin: 0;
padding: 0.5em 1em 0.5em 1em;
border-color: #eae9eb;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
float: left;
border-style: solid;
border-width: 1px;
border-left-color: var(--wp--preset--color--background);
font-weight: 600;
font-size: var(--wp--preset--font-size--medium);
&:first-child {
border-left-color: #eae9eb;
margin-left: 1em;
}
&.active {
box-shadow: 0 1px var(--wp--preset--color--background);
}
a {
text-decoration: none;
}
}
}
// Moved from blocktheme.scss to retain full styling.
ul.tabs li.active {
// Style active tab in theme colors.
background: var(--wp--preset--color--background, $contentbg);
border-bottom-color: var(--wp--preset--color--background, $contentbg);
}
.woocommerce-Tabs-panel {
padding-top: var(--wp--style--block-gap);
font-size: var(--wp--preset--font-size--small);
margin-left: 1em;
h2 {
display: none;
}
}
}
.woocommerce-Reviews {
ol.commentlist {
list-style: none;
@ -603,6 +546,59 @@ $tt2-gray: #f7f7f7;
}
}
// Description/Additional info/Reviews tabs.
.woocommerce-tabs {
padding-top: var(--wp--style--block-gap);
}
ul.wc-tabs {
padding: 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: #eae9eb;
li {
background: #eae9eb;
margin: 0;
padding: 0.5em 1em 0.5em 1em;
border-color: #eae9eb;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
float: left;
border-style: solid;
border-width: 1px;
border-left-color: var(--wp--preset--color--background);
font-weight: 600;
font-size: var(--wp--preset--font-size--medium);
&:first-child {
border-left-color: #eae9eb;
margin-left: 1em;
}
&.active {
// Style active tab in theme colors.
background: var(--wp--preset--color--background, $contentbg);
border-bottom-color: var(--wp--preset--color--background, $contentbg);
box-shadow: 0 1px var(--wp--preset--color--background);
}
a {
text-decoration: none;
}
}
}
.woocommerce-Tabs-panel {
padding-top: var(--wp--style--block-gap);
font-size: var(--wp--preset--font-size--small);
margin-left: 1em;
h2 {
display: none;
}
}
/**
* Form fields
*/

View File

@ -56,12 +56,22 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
wp_style_add_data( 'woocommerce_admin_privacy_styles', 'rtl', 'replace' );
if ( $screen && $screen->is_block_editor() ) {
wp_register_style( 'woocommerce-general', WC()->plugin_url() . '/assets/css/woocommerce.css', array(), $version );
wp_style_add_data( 'woocommerce-general', 'rtl', 'replace' );
if ( wc_current_theme_is_fse_theme() ) {
wp_register_style( 'woocommerce-blocktheme', WC()->plugin_url() . '/assets/css/woocommerce-blocktheme.css', array(), $version );
wp_style_add_data( 'woocommerce-blocktheme', 'rtl', 'replace' );
wp_enqueue_style( 'woocommerce-blocktheme' );
$styles = WC_Frontend_Scripts::get_styles();
if ( $styles ) {
foreach ( $styles as $handle => $args ) {
wp_register_style(
$handle,
$args['src'],
$args['deps'],
$args['version'],
$args['media']
);
if ( ! isset( $args['has_rtl'] ) ) {
wp_style_add_data( $handle, 'rtl', 'replace' );
}
}
}
}