Skip to content

Commit

Permalink
prep build 12/10
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Dec 10, 2024
2 parents fb70061 + 244c145 commit 6efaf03
Show file tree
Hide file tree
Showing 78 changed files with 1,397 additions and 758 deletions.
3 changes: 3 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"plugins": [ "." ],
"themes": [ "./test/emptytheme" ],
"env": {
"development": {
"phpmyadminPort": 9000
},
"tests": {
"mappings": {
"wp-content/plugins/gutenberg": ".",
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7865.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7865

* https://github.com/WordPress/gutenberg/pull/66851
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ Contains the block elements used to render content when no query results are fou

- **Name:** core/query-no-results
- **Category:** theme
- **Parent:** core/query
- **Ancestor:** core/query
- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~

## Pagination
Expand Down
13 changes: 13 additions & 0 deletions lib/block-editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ function gutenberg_get_block_editor_settings( $settings ) {
$global_styles[] = $block_classes;
}

// Get any additional css from the customizer and add it before global styles custom CSS.
$global_styles[] = array(
'css' => wp_get_custom_css(),
'__unstableType' => 'user',
'isGlobalStyles' => false,
);

/*
* Add the custom CSS as a separate stylesheet so any invalid CSS
* entered by users does not break other global styles.
Expand All @@ -74,6 +81,12 @@ function gutenberg_get_block_editor_settings( $settings ) {
$block_classes['css'] = $actual_css;
$global_styles[] = $block_classes;
}
// Get any additional css from the customizer.
$global_styles[] = array(
'css' => wp_get_custom_css(),
'__unstableType' => 'user',
'isGlobalStyles' => false,
);
}

$settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
Expand Down
26 changes: 25 additions & 1 deletion lib/compat/wordpress-6.8/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,33 @@ function gutenberg_redirect_site_editor_deprecated_urls() {
* @return callable The default handler or a custom handler.
*/
function gutenberg_styles_wp_die_handler( $default_handler ) {
if ( ! wp_is_block_theme() && str_contains( $_SERVER['REQUEST_URI'], 'site-editor.php' ) && isset( $_GET['p'] ) ) {
if ( ! wp_is_block_theme() && str_contains( $_SERVER['REQUEST_URI'], 'site-editor.php' ) && current_user_can( 'edit_theme_options' ) ) {
return '__return_false';
}
return $default_handler;
}
add_filter( 'wp_die_handler', 'gutenberg_styles_wp_die_handler' );

/**
* Add a Styles submenu under the Appearance menu
* for Classic themes.
*
* @global array $submenu
*/
function gutenberg_add_styles_submenu_item() {
if ( ! wp_is_block_theme() && ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() ) ) {
global $submenu;

$styles_menu_item = array(
__( 'Design', 'gutenberg' ),
'edit_theme_options',
'site-editor.php',
);
// If $submenu exists, insert the Styles submenu item at position 2.
if ( $submenu && isset( $submenu['themes.php'] ) ) {
// This might not work as expected if the submenu has already been modified.
array_splice( $submenu['themes.php'], 1, 1, array( $styles_menu_item ) );
}
}
}
add_action( 'admin_init', 'gutenberg_add_styles_submenu_item' );
100 changes: 50 additions & 50 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,157 +44,157 @@ function gutenberg_initialize_experiments_settings() {
);

add_settings_field(
'gutenberg-sync-collaboration',
__( 'Live Collaboration and offline persistence', 'gutenberg' ),
'gutenberg-block-experiments',
__( 'Blocks: add experimental blocks', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable the live collaboration and offline persistence between peers', 'gutenberg' ),
'id' => 'gutenberg-sync-collaboration',
'label' => __( 'Enables experimental blocks on a rolling basis as they are developed.<p class="description">(Warning: these blocks may have significant changes during development that cause validation errors and display issues.)</p>', 'gutenberg' ),
'id' => 'gutenberg-block-experiments',
)
);

add_settings_field(
'gutenberg-custom-dataviews',
__( 'Custom dataviews', 'gutenberg' ),
'gutenberg-form-blocks',
__( 'Blocks: add Form and input blocks', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test the custom dataviews in the pages page.', 'gutenberg' ),
'id' => 'gutenberg-custom-dataviews',
'label' => __( 'Enables new blocks to allow building forms. You are likely to experience UX issues that are being addressed.', 'gutenberg' ),
'id' => 'gutenberg-form-blocks',
)
);

add_settings_field(
'gutenberg-color-randomizer',
__( 'Color randomizer', 'gutenberg' ),
'gutenberg-grid-interactivity',
__( 'Blocks: add Grid interactivity', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test the Global Styles color randomizer; a utility that lets you mix the current color palette pseudo-randomly.', 'gutenberg' ),
'id' => 'gutenberg-color-randomizer',
'label' => __( 'Enables enhancements to the Grid block that let you move and resize items in the editor canvas.', 'gutenberg' ),
'id' => 'gutenberg-grid-interactivity',
)
);

add_settings_field(
'gutenberg-block-experiments',
__( 'Experimental blocks', 'gutenberg' ),
'gutenberg-no-tinymce',
__( 'Blocks: disable TinyMCE and Classic block', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable experimental blocks.<p class="description">(Warning: these blocks may have significant changes during development that cause validation errors and display issues.)</p>', 'gutenberg' ),
'id' => 'gutenberg-block-experiments',
'label' => __( 'Disables the TinyMCE and Classic block', 'gutenberg' ),
'id' => 'gutenberg-no-tinymce',
)
);

add_settings_field(
'gutenberg-form-blocks',
__( 'Form and input blocks', 'gutenberg' ),
'gutenberg-media-processing',
__( 'Client-side media processing', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test new blocks to allow building forms (Warning: The new feature is not ready. You may experience UX issues that are being addressed)', 'gutenberg' ),
'id' => 'gutenberg-form-blocks',
'label' => __( 'Enables client-side media processing to leverage the browser\'s capabilities to handle tasks like image resizing and compression.', 'gutenberg' ),
'id' => 'gutenberg-media-processing',
)
);

add_settings_field(
'gutenberg-grid-interactivity',
__( 'Grid interactivity', 'gutenberg' ),
'gutenberg-block-comment',
__( 'Collaboration: add block level comments', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test enhancements to the Grid block that let you move and resize items in the editor canvas.', 'gutenberg' ),
'id' => 'gutenberg-grid-interactivity',
'label' => __( 'Enables multi-user block level commenting.', 'gutenberg' ),
'id' => 'gutenberg-block-comment',
)
);

add_settings_field(
'gutenberg-no-tinymce',
__( 'Disable TinyMCE and Classic block', 'gutenberg' ),
'gutenberg-sync-collaboration',
__( 'Collaboration: add real time editing', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Disable TinyMCE and Classic block', 'gutenberg' ),
'id' => 'gutenberg-no-tinymce',
'label' => __( 'Enables live collaboration and offline persistence between peers.', 'gutenberg' ),
'id' => 'gutenberg-sync-collaboration',
)
);

add_settings_field(
'gutenberg-full-page-client-side-navigation',
__( 'Enable full page client-side navigation', 'gutenberg' ),
'gutenberg-color-randomizer',
__( 'Color randomizer', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable full page client-side navigation using the Interactivity API', 'gutenberg' ),
'id' => 'gutenberg-full-page-client-side-navigation',
'label' => __( 'Enables the Global Styles color randomizer in the Site Editor; a utility that lets you mix the current color palette pseudo-randomly.', 'gutenberg' ),
'id' => 'gutenberg-color-randomizer',
)
);

add_settings_field(
'gutenberg-new-posts-dashboard',
__( 'Redesigned posts dashboard', 'gutenberg' ),
'gutenberg-custom-dataviews',
__( 'Data Views: add Custom Views', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable a redesigned posts dashboard.', 'gutenberg' ),
'id' => 'gutenberg-new-posts-dashboard',
'label' => __( 'Enables the ability to add, edit, and save custom views when in the Site Editor.', 'gutenberg' ),
'id' => 'gutenberg-custom-dataviews',
)
);

add_settings_field(
'gutenberg-quick-edit-dataviews',
__( 'Quick Edit in DataViews', 'gutenberg' ),
'gutenberg-new-posts-dashboard',
__( 'Data Views: enable for Posts', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Allow access to a quick edit panel in the pages data views.', 'gutenberg' ),
'id' => 'gutenberg-quick-edit-dataviews',
'label' => __( 'Enables a redesigned posts dashboard accessible through a submenu item in the Gutenberg plugin.', 'gutenberg' ),
'id' => 'gutenberg-new-posts-dashboard',
)
);

add_settings_field(
'gutenberg-block-comment',
__( 'Block Comments', 'gutenberg' ),
'gutenberg-quick-edit-dataviews',
__( 'Data Views: add Quick Edit', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable multi-user commenting on blocks', 'gutenberg' ),
'id' => 'gutenberg-block-comment',
'label' => __( 'Enables access to a Quick Edit panel in the Site Editor Pages experience.', 'gutenberg' ),
'id' => 'gutenberg-quick-edit-dataviews',
)
);

add_settings_field(
'gutenberg-media-processing',
__( 'Client-side media processing', 'gutenberg' ),
'gutenberg-full-page-client-side-navigation',
__( 'iAPI: full page client side navigation', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable client-side media processing.', 'gutenberg' ),
'id' => 'gutenberg-media-processing',
'label' => __( 'Enables full-page client-side navigation with the Interactivity API, updating HTML while preserving application state.', 'gutenberg' ),
'id' => 'gutenberg-full-page-client-side-navigation',
)
);

add_settings_field(
'gutenberg-editor-write-mode',
__( 'Editor write mode', 'gutenberg' ),
__( 'Simplified site editing', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable write mode in editor.', 'gutenberg' ),
'label' => __( 'Enables Write mode in the Site Editor for a simplified editing experience.', 'gutenberg' ),
'id' => 'gutenberg-editor-write-mode',
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function pickStyleKeys( treeToPickFrom ) {
// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
const clonedEntries = pickedEntries.map( ( [ key, style ] ) => [
key,
JSON.parse( JSON.stringify( style ) ),
structuredClone( style ),
] );
return Object.fromEntries( clonedEntries );
}
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function InserterMenu(
if ( isZoomOutMode ) {
return 'patterns';
}

return 'blocks';
}
const [ selectedTab, setSelectedTab ] = useState( getInitialTab() );

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export function omitStyle( style, paths, preserveReference = false ) {

let newStyle = style;
if ( ! preserveReference ) {
newStyle = JSON.parse( JSON.stringify( style ) );
newStyle = structuredClone( style );
}

if ( ! Array.isArray( paths ) ) {
Expand Down
27 changes: 15 additions & 12 deletions packages/block-editor/src/hooks/test/font-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import {
import _fontSize from '../font-size';

const noop = () => {};
const EMPTY_ARRAY = [];
const EMPTY_OBJECT = {};
const fontSizes = [
{
name: 'A larger font',
size: '32px',
slug: 'larger',
},
];

function addUseSettingFilter( callback ) {
addFilter(
Expand Down Expand Up @@ -55,21 +64,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [
{
name: 'A larger font',
size: '32px',
slug: 'larger',
},
];
return fontSizes;
}

if ( 'typography.fluid' === path ) {
return false;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand All @@ -95,15 +98,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [];
return EMPTY_ARRAY;
}

if ( 'typography.fluid' === path ) {
return false;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand Down Expand Up @@ -132,15 +135,15 @@ describe( 'useBlockProps', () => {
registerBlockType( blockSettings.name, blockSettings );
addUseSettingFilter( ( result, path ) => {
if ( 'typography.fontSizes' === path ) {
return [];
return EMPTY_ARRAY;
}

if ( 'typography.fluid' === path ) {
return true;
}

if ( 'layout' === path ) {
return {};
return EMPTY_OBJECT;
}

return result;
Expand Down
Loading

0 comments on commit 6efaf03

Please sign in to comment.