Skip to content

Commit

Permalink
Merge branch 'trunk' into enhancement/post-publish-command
Browse files Browse the repository at this point in the history
  • Loading branch information
benazeer-ben authored Nov 15, 2024
2 parents acca029 + 2028fd8 commit a743486
Show file tree
Hide file tree
Showing 227 changed files with 3,115 additions and 1,769 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Use desired version of Java
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
distribution: 'corretto'
java-version: '17'
Expand All @@ -47,7 +47,7 @@ jobs:
run: npm run native test:e2e:setup

- name: Gradle cache
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0
uses: gradle/actions/setup-gradle@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4.2.0

# AVD cache disabled as it caused emulator termination to hang indefinitely.
# https://github.com/ReactiveCircus/android-emulator-runner/issues/385
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0 # v1.197.0
- uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
with:
# `.ruby-version` file location
working-directory: packages/react-native-editor/ios
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.7/7676.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7676

* https://github.com/WordPress/gutenberg/pull/66359
4 changes: 4 additions & 0 deletions backport-changelog/6.8/7265.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/7265

* https://github.com/WordPress/gutenberg/pull/66850
* https://github.com/WordPress/gutenberg/pull/66947
4 changes: 4 additions & 0 deletions backport-changelog/6.8/7759.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/7759

* https://github.com/WordPress/gutenberg/pull/66896

3 changes: 3 additions & 0 deletions backport-changelog/6.8/7784.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7784

