Skip to content

Commit 3ce1761

Browse files
release(minor): version 2.6.0
### 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.
2 parents 4a4260f + 379dddd commit 3ce1761

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3841
-364
lines changed

.github/workflows/build-size.yml

+10
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ jobs:
111111
with:
112112
base_path: './base/dashboard/stats.json'
113113
pr_path: './pr/dashboard/stats.json'
114+
- name: Get Onboarding diff
115+
id: get-onboarding-diff
116+
uses: NejcZdovc/bundle-size-diff@v1
117+
with:
118+
base_path: './base/onboarding/stats.json'
119+
pr_path: './pr/onboarding/stats.json'
114120
- name: Get Export Import diff
115121
id: get-export-import-diff
116122
uses: NejcZdovc/bundle-size-diff@v1
@@ -146,6 +152,10 @@ jobs:
146152
NEW_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.pr_file_string }}
147153
DIFF_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.diff_file_string }}
148154
DIFF_PERCENT_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.percent }}
155+
OLD_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.base_file_string }}
156+
NEW_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.pr_file_string }}
157+
DIFF_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.diff_file_string }}
158+
DIFF_PERCENT_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.percent }}
149159
OLD_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.base_file_string }}
150160
NEW_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.pr_file_string }}
151161
DIFF_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.diff_file_string }}

.github/workflows/comment.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
| Blocks | {OLD_BLOCKS} | {NEW_BLOCKS} | {DIFF_BLOCKS} ({DIFF_PERCENT_BLOCKS}%) |
77
| CSS | {OLD_CSS} | {NEW_CSS} | {DIFF_CSS} ({DIFF_PERCENT_CSS}%) |
88
| Dashboard | {OLD_DASHBOARD} | {NEW_DASHBOARD} | {DIFF_DASHBOARD} ({DIFF_PERCENT_DASHBOARD}%) |
9+
| Onboarding | {OLD_ONBOARDING} | {NEW_ONBOARDING} | {DIFF_ONBOARDING} ({DIFF_PERCENT_ONBOARDING}%) |
910
| Export Import | {OLD_EXPORT_IMPORT} | {NEW_EXPORT_IMPORT} | {DIFF_EXPORT_IMPORT} ({DIFF_PERCENT_EXPORT_IMPORT}%) |
1011
| Pro | {OLD_PRO} | {NEW_PRO} | {DIFF_PRO} ({DIFF_PERCENT_PRO}%) |

.wp-env.override.json

+15-8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"WP_DEFAULT_THEME": "twentytwentythree"
1111
},
1212
"env": {
13+
"development": {
14+
"themes": [ "./test/emptytheme" ],
15+
"mappings": {
16+
"wp-content/themes/raft": "https://github.com/Codeinwp/raft/archive/refs/heads/onboarding.zip"
17+
}
18+
},
1319
"tests": {
1420
"config": {
1521
"WP_DEBUG": false,
@@ -18,14 +24,15 @@
1824
"plugins": [
1925
"."
2026
],
21-
"themes": [ "./test/emptytheme" ],
22-
"mappings": {
23-
"wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins",
24-
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins",
25-
"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
26-
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip",
27-
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip"
28-
}
27+
"themes": [ "./test/emptytheme" ],
28+
"mappings": {
29+
"wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins",
30+
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins",
31+
"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
32+
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip",
33+
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip",
34+
"wp-content/themes/raft": "https://github.com/Codeinwp/raft/archive/refs/heads/onboarding.zip"
35+
}
2936
}
3037
}
3138
}

composer.lock

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/class-main.php

