Skip to content

Commit

Permalink
prep build 07/13
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jul 13, 2022
2 parents a41863f + 58c78ec commit fe6261f
Show file tree
Hide file tree
Showing 151 changed files with 532 additions and 146 deletions.
230 changes: 230 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ ln -s gutenberg/packages/e2e-tests/plugins/* .
You'll need to run this again if new plugins are added. To run e2e tests:

```bash
WP_BASE_URL=http://localhost:8888/gutenberg npm run test-e2e
WP_BASE_URL=http://localhost:8888/gutenberg/ npm run test-e2e
```

#### Caching of PHP files
Expand Down
7 changes: 5 additions & 2 deletions docs/contributors/code/managing-packages.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Managing Packages

This repository uses [lerna] to manage Gutenberg modules and publish them as packages to [npm]. This enforces certain steps in the workflow which are described in details in [packages](https://github.com/WordPress/gutenberg/blob/HEAD/packages/README.md) documentation.
This repository uses [monorepo] to manage WordPress modules and publish them with [lerna] as packages to [npm]. This enforces certain steps in the workflow which are described in details in [packages](https://github.com/WordPress/gutenberg/blob/HEAD/packages/README.md) documentation.

Maintaining dozens of npm packages is difficult—it can be tough to keep track of changes. That's why we use `CHANGELOG.md` files for each package to simplify the release process. As a contributor, you should add an entry to the aforementioned file each time you contribute adding production code as described in [Maintaining Changelogs](https://github.com/WordPress/gutenberg/blob/HEAD/packages/README.md#maintaining-changelogs) section.

[lerna]: https://lerna.js.org
Publishing WordPress packages to npm is automated by synchronizing it with the bi-weekly Gutenberg plugin RC1 release. You can learn more about this process and other ways to publish new versions of npm packages in the [Gutenberg Release Process document](/docs/contributors/code/release.md#packages-releases-to-npm-and-wordpress-core-updates).

[lerna]: https://lerna.js.org/
[monorepo]: https://monorepo.tools
[npm]: https://www.npmjs.com/
22 changes: 22 additions & 0 deletions lib/compat/wordpress-6.1/edit-form-blocks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Patches resources loaded by the block editor page.
*
* @package gutenberg
*/

