Skip to content

Commit

Permalink
prep build 3/5
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Mar 5, 2025
2 parents a6ec6fe + 98622bf commit 032ade8
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 54 deletions.
3 changes: 3 additions & 0 deletions backport-changelog/6.8/8372.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/8372

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

* https://github.com/WordPress/gutenberg/pull/69400
6 changes: 4 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
== Changelog ==

= 20.4.0-rc.1 =

= 20.4.0 =

## Changelog

Expand All @@ -18,6 +17,7 @@
#### Block Library
- Post Navigation Link: Enable all non-interactive formats. ([69325](https://github.com/WordPress/gutenberg/pull/69325))
- Pullquote: Adding missing alignment style. ([68121](https://github.com/WordPress/gutenberg/pull/68121))
- Query Loop: Add `menu_order` as sorting option. ([68781](https://github.com/WordPress/gutenberg/pull/68781))

#### Site Editor
- Enhance 404 message styling. ([69234](https://github.com/WordPress/gutenberg/pull/69234))
Expand Down Expand Up @@ -182,6 +182,8 @@ The following contributors merged PRs in this release:
@adamsilverstein @afercia @alexchrysovergis @andreawetzel @benazeer-ben @carolinan @DAreRodz @davilera @fabiankaegy @felixarntz @himanshupathak95 @huubl @im3dabasia @Infinite-Null @jonathanbossenger @juanmaguitar @kellymears @Mamaduka @ockham @Rishit30G @SainathPoojary @shail-mehta @shimotmk @singhakanshu00 @snehapatil2001 @stokesman @Sukhendu2002 @swissspidy @t-hamano @yogeshbhutkar




= 20.0.3 =

## Changelog
Expand Down
32 changes: 32 additions & 0 deletions lib/compat/wordpress-6.8/admin-bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Updates the Edit Site link in the admin bar to point to the top level of the Site Editor.
* Removes the use of the $_wp_current_template_id global and the query args.
* Displays the link while in the admin area.
* Changes the capitalization of the link text to match WP 6.8: https://core.trac.wordpress.org/ticket/62971
*
* Note: Backports into wp-includes\admin-bar.php wp_admin_bar_edit_site_menu()
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
function gutenberg_wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
// Don't show if a block theme is not activated.
if ( ! wp_is_block_theme() ) {
return;
}

// Don't show for users who can't edit theme options.
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}

$wp_admin_bar->add_node(
array(
'id' => 'site-editor',
'title' => __( 'Edit Site' ),
'href' => admin_url( 'site-editor.php' ),
)
);
}

add_action( 'admin_bar_menu', 'gutenberg_wp_admin_bar_edit_site_menu', 41 );
9 changes: 5 additions & 4 deletions lib/compat/wordpress-6.8/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
if ( 'page' === $post->post_type ) {
$paths[] = add_query_arg(
'slug',
// @see https://github.com/WordPress/gutenberg/blob/489f6067c623926bce7151a76755bb68d8e22ea7/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js#L139-L140
'page-' . $post->post_name,
// @see https://github.com/WordPress/gutenberg/blob/e093fefd041eb6cc4a4e7f67b92ab54fd75c8858/packages/core-data/src/private-selectors.ts#L244-L254
empty( $post->post_name ) ? 'page' : 'page-' . $post->post_name,
'/wp/v2/templates/lookup'
);
}
Expand Down Expand Up @@ -68,8 +68,8 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
* See the call to `canUser()`, under `useGlobalStylesUserConfig()` in `packages/edit-site/src/components/use-global-styles-user-config/index.js`.
* Please ensure that the equivalent check is kept in sync with this preload path.
*/
$context = current_user_can( 'edit_theme_options' ) ? 'edit' : 'view';
$paths[] = "/wp/v2/global-styles/$global_styles_id?context=$context";
$rest_context = current_user_can( 'edit_theme_options' ) ? 'edit' : 'view';
$paths[] = "/wp/v2/global-styles/$global_styles_id?context=$rest_context";

// Used by getBlockPatternCategories in useBlockEditorSettings.
$paths[] = '/wp/v2/block-patterns/categories';
Expand All @@ -94,6 +94,7 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
)
);
}

return $paths;
}
add_filter( 'block_editor_rest_api_preload_paths', 'gutenberg_block_editor_preload_paths_6_8', 10, 2 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.7/post-formats.php';

// WordPress 6.8 compat.
require __DIR__ . '/compat/wordpress-6.8/admin-bar.php';
require __DIR__ . '/compat/wordpress-6.8/preload.php';
require __DIR__ . '/compat/wordpress-6.8/blocks.php';
require __DIR__ . '/compat/wordpress-6.8/functions.php';
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "20.4.0-rc.1",
"version": "20.4.0",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
117 changes: 84 additions & 33 deletions packages/block-library/src/audio/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import clsx from 'clsx';
import { isBlobURL } from '@wordpress/blob';
import {
Disabled,
PanelBody,
SelectControl,
Spinner,
ToggleControl,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import {
BlockControls,
Expand All @@ -32,7 +33,10 @@ import { useState } from '@wordpress/element';
* Internal dependencies
*/
import { createUpgradedEmbedBlock } from '../embed/util';
import { useUploadMediaFromBlobURL } from '../utils/hooks';
import {
useUploadMediaFromBlobURL,
useToolsPanelDropdownMenuProps,
} from '../utils/hooks';
import { Caption } from '../utils/caption';

const ALLOWED_MEDIA_TYPES = [ 'audio' ];
Expand Down Expand Up @@ -126,6 +130,7 @@ function AudioEdit( {
const blockProps = useBlockProps( {
className: classes,
} );
const dropdownMenuProps = useToolsPanelDropdownMenuProps();

if ( ! src && ! temporaryURL ) {
return (
Expand Down Expand Up @@ -160,42 +165,88 @@ function AudioEdit( {
</BlockControls>
) }
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
autoplay: false,
loop: false,
preload: undefined,
} );
} }
dropdownMenuProps={ dropdownMenuProps }
>
<ToolsPanelItem
label={ __( 'Autoplay' ) }
onChange={ toggleAttribute( 'autoplay' ) }
checked={ autoplay }
help={ getAutoplayHelp }
/>
<ToggleControl
__nextHasNoMarginBottom
isShownByDefault
hasValue={ () => !! autoplay }
onDeselect={ () =>
setAttributes( {
autoplay: false,
} )
}
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Autoplay' ) }
onChange={ toggleAttribute( 'autoplay' ) }
checked={ !! autoplay }
help={ getAutoplayHelp }
/>
</ToolsPanelItem>
<ToolsPanelItem
label={ __( 'Loop' ) }
onChange={ toggleAttribute( 'loop' ) }
checked={ loop }
/>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ _x( 'Preload', 'noun; Audio block parameter' ) }
value={ preload || '' }
// `undefined` is required for the preload attribute to be unset.
onChange={ ( value ) =>
isShownByDefault
hasValue={ () => !! loop }
onDeselect={ () =>
setAttributes( {
preload: value || undefined,
loop: false,
} )
}
options={ [
{ value: '', label: __( 'Browser default' ) },
{ value: 'auto', label: __( 'Auto' ) },
{ value: 'metadata', label: __( 'Metadata' ) },
{
value: 'none',
label: _x( 'None', 'Preload value' ),
},
] }
/>
</PanelBody>
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Loop' ) }
onChange={ toggleAttribute( 'loop' ) }
checked={ !! loop }
/>
</ToolsPanelItem>
<ToolsPanelItem
label={ __( 'Preload' ) }
isShownByDefault
hasValue={ () => !! preload }
onDeselect={ () =>
setAttributes( {
preload: undefined,
} )
}
>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ _x(
'Preload',
'noun; Audio block parameter'
) }
value={ preload || '' }
// `undefined` is required for the preload attribute to be unset.
onChange={ ( value ) =>
setAttributes( {
preload: value || undefined,
} )
}
options={ [
{ value: '', label: __( 'Browser default' ) },
{ value: 'auto', label: __( 'Auto' ) },
{ value: 'metadata', label: __( 'Metadata' ) },
{
value: 'none',
label: _x( 'None', 'Preload value' ),
},
] }
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<figure { ...blockProps }>
{ /*
Expand Down
20 changes: 14 additions & 6 deletions packages/block-library/src/comment-template/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,21 @@ const useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {
} ),
method: 'HEAD',
parse: false,
} ).then( ( res ) => {
const pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );
setDefaultPages( {
...defaultPages,
[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.
} )
.then( ( res ) => {
const pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );
setDefaultPages( {
...defaultPages,
[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.
} );
} )
.catch( () => {
// There's no 0th page, but we can't know the number of pages, fallback to 1.
setDefaultPages( {
...defaultPages,
[ key ]: 1,
} );
} );
} );
}, [ defaultPage, postId, perPage, setDefaultPages ] );

// The oldest one is always the first one.
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
orderby: orderBy,
per_page: postsToShow,
_embed: 'wp:featuredmedia',
ignore_sticky: true,
} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )
);

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/site-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function render_block_core_site_title( $attributes ) {
}

if ( $attributes['isLink'] ) {
$aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
$aria_current = ! is_paged() && ( is_front_page() || is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ? ' aria-current="page"' : '';
$link_target = ! empty( $attributes['linkTarget'] ) ? $attributes['linkTarget'] : '_self';

$site_title = sprintf(
Expand Down
7 changes: 5 additions & 2 deletions packages/block-library/src/table-of-contents/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function getLatestHeadings( select, clientId ) {
const {
getBlockAttributes,
getBlockName,
getClientIdsWithDescendants,
getBlocksByName,
getClientIdsOfDescendants,
} = select( blockEditorStore );

// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
Expand All @@ -31,8 +31,11 @@ function getLatestHeadings( select, clientId ) {
const isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;
const { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};

// Get post-content block client ID.
const [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );

// Get the client ids of all blocks in the editor.
const allBlockClientIds = getClientIdsWithDescendants();
const allBlockClientIds = getClientIdsOfDescendants( postContentClientId );

// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.
let tocPage = 1;
Expand Down
17 changes: 17 additions & 0 deletions packages/dataviews/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,23 @@ The header text to show in the modal.
- Type: `string`
- Optional
### `modalSize`
Specifies the size of the modal window when displaying action content using `RenderModal`.
- Type: `string`
- Optional
- Default: `'medium'`
- One of: `'small'`, `'medium'`, `'large'`, `'fill'`
Example:
```js
{
modalSize: 'large';
}
```
## Fields API
### `id`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function ActionModal< Item >( {
__experimentalHideHeader={ !! action.hideModalHeader }
onRequestClose={ closeModal }
focusOnMount="firstContentElement"
size="medium"
size={ action.modalSize || 'medium' }
overlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(
action.id
) }` }
Expand Down
7 changes: 7 additions & 0 deletions packages/dataviews/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ export interface ActionModal< Item > extends ActionBase< Item > {
* The header of the modal.
*/
modalHeader?: string;

/**
* The size of the modal.
*
* @default 'medium'
*/
modalSize?: 'small' | 'medium' | 'large' | 'fill';
}

export interface ActionButton< Item > extends ActionBase< Item > {
Expand Down
Loading

0 comments on commit 032ade8

Please sign in to comment.