Version Description
Download this release
Release Info
Developer | nosolosw |
Plugin | Gutenberg |
Version | 9.2.2 |
Comparing to | |
See all releases |
Code changes from version 9.2.1 to 9.2.2
- changelog.txt +6 -0
- gutenberg.php +3 -3
- lib/class-wp-block-supports.php +47 -6
- lib/class-wp-block.php +3 -9
- lib/compat.php +0 -37
- readme.txt +2 -2
changelog.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 9.2.1 =
|
4 |
|
5 |
### Bug Fixes
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 9.2.2 =
|
4 |
+
|
5 |
+
### Bug Fixes
|
6 |
+
|
7 |
+
- Fix widget previews in the widget screen [26356](https://github.com/WordPress/gutenberg/pull/26356) [26417](https://github.com/WordPress/gutenberg/pull/26417)
|
8 |
+
|
9 |
= 9.2.1 =
|
10 |
|
11 |
### Bug Fixes
|
gutenberg.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core.
|
6 |
* Requires at least: 5.3
|
7 |
* Requires PHP: 5.6
|
8 |
-
* Version: 9.2.
|
9 |
* Author: Gutenberg Team
|
10 |
* Text Domain: gutenberg
|
11 |
*
|
@@ -13,8 +13,8 @@
|
|
13 |
*/
|
14 |
|
15 |
### BEGIN AUTO-GENERATED DEFINES
|
16 |
-
define( 'GUTENBERG_VERSION', '9.2.
|
17 |
-
define( 'GUTENBERG_GIT_COMMIT', '
|
18 |
### END AUTO-GENERATED DEFINES
|
19 |
|
20 |
gutenberg_pre_init();
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core.
|
6 |
* Requires at least: 5.3
|
7 |
* Requires PHP: 5.6
|
8 |
+
* Version: 9.2.2
|
9 |
* Author: Gutenberg Team
|
10 |
* Text Domain: gutenberg
|
11 |
*
|
13 |
*/
|
14 |
|
15 |
### BEGIN AUTO-GENERATED DEFINES
|
16 |
+
define( 'GUTENBERG_VERSION', '9.2.2' );
|
17 |
+
define( 'GUTENBERG_GIT_COMMIT', '28b1593597ced9fd9dfb3450ad8dca9f087ab198' );
|
18 |
### END AUTO-GENERATED DEFINES
|
19 |
|
20 |
gutenberg_pre_init();
|
lib/class-wp-block-supports.php
CHANGED
@@ -19,6 +19,13 @@ class WP_Block_Supports {
|
|
19 |
*/
|
20 |
private $block_supports = array();
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
/**
|
23 |
* Container for the main instance of the class.
|
24 |
*
|
@@ -67,13 +74,12 @@ class WP_Block_Supports {
|
|
67 |
* Generates an array of HTML attributes, such as classes, by applying to
|
68 |
* the given block all of the features that the block supports.
|
69 |
*
|
70 |
-
* @param array $parsed_block Block as parsed from content.
|
71 |
* @return array Array of HTML attributes.
|
72 |
*/
|
73 |
-
public function apply_block_supports(
|
74 |
-
$block_attributes =
|
75 |
$block_type = WP_Block_Type_Registry::get_instance()->get_registered(
|
76 |
-
|
77 |
);
|
78 |
|
79 |
// If no render_callback, assume styles have been previously handled.
|
@@ -144,8 +150,7 @@ class WP_Block_Supports {
|
|
144 |
* @return string String of HTML classes.
|
145 |
*/
|
146 |
function get_block_wrapper_attributes( $extra_attributes = array() ) {
|
147 |
-
|
148 |
-
$new_attributes = WP_Block_Supports::get_instance()->apply_block_supports( $current_parsed_block );
|
149 |
|
150 |
if ( empty( $new_attributes ) && empty( $extra_attributes ) ) {
|
151 |
return '';
|
@@ -191,4 +196,40 @@ function get_block_wrapper_attributes( $extra_attributes = array() ) {
|
|
191 |
return implode( ' ', $normalized_attributes );
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 );
|
|
19 |
*/
|
20 |
private $block_supports = array();
|
21 |
|
22 |
+
/**
|
23 |
+
* Tracks the current block to be rendered.
|
24 |
+
*
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
public static $block_to_render = null;
|
28 |
+
|
29 |
/**
|
30 |
* Container for the main instance of the class.
|
31 |
*
|
74 |
* Generates an array of HTML attributes, such as classes, by applying to
|
75 |
* the given block all of the features that the block supports.
|
76 |
*
|
|
|
77 |
* @return array Array of HTML attributes.
|
78 |
*/
|
79 |
+
public function apply_block_supports() {
|
80 |
+
$block_attributes = self::$block_to_render['attrs'];
|
81 |
$block_type = WP_Block_Type_Registry::get_instance()->get_registered(
|
82 |
+
self::$block_to_render['blockName']
|
83 |
);
|
84 |
|
85 |
// If no render_callback, assume styles have been previously handled.
|
150 |
* @return string String of HTML classes.
|
151 |
*/
|
152 |
function get_block_wrapper_attributes( $extra_attributes = array() ) {
|
153 |
+
$new_attributes = WP_Block_Supports::get_instance()->apply_block_supports();
|
|
|
154 |
|
155 |
if ( empty( $new_attributes ) && empty( $extra_attributes ) ) {
|
156 |
return '';
|
196 |
return implode( ' ', $normalized_attributes );
|
197 |
}
|
198 |
|
199 |
+
/**
|
200 |
+
* Callback hooked to the register_block_type_args filter.
|
201 |
+
*
|
202 |
+
* This hooks into block registration to wrap the render_callback
|
203 |
+
* of dynamic blocks with a closure that keeps track of the
|
204 |
+
* current block to be rendered.
|
205 |
+
*
|
206 |
+
* @param array $args Block attributes.
|
207 |
+
* @return array Block attributes.
|
208 |
+
*/
|
209 |
+
function wp_block_supports_track_block_to_render( $args ) {
|
210 |
+
if ( is_callable( $args['render_callback'] ) ) {
|
211 |
+
$block_render_callback = $args['render_callback'];
|
212 |
+
$args['render_callback'] = function( $attributes, $content, $block = null ) use ( $block_render_callback ) {
|
213 |
+
// Check for null for back compatibility with WP_Block_Type->render
|
214 |
+
// which is unused since the introduction of WP_Block class.
|
215 |
+
//
|
216 |
+
// See:
|
217 |
+
// - https://core.trac.wordpress.org/ticket/49927
|
218 |
+
// - commit 910de8f6890c87f93359c6f2edc6c27b9a3f3292 at wordpress-develop.
|
219 |
+
|
220 |
+
if ( null === $block ) {
|
221 |
+
return $block_render_callback( $attributes, $content );
|
222 |
+
}
|
223 |
+
|
224 |
+
$parent_block = WP_Block_Supports::$block_to_render;
|
225 |
+
WP_Block_Supports::$block_to_render = $block->parsed_block;
|
226 |
+
$result = $block_render_callback( $attributes, $content, $block );
|
227 |
+
WP_Block_Supports::$block_to_render = $parent_block;
|
228 |
+
return $result;
|
229 |
+
};
|
230 |
+
}
|
231 |
+
return $args;
|
232 |
+
}
|
233 |
+
|
234 |
add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 );
|
235 |
+
add_filter( 'register_block_type_args', 'wp_block_supports_track_block_to_render' );
|
lib/class-wp-block.php
CHANGED
@@ -203,7 +203,6 @@ class WP_Block {
|
|
203 |
*/
|
204 |
public function render( $options = array() ) {
|
205 |
global $post;
|
206 |
-
global $current_parsed_block;
|
207 |
$options = array_replace(
|
208 |
array(
|
209 |
'dynamic' => true,
|
@@ -217,14 +216,9 @@ class WP_Block {
|
|
217 |
if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) {
|
218 |
$index = 0;
|
219 |
foreach ( $this->inner_content as $chunk ) {
|
220 |
-
|
221 |
-
$
|
222 |
-
|
223 |
-
$parent_parsed_block = $current_parsed_block;
|
224 |
-
$current_parsed_block = $this->inner_blocks[ $index ]->parsed_block;
|
225 |
-
$block_content .= $this->inner_blocks[ $index++ ]->render();
|
226 |
-
$current_parsed_block = $parent_parsed_block;
|
227 |
-
}
|
228 |
}
|
229 |
}
|
230 |
|
203 |
*/
|
204 |
public function render( $options = array() ) {
|
205 |
global $post;
|
|
|
206 |
$options = array_replace(
|
207 |
array(
|
208 |
'dynamic' => true,
|
216 |
if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) {
|
217 |
$index = 0;
|
218 |
foreach ( $this->inner_content as $chunk ) {
|
219 |
+
$block_content .= is_string( $chunk ) ?
|
220 |
+
$chunk :
|
221 |
+
$this->inner_blocks[ $index++ ]->render();
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
}
|
224 |
|
lib/compat.php
CHANGED
@@ -508,40 +508,3 @@ function gutenberg_override_reusable_block_post_type_labels() {
|
|
508 |
);
|
509 |
}
|
510 |
add_filter( 'post_type_labels_wp_block', 'gutenberg_override_reusable_block_post_type_labels', 10, 0 );
|
511 |
-
|
512 |
-
global $current_parsed_block;
|
513 |
-
$current_parsed_block = array(
|
514 |
-
'blockName' => null,
|
515 |
-
'attributes' => null,
|
516 |
-
);
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Wraps the render_callback of dynamic blocks to keep track
|
520 |
-
* of the current block being rendered via a global variable
|
521 |
-
* called $current_parsed_block.
|
522 |
-
*
|
523 |
-
* This is for get_block_wrapper_attributes to get access
|
524 |
-
* to the runtime data of the block being rendered.
|
525 |
-
*
|
526 |
-
* This shim can be removed when the plugin requires WordPress 5.6.
|
527 |
-
*
|
528 |
-
* @since 9.2.1
|
529 |
-
*
|
530 |
-
* @param array $args Block attributes.
|
531 |
-
* @return array Block attributes.
|
532 |
-
*/
|
533 |
-
function gutenberg_current_parsed_block_tracking( $args ) {
|
534 |
-
if ( null !== $args['render_callback'] ) {
|
535 |
-
$block_render_callback = $args['render_callback'];
|
536 |
-
$args['render_callback'] = function( $attributes, $content, $block ) use ( $block_render_callback ) {
|
537 |
-
global $current_parsed_block;
|
538 |
-
$parent_parsed_block = $current_parsed_block;
|
539 |
-
$current_parsed_block = $block->parsed_block;
|
540 |
-
$result = $block_render_callback( $attributes, $content, $block );
|
541 |
-
$current_parsed_block = $parent_parsed_block;
|
542 |
-
return $result;
|
543 |
-
};
|
544 |
-
}
|
545 |
-
return $args;
|
546 |
-
}
|
547 |
-
add_filter( 'register_block_type_args', 'gutenberg_current_parsed_block_tracking' );
|
508 |
);
|
509 |
}
|
510 |
add_filter( 'post_type_labels_wp_block', 'gutenberg_override_reusable_block_post_type_labels', 10, 0 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: matveb, joen, karmatosed
|
|
3 |
Requires at least: 5.4.0
|
4 |
Tested up to: 5.5
|
5 |
Requires PHP: 5.6
|
6 |
-
Stable tag: 9.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -57,4 +57,4 @@ View <a href="https://developer.wordpress.org/block-editor/principles/versions-i
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
-
To read the changelog for Gutenberg 9.2.
|
3 |
Requires at least: 5.4.0
|
4 |
Tested up to: 5.5
|
5 |
Requires PHP: 5.6
|
6 |
+
Stable tag: 9.2.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
To read the changelog for Gutenberg 9.2.2, please navigate to the <a href="https://github.com/WordPress/gutenberg/releases/tag/v9.2.2">release page</a>.
|