Skip to content

Commit

Permalink
Update documentation to match the code
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 1, 2018
1 parent 56f3269 commit 7a9c1d8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
13 changes: 6 additions & 7 deletions docs/blocks/block-controls-toolbars-and-inspector.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Block Controls: Toolbars and Inspector

To simplify block customization and ensure a consistent experience for users, there are a number of built-in UI patterns to help generate the editor preview. Like with the `RichText` component covered in the previous chapter, the `wp.blocks` global includes a few other common components to render editing interfaces. In this chapter, we'll explore toolbars and the block inspector.
To simplify block customization and ensure a consistent experience for users, there are a number of built-in UI patterns to help generate the editor preview. Like with the `RichText` component covered in the previous chapter, the `wp.editor` global includes a few other common components to render editing interfaces. In this chapter, we'll explore toolbars and the block inspector.

## Toolbar

Expand All @@ -15,9 +15,9 @@ You can also customize the toolbar to include controls specific to your block ty
```js
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
RichText = wp.blocks.RichText,
BlockControls = wp.blocks.BlockControls,
AlignmentToolbar = wp.blocks.AlignmentToolbar;
RichText = wp.editor.RichText,
BlockControls = wp.editor.BlockControls,
AlignmentToolbar = wp.editor.AlignmentToolbar;

registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-04', {
title: 'Hello World (Step 4)',
Expand Down Expand Up @@ -89,13 +89,12 @@ registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-04', {
```
{% ESNext %}
```js
const { registerBlockType } = wp.blocks;
const {
registerBlockType,
RichText,
BlockControls,
AlignmentToolbar,
source
} = wp.blocks;
} = wp.editor;

registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-04', {
title: 'Hello World (Step 4)',
Expand Down
5 changes: 3 additions & 2 deletions docs/blocks/introducing-attributes-and-editable-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ One challenge of maintaining the representation of a block as a JavaScript objec
```js
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
RichText = wp.blocks.RichText;
RichText = wp.editor.RichText;

registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-03', {
title: 'Hello World (Step 3)',
Expand Down Expand Up @@ -60,7 +60,8 @@ registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-03', {
```
{% ESNext %}
```js
const { registerBlockType, RichText, source } = wp.blocks;
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;

registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-03', {
title: 'Hello World (Step 3)',
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/deprecated.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Gutenberg's deprecation policy is intended to support backwards-compatibility for two minor releases, when possible. The current deprecations are listed below and are grouped by _the version at which they will be removed completely_. If your plugin depends on these behaviors, you must update to the recommended alternative before the noted version.

## 3.1.0

- All components in `wp.blocks.*` are removed. Please use `wp.editor.*` instead.

## 3.0.0

- `wp.blocks.registerCoreBlocks` function removed. Please use `wp.coreBlocks.registerCoreBlocks` instead.
Expand Down
5 changes: 3 additions & 2 deletions editor/components/plain-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ wp.blocks.registerBlockType( /* ... */, {
},

edit: function( props ) {
return wp.element.createElement( wp.blocks.PlainText, {
return wp.element.createElement( wp.editor.PlainText, {
className: props.className,
value: props.attributes.content,
onChange: function( content ) {
Expand All @@ -41,7 +41,8 @@ wp.blocks.registerBlockType( /* ... */, {
```
{% ESNext %}
```js
const { registerBlockType, PlainText } = wp.blocks;
const { registerBlockType } = wp.blocks;
const { PlainText } = wp.editor;

registerBlockType( /* ... */, {
// ...
Expand Down
7 changes: 4 additions & 3 deletions editor/components/rich-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ wp.blocks.registerBlockType( /* ... */, {
},

edit: function( props ) {
return wp.element.createElement( wp.blocks.RichText, {
return wp.element.createElement( wp.editor.RichText, {
tagName: 'h2',
className: props.className,
value: props.attributes.content,
Expand All @@ -102,15 +102,16 @@ wp.blocks.registerBlockType( /* ... */, {
},

save: function() {
return wp.element.createElement( wp.blocks.RichText.Content, {
return wp.element.createElement( wp.editor.RichText.Content, {
tagName: 'h2', value: props.attributes.content
} );
}
} );
```
{% ESNext %}
```js
const { registerBlockType, RichText } = wp.blocks;
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;

registerBlockType( /* ... */, {
// ...
Expand Down

0 comments on commit 7a9c1d8

Please sign in to comment.