/**
* Adds the preload paths registered in Core (`edit-form-blocks.php`).
*
* @param array $preload_paths Preload paths to be filtered.
* @param WP_Block_Editor_Context $context The current block editor context.
* @return array
*/
function gutenberg_preload_template_permissions( $preload_paths, $context ) {
if ( ! empty( $context->post ) ) {
$preload_paths[] = array( rest_get_route_for_post_type_items( 'wp_template' ), 'OPTIONS' );
}

return $preload_paths;
}
add_filter( 'block_editor_rest_api_preload_paths', 'gutenberg_preload_template_permissions', 10, 2 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.1/script-loader.php';
require __DIR__ . '/compat/wordpress-6.1/date-settings.php';
require __DIR__ . '/compat/wordpress-6.1/block-patterns.php';
require __DIR__ . '/compat/wordpress-6.1/edit-form-blocks.php';

// Experimental features.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API.
Expand Down
2 changes: 1 addition & 1 deletion 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": "13.6.0",
"version": "13.7.0-rc.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
70 changes: 9 additions & 61 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Managing Packages

This repository uses [lerna] to manage WordPress modules and publish them as packages to [npm].
This repository uses [monorepo] to manage WordPress modules and publish them with [lerna] as packages to [npm].

## Creating a New Package

Expand Down Expand Up @@ -101,7 +101,7 @@ Next, you need to run `npm install` in the root of the project to ensure that `p

#### Updating Existing Dependencies

This is the most confusing part of working with [lerna] which causes a lot of hassles for contributors. The most successful strategy so far is to do the following:
This is the most confusing part of working with [monorepo] which causes a lot of hassles for contributors. The most successful strategy so far is to do the following:

1. First, remove the existing dependency as described in the previous section.
2. Next, add the same dependency back as described in the first section of this chapter. This time it wil get the latest version applied unless you enforce a different version explicitly.
Expand Down Expand Up @@ -180,64 +180,7 @@ While other section naming can be used when appropriate, it's important that are

When in doubt, refer to [Semantic Versioning specification](https://semver.org/).

If you are publishing new versions of packages, note that there are versioning recommendations outlined in the [Gutenberg Release Process document](/docs/contributors/release.md) which prescribe _minimum_ version bumps for specific types of releases. The chosen version should be the greater of the two between the semantic versioning and Gutenberg release minimum version bumps.

## Releasing Packages

Lerna automatically releases all outdated packages. To check which packages are outdated and will be released, type `npm run publish:check` from the branch that keeps the code for a given `wp/X.Y` release type (example `wp/5.7`).

If you have the ability to publish packages, you _must_ have [2FA enabled](https://docs.npmjs.com/getting-started/using-two-factor-authentication) on your [npm account][npm].

### Before Releasing

Confirm that you're logged in to [npm], by running `npm whoami`. If you're not logged in, run `npm adduser` to login.

If you're publishing a new package, ensure that its `package.json` file contains the correct `publishConfig` settings:

```json
{
"publishConfig": {
"access": "public"
}
}
```

You can check your package configs by running `npm run lint-pkg-json`.

### Development Release

Run the following commands from the `trunk` branch to publish to npm (with a `next` dist tag) a development version of the packages.

```bash
npm install
./bin/plugin/cli.js npm-next
```

See more details in [Development Releases](/docs/contributors/code/release.md#development-releases) section of the Gutenberg release process documentation.

### Production Release

To release a production version for the outdated packages, run the following commands from the `trunk` branch:

```bash
npm install
./bin/plugin/cli.js npm-latest
```

See more details in [Synchronizing WordPress Trunk](/docs/contributors/code/release.md#synchronizing-wordpress-trunk) section of the Gutenberg release process documentation.

### Legacy Patch Release

To release a patch for the older major or minor version of packages, run the following commands from the corresponding `wp/X.Y` (example `wp/5.7`) release branch:

```bash
npm install
npm run publish:patch
```

This is usually necessary when adding bug fixes or security patches to the earlier versions of WordPress. This will publish only a patch version of the built packages. This is useful for backpublishing certain packages to WordPress.

See more details in [Minor WordPress Releases](/docs/contributors/code/release.md#minor-wordpress-releases) section of the Gutenberg release process documentation.
If you are publishing new versions of packages, note that there are versioning recommendations outlined in the [Gutenberg Release Process document](https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/release.md) which prescribe _minimum_ version bumps for specific types of releases. The chosen version should be the greater of the two between the semantic versioning and Gutenberg release minimum version bumps.

## TypeScript

Expand Down Expand Up @@ -296,6 +239,7 @@ For consumers to use the published type declarations, we'll set the `types` fiel
Ensure that the `build-types` directory will be included in the published package, for example if a `files` field is declared.

[lerna]: https://lerna.js.org/
[monorepo]: https://monorepo.tools
[npm]: https://www.npmjs.com/

## Optimizing for bundlers
Expand Down Expand Up @@ -323,4 +267,8 @@ If your package includes a few files with side effects, you can list them instea
}
```

Please consult the [side effects documentation](./side-effects.md) for more information on identifying and declaring side effects.
Please consult the [side effects documentation](https://github.com/WordPress/gutenberg/blob/HEAD/packages/side-effects.md) for more information on identifying and declaring side effects.

## Publishing to npm

Publishing WordPress packages to npm is automated by synchronizing it with the bi-weekly Gutenberg plugin RC1 release. You can learn more about this process and other ways to publish new versions of npm packages in the [Gutenberg Release Process document](https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/release.md#packages-releases-to-npm-and-wordpress-core-updates).
2 changes: 2 additions & 0 deletions packages/a11y/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.13.0 (2022-07-13)

## 3.12.0 (2022-06-29)

## 3.11.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/a11y/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/a11y",
"version": "3.12.0",
"version": "3.13.0",
"description": "Accessibility (a11y) utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/annotations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 2.13.0 (2022-07-13)

## 2.12.0 (2022-06-29)

## 2.11.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/annotations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
"version": "2.12.0",
"version": "2.13.0",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/api-fetch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 6.10.0 (2022-07-13)

## 6.9.0 (2022-06-29)

## 6.8.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/api-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/api-fetch",
"version": "6.9.0",
"version": "6.10.0",
"description": "Utility to make WordPress REST API requests.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/autop/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.13.0 (2022-07-13)

## 3.12.0 (2022-06-29)

## 3.11.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/autop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/autop",
"version": "3.12.0",
"version": "3.13.0",
"description": "WordPress's automatic paragraph functions `autop` and `removep`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-default/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-preset-default",
"version": "6.14.0",
"version": "6.15.0",
"description": "Default Babel preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/blob/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.13.0 (2022-07-13)

## 3.12.0 (2022-06-29)

## 3.11.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/blob/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blob",
"version": "3.12.0",
"version": "3.13.0",
"description": "Blob utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/block-directory/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.11.0 (2022-07-13)

## 3.10.0 (2022-06-29)

## 3.9.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/block-directory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-directory",
"version": "3.10.0",
"version": "3.11.0",
"description": "Extend editor with block directory features to search, download and install blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 9.5.0 (2022-07-13)

## 9.4.0 (2022-06-29)

## 9.3.0 (2022-06-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-editor",
"version": "9.4.0",
"version": "9.5.0",
"description": "Generic block editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down
46 changes: 42 additions & 4 deletions packages/block-editor/src/components/block-lock/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
FlexItem,
Icon,
Modal,
ToggleControl,
} from '@wordpress/components';
import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';
import { useInstanceId } from '@wordpress/compose';
Expand All @@ -23,20 +24,41 @@ import useBlockLock from './use-block-lock';
import useBlockDisplayInformation from '../use-block-display-information';
import { store as blockEditorStore } from '../../store';

function getTemplateLockValue( lock ) {
// Prevents all operations.
if ( lock.remove && lock.move ) {
return 'all';
}

// Prevents inserting or removing blocks, but allows moving existing blocks.
if ( lock.remove && ! lock.move ) {
return 'insert';
}

return false;
}

export default function BlockLockModal( { clientId, onClose } ) {
const [ lock, setLock ] = useState( { move: false, remove: false } );
const { canEdit, canMove, canRemove } = useBlockLock( clientId );
const { isReusable } = useSelect(
const { isReusable, templateLock, hasTemplateLock } = useSelect(
( select ) => {
const { getBlockName } = select( blockEditorStore );
const { getBlockName, getBlockAttributes } =
select( blockEditorStore );
const blockName = getBlockName( clientId );
const blockType = getBlockType( blockName );

return {
isReusable: isReusableBlock( getBlockType( blockName ) ),
isReusable: isReusableBlock( blockType ),
templateLock: getBlockAttributes( clientId )?.templateLock,
hasTemplateLock: !! blockType?.attributes?.templateLock,
};
},
[ clientId ]
);
const [ applyTemplateLock, setApplyTemplateLock ] = useState(
!! templateLock
);
const { updateBlockAttributes } = useDispatch( blockEditorStore );
const blockInformation = useBlockDisplayInformation( clientId );
const instanceId = useInstanceId(
Expand Down Expand Up @@ -69,7 +91,12 @@ export default function BlockLockModal( { clientId, onClose } ) {
<form
onSubmit={ ( event ) => {
event.preventDefault();
updateBlockAttributes( [ clientId ], { lock } );
updateBlockAttributes( [ clientId ], {
lock,
templateLock: applyTemplateLock
? getTemplateLockValue( lock )
: undefined,
} );
onClose();
} }
>
Expand Down Expand Up @@ -171,6 +198,17 @@ export default function BlockLockModal( { clientId, onClose } ) {
/>
</li>
</ul>
{ hasTemplateLock && (
<ToggleControl
className="block-editor-block-lock-modal__template-lock"
label={ __( 'Apply to all blocks inside' ) }
checked={ applyTemplateLock }
disabled={ lock.move && ! lock.remove }
onChange={ () =>
setApplyTemplateLock( ! applyTemplateLock )
}
/>
) }
</div>
<Flex
className="block-editor-block-lock-modal__actions"
Expand Down
10 changes: 10 additions & 0 deletions packages/block-editor/src/components/block-lock/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
}
}

.block-editor-block-lock-modal__template-lock {
border-top: $border-width solid $gray-300;
margin-top: $grid-unit-20;
padding: $grid-unit-15 0;

.components-base-control__field {
margin: 0;
}
}

.block-editor-block-lock-modal__actions {
margin-top: $grid-unit-30;
}
Expand Down
Loading

0 comments on commit fe6261f

Please sign in to comment.