Skip to content

Commit

Permalink
prep build 10/28
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Oct 28, 2022
2 parents 6f1c246 + 67fe26f commit 3a20c5c
Show file tree
Hide file tree
Showing 75 changed files with 1,181 additions and 438 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ module.exports = {
'reverse',
'size',
'snakeCase',
'some',
'sortBy',
'startCase',
'startsWith',
Expand Down Expand Up @@ -331,6 +332,7 @@ module.exports = {
'**/*.@(android|ios|native).js',
'packages/react-native-*/**/*.js',
'test/native/**/*.js',
'test/e2e/**/*.[tj]s',
],
extends: [
'plugin:jest-dom/recommended',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
NO_CHECKS: 'true'

- name: Upload artifact
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: gutenberg-plugin
path: ./gutenberg.zip
Expand All @@ -203,7 +203,7 @@ jobs:
- name: Upload release notes artifact
if: ${{ needs.bump-version.outputs.new_version }}
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: release-notes
path: ./release-notes.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/end2end-test-playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ jobs:
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright
- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: failures-artifacts
path: artifacts/test-results
if-no-files-found: ignore

- name: Archive flaky tests report
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report-playwright
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ jobs:
$( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests )
- name: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: failures-artifacts
path: artifacts
if-no-files-found: ignore

- name: Archive flaky tests report
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report-${{ matrix.part }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Compare performance with trunk
if: github.event_name == 'pull_request'
run: ./bin/plugin/cli.js perf --ci $GITHUB_SHA trunk --tests-branch $GITHUB_SHA
run: ./bin/plugin/cli.js perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA

- name: Compare performance with current WordPress Core and previous Gutenberg versions
if: github.event_name == 'release'
Expand All @@ -50,7 +50,7 @@ jobs:
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt)
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION"
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
./bin/plugin/cli.js perf --ci "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --wp-version "$WP_MAJOR"
./bin/plugin/cli.js perf "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --wp-version "$WP_MAJOR"
- name: Compare performance with base branch
if: github.event_name == 'push'
Expand All @@ -61,7 +61,7 @@ jobs:
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt)
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION"
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
./bin/plugin/cli.js perf --ci $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"
./bin/plugin/cli.js perf $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
if: github.event_name == 'push'
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 @@ -52,13 +52,13 @@ jobs:
profile: pixel_xl
script: npm run native test:e2e:android:local ${{ matrix.native-test-name }}

- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: android-screen-recordings
path: packages/react-native-editor/android-screen-recordings

- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: appium-logs
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 @@ -77,13 +77,13 @@ jobs:
rm packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle
rm -rf packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/assets
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: ios-screen-recordings
path: packages/react-native-editor/ios-screen-recordings

- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: appium-logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/storybook-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: npm run storybook:build

- name: Deploy
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 # v3.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./storybook/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-release-to-plugin-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
fi
- name: Upload Changelog artifact
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: changelog ${{ matrix.label }}
path: ./changelog.txt
Expand Down
6 changes: 4 additions & 2 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ async function runTestSuite( testSuite, performanceTestDirectory ) {
* @param {WPPerformanceCommandOptions} options Command options.
*/
async function runPerformanceTests( branches, options ) {
const runningInCI = !! process.env.CI || !! options.ci;

// The default value doesn't work because commander provides an array.
if ( branches.length === 0 ) {
branches = [ 'trunk' ];
Expand All @@ -201,11 +203,11 @@ async function runPerformanceTests( branches, options ) {
log(
formats.title( '\n💃 Performance Tests 🕺\n' ),
'\nWelcome! This tool runs the performance tests on multiple branches and displays a comparison table.\n' +
'In order to run the tests, the tool is going to load a WordPress environment on 8888 and 8889 ports.\n' +
'In order to run the tests, the tool is going to load a WordPress environment on ports 8888 and 8889.\n' +
'Make sure these ports are not used before continuing.\n'
);

if ( ! options.ci ) {
if ( ! runningInCI ) {
await askForConfirmation( 'Ready to go? ' );
}

Expand Down
17 changes: 16 additions & 1 deletion docs/how-to-guides/curating-the-editor-experience.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@ Users have the ability to lock and unlock blocks via the editor. The locking UI

Keep in mind that each block you want to lock will need to be individually locked as desired. There is not a way to mass lock blocks currently.

**Lock patterns or templates**
**Apply block locking to patterns or templates**

When building patterns or templates, theme authors can use these same UI tools to set the default locked state of blocks. For example, a theme author could lock various pieces of a header. Keep in mind that by default, users with editing access can unlock these blocks. [Here’s an example of a pattern](https://gist.github.com/annezazu/acee30f8b6e8995e1b1a52796e6ef805) with various blocks locked in different ways and here’s more context on [creating a template with locked blocks](https://make.wordpress.org/core/2022/02/09/core-editor-improvement-curated-experiences-with-locking-apis-theme-json/). You can build these patterns in the editor itself, including adding locking options, before following the [documentation to register them](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-patterns/).

**Apply content only editing in patterns or templates**

This functionality was introduced in WordPress 6.1. In contrast to block locking, which disables the ability to move or remove blocks, content only editing is both designed for use at the pattern or template level and hides all design tools, while still allowing for the ability to edit the content of the blocks. This provides a great way to simplify the interface for users and preserve a design. When this option is added, the following changes occur:

- Non-content child blocks (containers, spacers, columns, etc) are hidden from list view, un-clickable on the canvas, and entirely un-editable.
- The Inspector will display a list of all child 'content' blocks. Clicking a block in this list reveals its settings panel.
- The main List View only shows content blocks, all at the same level regardless of actual nesting.
- Children blocks within the overall content locked container are automatically move / remove locked.
- Additional child blocks cannot be inserted, further preserving the design and layout.
- There is a link in the block toolbar to ‘Modify’ that a user can toggle on/off to have access to the broader design tools. Currently, it's not possibly to programmatically remove this option.

This option can be applied to Columns, Cover, and Group blocks as well as third-party blocks that have the templateLock attribute in its block.json. To adopt this functionality, you need to use `"templateLock":"contentOnly"`. [Here's an example of a pattern](https://gist.github.com/annezazu/d62acd2514cea558be6cea97fe28ff3c) with this functionality in place. For more information, please [review the relevant documentation](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-templates/#locking).

Note: There is no UI in place to manage content locking and it must be managed at the code level.

**Change permissions to control locking ability**

Agencies and plugin authors can offer an even more curated experience by limiting which users have [permission to lock and unlock blocks](https://make.wordpress.org/core/2022/05/05/block-locking-settings-in-wordpress-6-0/). By default, anyone who is an administrator will have access to lock and unlock blocks.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/block-api/block-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Starting in WordPress 5.8 release, we encourage using the `block.json` metadata
"category": "text",
"parent": [ "core/group" ],
"icon": "star",
"description": "Shows warning, error or success notices",
"description": "Shows warning, error or success notices...",
"keywords": [ "alert", "message" ],
"version": "1.0.3",
"textdomain": "my-plugin",
Expand Down
4 changes: 2 additions & 2 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ function gutenberg_restore_group_inner_container( $block_content, $block ) {
preg_quote( $tag_name, '/' )
);
if (
WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() ||
wp_theme_has_theme_json() ||
1 === preg_match( $group_with_inner_container_regex, $block_content ) ||
( isset( $block['attrs']['layout']['type'] ) && 'flex' === $block['attrs']['layout']['type'] )
) {
Expand Down Expand Up @@ -542,7 +542,7 @@ function gutenberg_restore_image_outer_container( $block_content, $block ) {
)/iUx";

if (
WP_Theme_JSON_Resolver::theme_has_support() ||
wp_theme_has_theme_json() ||
0 === preg_match( $image_with_align, $block_content, $matches )
) {
return $block_content;
Expand Down
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function gutenberg_register_packages_styles( $styles ) {
);

// Only load the default layout and margin styles for themes without theme.json file.
if ( ! WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() ) {
if ( ! wp_theme_has_theme_json() ) {
$wp_edit_blocks_dependencies[] = 'wp-editor-classic-layout-styles';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.0/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function _register_remote_theme_patterns() {
return;
}

if ( ! WP_Theme_JSON_Resolver_Gutenberg::theme_has_support() ) {
if ( ! wp_theme_has_theme_json() ) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function get_theme_data( $deprecated = array(), $options = array()
* and merge the static::$theme upon that.
*/
$theme_support_data = WP_Theme_JSON_Gutenberg::get_from_editor_settings( get_default_block_editor_settings() );
if ( ! static::theme_has_support() ) {
if ( ! wp_theme_has_theme_json() ) {
if ( ! isset( $theme_support_data['settings']['color'] ) ) {
$theme_support_data['settings']['color'] = array();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function gutenberg_get_global_styles_svg_filters() {
}
}

$supports_theme_json = WP_Theme_JSON_Resolver_Gutenberg::theme_has_support();
$supports_theme_json = wp_theme_has_theme_json();

$origins = array( 'default', 'theme', 'custom' );
if ( ! $supports_theme_json ) {
Expand Down
8 changes: 0 additions & 8 deletions lib/compat/wordpress-6.0/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ function gutenberg_register_edit_site_export_endpoint() {
}
add_action( 'rest_api_init', 'gutenberg_register_edit_site_export_endpoint' );

/**
* Registers the block pattern categories REST API routes.
*/
function gutenberg_register_rest_block_pattern_categories() {
$block_patterns = new WP_REST_Block_Pattern_Categories_Controller();
$block_patterns->register_routes();
}
add_action( 'rest_api_init', 'gutenberg_register_rest_block_pattern_categories' );

/**
* Register a core site settings.
Expand Down
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.1/block-editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function gutenberg_get_block_editor_settings( $settings ) {
}
}

if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
if ( wp_theme_has_theme_json() ) {
$block_classes = array(
'css' => 'styles',
'__unstableType' => 'theme',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function gutenberg_get_global_stylesheet( $types = array() ) {
}
}
$tree = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data();
$supports_theme_json = WP_Theme_JSON_Resolver_Gutenberg::theme_has_support();
$supports_theme_json = wp_theme_has_theme_json();
if ( empty( $types ) && ! $supports_theme_json ) {
$types = array( 'variables', 'presets', 'base-layout-styles' );
} elseif ( empty( $types ) ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.1/template-parts-screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static function( $classes ) {
'styles' => get_block_editor_theme_styles(),
'defaultTemplateTypes' => $indexed_template_types,
'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(),
'supportsLayout' => WP_Theme_JSON_Resolver::theme_has_support(),
'supportsLayout' => wp_theme_has_theme_json(),
'supportsTemplatePartsMode' => ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ),
'__unstableHomeTemplate' => gutenberg_resolve_home_template(),
);
Expand Down
62 changes: 62 additions & 0 deletions lib/compat/wordpress-6.2/block-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* Overrides Core's wp-includes/block-patterns.php to add category descriptions for WP 6.2.
*
* @package gutenberg
*/

/**
* Registers the block pattern categories REST API routes.
*/
function gutenberg_register_core_block_patterns_and_categories() {
register_block_pattern_category(
'buttons',
array(
'label' => _x( 'Buttons', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'columns',
array(
'label' => _x( 'Columns', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'footer',
array(
'label' => _x( 'Footers', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'gallery',
array(
'label' => _x( 'Gallery', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'header',
array(
'label' => _x( 'Headers', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'text',
array(
'label' => _x( 'Text', 'Block pattern category', 'gutenberg' ),
)
);
register_block_pattern_category(
'query',
array(
'label' => _x( 'Posts', 'Block pattern category', 'gutenberg' ),
'description' => __( 'Display post summaries in lists, grids, and other layouts.', 'gutenberg' ),
)
);
register_block_pattern_category(
'featured',
array(
'label' => _x( 'Featured', 'Block pattern category', 'gutenberg' ),
)
);
}
add_action( 'init', 'gutenberg_register_core_block_patterns_and_categories' );
Loading

0 comments on commit 3a20c5c

Please sign in to comment.