Gutenberg - Version 8.9.2

Version Description

Download this release

Release Info

Developer youknowriad
Plugin Icon 128x128 Gutenberg
Version 8.9.2
Comparing to
See all releases

Code changes from version 8.9.1 to 8.9.2

build/block-library/blocks/categories.php CHANGED
@@ -33,7 +33,13 @@ function gutenberg_render_block_core_categories( $attributes ) {
33
  $type = 'dropdown';
34
 
35
  if ( ! is_admin() ) {
36
- $wrapper_markup .= gutenberg_build_dropdown_script_block_core_categories( $id );
 
 
 
 
 
 
37
  }
38
  } else {
39
  $wrapper_markup = '<ul class="%1$s">%2$s</ul>';
33
  $type = 'dropdown';
34
 
35
  if ( ! is_admin() ) {
36
+ // Inject the dropdown script immediately after the select dropdown.
37
+ $items_markup = preg_replace(
38
+ '#(?<=</select>)#',
39
+ gutenberg_build_dropdown_script_block_core_categories( $id ),
40
+ $items_markup,
41
+ 1
42
+ );
43
  }
44
  } else {
45
  $wrapper_markup = '<ul class="%1$s">%2$s</ul>';
changelog.txt CHANGED
@@ -1,5 +1,14 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
3
  = 8.9.1 =
4
 
5
  ### Bug Fixes
1
  == Changelog ==
2
 
3
+ = 8.9.2 =
4
+
5
+ ### Bug fixes
6
+
7
+ - Block supports: Fix block attribute (style and class) double-encoding (#25079)
8
+ - Restore injection of build_dropdown_script_block_core_categories() (#25026)
9
+ - Block supports: Restore root DOMDocument save (#25028)
10
+
11
+
12
  = 8.9.1 =
13
 
14
  ### 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: 8.9.1
9
  * Author: Gutenberg Team
10
  * Text Domain: gutenberg
11
  *
@@ -13,8 +13,8 @@
13
  */
14
 
15
  ### BEGIN AUTO-GENERATED DEFINES
16
- define( 'GUTENBERG_VERSION', '8.9.1' );
17
- define( 'GUTENBERG_GIT_COMMIT', 'bb17d4a3a1f35e51fc60b6619c14e7165357c630' );
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: 8.9.2
9
  * Author: Gutenberg Team
10
  * Text Domain: gutenberg
11
  *
13
  */
14
 
15
  ### BEGIN AUTO-GENERATED DEFINES
16
+ define( 'GUTENBERG_VERSION', '8.9.2' );
17
+ define( 'GUTENBERG_GIT_COMMIT', '0ac5d4e840646aa80f1b69d59913e2471ab29d22' );
18
  ### END AUTO-GENERATED DEFINES
19
 
20
  gutenberg_pre_init();
lib/block-supports/index.php CHANGED
@@ -52,16 +52,18 @@ function gutenberg_apply_block_supports( $block_content, $block ) {
52
  return $block_content;
53
  }
54
 
55
- // We need to wrap the block in order to handle UTF-8 properly.
56
- $wrapper_left = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>';
57
- $wrapper_right = '</body></html>';
58
-
59
  $dom = new DOMDocument( '1.0', 'utf-8' );
60
 
61
  // Suppress DOMDocument::loadHTML warnings from polluting the front-end.
62
  $previous = libxml_use_internal_errors( true );
63
 
64
- $success = $dom->loadHTML( $wrapper_left . $block_content . $wrapper_right, LIBXML_HTML_NODEFDTD | LIBXML_COMPACT );
 
 
 
 
 
 
65
 
66
  // Clear errors and reset the use_errors setting.
67
  libxml_clear_errors();
@@ -71,9 +73,13 @@ function gutenberg_apply_block_supports( $block_content, $block ) {
71
  return $block_content;
72
  }
73
 
 
 
 
74
  $xpath = new DOMXPath( $dom );
75
- $block_root = $xpath->query( '/html/body/*' )[0];
76
 
 
77
  if ( empty( $block_root ) ) {
78
  return $block_content;
79
  }
@@ -89,14 +95,21 @@ function gutenberg_apply_block_supports( $block_content, $block ) {
89
 
90
  // Apply new styles and classes.
91
  if ( ! empty( $new_classes ) ) {
92
- $block_root->setAttribute( 'class', esc_attr( implode( ' ', $new_classes ) ) );
 
93
  }
94
 
95
  if ( ! empty( $new_styles ) ) {
96
- $block_root->setAttribute( 'style', esc_attr( implode( '; ', $new_styles ) . ';' ) );
 
97
  }
98
 
99
- return $dom->saveHtml( $block_root );
 
 
 
 
 
100
  }
101
  add_filter( 'render_block', 'gutenberg_apply_block_supports', 10, 2 );
102
 
52
  return $block_content;
53
  }
54
 
 
 
 
 
55
  $dom = new DOMDocument( '1.0', 'utf-8' );
56
 
57
  // Suppress DOMDocument::loadHTML warnings from polluting the front-end.
58
  $previous = libxml_use_internal_errors( true );
59
 
60
+ // We need to wrap the block in order to handle UTF-8 properly.
61
+ $wrapped_block_html =
62
+ '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>'
63
+ . $block_content
64
+ . '</body></html>';
65
+
66
+ $success = $dom->loadHTML( $wrapped_block_html, LIBXML_HTML_NODEFDTD | LIBXML_COMPACT );
67
 
68
  // Clear errors and reset the use_errors setting.
69
  libxml_clear_errors();
73
  return $block_content;
74
  }
75
 
76
+ // Structure is like `<html><head/><body/></html>`, so body is the `lastChild` of our document.
77
+ $body_element = $dom->documentElement->lastChild; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
78
+
79
  $xpath = new DOMXPath( $dom );
80
+ $block_root = $xpath->query( './*', $body_element )[0];
81
 
82
+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
83
  if ( empty( $block_root ) ) {
84
  return $block_content;
85
  }
95
 
96
  // Apply new styles and classes.
97
  if ( ! empty( $new_classes ) ) {
98
+ // `DOMElement::setAttribute` handles attribute value escaping.
99
+ $block_root->setAttribute( 'class', implode( ' ', $new_classes ) );
100
  }
101
 
102
  if ( ! empty( $new_styles ) ) {
103
+ // `DOMElement::setAttribute` handles attribute value escaping.
104
+ $block_root->setAttribute( 'style', implode( '; ', $new_styles ) . ';' );
105
  }
106
 
107
+ $result = '';
108
+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
109
+ foreach ( $body_element->childNodes as $child_node ) {
110
+ $result .= $dom->saveHtml( $child_node );
111
+ }
112
+ return $result;
113
  }
114
  add_filter( 'render_block', 'gutenberg_apply_block_supports', 10, 2 );
115
 
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: 8.9.0
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 8.9.1, please navigate to the <a href="https://github.com/WordPress/gutenberg/releases/tag/v8.9.1">release page</a>.
3
  Requires at least: 5.4.0
4
  Tested up to: 5.5
5
  Requires PHP: 5.6
6
+ Stable tag: 8.9.1
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 8.9.2, please navigate to the <a href="https://github.com/WordPress/gutenberg/releases/tag/v8.9.2">release page</a>.