diff --git a/packages/block-directory/README.md b/packages/block-directory/README.md
index 95ed65f00ac181..35d58dd5b5e2a7 100644
--- a/packages/block-directory/README.md
+++ b/packages/block-directory/README.md
@@ -125,8 +125,8 @@ Returns an action object used to indicate install in progress.
_Parameters_
-- _blockId_ `string`:
-- _isInstalling_ `boolean`:
+- _blockId_ `string`:
+- _isInstalling_ `boolean`:
_Returns_
@@ -251,7 +251,6 @@ _Returns_
- `boolean`: Whether a request is in progress for the blocks list.
-
diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md
index 0b5ec868655cfc..4dc58c54807546 100644
--- a/packages/block-editor/README.md
+++ b/packages/block-editor/README.md
@@ -127,7 +127,7 @@ _Related_
_Parameters_
-- _props_ `BlockContextProviderProps`:
+- _props_ `BlockContextProviderProps`:
### BlockControls
@@ -222,7 +222,7 @@ _Usage_
_Parameters_
-- _props_ `Object`:
+- _props_ `Object`:
- _props.clientId_ `string`: Client ID of block.
_Returns_
@@ -261,7 +261,7 @@ _Related_
### ButtonBlockerAppender
-> **Deprecated**
+> **Deprecated**
Use `ButtonBlockAppender` instead.
@@ -291,12 +291,15 @@ Use this higher-order component to work with a custom set of colors.
_Usage_
```jsx
-const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];
+const CUSTOM_COLORS = [
+ { name: 'Red', slug: 'red', color: '#ff0000' },
+ { name: 'Blue', slug: 'blue', color: '#0000ff' },
+];
const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );
// ...
export default compose(
- withCustomColors( 'backgroundColor', 'borderColor' ),
- MyColorfulComponent,
+ withCustomColors( 'backgroundColor', 'borderColor' ),
+ MyColorfulComponent
);
```
@@ -359,8 +362,8 @@ _Returns_
### getFontSize
- Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values.
- If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned.
+Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values.
+If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned.
_Parameters_
@@ -481,7 +484,7 @@ _Related_
### MultiSelectScrollIntoView
-> **Deprecated**
+> **Deprecated**
Scrolls the multi block selection end into view if not in view already. This
is important to do after selection by keyboard.
@@ -659,7 +662,7 @@ _Parameters_
- _props_ `Object`: Optional. Props to pass to the element. Must contain the ref if one is defined.
- _options_ `Object`: Options for internal use only.
-- _options.\_\_unstableIsHtml_ `boolean`:
+- _options.\_\_unstableIsHtml_ `boolean`:
_Returns_
@@ -728,8 +731,8 @@ _Usage_
```jsx
export default compose(
- withColors( 'backgroundColor', { textColor: 'color' } ),
- MyColorfulComponent,
+ withColors( 'backgroundColor', { textColor: 'color' } ),
+ MyColorfulComponent
);
```
@@ -764,7 +767,6 @@ _Parameters_
- _props_ `Object`: Component properties.
- _props.children_ `WPElement`: Children to be rendered.
-
diff --git a/packages/block-library/README.md b/packages/block-library/README.md
index 9106f9b60e9c21..c10c1a44b27bbc 100644
--- a/packages/block-library/README.md
+++ b/packages/block-library/README.md
@@ -88,7 +88,6 @@ _Parameters_
- _blocks_ `Array`: An optional array of the core blocks being registered.
-
\n',
+ },
+ ];
```
_Parameters_
@@ -102,7 +110,6 @@ _Returns_
- `Array`: A block-based representation of the input HTML.
-
## Theory
diff --git a/packages/blocks/README.md b/packages/blocks/README.md
index 28f94c1078acac..bf8872d9ce054a 100644
--- a/packages/blocks/README.md
+++ b/packages/blocks/README.md
@@ -301,8 +301,8 @@ Create a block object from the example API.
_Parameters_
-- _name_ `string`:
-- _example_ `Object`:
+- _name_ `string`:
+- _example_ `Object`:
_Returns_
@@ -654,7 +654,7 @@ Converts an HTML string to known blocks. Strips everything else.
_Parameters_
-- _options_ `Object`:
+- _options_ `Object`:
- _options.HTML_ `[string]`: The HTML to convert.
- _options.plainText_ `[string]`: Plain text version.
- _options.mode_ `[string]`: Handle content as blocks or inline content. _ 'AUTO': Decide based on the content passed. _ 'INLINE': Always handle as inline content, and return string. \* 'BLOCKS': Always handle as blocks, and return array of blocks.
@@ -671,7 +671,7 @@ Converts an HTML string to known blocks.
_Parameters_
-- _$1_ `Object`:
+- _$1_ `Object`:
- _$1.HTML_ `string`: The HTML to convert.
_Returns_
@@ -866,7 +866,6 @@ _Returns_
- `WPComponent`: Enhanced component with injected BlockContent as prop.
-
+ );
+};
```
_Parameters_
@@ -480,10 +482,10 @@ this is useful in performance related work, to check why a component re-renders.
_Usage_
```jsx
-function MyComponent(props) {
- useWarnOnChange(props);
+function MyComponent( props ) {
+ useWarnOnChange( props );
- return "Something";
+ return 'Something';
}
```
@@ -494,7 +496,7 @@ _Parameters_
### withGlobalEvents
-> **Deprecated**
+> **Deprecated**
Higher-order component creator which, given an object of DOM event types and
values corresponding to a callback function name on the component, will
@@ -544,7 +546,6 @@ _Returns_
- `any`: A higher order component wrapper accepting a component that takes the state props + its own props + `setState` and returning a component that only accepts the own props.
-
diff --git a/packages/core-data/README.md b/packages/core-data/README.md
index 4e543905c563fd..ac93d0966542a3 100644
--- a/packages/core-data/README.md
+++ b/packages/core-data/README.md
@@ -745,7 +745,6 @@ _Returns_
- `boolean`: Whether the entity record is saving or not.
-
diff --git a/packages/data-controls/README.md b/packages/data-controls/README.md
index c5988331f47c2b..3089cf5c2a4c3c 100644
--- a/packages/data-controls/README.md
+++ b/packages/data-controls/README.md
@@ -64,11 +64,11 @@ import * as actions from './actions';
import * as resolvers from './resolvers';
registerStore( 'my-custom-store', {
-reducer,
-controls,
-actions,
-selectors,
-resolvers,
+ reducer,
+ controls,
+ actions,
+ selectors,
+ resolvers,
} );
```
@@ -103,5 +103,4 @@ _Parameters_
- _args_ `Array`: Arguments passed without change to the `@wordpress/data` control.
-
diff --git a/packages/data/README.md b/packages/data/README.md
index c4f73bee7d8dda..bd6a5ce50cffc3 100644
--- a/packages/data/README.md
+++ b/packages/data/README.md
@@ -275,19 +275,19 @@ _Usage_
import { useSelect, AsyncModeProvider } from '@wordpress/data';
function BlockCount() {
- const count = useSelect( ( select ) => {
- return select( 'core/block-editor' ).getBlockCount()
- }, [] );
+ const count = useSelect( ( select ) => {
+ return select( 'core/block-editor' ).getBlockCount();
+ }, [] );
- return count;
+ return count;
}
function App() {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
}
```
@@ -315,18 +315,16 @@ _Usage_
import { combineReducers, createReduxStore, register } from '@wordpress/data';
const prices = ( state = {}, action ) => {
- return action.type === 'SET_PRICE' ?
- {
- ...state,
- [ action.item ]: action.price,
- } :
- state;
+ return action.type === 'SET_PRICE'
+ ? {
+ ...state,
+ [ action.item ]: action.price,
+ }
+ : state;
};
const discountPercent = ( state = 0, action ) => {
- return action.type === 'START_SALE' ?
- action.discountPercent :
- state;
+ return action.type === 'START_SALE' ? action.discountPercent : state;
};
const store = createReduxStore( 'my-shop', {
@@ -361,10 +359,10 @@ _Usage_
import { createReduxStore } from '@wordpress/data';
const store = createReduxStore( 'demo', {
- reducer: ( state = 'OK' ) => state,
- selectors: {
- getValue: ( state ) => state,
- },
+ reducer: ( state = 'OK' ) => state,
+ selectors: {
+ getValue: ( state ) => state,
+ },
} );
```
@@ -397,13 +395,13 @@ Creates a control function that takes additional curried argument with the `regi
While a regular control has signature
```js
-( action ) => ( iteratorOrPromise )
+( action ) => iteratorOrPromise;
```
where the control works with the `action` that it's bound to, a registry control has signature:
```js
-( registry ) => ( action ) => ( iteratorOrPromise )
+( registry ) => ( action ) => iteratorOrPromise;
```
A registry control is typically used to select data or dispatch an action to a registered
@@ -426,14 +424,14 @@ Creates a selector function that takes additional curried argument with the
registry `select` function. While a regular selector has signature
```js
-( state, ...selectorArgs ) => ( result )
+( state, ...selectorArgs ) => result;
```
that allows to select data from the store's `state`, a registry selector
has signature:
```js
-( select ) => ( state, ...selectorArgs ) => ( result )
+( select ) => ( state, ...selectorArgs ) => result;
```
that supports also selecting from other registered stores.
@@ -442,14 +440,18 @@ _Usage_
```js
const getCurrentPostId = createRegistrySelector( ( select ) => ( state ) => {
- return select( 'core/editor' ).getCurrentPostId();
+ return select( 'core/editor' ).getCurrentPostId();
} );
const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
- // calling another registry selector just like any other function
- const postType = getCurrentPostType( state );
- const postId = getCurrentPostId( state );
- return select( 'core' ).getEntityRecordEdits( 'postType', postType, postId );
+ // calling another registry selector just like any other function
+ const postType = getCurrentPostType( state );
+ const postId = getCurrentPostId( state );
+ return select( 'core' ).getEntityRecordEdits(
+ 'postType',
+ postType,
+ postId
+ );
} );
```
@@ -512,10 +514,10 @@ _Usage_
import { createReduxStore, register } from '@wordpress/data';
const store = createReduxStore( 'demo', {
- reducer: ( state = 'OK' ) => state,
- selectors: {
- getValue: ( state ) => state,
- },
+ reducer: ( state = 'OK' ) => state,
+ selectors: {
+ getValue: ( state ) => state,
+ },
} );
register( store );
```
@@ -603,7 +605,7 @@ _Usage_
```js
import { resolveSelect } from '@wordpress/data';
-resolveSelect( 'my-shop' ).getPrice( 'hammer' ).then(console.log)
+resolveSelect( 'my-shop' ).getPrice( 'hammer' ).then( console.log );
```
_Parameters_
@@ -688,21 +690,25 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
function Button( { onClick, children } ) {
- return
+ return (
+
+ );
}
const SaleButton = ( { children } ) => {
- const { stockNumber } = useSelect(
- ( select ) => select( 'my-shop' ).getStockNumber(),
- []
- );
- const { startSale } = useDispatch( 'my-shop' );
- const onClick = useCallback( () => {
- const discountPercent = stockNumber > 50 ? 10: 20;
- startSale( discountPercent );
- }, [ stockNumber ] );
- return
-}
+ const { stockNumber } = useSelect(
+ ( select ) => select( 'my-shop' ).getStockNumber(),
+ []
+ );
+ const { startSale } = useDispatch( 'my-shop' );
+ const onClick = useCallback( () => {
+ const discountPercent = stockNumber > 50 ? 10 : 20;
+ startSale( discountPercent );
+ }, [ stockNumber ] );
+ return ;
+};
// Rendered somewhere in the application:
//
@@ -729,30 +735,27 @@ It acts similarly to the `useContext` react hook.
Note: Generally speaking, `useRegistry` is a low level hook that in most cases
won't be needed for implementation. Most interactions with the `@wordpress/data`
-API can be performed via the `useSelect` hook, or the `withSelect` and
+API can be performed via the `useSelect` hook, or the `withSelect` and
`withDispatch` higher order components.
_Usage_
```js
-import {
- RegistryProvider,
- createRegistry,
- useRegistry,
-} from '@wordpress/data';
+import { RegistryProvider, createRegistry, useRegistry } from '@wordpress/data';
const registry = createRegistry( {} );
const SomeChildUsingRegistry = ( props ) => {
- const registry = useRegistry( registry );
- // ...logic implementing the registry in other react hooks.
+ const registry = useRegistry( registry );
+ // ...logic implementing the registry in other react hooks.
};
-
const ParentProvidingRegistry = ( props ) => {
- return
-
-
+ return (
+
+
+
+ );
};
```
@@ -773,13 +776,16 @@ _Usage_
import { useSelect } from '@wordpress/data';
function HammerPriceDisplay( { currency } ) {
- const price = useSelect( ( select ) => {
- return select( 'my-shop' ).getPrice( 'hammer', currency )
- }, [ currency ] );
- return new Intl.NumberFormat( 'en-US', {
- style: 'currency',
- currency,
- } ).format( price );
+ const price = useSelect(
+ ( select ) => {
+ return select( 'my-shop' ).getPrice( 'hammer', currency );
+ },
+ [ currency ]
+ );
+ return new Intl.NumberFormat( 'en-US', {
+ style: 'currency',
+ currency,
+ } ).format( price );
}
// Rendered in the application:
@@ -803,12 +809,12 @@ function because your component won't re-render on a data change.**
import { useSelect } from '@wordpress/data';
function Paste( { children } ) {
- const { getSettings } = useSelect( 'my-shop' );
- function onPaste() {
- // Do something with the settings.
- const settings = getSettings();
- }
- return
{ children }
;
+ const { getSettings } = useSelect( 'my-shop' );
+ function onPaste() {
+ // Do something with the settings.
+ const settings = getSettings();
+ }
+ return
diff --git a/packages/keycodes/README.md b/packages/keycodes/README.md
index 27cfd074d14304..defcc8fff3893d 100644
--- a/packages/keycodes/README.md
+++ b/packages/keycodes/README.md
@@ -146,7 +146,7 @@ _Usage_
```js
// Assuming macOS:
-rawShortcut.primary( 'm' )
+rawShortcut.primary( 'm' );
// "meta+m""
```
@@ -195,7 +195,6 @@ Keycode for UP key.
Keycode for ZERO key.
-
diff --git a/packages/plugins/README.md b/packages/plugins/README.md
index 6dd7a358b5a553..94f0bd2b0071a2 100644
--- a/packages/plugins/README.md
+++ b/packages/plugins/README.md
@@ -52,12 +52,7 @@ var el = wp.element.createElement;
var PluginArea = wp.plugins.PluginArea;
function Layout() {
- return el(
- 'div',
- { scope: 'my-page' },
- 'Content of the page',
- PluginArea
- );
+ return el( 'div', { scope: 'my-page' }, 'Content of the page', PluginArea );
}
```
@@ -128,15 +123,10 @@ import { more } from '@wordpress/icons';
const Component = () => (
<>
-
+
My Sidebar
-
+
Content of the sidebar
>
@@ -199,7 +189,6 @@ _Returns_
- `WPComponent`: Enhanced component with injected context as props.
-
diff --git a/packages/priority-queue/README.md b/packages/priority-queue/README.md
index ae95e7fab18ab7..43f5f725161895 100644
--- a/packages/priority-queue/README.md
+++ b/packages/priority-queue/README.md
@@ -34,7 +34,7 @@ const ctx2 = {};
// For a given context in the queue, only the last callback is executed.
queue.add( ctx1, () => console.log( 'This will be printed first' ) );
-queue.add( ctx2, () => console.log( 'This won\'t be printed' ) );
+queue.add( ctx2, () => console.log( "This won't be printed" ) );
queue.add( ctx2, () => console.log( 'This will be printed second' ) );
```
@@ -42,7 +42,6 @@ _Returns_
- `WPPriorityQueue`: Queue object with `add`, `flush` and `reset` methods.
-
diff --git a/packages/react-i18n/README.md b/packages/react-i18n/README.md
index b1656b7cc8aa47..1386b4c045dce9 100644
--- a/packages/react-i18n/README.md
+++ b/packages/react-i18n/README.md
@@ -88,7 +88,6 @@ _Returns_
- `FunctionComponent< PropsAndI18n< P > >`: The wrapped component
-
diff --git a/packages/redux-routine/README.md b/packages/redux-routine/README.md
index 8f79c7cabb4745..d13c2beef56932 100644
--- a/packages/redux-routine/README.md
+++ b/packages/redux-routine/README.md
@@ -76,7 +76,6 @@ _Returns_
- `import('redux').Middleware`: Co-routine runtime
-
## Motivation
diff --git a/packages/rich-text/README.md b/packages/rich-text/README.md
index 0c987517e5e81f..c3bb074551d202 100644
--- a/packages/rich-text/README.md
+++ b/packages/rich-text/README.md
@@ -85,7 +85,7 @@ _Parameters_
- _$1.multilineTag_ `[string]`: Multiline tag if the structure is multiline.
- _$1.multilineWrapperTags_ `[Array]`: Tags where lines can be found if nesting is possible.
- _$1.preserveWhiteSpace_ `[boolean]`: Whether or not to collapse white space characters.
-- _$1.\_\_unstableIsEditableTree_ `[boolean]`:
+- _$1.\_\_unstableIsEditableTree_ `[boolean]`:
_Returns_
@@ -295,7 +295,7 @@ Indices are retrieved from the selection if none are provided.
_Parameters_
-- _value_ `RichTextValue`:
+- _value_ `RichTextValue`:
- _string_ `[number|string]`: Start index, or string at which to split.
_Returns_
@@ -365,7 +365,7 @@ to the `Popover` component.
_Parameters_
- _$1_ `Object`: Named parameters.
-- _$1.ref_ `RefObject`: React ref of the element containing the editable content.
+- _$1.ref_ `RefObject`: React ref of the element containing the editable content.
- _$1.value_ `RichTextValue`: Value to check for selection.
- _$1.settings_ `RichTextFormatType`: The format type's settings.
@@ -373,7 +373,6 @@ _Returns_
- `Element|Range`: The active element or selection range.
-
diff --git a/packages/shortcode/README.md b/packages/shortcode/README.md
index 8816d8abd8928b..fda45bc1e0328b 100644
--- a/packages/shortcode/README.md
+++ b/packages/shortcode/README.md
@@ -136,13 +136,12 @@ format the shortcode using a `single` tag, and a `content` string.
_Parameters_
-- _options_ `Object`:
+- _options_ `Object`:
_Returns_
- `string`: String representation of the shortcode.
-