From 7a9c1d852253d25af8ccf8ab7c1842a895b28a79 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 1 May 2018 13:38:04 +0100 Subject: [PATCH] Update documentation to match the code --- .../blocks/block-controls-toolbars-and-inspector.md | 13 ++++++------- .../introducing-attributes-and-editable-fields.md | 5 +++-- docs/reference/deprecated.md | 4 ++++ editor/components/plain-text/README.md | 5 +++-- editor/components/rich-text/README.md | 7 ++++--- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/blocks/block-controls-toolbars-and-inspector.md b/docs/blocks/block-controls-toolbars-and-inspector.md index af1eca93c115a..2ddc50c2e542f 100644 --- a/docs/blocks/block-controls-toolbars-and-inspector.md +++ b/docs/blocks/block-controls-toolbars-and-inspector.md @@ -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 @@ -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)', @@ -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)', diff --git a/docs/blocks/introducing-attributes-and-editable-fields.md b/docs/blocks/introducing-attributes-and-editable-fields.md index ca893b9fcab80..509593527acdc 100644 --- a/docs/blocks/introducing-attributes-and-editable-fields.md +++ b/docs/blocks/introducing-attributes-and-editable-fields.md @@ -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)', @@ -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)', diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index f270eb5ea7b4f..9fad274949044 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -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. diff --git a/editor/components/plain-text/README.md b/editor/components/plain-text/README.md index 377e86b7caf39..36909597bc6aa 100644 --- a/editor/components/plain-text/README.md +++ b/editor/components/plain-text/README.md @@ -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 ) { @@ -41,7 +41,8 @@ wp.blocks.registerBlockType( /* ... */, { ``` {% ESNext %} ```js -const { registerBlockType, PlainText } = wp.blocks; +const { registerBlockType } = wp.blocks; +const { PlainText } = wp.editor; registerBlockType( /* ... */, { // ... diff --git a/editor/components/rich-text/README.md b/editor/components/rich-text/README.md index 88668093a53ec..302365b026cdf 100644 --- a/editor/components/rich-text/README.md +++ b/editor/components/rich-text/README.md @@ -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, @@ -102,7 +102,7 @@ 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 } ); } @@ -110,7 +110,8 @@ wp.blocks.registerBlockType( /* ... */, { ``` {% ESNext %} ```js -const { registerBlockType, RichText } = wp.blocks; +const { registerBlockType } = wp.blocks; +const { RichText } = wp.editor; registerBlockType( /* ... */, { // ...