Skip to content

Commit

Permalink
prep build 10/16
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Oct 16, 2023
2 parents 771dc30 + e33eead commit d491475
Show file tree
Hide file tree
Showing 139 changed files with 2,422 additions and 1,035 deletions.
25 changes: 25 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
== Changelog ==

= 16.8.1 =



## Changelog

### Enhancements

- Update: Improve footnotes sanitisation by removing unrequired keys. ([55305](https://github.com/WordPress/gutenberg/pull/55305))


### Code Quality

- Update: Navigation link force arrow attribute to be part of the hardcoded set. ([55306](https://github.com/WordPress/gutenberg/pull/55306))




## Contributors

The following contributors merged PRs in this release:

@jorgefilipecosta


= 16.8.0 =

= 16.8.0-rc.2 =
Expand Down
2 changes: 1 addition & 1 deletion docs/contributors/code/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This living document serves to prescribe instructions and best practices for wri

<div class="callout callout-info">

See the dedicated guide if you're working with the previous Jest + Puppeteer framework. See the [migration guide](https://github.com/WordPress/gutenberg/tree/HEAD/docs/contributors/code/e2e/migration.md) if you're migrating tests from Jest + Puppeteer.
See the dedicated guide if you're working with the previous Jest + Puppeteer framework. See the <a href="https://github.com/WordPress/gutenberg/tree/HEAD/docs/contributors/code/e2e/migration.md">migration guide</a> if you're migrating tests from Jest + Puppeteer.
</div>


Expand Down
5 changes: 3 additions & 2 deletions docs/contributors/code/e2e/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ This document outlines a typical flow of migrating a Jest + Puppeteer test to Pl
Before migrating a test utility function, think twice about whether it's necessary. Playwright offers a lot of readable and powerful APIs which make a lot of the utils obsolete. Try implementing the same thing inline directly in the test first. Only follow the below guide if that doesn't work for you. Some examples of utils that deserve to be implemented in the `e2e-test-utils-playwright` package include complex browser APIs (like `pageUtils.dragFiles` and `pageUtils.pressKeys`) and APIs that set states (`requestUtils.*`).
> **Note**
> The `e2e-test-utils-playwright` package is not meant to be a drop-in replacement of the Jest + Puppeteer's `e2e-test-utils` package. Some utils are only created to ease the migration process, but they are not necessarily required.
<div class="callout callout-info">
The <code>e2e-test-utils-playwright</code> package is not meant to be a drop-in replacement of the Jest + Puppeteer's <code>e2e-test-utils</code> package. Some utils are only created to ease the migration process, but they are not necessarily required.
</div>

Playwright utilities are organized a little differently from those in the `e2e-test-utils` package. The `e2e-test-utils-playwright` package has the following folders that utils are divided up into:
- `admin` - Utilities related to WordPress admin or WordPress admin's user interface (e.g. `visitAdminPage`).
Expand Down
12 changes: 11 additions & 1 deletion docs/how-to-guides/block-tutorial/nested-blocks-inner-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ registerBlockType( 'gutenberg-examples/example-06', {

## Allowed Blocks

Using the `ALLOWED_BLOCKS` property, you can define the set of blocks allowed in your InnerBlock. This restricts the blocks that can be included only to those listed, all other blocks will not show in the inserter.
Using the `allowedBlocks` property, you can define the set of blocks allowed in your InnerBlock. This restricts the blocks that can be included only to those listed, all other blocks will not show in the inserter.

```js
const ALLOWED_BLOCKS = [ 'core/image', 'core/paragraph' ];
Expand All @@ -87,6 +87,16 @@ By default, `InnerBlocks` expects its blocks to be shown in a vertical list. A v

Specifying this prop does not affect the layout of the inner blocks, but results in the block mover icons in the child blocks being displayed horizontally, and also ensures that drag and drop works correctly.

## Default Block

By default `InnerBlocks` opens a list of permitted blocks via `allowedBlocks` when the block appender is clicked. You can modify the default block and its attributes that are inserted when the initial block appender is clicked by using the `defaultBlock` property. For example:

```js
<InnerBlocks defaultBlock={['core/paragraph', {placeholder: "Lorem ipsum..."}]} directInsert />
```

By default this behavior is disabled until the `directInsert` prop is set to `true`. This allows you to specify conditions for when the default block should or should not be inserted.

## Template

Use the template property to define a set of blocks that prefill the InnerBlocks component when inserted. You can set attributes on the blocks to define their use. The example below shows a book review template using InnerBlocks component and setting placeholders values to show the block usage.
Expand Down
1 change: 1 addition & 0 deletions docs/how-to-guides/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ Note, however, that not all settings are relevant for all blocks. The settings s

There's one special setting property, `appearanceTools`, which is a boolean and its default value is false. Themes can use this setting to enable the following ones:

- background: backgroundImage
- border: color, radius, style, width
- color: link
- dimensions: minHeight
Expand Down
88 changes: 88 additions & 0 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,91 @@ function gutenberg_register_metadata_attribute( $args ) {
return $args;
}
add_filter( 'register_block_type_args', 'gutenberg_register_metadata_attribute' );

/**
* Strips all HTML from the content of footnotes, and sanitizes the ID.
*
* This function expects slashed data on the footnotes content.
*
* @access private
*
* @param string $footnotes JSON encoded string of an array containing the content and ID of each footnote.
* @return string Filtered content without any HTML on the footnote content and with the sanitized id.
*/
function _gutenberg_filter_post_meta_footnotes( $footnotes ) {
$footnotes_decoded = json_decode( $footnotes, true );
if ( ! is_array( $footnotes_decoded ) ) {
return '';
}
$footnotes_sanitized = array();
foreach ( $footnotes_decoded as $footnote ) {
if ( ! empty( $footnote['content'] ) && ! empty( $footnote['id'] ) ) {
$footnotes_sanitized[] = array(
'id' => sanitize_key( $footnote['id'] ),
'content' => wp_unslash( wp_filter_post_kses( wp_slash( $footnote['content'] ) ) ),
);
}
}
return wp_json_encode( $footnotes_sanitized );
}

/**
* Adds the filters to filter footnotes meta field.
*
* @access private
*/
function _gutenberg_footnotes_kses_init_filters() {
add_filter( 'sanitize_post_meta_footnotes', '_gutenberg_filter_post_meta_footnotes' );
}

/**
* Removes the filters that filter footnotes meta field.
*
* @access private
*/
function _gutenberg_footnotes_remove_filters() {
remove_filter( 'sanitize_post_meta_footnotes', '_gutenberg_filter_post_meta_footnotes' );
}

/**
* Registers the filter of footnotes meta field if the user does not have unfiltered_html capability.
*
* @access private
*/
function _gutenberg_footnotes_kses_init() {
if ( function_exists( '_wp_filter_post_meta_footnotes' ) ) {
return;
}
_gutenberg_footnotes_remove_filters();
if ( ! current_user_can( 'unfiltered_html' ) ) {
_gutenberg_footnotes_kses_init_filters();
}
}

/**
* Initializes footnotes meta field filters when imported data should be filtered.
*
* This filter is the last being executed on force_filtered_html_on_import.
* If the input of the filter is true it means we are in an import situation and should
* enable kses, independently of the user capabilities.
* So in that case we call _gutenberg_footnotes_kses_init_filters;
*
* @access private
*
* @param string $arg Input argument of the filter.
* @return string Input argument of the filter.
*/
function _gutenberg_footnotes_force_filtered_html_on_import_filter( $arg ) {
if ( function_exists( '_wp_filter_post_meta_footnotes' ) ) {
return;
}
// force_filtered_html_on_import is true we need to init the global styles kses filters.
if ( $arg ) {
_gutenberg_footnotes_kses_init_filters();
}
return $arg;
}

add_action( 'init', '_gutenberg_footnotes_kses_init' );
add_action( 'set_current_user', '_gutenberg_footnotes_kses_init' );
add_filter( 'force_filtered_html_on_import', '_gutenberg_footnotes_force_filtered_html_on_import_filter', 999 );
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -3389,7 +3389,7 @@ public function set_spacing_sizes() {
|| ! is_numeric( $spacing_scale['mediumStep'] )
|| ( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ) {
if ( ! empty( $spacing_scale ) ) {
trigger_error( __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), E_USER_NOTICE );
_doing_it_wrong( __METHOD__, __( 'Some of the theme.json settings.spacing.spacingScale values are invalid', 'gutenberg' ), '6.1.0' );
}
return null;
}
Expand Down
12 changes: 6 additions & 6 deletions lib/experimental/fonts/font-library/class-wp-font-collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @package WordPress
* @subpackage Font Library
* @since 6.4.0
* @since 6.5.0
*/

if ( class_exists( 'WP_Font_Collection' ) ) {
Expand All @@ -16,14 +16,14 @@
/**
* Font Collection class.
*
* @since 6.4.0
* @since 6.5.0
*/
class WP_Font_Collection {

/**
* Font collection configuration.
*
* @since 6.4.0
* @since 6.5.0
*
* @var array
*/
Expand All @@ -32,7 +32,7 @@ class WP_Font_Collection {
/**
* WP_Font_Collection constructor.
*
* @since 6.4.0
* @since 6.5.0
*
* @param array $config Font collection config options.
* See {@see wp_register_font_collection()} for the supported fields.
Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct( $config ) {
/**
* Gets the font collection config.
*
* @since 6.4.0
* @since 6.5.0
*
* @return array An array containing the font collection config.
*/
Expand All @@ -72,7 +72,7 @@ public function get_config() {
/**
* Gets the font collection data.
*
* @since 6.4.0
* @since 6.5.0
*
* @return array|WP_Error An array containing the list of font families in theme.json format on success,
* else an instance of WP_Error on failure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @package WordPress
* @subpackage Font Library
* @since 6.4.0
* @since 6.5.0
*/

if ( class_exists( 'WP_Font_Family_Utils' ) ) {
Expand All @@ -16,7 +16,7 @@
/**
* A class of utilities for working with the Font Library.
*
* @since 6.4.0
* @since 6.5.0
*/
class WP_Font_Family_Utils {

Expand All @@ -26,7 +26,7 @@ class WP_Font_Family_Utils {
* Creates a filename for a font face asset using font family, style, weight and
* extension information.
*
* @since 6.4.0
* @since 6.5.0
*
* @param string $font_slug The font slug to use in the filename.
* @param array $font_face The font face array containing 'fontFamily', 'fontStyle', and
Expand All @@ -48,7 +48,7 @@ public static function get_filename_from_font_face( $font_slug, $font_face, $url
/**
* Merges two fonts and their font faces.
*
* @since 6.4.0
* @since 6.5.0
*
* @param array $font1 The first font to merge.
* @param array $font2 The second font to merge.
Expand Down Expand Up @@ -79,7 +79,7 @@ public static function merge_fonts_data( $font1, $font2 ) {
/**
* Returns whether the given file has a font MIME type.
*
* @since 6.4.0
* @since 6.5.0
*
* @param string $filepath The file to check.
* @return bool True if the file has a font MIME type, false otherwise.
Expand Down
Loading

0 comments on commit d491475

Please sign in to comment.