Skip to content

Commit

Permalink
prep build 12/14
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Dec 14, 2023
2 parents 60a80d3 + 27ab284 commit 9800994
Show file tree
Hide file tree
Showing 313 changed files with 3,247 additions and 1,960 deletions.
314 changes: 314 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions docs/getting-started/fundamentals/block-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `block.json` file simplifies the processs of defining and registering a block by using the same block's definition in JSON format to register the block in both the server and the client.

[![Open block.json diagram in excalidraw](https://developer.wordpress.org/files/2023/11/block-json.png)](https://excalidraw.com/#json=v1GrIkGsYGKv8P14irBy6,Yy0vl8q7DTTL2VsH5Ww27A "Open block.json diagram in excalidraw")
[![Open block.json diagram image](https://developer.wordpress.org/files/2023/11/block-json.png)](https://developer.wordpress.org/files/2023/11/block-json.png "Open block.json diagram image")

<div class="callout callout-tip">
Click <a href="https://github.com/WordPress/block-development-examples/tree/trunk/plugins/block-supports-6aa4dd">here</a> to see a full block example and check <a href="https://github.com/WordPress/block-development-examples/blob/trunk/plugins/block-supports-6aa4dd/src/block.json">its <code>block.json</code></a>
Expand Down Expand Up @@ -79,7 +79,7 @@ _See how the attributes are passed to the [`Edit` component](https://github.com/
Check the <a href="https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/"> <code>attributes</code> </a> reference page for full info about the Attributes API.
</div>

[![Open Attributes diagram in excalidraw](https://developer.wordpress.org/files/2023/11/attributes.png)](https://excalidraw.com/#json=pSgCZy8q9GbH7r0oz2fL1,MFCLd6ddQHqi_UqNp5ZSgg "Open Attributes diagram in excalidraw")
[![Open Attributes diagram image](https://developer.wordpress.org/files/2023/11/attributes.png)](https://developer.wordpress.org/files/2023/11/attributes.png "Open Attributes diagram image")


## Enable UI settings panels for the block with `supports`
Expand Down Expand Up @@ -113,3 +113,9 @@ _See the [full block example](https://github.com/WordPress/block-development-exa
<div class="callout callout-info">
Check the <a href="https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/"> <code>supports</code> </a> reference page for full info about the Supports API.
</div>


## Additional resources

- [block.json diagram](https://excalidraw.com/#json=v1GrIkGsYGKv8P14irBy6,Yy0vl8q7DTTL2VsH5Ww27A)
- [Attributes diagram](https://excalidraw.com/#json=pSgCZy8q9GbH7r0oz2fL1,MFCLd6ddQHqi_UqNp5ZSgg)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ It is recommended to **register blocks within plugins** to ensure they stay avai

The files generated by `create-block` are a good reference of the files that can be involved in the definition and registration of a block.

[![Open File Structure of a Block Diagram in excalidraw](https://developer.wordpress.org/files/2023/11/file-structure-block.png)](https://excalidraw.com/#json=YYpeR-kY1ZMhFKVZxGhMi,mVZewfwNAh_oL-7bj4gmdw "Open File Structure of a Block Diagram in excalidraw")
[![Open File Structure of a Block diagram image](https://developer.wordpress.org/files/2023/11/file-structure-block.png)](https://developer.wordpress.org/files/2023/11/file-structure-block.png "Open File Structure of a Block diagram image")

## Folders and files involved in a block's definition and registration

### `<plugin-file>.php`

Expand Down Expand Up @@ -80,7 +82,4 @@ In a standard project, the `build` folder contains the generated files in [the b

## Additional resources

- [Metadata in block.json](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/)
- [`wp-scripts build`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#build)
- [`wp-scripts start`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#start)
- [How webpack and WordPress packages interact](https://developer.wordpress.org/news/2023/04/how-webpack-and-wordpress-packages-interact/) | Developer Blog
- [File Structure of a Block diagram](https://excalidraw.com/#json=YYpeR-kY1ZMhFKVZxGhMi,mVZewfwNAh_oL-7bj4gmdw)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Browsers cannot interpret or run ESNext and JSX syntaxes, so a transformation st

Among other things, with `wp-scripts` package you can use Javascript modules to distribute your code among different files and get a few bundled files at the end of the build process (see [example](https://github.com/WordPress/block-development-examples/tree/trunk/plugins/data-basics-59c8f8)).

[![Build Process Diagram](https://developer.wordpress.org/files/2023/11/build-process.png)](https://excalidraw.com/#json=4aNG9JUti3pMnsfoga35b,ihEAI8p5dwkpjWr6gQmjuw "Open Build Process Diagram in Excalidraw")
[![Open Build Process diagram image](https://developer.wordpress.org/files/2023/11/build-process.png)](https://developer.wordpress.org/files/2023/11/build-process.png "Open Build Process diagram image")

With the [proper `package.json` scripts](https://developer.wordpress.org/block-editor/getting-started/devenv/get-started-with-wp-scripts/#basic-usage) you can launch the build process with `wp-scripts` in production and development mode:

Expand Down Expand Up @@ -49,3 +49,4 @@ Use [`enqueue_block_editor_assets`](https://developer.wordpress.org/reference/ho
- [block-development-examples](https://github.com/WordPress/block-development-examples) | GitHub repository
- [block-theme-examples](https://github.com/wptrainingteam/block-theme-examples) | GitHub repository
- [How webpack and WordPress packages interact](https://developer.wordpress.org/news/2023/04/how-webpack-and-wordpress-packages-interact/) | Developer Blog
- [Build Process Diagram](https://excalidraw.com/#json=4aNG9JUti3pMnsfoga35b,ihEAI8p5dwkpjWr6gQmjuw)
3 changes: 2 additions & 1 deletion docs/getting-started/fundamentals/registration-of-a-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Although technically, blocks could be registered only in the client, **registeri

For example, to allow a block [to be styled via `theme.json`](https://developer.wordpress.org/themes/global-settings-and-styles/settings/blocks/), it needs to be registered on the server, otherwise, any styles assigned to it in `theme.json` will be ignored.

[![Open Block Registration diagram in excalidraw](https://developer.wordpress.org/files/2023/11/block-registration-e1700493399839.png)](https://excalidraw.com/#json=PUQu7jpvbKsUHYfpHWn7s,61QnhpZtjykp3s44lbUN_g "Open Block Registration diagram in excalidraw")
[![Open Block Registration diagram image](https://developer.wordpress.org/files/2023/11/block-registration-e1700493399839.png)](https://developer.wordpress.org/files/2023/11/block-registration-e1700493399839.png "Open Block Registration diagram image")

### Registration of the block with PHP (server-side)

Expand Down Expand Up @@ -96,3 +96,4 @@ _See the [code above](https://github.com/WordPress/block-development-examples/bl
- [`register_block_type` PHP function](https://developer.wordpress.org/reference/functions/register_block_type/)
- [`registerBlockType` JS function](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blocks/#registerblocktype)
- [Why a block needs to be registered in both the server and the client?](https://github.com/WordPress/gutenberg/discussions/55884) | GitHub Discussion
- [Block Registration diagram](https://excalidraw.com/#json=PUQu7jpvbKsUHYfpHWn7s,61QnhpZtjykp3s44lbUN_g)
12 changes: 12 additions & 0 deletions docs/reference-guides/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ Returns true if the template editing mode is enabled.

### isEditorPanelEnabled

> **Deprecated**
Returns true if the given panel is enabled, or false otherwise. Panels are enabled by default.

_Parameters_
Expand All @@ -157,6 +159,8 @@ _Returns_

### isEditorPanelOpened

> **Deprecated**
Returns true if the given panel is open, or false otherwise. Panels are closed by default.

_Parameters_
Expand All @@ -170,6 +174,8 @@ _Returns_

### isEditorPanelRemoved

> **Deprecated**
Returns true if the given panel was programmatically removed, or false otherwise. All panels are not removed by default.

_Parameters_
Expand Down Expand Up @@ -408,6 +414,8 @@ _Returns_

### removeEditorPanel

> **Deprecated**
Returns an action object used to remove a panel from the editor.

_Parameters_
Expand Down Expand Up @@ -484,6 +492,8 @@ Action that toggles Distraction free mode. Distraction free mode expects there a

### toggleEditorPanelEnabled

> **Deprecated**
Returns an action object used to enable or disable a panel in the editor.

_Parameters_
Expand All @@ -496,6 +506,8 @@ _Returns_

### toggleEditorPanelOpened

> **Deprecated**
Opens a closed panel and closes an open panel.

_Parameters_
Expand Down
71 changes: 71 additions & 0 deletions docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,45 @@ _Returns_

- `boolean`: Whether the post can be saved.

### isEditorPanelEnabled

Returns true if the given panel is enabled, or false otherwise. Panels are enabled by default.

_Parameters_

- _state_ `Object`: Global application state.
- _panelName_ `string`: A string that identifies the panel.

_Returns_

- `boolean`: Whether or not the panel is enabled.

### isEditorPanelOpened

Returns true if the given panel is open, or false otherwise. Panels are closed by default.

_Parameters_

- _state_ `Object`: Global application state.
- _panelName_ `string`: A string that identifies the panel.

_Returns_

- `boolean`: Whether or not the panel is open.

### isEditorPanelRemoved

Returns true if the given panel was programmatically removed, or false otherwise. All panels are not removed by default.

_Parameters_

- _state_ `Object`: Global application state.
- _panelName_ `string`: A string that identifies the panel.

_Returns_

- `boolean`: Whether or not the panel is removed.

### isFirstMultiSelectedBlock

_Related_
Expand Down Expand Up @@ -1226,6 +1265,18 @@ _Related_

- removeBlocks in core/block-editor store.

### removeEditorPanel

Returns an action object used to remove a panel from the editor.

_Parameters_

- _panelName_ `string`: A string that identifies the panel to remove.

_Returns_

- `Object`: Action object.

### replaceBlock

_Related_
Expand Down Expand Up @@ -1379,6 +1430,26 @@ _Related_

- toggleBlockMode in core/block-editor store.

### toggleEditorPanelEnabled

Returns an action object used to enable or disable a panel in the editor.

_Parameters_

- _panelName_ `string`: A string that identifies the panel to enable or disable.

_Returns_

- `Object`: Action object.

### toggleEditorPanelOpened

Opens a closed panel and closes an open panel.

_Parameters_

- _panelName_ `string`: A string that identifies the panel to open or close.

### toggleSelection

_Related_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ To programmatically toggle panels, use the following:

```js
import { useDispatch } from '@wordpress/data';
import { store as editPostStore } from '@wordpress/edit-post';
import { store as editorStore } from '@wordpress/editor';

const Example = () => {
const { toggleEditorPanelOpened } = useDispatch( editPostStore );
const { toggleEditorPanelOpened } = useDispatch( editorStore );
return (
<Button
variant="primary"
Expand All @@ -76,10 +76,10 @@ It is also possible to remove panels from the admin using the `removeEditorPanel

```js
import { useDispatch } from '@wordpress/data';
import { store as editPostStore } from '@wordpress/edit-post';
import { store as editorStore } from '@wordpress/editor';

const Example = () => {
const { removeEditorPanel } = useDispatch( editPostStore );
const { removeEditorPanel } = useDispatch( editorStore );
return (
<Button
variant="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ private function apply_attributes_updates( $shift_this_point = 0 ) {
* replacements adjust offsets in the input document.
*/
foreach ( $this->bookmarks as $bookmark_name => $bookmark ) {
$bookmark_end = $bookmark->start + $bookmark->length;
$bookmark_end = $bookmark->start + $bookmark->length;

/*
* Each lexical update which appears before the bookmark's endpoints
Expand Down
Loading

0 comments on commit 9800994

Please sign in to comment.