-
{ description }
+
{ widgetAreas?.length === 0 && (
{ __(
diff --git a/packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js b/packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js
index 9fd47b3e110bc..53c90ebee14e2 100644
--- a/packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js
+++ b/packages/edit-widgets/src/hooks/use-widget-library-insertion-point.js
@@ -7,6 +7,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
+import { store as editWidgetsStore } from '../store';
import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';
const useWidgetLibraryInsertionPoint = () => {
@@ -30,6 +31,16 @@ const useWidgetLibraryInsertionPoint = () => {
getBlockIndex,
} = select( blockEditorStore );
+ const insertionPoint = select(
+ editWidgetsStore
+ ).__experimentalGetInsertionPoint();
+
+ // "Browse all" in the quick inserter will set the rootClientId to the current block.
+ // Otherwise, it will just be undefined, and we'll have to handle it differently below.
+ if ( insertionPoint.rootClientId ) {
+ return insertionPoint;
+ }
+
const clientId = getBlockSelectionEnd() || firstRootId;
const rootClientId = getBlockRootClientId( clientId );
diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js
index 7527529dbb4ed..fa3173c7c91f1 100644
--- a/packages/edit-widgets/src/index.js
+++ b/packages/edit-widgets/src/index.js
@@ -6,7 +6,7 @@ import {
unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase
setFreeformContentHandlerName,
} from '@wordpress/blocks';
-import { render } from '@wordpress/element';
+import { render, unmountComponentAtNode } from '@wordpress/element';
import {
registerCoreBlocks,
__experimentalGetCoreBlocks,
@@ -36,6 +36,23 @@ const disabledBlocks = [
...( ! ALLOW_REUSABLE_BLOCKS && [ 'core/block' ] ),
];
+/**
+ * Reinitializes the editor after the user chooses to reboot the editor after
+ * an unhandled error occurs, replacing previously mounted editor element using
+ * an initial state from prior to the crash.
+ *
+ * @param {Element} target DOM node in which editor is rendered.
+ * @param {?Object} settings Editor settings object.
+ */
+export function reinitializeEditor( target, settings ) {
+ unmountComponentAtNode( target );
+ const reboot = reinitializeEditor.bind( null, target, settings );
+ render(
+ ,
+ target
+ );
+}
+
/**
* Initializes the block editor in the widgets screen.
*
@@ -43,6 +60,8 @@ const disabledBlocks = [
* @param {Object} settings Block editor settings.
*/
export function initialize( id, settings ) {
+ const target = document.getElementById( id );
+ const reboot = reinitializeEditor.bind( null, target, settings );
const coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {
return ! (
disabledBlocks.includes( block.name ) ||
@@ -70,8 +89,8 @@ export function initialize( id, settings ) {
// see: https://github.com/WordPress/gutenberg/issues/33097
setFreeformContentHandlerName( 'core/html' );
render(
- ,
- document.getElementById( id )
+ ,
+ target
);
}
diff --git a/packages/edit-widgets/src/store/selectors.js b/packages/edit-widgets/src/store/selectors.js
index bd520ea15d732..b61e48ed1bb3a 100644
--- a/packages/edit-widgets/src/store/selectors.js
+++ b/packages/edit-widgets/src/store/selectors.js
@@ -218,6 +218,18 @@ export function isInserterOpened( state ) {
return !! state.blockInserterPanel;
}
+/**
+ * Get the insertion point for the inserter.
+ *
+ * @param {Object} state Global application state.
+ *
+ * @return {Object} The root client ID and index to insert at.
+ */
+export function __experimentalGetInsertionPoint( state ) {
+ const { rootClientId, insertionIndex } = state.blockInserterPanel;
+ return { rootClientId, insertionIndex };
+}
+
/**
* Returns true if a block can be inserted into a widget area.
*
diff --git a/packages/edit-widgets/src/style.scss b/packages/edit-widgets/src/style.scss
index c6a07b9b0356b..7d75dc6443bda 100644
--- a/packages/edit-widgets/src/style.scss
+++ b/packages/edit-widgets/src/style.scss
@@ -1,6 +1,7 @@
@import "../../interface/src/style.scss";
@import "./blocks/widget-area/editor.scss";
+@import "./components/error-boundary/style.scss";
@import "./components/header/style.scss";
@import "./components/keyboard-shortcut-help-modal/style.scss";
@import "./components/more-menu/style.scss";
diff --git a/packages/editor/src/components/post-taxonomies/most-used-terms.js b/packages/editor/src/components/post-taxonomies/most-used-terms.js
index da3539b05457e..9ceaa52e6dbbc 100644
--- a/packages/editor/src/components/post-taxonomies/most-used-terms.js
+++ b/packages/editor/src/components/post-taxonomies/most-used-terms.js
@@ -20,6 +20,7 @@ const DEFAULT_QUERY = {
per_page: MAX_MOST_USED_TERMS,
orderby: 'count',
order: 'desc',
+ hide_empty: true,
_fields: 'id,name,count',
};
diff --git a/packages/element/README.md b/packages/element/README.md
index b09cca79c8afb..6dcd2155d44e1 100755
--- a/packages/element/README.md
+++ b/packages/element/README.md
@@ -83,11 +83,11 @@ This assumes that you will import the `createElement` function in any file where
-# **Children**
+### Children
Object that provides utilities for dealing with React children.
-# **cloneElement**
+### cloneElement
Creates a copy of an element with extended props.
@@ -100,11 +100,11 @@ _Returns_
- `WPElement`: Cloned element.
-# **Component**
+### Component
A base class to create WordPress Components (Refs, state and lifecycle hooks)
-# **concatChildren**
+### concatChildren
Concatenate two or more React children objects.
@@ -116,7 +116,7 @@ _Returns_
- `Array`: The concatenated value.
-# **createContext**
+### createContext
Creates a context object containing two components: a provider and consumer.
@@ -128,7 +128,7 @@ _Returns_
- `Object`: Context object.
-# **createElement**
+### createElement
Returns a new element of given type. Type can be either a string tag name or
another function which itself returns an element.
@@ -143,7 +143,7 @@ _Returns_
- `WPElement`: Element.
-# **createInterpolateElement**
+### createInterpolateElement
This function creates an interpolated element from a passed in string with
specific tags matching how the string should be converted to an element via
@@ -175,7 +175,7 @@ _Returns_
- `WPElement`: A wp element.
-# **createPortal**
+### createPortal
Creates a portal into which a component can be rendered.
@@ -188,7 +188,7 @@ _Parameters_
- _child_ `import('./react').WPElement`: Any renderable child, such as an element, string, or fragment.
- _container_ `HTMLElement`: DOM node into which element should be rendered.
-# **createRef**
+### createRef
Returns an object tracking a reference to a rendered element via its
`current` property as either a DOMElement or Element, dependent upon the
@@ -198,7 +198,7 @@ _Returns_
- `Object`: Ref object.
-# **findDOMNode**
+### findDOMNode
Finds the dom node of a React component.
@@ -206,7 +206,7 @@ _Parameters_
- _component_ `import('./react').WPComponent`: Component's instance.
-# **forwardRef**
+### forwardRef
Component enhancer used to enable passing a ref to its wrapped component.
Pass a function argument which receives `props` and `ref` as its arguments,
@@ -221,11 +221,11 @@ _Returns_
- `WPComponent`: Enhanced component.
-# **Fragment**
+### Fragment
A component which renders its children without any wrapping element.
-# **isEmptyElement**
+### isEmptyElement
Checks if the provided WP element is empty.
@@ -237,7 +237,7 @@ _Returns_
- `boolean`: True when an element is considered empty.
-# **isValidElement**
+### isValidElement
Checks if an object is a valid WPElement.
@@ -249,19 +249,19 @@ _Returns_
- `boolean`: true if objectToTest is a valid WPElement and false otherwise.
-# **lazy**
+### lazy
_Related_
-
-# **memo**
+### memo
_Related_
-
-# **Platform**
+### Platform
Component used to detect the current Platform being used.
Use Platform.OS === 'web' to detect if running on web enviroment.
@@ -278,12 +278,14 @@ _Usage_
import { Platform } from '@wordpress/element';
const placeholderLabel = Platform.select( {
- native: __( 'Add media' ),
- web: __( 'Drag images, upload new ones or select files from your library.' ),
+ native: __( 'Add media' ),
+ web: __(
+ 'Drag images, upload new ones or select files from your library.'
+ ),
} );
```
-# **RawHTML**
+### RawHTML
Component used as equivalent of Fragment with unescaped HTML, in cases where
it is desirable to render dangerous HTML without needing a wrapper element.
@@ -298,7 +300,7 @@ _Returns_
- `JSX.Element`: Dangerously-rendering component.
-# **render**
+### render
Renders a given element into the target DOM node.
@@ -307,7 +309,7 @@ _Parameters_
- _element_ `import('./react').WPElement`: Element to render.
- _target_ `HTMLElement`: DOM node into which element should be rendered.
-# **renderToString**
+### renderToString
Serializes a React element to string.
@@ -321,17 +323,17 @@ _Returns_
- `string`: Serialized element.
-# **StrictMode**
+### StrictMode
Component that activates additional checks and warnings for its descendants.
-# **Suspense**
+### Suspense
_Related_
-
-# **switchChildrenNodeName**
+### switchChildrenNodeName
Switches the nodeName of all the elements in the children object.
@@ -344,7 +346,7 @@ _Returns_
- `?Object`: The updated children object.
-# **unmountComponentAtNode**
+### unmountComponentAtNode
Removes any mounted element from the target DOM node.
@@ -352,67 +354,66 @@ _Parameters_
- _target_ `Element`: DOM node in which element is to be removed
-# **useCallback**
+### useCallback
_Related_
-
-# **useContext**
+### useContext
_Related_
-
-# **useDebugValue**
+### useDebugValue
_Related_
-
-# **useEffect**
+### useEffect
_Related_
-
-# **useImperativeHandle**
+### useImperativeHandle
_Related_
-
-# **useLayoutEffect**
+### useLayoutEffect
_Related_
-
-# **useMemo**
+### useMemo
_Related_
-
-# **useReducer**
+### useReducer
_Related_
-
-# **useRef**
+### useRef
_Related_
-
-# **useState**
+### useState
_Related_
-
-
diff --git a/packages/escape-html/README.md b/packages/escape-html/README.md
index 2b35b9ff8daf7..e1fc36d503fc5 100644
--- a/packages/escape-html/README.md
+++ b/packages/escape-html/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **escapeAmpersand**
+### escapeAmpersand
Returns a string with ampersands escaped. Note that this is an imperfect
implementation, where only ampersands which do not appear as a pattern of
@@ -37,7 +37,7 @@ _Returns_
- `string`: Escaped string.
-# **escapeAttribute**
+### escapeAttribute
Returns an escaped attribute value.
@@ -62,7 +62,7 @@ _Returns_
- `string`: Escaped attribute value.
-# **escapeEditableHTML**
+### escapeEditableHTML
Returns an escaped Editable HTML element value. This is different from
`escapeHTML`, because for editable HTML, ALL ampersands must be escaped in
@@ -76,7 +76,7 @@ _Returns_
- `string`: Escaped HTML element value.
-# **escapeHTML**
+### escapeHTML
Returns an escaped HTML element value.
@@ -93,7 +93,7 @@ _Returns_
- `string`: Escaped HTML element value.
-# **escapeLessThan**
+### escapeLessThan
Returns a string with less-than sign replaced.
@@ -105,7 +105,7 @@ _Returns_
- `string`: Escaped string.
-# **escapeQuotationMark**
+### escapeQuotationMark
Returns a string with quotation marks replaced.
@@ -117,7 +117,7 @@ _Returns_
- `string`: Escaped string.
-# **isValidAttributeName**
+### isValidAttributeName
Returns true if the given attribute name is valid, or false otherwise.
@@ -129,7 +129,6 @@ _Returns_
- `boolean`: Whether attribute is valid.
-
diff --git a/packages/html-entities/README.md b/packages/html-entities/README.md
index f51848b18c74e..66d07432f563f 100644
--- a/packages/html-entities/README.md
+++ b/packages/html-entities/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **decodeEntities**
+### decodeEntities
Decodes the HTML entities from a given string.
@@ -35,7 +35,6 @@ _Returns_
- `string`: The decoded string.
-
diff --git a/packages/i18n/README.md b/packages/i18n/README.md
index 7c4982a9caa77..6333c02d2e488 100644
--- a/packages/i18n/README.md
+++ b/packages/i18n/README.md
@@ -27,7 +27,7 @@ For a complete example, see the [Internationalization section of the Block Edito
-# **createI18n**
+### createI18n
Create an i18n instance
@@ -41,11 +41,11 @@ _Returns_
- `I18n`: I18n instance
-# **defaultI18n**
+### defaultI18n
Default, singleton instance of `I18n`.
-# **getLocaleData**
+### getLocaleData
Returns locale data by domain in a Jed-formatted JSON object shape.
@@ -61,7 +61,7 @@ _Returns_
- `LocaleData`: Locale data.
-# **hasTranslation**
+### hasTranslation
Check if there is a translation for a given string (in singular form).
@@ -75,7 +75,7 @@ _Returns_
- `boolean`: Whether the translation exists or not.
-# **isRTL**
+### isRTL
Check if current locale is RTL.
@@ -88,7 +88,7 @@ _Returns_
- `boolean`: Whether locale is RTL.
-# **resetLocaleData**
+### resetLocaleData
Resets all current Tannin instance locale data and sets the specified
locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
@@ -102,7 +102,7 @@ _Parameters_
- _data_ `[LocaleData]`: Locale data configuration.
- _domain_ `[string]`: Domain for which configuration applies.
-# **setLocaleData**
+### setLocaleData
Merges locale data into the Tannin instance by domain. Accepts data in a
Jed-formatted JSON object shape.
@@ -116,7 +116,7 @@ _Parameters_
- _data_ `[LocaleData]`: Locale data configuration.
- _domain_ `[string]`: Domain for which configuration applies.
-# **sprintf**
+### sprintf
Returns a formatted string. If an error occurs in applying the format, the
original format string is returned.
@@ -134,7 +134,7 @@ _Returns_
- `string`: The formatted string.
-# **subscribe**
+### subscribe
Subscribes to changes of locale data
@@ -146,7 +146,7 @@ _Returns_
- `UnsubscribeCallback`: Unsubscribe callback
-# **\_n**
+### \_n
Translates and retrieves the singular or plural form based on the supplied
number.
@@ -166,7 +166,7 @@ _Returns_
- `string`: The translated singular or plural form.
-# **\_nx**
+### \_nx
Translates and retrieves the singular or plural form based on the supplied
number, with gettext context.
@@ -187,7 +187,7 @@ _Returns_
- `string`: The translated singular or plural form.
-# **\_x**
+### \_x
Retrieve translated string with gettext context.
@@ -205,7 +205,7 @@ _Returns_
- `string`: Translated context string without pipe.
-# **\_\_**
+### \_\_
Retrieve the translation of text.
@@ -222,7 +222,6 @@ _Returns_
- `string`: Translated text.
-
diff --git a/packages/keyboard-shortcuts/README.md b/packages/keyboard-shortcuts/README.md
index bb072ed81e859..9d62456b0f062 100644
--- a/packages/keyboard-shortcuts/README.md
+++ b/packages/keyboard-shortcuts/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **store**
+### store
Store definition for the keyboard shortcuts namespace.
@@ -28,7 +28,7 @@ _Type_
- `Object`
-# **useShortcut**
+### useShortcut
Attach a keyboard shortcut handler.
@@ -38,7 +38,6 @@ _Parameters_
- _callback_ `Function`: Shortcut callback.
- _options_ `Object`: Shortcut options.
-
diff --git a/packages/keycodes/README.md b/packages/keycodes/README.md
index 036258a6fbdc2..defcc8fff3893 100644
--- a/packages/keycodes/README.md
+++ b/packages/keycodes/README.md
@@ -38,27 +38,27 @@ onKeyDown( event ) {
-# **ALT**
+### ALT
Keycode for ALT key.
-# **BACKSPACE**
+### BACKSPACE
Keycode for BACKSPACE key.
-# **COMMAND**
+### COMMAND
Keycode for COMMAND/META key.
-# **CTRL**
+### CTRL
Keycode for CTRL key.
-# **DELETE**
+### DELETE
Keycode for DELETE key.
-# **displayShortcut**
+### displayShortcut
An object that contains functions to display shortcuts.
@@ -74,7 +74,7 @@ _Type_
- `WPModifierHandler>`Keyed map of functions to display shortcuts.
-# **displayShortcutList**
+### displayShortcutList
Return an array of the parts of a keyboard shortcut chord for display.
@@ -90,23 +90,23 @@ _Type_
- `WPModifierHandler>`Keyed map of functions to shortcut sequences.
-# **DOWN**
+### DOWN
Keycode for DOWN key.
-# **ENTER**
+### ENTER
Keycode for ENTER key.
-# **ESCAPE**
+### ESCAPE
Keycode for ESCAPE key.
-# **F10**
+### F10
Keycode for F10 key.
-# **isKeyboardEvent**
+### isKeyboardEvent
An object that contains functions to check if a keyboard event matches a
predefined shortcut combination.
@@ -123,11 +123,11 @@ _Type_
- `WPModifierHandler`Keyed map of functions to match events.
-# **LEFT**
+### LEFT
Keycode for LEFT key.
-# **modifiers**
+### modifiers
Object that contains functions that return the available modifier
depending on platform.
@@ -136,7 +136,7 @@ _Type_
- `WPModifierHandler< ( isApple: () => boolean ) => WPModifierPart[]>`
-# **rawShortcut**
+### rawShortcut
An object that contains functions to get raw shortcuts.
@@ -146,7 +146,7 @@ _Usage_
```js
// Assuming macOS:
-rawShortcut.primary( 'm' )
+rawShortcut.primary( 'm' );
// "meta+m""
```
@@ -154,15 +154,15 @@ _Type_
- `WPModifierHandler>`Keyed map of functions to raw shortcuts.
-# **RIGHT**
+### RIGHT
Keycode for RIGHT key.
-# **SHIFT**
+### SHIFT
Keycode for SHIFT key.
-# **shortcutAriaLabel**
+### shortcutAriaLabel
An object that contains functions to return an aria label for a keyboard
shortcut.
@@ -179,23 +179,22 @@ _Type_
- `WPModifierHandler>`Keyed map of functions to shortcut ARIA labels.
-# **SPACE**
+### SPACE
Keycode for SPACE key.
-# **TAB**
+### TAB
Keycode for TAB key.
-# **UP**
+### UP
Keycode for UP key.
-# **ZERO**
+### ZERO
Keycode for ZERO key.
-
diff --git a/packages/plugins/README.md b/packages/plugins/README.md
index c47c77206fb55..94f0bd2b0071a 100644
--- a/packages/plugins/README.md
+++ b/packages/plugins/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **getPlugin**
+#### getPlugin
Returns a registered plugin settings.
@@ -28,7 +28,7 @@ _Returns_
- `?WPPlugin`: Plugin setting.
-# **getPlugins**
+#### getPlugins
Returns all registered plugins without a scope or for a given scope.
@@ -40,7 +40,7 @@ _Returns_
- `WPPlugin[]`: The list of plugins without a scope or for a given scope.
-# **PluginArea**
+#### PluginArea
A component that renders all plugin fills in a hidden div.
@@ -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 );
}
```
@@ -77,7 +72,7 @@ _Returns_
- `WPComponent`: The component to be rendered.
-# **registerPlugin**
+#### registerPlugin
Registers a plugin to the editor.
@@ -128,15 +123,10 @@ import { more } from '@wordpress/icons';
const Component = () => (
<>
-
+
My Sidebar
-
+
Content of the sidebar
>
@@ -158,7 +148,7 @@ _Returns_
- `WPPlugin`: The final plugin settings object.
-# **unregisterPlugin**
+#### unregisterPlugin
Unregisters a plugin by name.
@@ -186,7 +176,7 @@ _Returns_
- `?WPPlugin`: The previous plugin settings object, if it has been successfully unregistered; otherwise `undefined`.
-# **withPluginContext**
+#### withPluginContext
A Higher Order Component used to inject Plugin context to the
wrapped component.
@@ -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 64e13011238ce..43f5f72516189 100644
--- a/packages/priority-queue/README.md
+++ b/packages/priority-queue/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **createQueue**
+### createQueue
Creates a context-aware queue that only executes
the last task of a given context.
@@ -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 16b9341d4180b..1386b4c045dce 100644
--- a/packages/react-i18n/README.md
+++ b/packages/react-i18n/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **I18nProvider**
+### I18nProvider
The `I18nProvider` should be mounted above any localized components:
@@ -46,7 +46,7 @@ _Returns_
- `JSX.Element`: Children wrapped in the I18nProvider.
-# **useI18n**
+### useI18n
React hook providing access to i18n functions. It exposes the `__`, `_x`, `_n`, `_nx`,
`isRTL` and `hasTranslation` functions from [`@wordpress/i18n`](../i18n).
@@ -63,7 +63,7 @@ function MyComponent() {
}
```
-# **withI18n**
+### withI18n
React higher-order component that passes the i18n translate functions (the same set
as exposed by the `useI18n` hook) to the wrapped component as props.
@@ -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 067ae8fb331cb..649dc16ef1397 100644
--- a/packages/redux-routine/README.md
+++ b/packages/redux-routine/README.md
@@ -59,7 +59,7 @@ request has completed does the action creator procede to return the `SET_TEMPERA
-# **default**
+### default
Creates a Redux middleware, given an object of controls where each key is an
action type for which to act upon, the value a function which returns either
@@ -76,7 +76,6 @@ _Returns_
- `Function`: Co-routine runtime
-
## Motivation
diff --git a/packages/rich-text/README.md b/packages/rich-text/README.md
index 0d99047be430b..c3bb074551d20 100644
--- a/packages/rich-text/README.md
+++ b/packages/rich-text/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **applyFormat**
+### applyFormat
Apply a format object to a Rich Text value from the given `startIndex` to the
given `endIndex`. Indices are retrieved from the selection if none are
@@ -33,7 +33,7 @@ _Returns_
- `RichTextValue`: A new value with the format applied.
-# **concat**
+### concat
Combine all Rich Text values into one. This is similar to
`String.prototype.concat`.
@@ -46,7 +46,7 @@ _Returns_
- `RichTextValue`: A new value combining all given records.
-# **create**
+### create
Create a RichText value from an `Element` tree (DOM), an HTML string or a
plain text string, with optionally a `Range` object to set the selection. If
@@ -85,13 +85,13 @@ _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_
- `RichTextValue`: A rich text value.
-# **getActiveFormat**
+### getActiveFormat
Gets the format object by type at the start of the selection. This can be
used to get e.g. the URL of a link format at the current selection, but also
@@ -107,7 +107,7 @@ _Returns_
- `RichTextFormat|undefined`: Active format object of the specified type, or undefined.
-# **getActiveObject**
+### getActiveObject
Gets the active object, if there is any.
@@ -119,7 +119,7 @@ _Returns_
- `RichTextFormat|void`: Active object, or undefined.
-# **getTextContent**
+### getTextContent
Get the textual content of a Rich Text value. This is similar to
`Element.textContent`.
@@ -132,7 +132,7 @@ _Returns_
- `string`: The text content.
-# **insert**
+### insert
Insert a Rich Text value, an HTML string, or a plain text string, into a
Rich Text value at the given `startIndex`. Any content between `startIndex`
@@ -150,7 +150,7 @@ _Returns_
- `RichTextValue`: A new value with the value inserted.
-# **insertObject**
+### insertObject
Insert a format as an object into a Rich Text value at the given
`startIndex`. Any content between `startIndex` and `endIndex` will be
@@ -167,7 +167,7 @@ _Returns_
- `RichTextValue`: A new value with the object inserted.
-# **isCollapsed**
+### isCollapsed
Check if the selection of a Rich Text value is collapsed or not. Collapsed
means that no characters are selected, but there is a caret present. If there
@@ -182,7 +182,7 @@ _Returns_
- `boolean|undefined`: True if the selection is collapsed, false if not, undefined if there is no selection.
-# **isEmpty**
+### isEmpty
Check if a Rich Text value is Empty, meaning it contains no text or any
objects (such as images).
@@ -195,7 +195,7 @@ _Returns_
- `boolean`: True if the value is empty, false if not.
-# **join**
+### join
Combine an array of Rich Text values into one, optionally separated by
`separator`, which can be a Rich Text value, HTML string, or plain text
@@ -210,7 +210,7 @@ _Returns_
- `RichTextValue`: A new combined value.
-# **registerFormatType**
+### registerFormatType
Registers a new format provided a unique name and an object defining its
behavior.
@@ -224,7 +224,7 @@ _Returns_
- `WPFormat|undefined`: The format, if it has been successfully registered; otherwise `undefined`.
-# **remove**
+### remove
Remove content from a Rich Text value between the given `startIndex` and
`endIndex`. Indices are retrieved from the selection if none are provided.
@@ -239,7 +239,7 @@ _Returns_
- `RichTextValue`: A new value with the content removed.
-# **removeFormat**
+### removeFormat
Remove any format object from a Rich Text value by type from the given
`startIndex` to the given `endIndex`. Indices are retrieved from the
@@ -256,7 +256,7 @@ _Returns_
- `RichTextValue`: A new value with the format applied.
-# **replace**
+### replace
Search a Rich Text value and replace the match(es) with `replacement`. This
is similar to `String.prototype.replace`.
@@ -271,7 +271,7 @@ _Returns_
- `RichTextValue`: A new value with replacements applied.
-# **slice**
+### slice
Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
retrieved from the selection if none are provided. This is similar to
@@ -287,7 +287,7 @@ _Returns_
- `RichTextValue`: A new extracted value.
-# **split**
+### split
Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
split at the given separator. This is similar to `String.prototype.split`.
@@ -295,14 +295,14 @@ 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_
- `Array|undefined`: An array of new values.
-# **store**
+### store
Store definition for the rich-text namespace.
@@ -314,7 +314,7 @@ _Type_
- `Object`
-# **toggleFormat**
+### toggleFormat
Toggles a format object to a Rich Text value at the current selection.
@@ -327,7 +327,7 @@ _Returns_
- `RichTextValue`: A new value with the format applied or removed.
-# **toHTMLString**
+### toHTMLString
Create an HTML string from a Rich Text value. If a `multilineTag` is
provided, text separated by a line separator will be wrapped in it.
@@ -343,7 +343,7 @@ _Returns_
- `string`: HTML string.
-# **unregisterFormatType**
+### unregisterFormatType
Unregisters a format.
@@ -355,7 +355,7 @@ _Returns_
- `RichTextFormatType|undefined`: The previous format value, if it has been successfully unregistered; otherwise `undefined`.
-# **useAnchorRef**
+### useAnchorRef
This hook, to be used in a format type's Edit component, returns the active
element that is formatted, or the selection range if no format is active.
@@ -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 1beaba7e6ec34..fda45bc1e0328 100644
--- a/packages/shortcode/README.md
+++ b/packages/shortcode/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **attrs**
+### attrs
Parse shortcode attributes.
@@ -38,7 +38,7 @@ _Returns_
- `WPShortcodeAttrs`: Parsed shortcode attributes.
-# **default**
+### default
Creates a shortcode instance.
@@ -55,7 +55,7 @@ _Returns_
- `WPShortcode`: Shortcode instance.
-# **fromMatch**
+### fromMatch
Generate a Shortcode Object from a RegExp match.
@@ -71,7 +71,7 @@ _Returns_
- `WPShortcode`: Shortcode instance.
-# **next**
+### next
Find the next matching shortcode.
@@ -85,7 +85,7 @@ _Returns_
- `?WPShortcodeMatch`: Matched information.
-# **regexp**
+### regexp
Generate a RegExp to identify a shortcode.
@@ -110,7 +110,7 @@ _Returns_
- `RegExp`: Shortcode RegExp.
-# **replace**
+### replace
Replace matching shortcodes in a block of text.
@@ -124,7 +124,7 @@ _Returns_
- `string`: Text with shortcodes replaced.
-# **string**
+### string
Generate a string from shortcode parameters.
@@ -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.
-
diff --git a/packages/url/README.md b/packages/url/README.md
index bec8886687b66..d6b338071b1b9 100644
--- a/packages/url/README.md
+++ b/packages/url/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **addQueryArgs**
+### addQueryArgs
Appends arguments as querystring to the provided URL. If the URL already
includes query arguments, the arguments are merged with (and take precedent
@@ -37,7 +37,7 @@ _Returns_
- `string`: URL with arguments applied.
-# **buildQueryString**
+### buildQueryString
Generates URL-encoded query string using input query data.
@@ -48,13 +48,13 @@ _Usage_
```js
const queryString = buildQueryString( {
- simple: 'is ok',
- arrays: [ 'are', 'fine', 'too' ],
- objects: {
- evenNested: {
- ok: 'yes',
- },
- },
+ simple: 'is ok',
+ arrays: [ 'are', 'fine', 'too' ],
+ objects: {
+ evenNested: {
+ ok: 'yes',
+ },
+ },
} );
// "simple=is%20ok&arrays%5B0%5D=are&arrays%5B1%5D=fine&arrays%5B2%5D=too&objects%5BevenNested%5D%5Bok%5D=yes"
```
@@ -67,7 +67,7 @@ _Returns_
- `string`: Query string.
-# **cleanForSlug**
+### cleanForSlug
Performs some basic cleanup of a string for use as a post slug.
@@ -88,15 +88,20 @@ _Returns_
- `string`: Processed string.
-# **filterURLForDisplay**
+### filterURLForDisplay
Returns a URL for display.
_Usage_
```js
-const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg
-const imageUrl = filterURLForDisplay( 'https://www.wordpress.org/wp-content/uploads/img.png', 20 ); // …ent/uploads/img.png
+const displayUrl = filterURLForDisplay(
+ 'https://www.wordpress.org/gutenberg/'
+); // wordpress.org/gutenberg
+const imageUrl = filterURLForDisplay(
+ 'https://www.wordpress.org/wp-content/uploads/img.png',
+ 20
+); // …ent/uploads/img.png
```
_Parameters_
@@ -108,7 +113,7 @@ _Returns_
- `string`: Displayed URL.
-# **getAuthority**
+### getAuthority
Returns the authority part of the URL.
@@ -127,15 +132,19 @@ _Returns_
- `string|void`: The authority part of the URL.
-# **getFragment**
+### getFragment
Returns the fragment part of the URL.
_Usage_
```js
-const fragment1 = getFragment( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // '#fragment'
-const fragment2 = getFragment( 'https://wordpress.org#another-fragment?query=true' ); // '#another-fragment'
+const fragment1 = getFragment(
+ 'http://localhost:8080/this/is/a/test?query=true#fragment'
+); // '#fragment'
+const fragment2 = getFragment(
+ 'https://wordpress.org#another-fragment?query=true'
+); // '#another-fragment'
```
_Parameters_
@@ -146,7 +155,7 @@ _Returns_
- `string|void`: The fragment part of the URL.
-# **getPath**
+### getPath
Returns the path part of the URL.
@@ -165,15 +174,19 @@ _Returns_
- `string|void`: The path part of the URL.
-# **getPathAndQueryString**
+### getPathAndQueryString
Returns the path part and query string part of the URL.
_Usage_
```js
-const pathAndQueryString1 = getPathAndQueryString( 'http://localhost:8080/this/is/a/test?query=true' ); // '/this/is/a/test?query=true'
-const pathAndQueryString2 = getPathAndQueryString( 'https://wordpress.org/help/faq/' ); // '/help/faq'
+const pathAndQueryString1 = getPathAndQueryString(
+ 'http://localhost:8080/this/is/a/test?query=true'
+); // '/this/is/a/test?query=true'
+const pathAndQueryString2 = getPathAndQueryString(
+ 'https://wordpress.org/help/faq/'
+); // '/help/faq'
```
_Parameters_
@@ -184,7 +197,7 @@ _Returns_
- `string`: The path part and query string part of the URL.
-# **getProtocol**
+### getProtocol
Returns the protocol part of the URL.
@@ -203,7 +216,7 @@ _Returns_
- `string|void`: The protocol part of the URL.
-# **getQueryArg**
+### getQueryArg
Returns a single query argument of the url
@@ -222,7 +235,7 @@ _Returns_
- `QueryArgParsed|void`: Query arg value.
-# **getQueryArgs**
+### getQueryArgs
Returns an object of query arguments of the given URL. If the given URL is
invalid or has no querystring, an empty object is returned.
@@ -242,14 +255,16 @@ _Returns_
- `QueryArgs`: Query args object.
-# **getQueryString**
+### getQueryString
Returns the query string part of the URL.
_Usage_
```js
-const queryString = getQueryString( 'http://localhost:8080/this/is/a/test?query=true#fragment' ); // 'query=true'
+const queryString = getQueryString(
+ 'http://localhost:8080/this/is/a/test?query=true#fragment'
+); // 'query=true'
```
_Parameters_
@@ -260,7 +275,7 @@ _Returns_
- `string|void`: The query string part of the URL.
-# **hasQueryArg**
+### hasQueryArg
Determines whether the URL contains a given query arg.
@@ -279,7 +294,7 @@ _Returns_
- `boolean`: Whether or not the URL contains the query arg.
-# **isEmail**
+### isEmail
Determines whether the given string looks like an email.
@@ -297,7 +312,7 @@ _Returns_
- `boolean`: Whether or not it looks like an email.
-# **isURL**
+### isURL
Determines whether the given string looks like a URL.
@@ -320,7 +335,7 @@ _Returns_
- `boolean`: Whether or not it looks like a URL.
-# **isValidAuthority**
+### isValidAuthority
Checks for invalid characters within the provided authority.
@@ -339,7 +354,7 @@ _Returns_
- `boolean`: True if the argument contains a valid authority.
-# **isValidFragment**
+### isValidFragment
Checks for invalid characters within the provided fragment.
@@ -358,7 +373,7 @@ _Returns_
- `boolean`: True if the argument contains a valid fragment.
-# **isValidPath**
+### isValidPath
Checks for invalid characters within the provided path.
@@ -377,7 +392,7 @@ _Returns_
- `boolean`: True if the argument contains a valid path
-# **isValidProtocol**
+### isValidProtocol
Tests if a url protocol is valid.
@@ -396,7 +411,7 @@ _Returns_
- `boolean`: True if the argument is a valid protocol (e.g. http\:, tel:).
-# **isValidQueryString**
+### isValidQueryString
Checks for invalid characters within the provided query string.
@@ -415,7 +430,7 @@ _Returns_
- `boolean`: True if the argument contains a valid query string.
-# **prependHTTP**
+### prependHTTP
Prepends "http\://" to a url, if it looks like something that is meant to be a TLD.
@@ -433,14 +448,18 @@ _Returns_
- `string`: The updated URL.
-# **removeQueryArgs**
+### removeQueryArgs
Removes arguments from the query string of the url
_Usage_
```js
-const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=foobar', 'foo', 'bar' ); // https://wordpress.org?baz=foobar
+const newUrl = removeQueryArgs(
+ 'https://wordpress.org?foo=bar&bar=baz&baz=foobar',
+ 'foo',
+ 'bar'
+); // https://wordpress.org?baz=foobar
```
_Parameters_
@@ -452,7 +471,7 @@ _Returns_
- `string`: Updated URL.
-# **safeDecodeURI**
+### safeDecodeURI
Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
`decodeURI` throws an error.
@@ -471,7 +490,7 @@ _Returns_
- `string`: Decoded URI if possible.
-# **safeDecodeURIComponent**
+### safeDecodeURIComponent
Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
`decodeURIComponent` throws an error.
@@ -484,7 +503,6 @@ _Returns_
- `string`: Decoded URI component if possible.
-
diff --git a/packages/viewport/README.md b/packages/viewport/README.md
index a7e8ab7fdb381..d3c185ae94e25 100644
--- a/packages/viewport/README.md
+++ b/packages/viewport/README.md
@@ -55,7 +55,7 @@ This package provides a set of HOCs to author components whose behavior should v
-# **ifViewportMatches**
+#### ifViewportMatches
Higher-order component creator, creating a new component which renders if
the viewport query is satisfied.
@@ -82,7 +82,7 @@ _Returns_
- `Function`: Higher-order component.
-# **store**
+#### store
Store definition for the viewport namespace.
@@ -94,7 +94,7 @@ _Type_
- `Object`
-# **withViewportMatch**
+#### withViewportMatch
Higher-order component creator, creating a new component which renders with
the given prop names, where the value passed to the underlying component is
@@ -108,9 +108,7 @@ _Usage_
```jsx
function MyComponent( { isMobile } ) {
- return (
- Currently: { isMobile ? 'Mobile' : 'Not Mobile' }
- );
+ return Currently: { isMobile ? 'Mobile' : 'Not Mobile' }
;
}
MyComponent = withViewportMatch( { isMobile: '< small' } )( MyComponent );
@@ -124,7 +122,6 @@ _Returns_
- `Function`: Higher-order component.
-
diff --git a/packages/warning/README.md b/packages/warning/README.md
index 47a7270550692..db403d47b2809 100644
--- a/packages/warning/README.md
+++ b/packages/warning/README.md
@@ -30,7 +30,7 @@ To prevent that, you should:
-# **default**
+### default
Shows a warning with `message` if environment is not `production`.
@@ -51,7 +51,6 @@ _Parameters_
- _message_ `string`: Message to show in the warning.
-
diff --git a/packages/widgets/src/blocks/legacy-widget/editor.scss b/packages/widgets/src/blocks/legacy-widget/editor.scss
index a7bbb6b92d9e9..ff8378cfc0170 100644
--- a/packages/widgets/src/blocks/legacy-widget/editor.scss
+++ b/packages/widgets/src/blocks/legacy-widget/editor.scss
@@ -67,6 +67,8 @@
line-height: 1;
min-height: 30px;
padding-left: $grid-unit-10;
+ padding-top: $grid-unit;
+ padding-bottom: $grid-unit;
}
select {
padding-left: $grid-unit-05;
diff --git a/packages/wordcount/README.md b/packages/wordcount/README.md
index ace076c97108c..7f8ee0b094b79 100644
--- a/packages/wordcount/README.md
+++ b/packages/wordcount/README.md
@@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If
-# **count**
+### count
Count some words.
@@ -24,7 +24,7 @@ _Usage_
```js
import { count } from '@wordpress/wordcount';
-const numberOfWords = count( 'Words to count', 'words', {} )
+const numberOfWords = count( 'Words to count', 'words', {} );
```
_Parameters_
@@ -37,7 +37,6 @@ _Returns_
- `number`: The word or character count.
-