Skip to content

Commit

Permalink
release(minor): version 2.6.0
Browse files Browse the repository at this point in the history
### New Features
- **New Onboarding Wizard for Raft Theme**: Introduced a New Onboarding Wizard to enhance the setup experience for the Raft theme.

### Bug Fixes
- **Button Group Error on Nofollow Disable**: Resolved an issue where disabling 'Add Nofollow' and refreshing the page caused errors in the Button group.
- **Block Conditions PHP Array Issue**: Fixed a problem where block conditions were throwing a PHP array error.
- **Styling Loss in Widgets Area with Elementor**: Addressed the issue where blocks added in the widgets area lost styling when Elementor was activated.
- **Slider Images in Neve's Header Not Rendering**: Fixed a bug where slider images were not being rendered if added in Neve's header.
  • Loading branch information
HardeepAsrani authored Dec 18, 2023
2 parents 4a4260f + 379dddd commit 3ce1761
Show file tree
Hide file tree
Showing 49 changed files with 3,841 additions and 364 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ jobs:
with:
base_path: './base/dashboard/stats.json'
pr_path: './pr/dashboard/stats.json'
- name: Get Onboarding diff
id: get-onboarding-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/onboarding/stats.json'
pr_path: './pr/onboarding/stats.json'
- name: Get Export Import diff
id: get-export-import-diff
uses: NejcZdovc/bundle-size-diff@v1
Expand Down Expand Up @@ -146,6 +152,10 @@ jobs:
NEW_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.pr_file_string }}
DIFF_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.diff_file_string }}
DIFF_PERCENT_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.percent }}
OLD_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.base_file_string }}
NEW_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.pr_file_string }}
DIFF_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.diff_file_string }}
DIFF_PERCENT_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.percent }}
OLD_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.base_file_string }}
NEW_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.pr_file_string }}
DIFF_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.diff_file_string }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
| Blocks | {OLD_BLOCKS} | {NEW_BLOCKS} | {DIFF_BLOCKS} ({DIFF_PERCENT_BLOCKS}%) |
| CSS | {OLD_CSS} | {NEW_CSS} | {DIFF_CSS} ({DIFF_PERCENT_CSS}%) |
| Dashboard | {OLD_DASHBOARD} | {NEW_DASHBOARD} | {DIFF_DASHBOARD} ({DIFF_PERCENT_DASHBOARD}%) |
| Onboarding | {OLD_ONBOARDING} | {NEW_ONBOARDING} | {DIFF_ONBOARDING} ({DIFF_PERCENT_ONBOARDING}%) |
| Export Import | {OLD_EXPORT_IMPORT} | {NEW_EXPORT_IMPORT} | {DIFF_EXPORT_IMPORT} ({DIFF_PERCENT_EXPORT_IMPORT}%) |
| Pro | {OLD_PRO} | {NEW_PRO} | {DIFF_PRO} ({DIFF_PERCENT_PRO}%) |
23 changes: 15 additions & 8 deletions .wp-env.override.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"WP_DEFAULT_THEME": "twentytwentythree"
},
"env": {
"development": {
"themes": [ "./test/emptytheme" ],
"mappings": {
"wp-content/themes/raft": "https://github.com/Codeinwp/raft/archive/refs/heads/onboarding.zip"
}
},
"tests": {
"config": {
"WP_DEBUG": false,
Expand All @@ -18,14 +24,15 @@
"plugins": [
"."
],
"themes": [ "./test/emptytheme" ],
"mappings": {
"wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins",
"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip"
}
"themes": [ "./test/emptytheme" ],
"mappings": {
"wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins",
"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip",
"wp-content/themes/raft": "https://github.com/Codeinwp/raft/archive/refs/heads/onboarding.zip"
}
}
}
}
36 changes: 18 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions inc/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ public function autoload_classes() {
'\ThemeIsle\GutenbergBlocks\Plugins\Block_Conditions',
'\ThemeIsle\GutenbergBlocks\Plugins\Dashboard',
'\ThemeIsle\GutenbergBlocks\Plugins\Dynamic_Content',
'\ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding',
'\ThemeIsle\GutenbergBlocks\Plugins\Options_Settings',
'\ThemeIsle\GutenbergBlocks\Plugins\Stripe_API',
'\ThemeIsle\GutenbergBlocks\Render\Masonry_Variant',
'\ThemeIsle\GutenbergBlocks\Server\Dashboard_Server',
'\ThemeIsle\GutenbergBlocks\Server\Dynamic_Content_Server',
'\ThemeIsle\GutenbergBlocks\Server\Stripe_Server',
'\ThemeIsle\GutenbergBlocks\Server\FSE_Onboarding_Server',
'\ThemeIsle\GutenbergBlocks\Integration\Form_Providers',
'\ThemeIsle\GutenbergBlocks\Integration\Form_Email',
'\ThemeIsle\GutenbergBlocks\Server\Form_Server',
Expand Down
8 changes: 4 additions & 4 deletions inc/class-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function enqueue_block_editor_assets() {
}

global $wp_roles;

wp_localize_script(
'otter-blocks',
'themeisleGutenberg',
Expand Down Expand Up @@ -329,7 +329,7 @@ public function enqueue_block_assets() {
return;
}



if ( is_singular() ) {
$this->enqueue_dependencies();
Expand Down Expand Up @@ -362,7 +362,7 @@ function ( $content ) {
}

if ( $has_widgets ) {

add_filter(
'wp_footer',
function ( $content ) {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ public function load_condition_hide_on_styles( $block_content, $block ) {

foreach ( $block['attrs']['otterConditions'] as $group ) {
foreach ( $group as $condition ) {
if ( 'screenSize' === $condition['type'] && isset( $condition['screen_sizes'] ) && is_array( $condition['screen_sizes'] ) ) {
if ( array_key_exists( 'type', $condition ) && 'screenSize' === $condition['type'] && isset( $condition['screen_sizes'] ) && is_array( $condition['screen_sizes'] ) ) {
$has_condition = true;
break;
}
Expand Down
106 changes: 103 additions & 3 deletions inc/css/class-css-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use ThemeIsle\GutenbergBlocks\Base_CSS;

use ThemeIsle\GutenbergBlocks\Registration;
use tubalmartin\CssMin\Minifier as CSSmin;

/**
Expand All @@ -30,7 +31,89 @@ public function init() {
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
add_action( 'rest_api_init', array( $this, 'autoload_block_classes' ) );
add_action( 'before_delete_post', array( __CLASS__, 'delete_css_file' ) );
add_action( 'customize_save_after', array( __CLASS__, 'save_widgets_styles' ) );
add_action( 'customize_save_after', array( $this, 'customize_save_after' ) );
add_filter( 'customize_dynamic_partial_args', array( $this, 'customize_dynamic_partial_args' ), 10, 2 );
}

/**
* Method used to register actively used widgets.
*
* @return void
*/
private function register_used_widgets() {
$registration = Registration::instance();
$widgets_used = $registration::$widget_used;
if ( empty( $widgets_used ) ) {
$sidebar_widgets = get_option( 'sidebars_widgets' );
foreach ( $sidebar_widgets as $sidebar => $widgets ) {
if ( 'wp_inactive_widgets' === $sidebar || ! is_array( $widgets ) ) {
continue;
}
foreach ( $widgets as $widget ) {
$widgets_used[] = $widget;
}
}
$registration::$widget_used = $widgets_used;
}
}

/**
* Method used to add a filter for widget rendering before the partial is rendered.
*
* @param array $partial_args Partial args.
* @param string $partial_id Partial ID.
*
* @return array
*/
public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
if ( preg_match( '/^widget\[(?P<widget_id>.+)\]$/', $partial_id, $matches ) ) {
add_filter( 'widget_block_content', array( $this, 'customize_widget_block_content' ), 10, 3 );
}

return $partial_args;
}

/**
* Add inline styles for partially rendered block inside customizer.
*
* @param string $block_content The block content.
* @param array $block The block data.
* @param \WP_Widget $instance The widget instance.
*
* @return string
*/
public function customize_widget_block_content( $block_content, $block, $instance ) {
$widget_data = get_option( 'widget_block', array() );
$partial_widget = (object) $widget_data[ $instance->number ];
if ( ! isset( $widget_data[ $instance->number ] ) ) {
return $block_content;
}
if ( ! $widget_data[ $instance->number ] ) {
return $block_content;
}

$content = $partial_widget->content;
$blocks = parse_blocks( $content );

if ( ! is_array( $blocks ) || empty( $blocks ) ) {
return $block_content;
}

$animations = boolval( preg_match( '/\banimated\b/', $content ) );
$css = $this->cycle_through_static_blocks( $blocks, $animations );

return '<style>.customize-previewing ' . $css . '</style>' . $block_content;
}

/**
* Method after the customizer save is done.
*
* @return void
*/
public function customize_save_after() {
$this->register_used_widgets();

$this->save_widgets_styles();
}

/**
Expand Down Expand Up @@ -96,7 +179,7 @@ public function register_routes() {
array(
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array( $this, 'save_widgets_styles' ),
'callback' => array( $this, 'save_widgets_styles_rest' ),
'permission_callback' => function () {
return current_user_can( 'edit_theme_options' );
},
Expand All @@ -105,6 +188,23 @@ public function register_routes() {
);
}

/**
* When in REST API context, autoload widgets used so that all css data is updated.
*
* @param \WP_REST_Request $request The request object.
*
* @return \WP_REST_Response | \WP_Error
*/
public function save_widgets_styles_rest( \WP_REST_Request $request ) {
$this->register_used_widgets();

$response = $this->save_widgets_styles();
if ( is_null( $response ) ) {
$response = true;
}
return rest_ensure_response( $response );
}

/**
* Function to save post CSS.
*
Expand Down Expand Up @@ -439,7 +539,7 @@ public static function compress( $css ) {

/**
* Mark in post meta if the post has a review block.
*
*
* @param int $post_id Post ID.
* @since 2.4.0
* @access public
Expand Down
4 changes: 4 additions & 0 deletions inc/plugins/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace ThemeIsle\GutenbergBlocks\Plugins;

use ThemeIsle\GutenbergBlocks\Pro;
use ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding;

/**
* Class Dashboard
Expand Down Expand Up @@ -195,6 +196,9 @@ public function enqueue_options_assets() {
'docsLink' => Pro::get_docs_url(),
'showFeedbackNotice' => $this->should_show_feedback_notice(),
'deal' => ! Pro::is_pro_installed() ? $offer->get_localized_data() : array(),
'hasOnboarding' => false !== get_theme_support( FSE_Onboarding::SUPPORT_KEY ),
'days_since_install' => round( ( time() - get_option( 'otter_blocks_install', 0 ) ) / DAY_IN_SECONDS ),
'rootUrl' => get_site_url(),
)
)
);
Expand Down
Loading

0 comments on commit 3ce1761

Please sign in to comment.