Skip to content

Commit

Permalink
prep build 12/5
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Dec 5, 2024
2 parents 12e3105 + 0b3a191 commit a35b3b4
Show file tree
Hide file tree
Showing 128 changed files with 1,193 additions and 539 deletions.
1 change: 1 addition & 0 deletions backport-changelog/6.8/7695.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ https://github.com/WordPress/wordpress-develop/pull/7695
* https://github.com/WordPress/gutenberg/pull/67465
* https://github.com/WordPress/gutenberg/pull/66579
* https://github.com/WordPress/gutenberg/pull/66654
* https://github.com/WordPress/gutenberg/pull/67518
249 changes: 249 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions docs/contributors/repository-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,3 @@ If you meet this criterion of several meaningful contributions having been accep
## Projects

We use [GitHub projects](https://github.com/WordPress/gutenberg/projects) to keep track of details that aren't immediately actionable, but that we want to keep around for future reference.

Some key projects include:

- [Phase 2](https://github.com/WordPress/gutenberg/projects/13) - Development tasks needed for Phase 2 of Gutenberg.
- [Phase 2 design](https://github.com/WordPress/gutenberg/projects/21) - Tasks for design in Phase 2. Note: specific projects may have their own boards.
- [Ideas](https://github.com/WordPress/gutenberg/projects/8) - Project containing tickets that, while closed for the time being, can be revisited in the future.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ As of Gutenberg version 14.2, the following controls are available:
- `taxQuery` - Shows available taxonomies filters for the currently selected post type.
- `author` - Shows an input field to filter the query by author.
- `search` - Shows an input field to filter the query by keywords.
- `format` - Shows an input field to filter the query by array/collection of [formats](https://developer.wordpress.org/advanced-administration/wordpress/post-formats/#supported-formats).
- `parents` - Shows an input field to filter the query using parent(s) entity.

In our case, the property would look like this:

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 @@ -820,7 +820,7 @@ Create a break between ideas or sections with a horizontal separator. ([Source](
- **Name:** core/separator
- **Category:** design
- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), interactivity (clientNavigation), spacing (margin)
- **Attributes:** opacity
- **Attributes:** opacity, tagName

## Shortcode

Expand Down
8 changes: 4 additions & 4 deletions docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ _Parameters_

_Returns_

- `string?`: Default block name.
- `?string`: Default block name.

### getDefaultBlockVariation

Expand Down Expand Up @@ -464,7 +464,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling non-block content.
- `?string`: Name of the block for handling non-block content.

### getGroupingBlockName

Expand Down Expand Up @@ -502,7 +502,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling the grouping of blocks.
- `?string`: Name of the block for handling the grouping of blocks.

### getUnregisteredFallbackBlockName

Expand Down Expand Up @@ -540,7 +540,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling unregistered blocks.
- `?string`: Name of the block for handling unregistered blocks.

### hasBlockSupport

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ _Parameters_

_Returns_

- `string?`: Template ID.
- `?string`: Template ID.

### getDeviceType

Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/data/data-core-keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut description.
- `?string`: Shortcut description.

### getShortcutKeyCombination

Expand Down Expand Up @@ -335,7 +335,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut representation.
- `?string`: Shortcut representation.

<!-- END TOKEN(Autogenerated selectors|../../../packages/keyboard-shortcuts/src/store/selectors.js) -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,15 @@ When using region-based navigation, it's crucial to ensure that your interactive

`getServerState()` allows you to subscribe to changes in the **global state** that occur during client-side navigation. This function is analogous to `getServerContext()`, but it works with the global state instead of the local context.

The `getServerState()` function returns a read-only reactive object. This means that any [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) you have defined that watch the returned object will only trigger when the value returned by the function changes. If the value remains the same, the callback will not re-trigger.

Let's consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<?php
wp_interactivity_state( 'myPlugin', array(
<div <?php echo wp_interactivity_state( 'myPlugin', array(
'question' => get_question_for_page( get_the_ID() ),
'timeLeft' => 5 * 60, // Time to answer all the questions.
) );
?>
) ); ?>>
```

```javascript
Expand Down Expand Up @@ -789,14 +789,14 @@ store( 'myPlugin', {

`getServerContext()` allows you to subscribe to changes in the **local context** that occur during client-side navigation. This function is analogous to `getServerState()`, but it works with the local context instead of the global state.

The `getServerContext()` function returns a read-only reactive object. This means that any [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) you have defined that watch the returned object will only trigger when the value returned by the function changes. If the value remains the same, the callback will not re-trigger.

Consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<?php
wp_interactivity_context( 'myPlugin', array(
<div <?php echo wp_interactivity_data_wp_context( array(
'currentQuestion' => get_question_for_page( get_the_ID() ),
) );
?>
), ); ?>>
```

```javascript
Expand Down Expand Up @@ -830,12 +830,12 @@ store( 'myPlugin', {

### When to Use

Whenever you have interactive blocks that rely on global state that may change due to navigation events, ensuring consistency across different parts of your application.
Whenever you have interactive blocks that rely on global state or local context that may change due to navigation events, ensuring consistency across different parts of your application.

### Best Practices for using `getServerState()` and `getServerContext()`

- **Read-Only References:** Both `getServerState()` and `getServerContext()` return read-only objects. You can use those objects to update the global state or local context.
- **Callback Integration:** Incorporate these functions within your store [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) to react to state and context changes.
- **Callback Integration:** Incorporate these functions within your store [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) to react to state and context changes. Both `getServerState()` and `getServerContext()` return reactive objects. This means that their watch callbacks will only trigger when the value of a property changes. If the value remains the same, the callback will not re-trigger.

## Conclusion

Expand Down
1 change: 1 addition & 0 deletions lib/compat/wordpress-6.8/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
$route_for_post = rest_get_route_for_post( $post );
if ( $route_for_post ) {
$paths[] = add_query_arg( 'context', 'edit', $route_for_post );
$paths[] = add_query_arg( 'context', 'edit', '/wp/v2/types/' . $post->post_type );
if ( 'page' === $post->post_type ) {
$paths[] = add_query_arg(
'slug',
Expand Down
5 changes: 3 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": "19.8.0-rc.1",
"version": "19.8.0",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
21 changes: 21 additions & 0 deletions packages/babel-preset-default/polyfill-exclusions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,25 @@ module.exports = [
// This is an IE-only feature which we don't use, and don't want to polyfill.
// @see https://github.com/WordPress/gutenberg/pull/49234
'web.immediate',
// Remove Set feature polyfills.
//
// The Babel/core-js integration has a severe limitation, in that any Set
// objects (e.g. `new Set()`) are assumed to need all instance methods, and
// get them all polyfilled. There is no validation as to whether those
// methods are actually in use.
//
// This limitation causes a number of packages to unnecessarily get a
// dependency on `wp-polyfill`, which in most cases gets loaded as part of
// the critical path and can thus have an impact on performance.
//
// There is no good solution to this, and the one we've opted for here is
// to disable polyfilling these features entirely. Developers will need to
// take care not to use them in scenarios where the code may be running in
// older browsers without native support for them.
//
// These need to be specified as both `es.` and `esnext.` due to the way
// internal dependencies are set up in Babel / core-js.
//
// @see https://github.com/WordPress/gutenberg/pull/67230
/^es(next)?\.set\./,
];
1 change: 1 addition & 0 deletions packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ $z-layers: (
".editor-action-modal": 1000001,
".editor-post-template__swap-template-modal": 1000001,
".edit-site-template-panel__replace-template-modal": 1000001,
".fields-controls__template-modal": 1000001,

// Note: The ConfirmDialog component's z-index is being set to 1000001 in packages/components/src/confirm-dialog/styles.ts
// because it uses emotion and not sass. We need it to render on top its parent popover.
Expand Down
6 changes: 2 additions & 4 deletions packages/block-editor/src/autocompleters/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import { orderInserterBlockItems } from '../utils/order-inserter-block-items';
const noop = () => {};
const SHOWN_BLOCK_TYPES = 9;

/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */

/**
* Creates a blocks repeater for replacing the current block with a selected block type.
*
* @return {WPCompleter} A blocks completer.
* @return {Object} A blocks completer.
*/
function createBlockCompleter() {
return {
Expand Down Expand Up @@ -157,6 +155,6 @@ function createBlockCompleter() {
/**
* Creates a blocks repeater for replacing the current block with a selected block type.
*
* @return {WPCompleter} A blocks completer.
* @return {Object} A blocks completer.
*/
export default createBlockCompleter();
6 changes: 2 additions & 4 deletions packages/block-editor/src/autocompleters/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import { decodeEntities } from '@wordpress/html-entities';

const SHOWN_SUGGESTIONS = 10;

/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */

/**
* Creates a suggestion list for links to posts or pages.
*
* @return {WPCompleter} A links completer.
* @return {Object} A links completer.
*/
function createLinkCompleter() {
return {
Expand Down Expand Up @@ -60,6 +58,6 @@ function createLinkCompleter() {
/**
* Creates a suggestion list for links to posts or pages..
*
* @return {WPCompleter} A link completer.
* @return {Object} A link completer.
*/
export default createLinkCompleter();
8 changes: 3 additions & 5 deletions packages/block-editor/src/components/block-canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export function ExperimentalBlockCanvas( {
return (
<BlockTools
__unstableContentRef={ localRef }
style={ { height, display: 'flex' } }
className="block-editor-block-canvas"
style={ { height } }
>
<EditorStyles
styles={ styles }
Expand All @@ -67,10 +68,6 @@ export function ExperimentalBlockCanvas( {
ref={ contentRef }
className="editor-styles-wrapper"
tabIndex={ -1 }
style={ {
height: '100%',
width: '100%',
} }
>
{ children }
</WritingFlow>
Expand All @@ -81,6 +78,7 @@ export function ExperimentalBlockCanvas( {
return (
<BlockTools
__unstableContentRef={ localRef }
className="block-editor-block-canvas"
style={ { height, display: 'flex' } }
>
<Iframe
Expand Down
12 changes: 2 additions & 10 deletions packages/block-editor/src/components/block-edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { useContext, useMemo } from '@wordpress/element';
* Internal dependencies
*/
import BlockContext from '../block-context';
import { withBlockBindingsSupport } from './with-block-bindings-support';
import { canBindBlock } from '../../utils/block-bindings';

/**
* Default value used for blocks which do not define their own context needs,
Expand Down Expand Up @@ -49,8 +47,6 @@ const Edit = ( props ) => {

const EditWithFilters = withFilters( 'editor.BlockEdit' )( Edit );

const EditWithFiltersAndBindings = withBlockBindingsSupport( EditWithFilters );

const EditWithGeneratedProps = ( props ) => {
const { attributes = {}, name } = props;
const blockType = getBlockType( name );
Expand All @@ -71,12 +67,8 @@ const EditWithGeneratedProps = ( props ) => {
return null;
}

const EditComponent = canBindBlock( name )
? EditWithFiltersAndBindings
: EditWithFilters;

if ( blockType.apiVersion > 1 ) {
return <EditComponent { ...props } context={ context } />;
return <EditWithFilters { ...props } context={ context } />;
}

// Generate a class name for the block's editable form.
Expand All @@ -90,7 +82,7 @@ const EditWithGeneratedProps = ( props ) => {
);

return (
<EditComponent
<EditWithFilters
{ ...props }
context={ context }
className={ className }
Expand Down
19 changes: 6 additions & 13 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import {
memo,
useCallback,
RawHTML,
useContext,
useMemo,
} from '@wordpress/element';
import { memo, RawHTML, useContext, useMemo } from '@wordpress/element';
import {
getBlockType,
getSaveContent,
Expand All @@ -28,7 +22,7 @@ import {
store as blocksStore,
} from '@wordpress/blocks';
import { withFilters } from '@wordpress/components';
import { withDispatch, useDispatch, useSelect } from '@wordpress/data';
import { withDispatch, useSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';
import { safeHTML } from '@wordpress/dom';

Expand Down Expand Up @@ -103,6 +97,7 @@ function BlockListBlock( {
wrapperProps,
setAttributes,
onReplace,
onRemove,
onInsertBlocksAfter,
onMerge,
toggleSelection,
Expand All @@ -113,11 +108,6 @@ function BlockListBlock( {
themeSupportsLayout,
...context
} = useContext( PrivateBlockContext );
const { removeBlock } = useDispatch( blockEditorStore );
const onRemove = useCallback(
() => removeBlock( clientId ),
[ clientId, removeBlock ]
);

const parentLayout = useLayout() || {};

Expand Down Expand Up @@ -537,6 +527,9 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
initialPosition
);
},
onRemove() {
removeBlock( ownProps.clientId );
},
toggleSelection( selectionEnabled ) {
toggleSelection( selectionEnabled );
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { useBlockRefProvider } from './use-block-refs';
import { useIntersectionObserver } from './use-intersection-observer';
import { useScrollIntoView } from './use-scroll-into-view';
import { useFlashEditableBlocks } from '../../use-flash-editable-blocks';
import { canBindBlock } from '../../../utils/block-bindings';
import { canBindBlock } from '../../../hooks/use-bindings-attributes';
import { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';

/**
Expand Down
Loading

0 comments on commit a35b3b4

Please sign in to comment.