* https://github.com/WordPress/gutenberg/pull/66948
320 changes: 320 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/contributors/versions-in-wordpress.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre
| Gutenberg Versions | WordPress Version |
| ------------------ | ----------------- |
| 18.6-19.3 | 6.7 |
| 17.8-18.5 | 6.6.2 |
| 17.8-18.5 | 6.6.1 |
| 17.8-18.5 | 6.6 |
| 16.8-17.7 | 6.5.5 |
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Hide and show additional content. ([Source](https://github.com/WordPress/gutenbe

- **Name:** core/details
- **Category:** text
- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** showContent, summary

## Embed
Expand Down
14 changes: 14 additions & 0 deletions docs/reference-guides/data/data-core-edit-site.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ _Returns_

### getEditedPostId

> **Deprecated**
Returns the ID of the currently edited template or template part.

_Parameters_
Expand All @@ -64,6 +66,8 @@ _Returns_

### getEditedPostType

> **Deprecated**
Returns the current edited post type (wp_template or wp_template_part).

_Parameters_
Expand Down Expand Up @@ -189,6 +193,8 @@ _Returns_
### isPage

> **Deprecated**
Whether or not the editor has a page loaded into it.

_Related_
Expand Down Expand Up @@ -273,6 +279,8 @@ _Parameters_

### setEditedEntity

> **Deprecated**
Action that sets an edited entity.

_Parameters_
Expand All @@ -287,6 +295,8 @@ _Returns_

### setEditedPostContext

> **Deprecated**
Set's the current block editor context.

_Parameters_
Expand Down Expand Up @@ -345,6 +355,8 @@ _Parameters_

### setNavigationMenu

> **Deprecated**
Action that sets a navigation menu.

_Parameters_
Expand Down Expand Up @@ -385,6 +397,8 @@ _Returns_

### setTemplatePart

> **Deprecated**
Action that sets a template part.

_Parameters_
Expand Down
2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.5
* Requires PHP: 7.2
* Version: 19.6.0
* Version: 19.7.0-rc.2
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
91 changes: 71 additions & 20 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2749,9 +2749,21 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt
foreach ( $theme_json['styles']['blocks'] as $name => $node ) {
$node_path = array( 'styles', 'blocks', $name );
if ( $include_node_paths_only ) {
$nodes[] = array(
$variation_paths = array();
if ( $include_variations && isset( $node['variations'] ) ) {
foreach ( $node['variations'] as $variation => $variation_node ) {
$variation_paths[] = array(
'path' => array( 'styles', 'blocks', $name, 'variations', $variation ),
);
}
}
$node = array(
'path' => $node_path,
);
if ( ! empty( $variation_paths ) ) {
$node['variations'] = $variation_paths;
}
$nodes[] = $node;
} else {
$selector = null;
if ( isset( $selectors[ $name ]['selector'] ) ) {
Expand Down Expand Up @@ -3565,26 +3577,12 @@ public static function remove_insecure_properties( $theme_json, $origin = 'theme

$variation_output = static::remove_insecure_styles( $variation_input );

// Process a variation's elements and element pseudo selector styles.
if ( isset( $variation_input['elements'] ) ) {
foreach ( $valid_element_names as $element_name ) {
$element_input = $variation_input['elements'][ $element_name ] ?? null;
if ( $element_input ) {
$element_output = static::remove_insecure_styles( $element_input );

if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) {
if ( isset( $element_input[ $pseudo_selector ] ) ) {
$element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] );
}
}
}
if ( isset( $variation_input['blocks'] ) ) {
$variation_output['blocks'] = static::remove_insecure_inner_block_styles( $variation_input['blocks'] );
}

if ( ! empty( $element_output ) ) {
_wp_array_set( $variation_output, array( 'elements', $element_name ), $element_output );
}
}
}
if ( isset( $variation_input['elements'] ) ) {
$variation_output['elements'] = static::remove_insecure_element_styles( $variation_input['elements'] );
}

if ( ! empty( $variation_output ) ) {
Expand Down Expand Up @@ -3622,6 +3620,59 @@ public static function remove_insecure_properties( $theme_json, $origin = 'theme
return $theme_json;
}

/**
* Remove insecure element styles within a variation or block.
*
* @since 6.8.0
*
* @param array $elements The elements to process.
* @return array The sanitized elements styles.
*/
protected static function remove_insecure_element_styles( $elements ) {
$sanitized = array();
$valid_element_names = array_keys( static::ELEMENTS );

foreach ( $valid_element_names as $element_name ) {
$element_input = $elements[ $element_name ] ?? null;
if ( $element_input ) {
$element_output = static::remove_insecure_styles( $element_input );

if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) {
if ( isset( $element_input[ $pseudo_selector ] ) ) {
$element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] );
}
}
}

$sanitized[ $element_name ] = $element_output;
}
}
return $sanitized;
}

/**
* Remove insecure styles from inner blocks and their elements.
*
* @since 6.8.0
*
* @param array $blocks The block styles to process.
* @return array Sanitized block type styles.
*/
protected static function remove_insecure_inner_block_styles( $blocks ) {
$sanitized = array();
foreach ( $blocks as $block_type => $block_input ) {
$block_output = static::remove_insecure_styles( $block_input );

if ( isset( $block_input['elements'] ) ) {
$block_output['elements'] = static::remove_insecure_element_styles( $block_input['elements'] );
}

$sanitized[ $block_type ] = $block_output;
}
return $sanitized;
}

/**
* Processes a setting node and returns the same node
* without the insecure settings.
Expand Down
8 changes: 7 additions & 1 deletion lib/compat/wordpress-6.7/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ function _gutenberg_add_block_templates_from_registry( $query_result, $query, $t
}

if ( ! isset( $query['wp_id'] ) ) {
$template_files = _gutenberg_get_block_templates_files( $template_type, $query );
// We need to unset the post_type query param because some templates
// would be excluded otherwise, like `page.html` when looking for
// `page` templates.
// See: https://github.com/WordPress/gutenberg/issues/65584
$template_files_query = $query;
unset( $template_files_query['post_type'] );
$template_files = _gutenberg_get_block_templates_files( $template_type, $template_files_query );

/*
* Add templates registered in the template registry. Filtering out the ones which have a theme file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
class Gutenberg_REST_Comment_Controller_6_8 extends WP_REST_Comments_Controller {

public function create_item_permissions_check( $request ) {
if ( empty( $request['comment_type'] ) || 'comment' === $request['comment_type'] ) {
return parent::create_item_permissions_check( $request );
}

if ( ! is_user_logged_in() ) {
if ( get_option( 'comment_registration' ) ) {
return new WP_Error(
Expand Down Expand Up @@ -90,14 +94,6 @@ public function create_item_permissions_check( $request ) {
);
}

if ( 'draft' === $post->post_status && 'comment' === $request['comment_type'] ) {
return new WP_Error(
'rest_comment_draft_post',
__( 'Sorry, you are not allowed to create a comment on this post.' ),
array( 'status' => 403 )
);
}

if ( 'trash' === $post->post_status ) {
return new WP_Error(
'rest_comment_trash_post',
Expand All @@ -114,14 +110,6 @@ public function create_item_permissions_check( $request ) {
);
}

if ( ! comments_open( $post->ID ) && 'comment' === $request['comment_type'] ) {
return new WP_Error(
'rest_comment_closed',
__( 'Sorry, comments are closed for this item.' ),
array( 'status' => 403 )
);
}

return true;
}
}
Expand Down
35 changes: 35 additions & 0 deletions lib/compat/wordpress-6.8/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* Adds the x-wav mime type to the list of mime types.
* This is necessary for Firefox as it uses the identifier for uploaded .wav files.
* Core backport should add the following to the default mime_types filters in
* `wp_get_mime_types()` in wp-includes/functions.php:
*
* `'wav|x-wav' => 'audio/wav'`
*
* @since 6.8.0
*
* @param string[] $mime_types Mime types.
* @return string[] Mime types keyed by the file extension regex corresponding to those types.
*/
function gutenberg_get_mime_types_6_8( $mime_types ) {
/*
* Only add support if there is existing support for 'wav'.
* Some plugins may have deliberately disabled it.
*/
if ( ! isset( $mime_types['wav'] ) && ! isset( $mime_types['wav|x-wav'] ) ) {
return $mime_types;
}
/*
* Also, given that other themes or plugins may have already
* tried to add x-wav type support, only
* add the mime type if it doesn't already exist
* to avoid overriding any customizations.
*/
if ( ! isset( $mime_types['x-wav'] ) && ! isset( $mime_types['wav|x-wav'] ) ) {
$mime_types['x-wav'] = 'audio/wav';
}
return $mime_types;
}
add_filter( 'mime_types', 'gutenberg_get_mime_types_6_8', 99 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function gutenberg_is_experiment_enabled( $name ) {
// WordPress 6.8 compat.
require __DIR__ . '/compat/wordpress-6.8/preload.php';
require __DIR__ . '/compat/wordpress-6.8/blocks.php';
require __DIR__ . '/compat/wordpress-6.8/functions.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
Expand Down
Loading

0 comments on commit a743486

Please sign in to comment.