+2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ public function autoload_classes() {
6767
'\ThemeIsle\GutenbergBlocks\Plugins\Block_Conditions',
6868
'\ThemeIsle\GutenbergBlocks\Plugins\Dashboard',
6969
'\ThemeIsle\GutenbergBlocks\Plugins\Dynamic_Content',
70+
'\ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding',
7071
'\ThemeIsle\GutenbergBlocks\Plugins\Options_Settings',
7172
'\ThemeIsle\GutenbergBlocks\Plugins\Stripe_API',
7273
'\ThemeIsle\GutenbergBlocks\Render\Masonry_Variant',
7374
'\ThemeIsle\GutenbergBlocks\Server\Dashboard_Server',
7475
'\ThemeIsle\GutenbergBlocks\Server\Dynamic_Content_Server',
7576
'\ThemeIsle\GutenbergBlocks\Server\Stripe_Server',
77+
'\ThemeIsle\GutenbergBlocks\Server\FSE_Onboarding_Server',
7678
'\ThemeIsle\GutenbergBlocks\Integration\Form_Providers',
7779
'\ThemeIsle\GutenbergBlocks\Integration\Form_Email',
7880
'\ThemeIsle\GutenbergBlocks\Server\Form_Server',

inc/class-registration.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function enqueue_block_editor_assets() {
244244
}
245245

246246
global $wp_roles;
247-
247+
248248
wp_localize_script(
249249
'otter-blocks',
250250
'themeisleGutenberg',
@@ -329,7 +329,7 @@ public function enqueue_block_assets() {
329329
return;
330330
}
331331

332-
332+
333333

334334
if ( is_singular() ) {
335335
$this->enqueue_dependencies();
@@ -362,7 +362,7 @@ function ( $content ) {
362362
}
363363

364364
if ( $has_widgets ) {
365-
365+
366366
add_filter(
367367
'wp_footer',
368368
function ( $content ) {
@@ -1005,7 +1005,7 @@ public function load_condition_hide_on_styles( $block_content, $block ) {
10051005

10061006
foreach ( $block['attrs']['otterConditions'] as $group ) {
10071007
foreach ( $group as $condition ) {
1008-
if ( 'screenSize' === $condition['type'] && isset( $condition['screen_sizes'] ) && is_array( $condition['screen_sizes'] ) ) {
1008+
if ( array_key_exists( 'type', $condition ) && 'screenSize' === $condition['type'] && isset( $condition['screen_sizes'] ) && is_array( $condition['screen_sizes'] ) ) {
10091009
$has_condition = true;
10101010
break;
10111011
}

inc/css/class-css-handler.php

+103-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use ThemeIsle\GutenbergBlocks\Base_CSS;
1111

12+
use ThemeIsle\GutenbergBlocks\Registration;
1213
use tubalmartin\CssMin\Minifier as CSSmin;
1314

1415
/**
@@ -30,7 +31,89 @@ public function init() {
3031
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
3132
add_action( 'rest_api_init', array( $this, 'autoload_block_classes' ) );
3233
add_action( 'before_delete_post', array( __CLASS__, 'delete_css_file' ) );
33-
add_action( 'customize_save_after', array( __CLASS__, 'save_widgets_styles' ) );
34+
add_action( 'customize_save_after', array( $this, 'customize_save_after' ) );
35+
add_filter( 'customize_dynamic_partial_args', array( $this, 'customize_dynamic_partial_args' ), 10, 2 );
36+
}
37+
38+
/**
39+
* Method used to register actively used widgets.
40+
*
41+
* @return void
42+
*/
43+
private function register_used_widgets() {
44+
$registration = Registration::instance();
45+
$widgets_used = $registration::$widget_used;
46+
if ( empty( $widgets_used ) ) {
47+
$sidebar_widgets = get_option( 'sidebars_widgets' );
48+
foreach ( $sidebar_widgets as $sidebar => $widgets ) {
49+
if ( 'wp_inactive_widgets' === $sidebar || ! is_array( $widgets ) ) {
50+
continue;
51+
}
52+
foreach ( $widgets as $widget ) {
53+
$widgets_used[] = $widget;
54+
}
55+
}
56+
$registration::$widget_used = $widgets_used;
57+
}
58+
}
59+
60+
/**
61+
* Method used to add a filter for widget rendering before the partial is rendered.
62+
*
63+
* @param array $partial_args Partial args.
64+
* @param string $partial_id Partial ID.
65+
*
66+
* @return array
67+
*/
68+
public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
69+
if ( preg_match( '/^widget\[(?P<widget_id>.+)\]$/', $partial_id, $matches ) ) {
70+
add_filter( 'widget_block_content', array( $this, 'customize_widget_block_content' ), 10, 3 );
71+
}
72+
73+
return $partial_args;
74+
}
75+
76+
/**
77+
* Add inline styles for partially rendered block inside customizer.
78+
*
79+
* @param string $block_content The block content.
80+
* @param array $block The block data.
81+
* @param \WP_Widget $instance The widget instance.
82+
*
83+
* @return string
84+
*/
85+
public function customize_widget_block_content( $block_content, $block, $instance ) {
86+
$widget_data = get_option( 'widget_block', array() );
87+
$partial_widget = (object) $widget_data[ $instance->number ];
88+
if ( ! isset( $widget_data[ $instance->number ] ) ) {
89+
return $block_content;
90+
}
91+
if ( ! $widget_data[ $instance->number ] ) {
92+
return $block_content;
93+
}
94+
95+
$content = $partial_widget->content;
96+
$blocks = parse_blocks( $content );
97+
98+
if ( ! is_array( $blocks ) || empty( $blocks ) ) {
99+
return $block_content;
100+
}
101+
102+
$animations = boolval( preg_match( '/\banimated\b/', $content ) );
103+
$css = $this->cycle_through_static_blocks( $blocks, $animations );
104+
105+
return '<style>.customize-previewing ' . $css . '</style>' . $block_content;
106+
}
107+
108+
/**
109+
* Method after the customizer save is done.
110+
*
111+
* @return void
112+
*/
113+
public function customize_save_after() {
114+
$this->register_used_widgets();
115+
116+
$this->save_widgets_styles();
34117
}
35118

36119
/**
@@ -96,7 +179,7 @@ public function register_routes() {
96179
array(
97180
array(
98181
'methods' => \WP_REST_Server::EDITABLE,
99-
'callback' => array( $this, 'save_widgets_styles' ),
182+
'callback' => array( $this, 'save_widgets_styles_rest' ),
100183
'permission_callback' => function () {
101184
return current_user_can( 'edit_theme_options' );
102185
},
@@ -105,6 +188,23 @@ public function register_routes() {
105188
);
106189
}
107190

191+
/**
192+
* When in REST API context, autoload widgets used so that all css data is updated.
193+
*
194+
* @param \WP_REST_Request $request The request object.
195+
*
196+
* @return \WP_REST_Response | \WP_Error
197+
*/
198+
public function save_widgets_styles_rest( \WP_REST_Request $request ) {
199+
$this->register_used_widgets();
200+
201+
$response = $this->save_widgets_styles();
202+
if ( is_null( $response ) ) {
203+
$response = true;
204+
}
205+
return rest_ensure_response( $response );
206+
}
207+
108208
/**
109209
* Function to save post CSS.
110210
*
@@ -439,7 +539,7 @@ public static function compress( $css ) {
439539

440540
/**
441541
* Mark in post meta if the post has a review block.
442-
*
542+
*
443543
* @param int $post_id Post ID.
444544
* @since 2.4.0
445545
* @access public

inc/plugins/class-dashboard.php

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace ThemeIsle\GutenbergBlocks\Plugins;
99

1010
use ThemeIsle\GutenbergBlocks\Pro;
11+
use ThemeIsle\GutenbergBlocks\Plugins\FSE_Onboarding;
1112

1213
/**
1314
* Class Dashboard
@@ -195,6 +196,9 @@ public function enqueue_options_assets() {
195196
'docsLink' => Pro::get_docs_url(),
196197
'showFeedbackNotice' => $this->should_show_feedback_notice(),
197198
'deal' => ! Pro::is_pro_installed() ? $offer->get_localized_data() : array(),
199+
'hasOnboarding' => false !== get_theme_support( FSE_Onboarding::SUPPORT_KEY ),
200+
'days_since_install' => round( ( time() - get_option( 'otter_blocks_install', 0 ) ) / DAY_IN_SECONDS ),
201+
'rootUrl' => get_site_url(),
198202
)
199203
)
200204
);

0 commit comments

Comments
 (0)