Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into rnmobile/add-reassure
Browse files Browse the repository at this point in the history
  • Loading branch information
derekblank committed Feb 20, 2023
2 parents 481b61a + 7f4bc29 commit 1954d30
Show file tree
Hide file tree
Showing 53 changed files with 463 additions and 372 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: Cache NPM packages
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Use desired version of Java
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0
uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 # v3.10.0
with:
distribution: 'temurin'
java-version: '11'
Expand All @@ -43,7 +43,7 @@ jobs:
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3

- name: AVD cache
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
id: avd-cache
with:
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt

- name: Restore build cache
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
path: |
packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
packages/react-native-editor/ios/build/WDA
key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }}

- name: Restore pods cache
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
path: |
packages/react-native-editor/ios/Pods
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT

- name: Cache PHPCS scan cache
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.0.11
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.0.11
with:
path: .cache/phpcs.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
Expand Down
13 changes: 13 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
== Changelog ==

= 15.2.0-rc.2 =

Various
Fonts API: Add missing files to lib/load.php. (https://github.com/WordPress/gutenberg/pull/48108)
First time contributors
The following PRs were merged by first time contributors:

Contributors
The following contributors merged PRs in this release:

@hellofromtonya


= 15.1.1 =


Expand Down
4 changes: 2 additions & 2 deletions docs/contributors/code/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ It is recommended to use the main `wp-polyfill` script handle which takes care o
## Bundling and code sharing

When using a JavaScript bundler like [webpack](https://webpack.js.org/), the scripts mentioned here
can be excluded from the bundle and provided by WordPress in the form of script dependencies [(see
`wp_enqueue_script`)][https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress].
can be excluded from the bundle and provided by WordPress in the form of script dependencies [see
`wp_enqueue_script`](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress).

The
[`@wordpress/dependency-extraction-webpack-plugin`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dependency-extraction-webpack-plugin)
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.0
* Requires PHP: 5.6
* Version: 15.2.0-rc.1
* Version: 15.2.0-rc.2
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,65 @@ public function get_template_fallback( $request ) {
$response = $this->prepare_item_for_response( $fallback_template, $request );
return rest_ensure_response( $response );
}

/**
* Add revisions to the response.
*
* @param WP_Block_Template $item Template instance.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
public function prepare_item_for_response( $item, $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$template = $item;

$fields = $this->get_fields_for_response( $request );

$response = parent::prepare_item_for_response( $item, $request );

if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
$links = $this->prepare_revision_links( $template );
$response->add_links( $links );
if ( ! empty( $links['self']['href'] ) ) {
$actions = $this->get_available_actions();
$self = $links['self']['href'];
foreach ( $actions as $rel ) {
$response->add_link( $rel, $self );
}
}
}

return $response;
}

/**
* Adds revisions to links.
*
* @since 6.2.0
*
* @param WP_Block_Template $template Template instance.
* @return array Links for the given post.
*/
protected function prepare_revision_links( $template ) {
$links = array();

if ( post_type_supports( $this->post_type, 'revisions' ) && (int) $template->wp_id ) {
$revisions = wp_get_latest_revision_id_and_total_count( (int) $template->wp_id );
$revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0;
$revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $template->id );

$links['version-history'] = array(
'href' => rest_url( $revisions_base ),
'count' => $revisions_count,
);

if ( $revisions_count > 0 ) {
$links['predecessor-version'] = array(
'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ),
'id' => $revisions['latest_id'],
);
}
}

return $links;
}
}
75 changes: 0 additions & 75 deletions lib/experimental/class-gutenberg-rest-template-revision-count.php

This file was deleted.

21 changes: 0 additions & 21 deletions lib/experimental/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,6 @@ function gutenberg_register_block_editor_settings() {
add_action( 'rest_api_init', 'gutenberg_register_block_editor_settings' );


/**
* Hook in to the template and template part post types and decorate
* the rest endpoint with the revision count.
*
* When merging to core, this can be removed once Gutenberg_REST_Template_Revision_Count is
* merged with WP_REST_Template_Controller.
*
* @param array $args Current registered post type args.
* @param string $post_type Name of post type.
*
* @return array
*/
function wp_api_template_revision_args( $args, $post_type ) {
if ( 'wp_template' === $post_type || 'wp_template_part' === $post_type ) {
$args['rest_controller_class'] = 'Gutenberg_REST_Template_Revision_Count';
}

return $args;
}
add_filter( 'register_post_type_args', 'wp_api_template_revision_args', 10, 2 );

/**
* Shim for get_sample_permalink() to add support for auto-draft status.
*
Expand Down
1 change: 0 additions & 1 deletion lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function gutenberg_is_experiment_enabled( $name ) {
if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) {
require_once __DIR__ . '/experimental/class-wp-rest-customizer-nonces.php';
}
require_once __DIR__ . '/experimental/class-gutenberg-rest-template-revision-count.php';

require_once __DIR__ . '/experimental/rest-api.php';
}
Expand Down
8 changes: 4 additions & 4 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": "15.2.0-rc.1",
"version": "15.2.0-rc.2",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
* WordPress dependencies
*/
import { createBlock } from '@wordpress/blocks';
import { addSubmenu, moreVertical } from '@wordpress/icons';
import {
addSubmenu,
chevronUp,
chevronDown,
moreVertical,
} from '@wordpress/icons';
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
import { useDispatch } from '@wordpress/data';
import { useDispatch, useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';

/**
Expand Down Expand Up @@ -80,14 +85,24 @@ function AddSubmenuItem( { block, onClose } ) {
export default function LeafMoreMenu( props ) {
const { clientId, block } = props;

const { removeBlocks } = useDispatch( blockEditorStore );
const { moveBlocksDown, moveBlocksUp, removeBlocks } =
useDispatch( blockEditorStore );

const label = sprintf(
const removeLabel = sprintf(
/* translators: %s: block name */
__( 'Remove %s' ),
BlockTitle( { clientId, maximumLength: 25 } )
);

const rootClientId = useSelect(
( select ) => {
const { getBlockRootClientId } = select( blockEditorStore );

return getBlockRootClientId( clientId );
},
[ clientId ]
);

return (
<DropdownMenu
icon={ moreVertical }
Expand All @@ -98,17 +113,39 @@ export default function LeafMoreMenu( props ) {
{ ...props }
>
{ ( { onClose } ) => (
<MenuGroup>
<AddSubmenuItem block={ block } onClose={ onClose } />
<MenuItem
onClick={ () => {
removeBlocks( [ clientId ], false );
onClose();
} }
>
{ label }
</MenuItem>
</MenuGroup>
<>
<MenuGroup>
<MenuItem
icon={ chevronUp }
onClick={ () => {
moveBlocksUp( [ clientId ], rootClientId );
onClose();
} }
>
{ __( 'Move up' ) }
</MenuItem>
<MenuItem
icon={ chevronDown }
onClick={ () => {
moveBlocksDown( [ clientId ], rootClientId );
onClose();
} }
>
{ __( 'Move down' ) }
</MenuItem>
<AddSubmenuItem block={ block } onClose={ onClose } />
</MenuGroup>
<MenuGroup>
<MenuItem
onClick={ () => {
removeBlocks( [ clientId ], false );
onClose();
} }
>
{ removeLabel }
</MenuItem>
</MenuGroup>
</>
) }
</DropdownMenu>
);
Expand Down
Loading

0 comments on commit 1954d30

Please sign in to comment.