Skip to content

Commit

Permalink
Update block inserter and library terminology.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed May 8, 2024
1 parent 990214e commit 327d470
Show file tree
Hide file tree
Showing 59 changed files with 140 additions and 152 deletions.
6 changes: 3 additions & 3 deletions docs/explanations/user-interface/block-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Group toolbar controls in logical segments. Don't add a segment for each.

### Block identification

A block should have a straightforward, short name so users can easily find it in the block library. A block named "YouTube" is easy to find and understand. The same block, named "Embedded Video (YouTube)", would be less clear and harder to find in the block library.
A block should have a straightforward, short name so users can easily find it in the Block Inserter. A block named "YouTube" is easy to find and understand. The same block, named "Embedded Video (YouTube)", would be less clear and harder to find in the Block Inserter.

When referring to a block in documentation or UI, use title case for the block title and lowercase for the "block" descriptor. For example:

Expand All @@ -76,11 +76,11 @@ When referring to a block in documentation or UI, use title case for the block t

Blocks should have an identifying icon, ideally using a single color. Try to avoid using the same icon used by an existing block. The core block icons are based on [Material Design Icons](https://fonts.google.com/icons). Look to that icon set, or to [Dashicons](https://developer.wordpress.org/resource/dashicons/) for style inspiration.

![A screenshot of the block library with concise block names](https://developer.wordpress.org/files/2022/01/blocks-do.png)
![A screenshot of the Block Inserter with concise block names](https://developer.wordpress.org/files/2022/01/blocks-do.png)
**Do:**
Use concise block names.

![A screenshot of the block library with long, multi-line block names](https://developer.wordpress.org/files/2022/01/blocks-dont.png)
![A screenshot of the Block Inserter with long, multi-line block names](https://developer.wordpress.org/files/2022/01/blocks-dont.png)
**Don't:**
Avoid long, multi-line block names.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The key difference between `parent` and `ancestor` is `parent` has finer specifi

### Defining parent block relationship

An example of this is the Column block, which is assigned the `parent` block setting. This allows the Column block to only be available as a nested direct descendant in its parent Columns block. Otherwise, the Column block will not be available as an option within the block inserter. See [Column code for reference](https://github.com/WordPress/gutenberg/tree/HEAD/packages/block-library/src/column).
An example of this is the Column block, which is assigned the `parent` block setting. This allows the Column block to only be available as a nested direct descendant in its parent Columns block. Otherwise, the Column block will not be available as an option within the Block Inserter. See [Column code for reference](https://github.com/WordPress/gutenberg/tree/HEAD/packages/block-library/src/column).

When defining a direct descendent block, use the `parent` block setting to define which block is the parent. This prevents the nested block from showing in the inserter outside of the InnerBlock it is defined for.

Expand All @@ -138,9 +138,9 @@ When defining a direct descendent block, use the `parent` block setting to defin

### Defining an ancestor block relationship

An example of this is the Comment Author Name block, which is assigned the `ancestor` block setting. This allows the Comment Author Name block to only be available as a nested descendant in its ancestral Comment Template block. Otherwise, the Comment Author Name block will not be available as an option within the block inserter. See [Comment Author Name code for reference](https://github.com/WordPress/gutenberg/tree/HEAD/packages/block-library/src/comment-author-name).
An example of this is the Comment Author Name block, which is assigned the `ancestor` block setting. This allows the Comment Author Name block to only be available as a nested descendant in its ancestral Comment Template block. Otherwise, the Comment Author Name block will not be available as an option within the Block Inserter. See [Comment Author Name code for reference](https://github.com/WordPress/gutenberg/tree/HEAD/packages/block-library/src/comment-author-name).

The `ancestor` relationship allows the Comment Author Name block to be anywhere in the hierarchical tree, and not _just_ a direct child of the parent Comment Template block, while still limiting its availability within the block inserter to only be visible an an option to insert if the Comment Template block is available.
The `ancestor` relationship allows the Comment Author Name block to be anywhere in the hierarchical tree, and not _just_ a direct child of the parent Comment Template block, while still limiting its availability within the Block Inserter to only be visible an an option to insert if the Comment Template block is available.

When defining a descendent block, use the `ancestor` block setting. This prevents the nested block from showing in the inserter outside of the InnerBlock it is defined for.

Expand Down
6 changes: 3 additions & 3 deletions docs/how-to-guides/widgets/legacy-widget-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

The Legacy Widget block allows users to add, edit and preview third party widgets that are registered by plugins and widgets that were added using the classic Widgets Editor.

Third party widgets can be added by inserting a Legacy Widget block using the block inserter and selecting the widget from the block's dropdown.
Third party widgets can be added by inserting a Legacy Widget block using the Block Inserter and selecting the widget from the block's dropdown.

Third party widgets may also be added by searching for the name of the widget in the block inserter and selecting the widget. A variation of the Legacy Widget block will be inserted.
Third party widgets may also be added by searching for the name of the widget in the Block Inserter and selecting the widget. A variation of the Legacy Widget block will be inserted.

## Compatibility with the Legacy Widget block

Expand Down Expand Up @@ -134,7 +134,7 @@ transforms: {
#### 3) Hide the widget from the Legacy Widget block
As a final touch, we can tell the Legacy Widget block to hide your widget from the "Select widget" dropdown and from the block inserter. This encourages users to use the block that replaces your widget.
As a final touch, we can tell the Legacy Widget block to hide your widget from the "Select widget" dropdown and from the Block Inserter. This encourages users to use the block that replaces your widget.
This can be done using the `widget_types_to_hide_from_legacy_widget_block` filter.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/block-api/block-patterns.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Patterns

Block Patterns are predefined block layouts available from the patterns tab of the block inserter. Once inserted into content, the blocks are ready for additional or modified content and configuration.
Block Patterns are predefined block layouts available from the patterns tab of the Block Inserter. Once inserted into content, the blocks are ready for additional or modified content and configuration.

## Block patterns

Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/block-api/block-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ This should match the namespace declared in the block name; the name of your plu

- **Type:** `String`

This will display in the block inserter section, which will list all blocks in this collection.
This will display in the Block Inserter section, which will list all blocks in this collection.

#### Icon

- **Type:** `Object`

(Optional) An icon to display alongside the title in the block inserter.
(Optional) An icon to display alongside the title in the Block Inserter.

```js
// Registering a block collection
Expand Down
2 changes: 1 addition & 1 deletion packages/block-directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If

## Usage

This package builds a standalone JS file. When loaded on a page with the block editor, it extends the block inserter to search for blocks from WordPress.org.
This package builds a standalone JS file. When loaded on a page with the block editor, it extends the Block Inserter to search for blocks from WordPress.org.

To do this, it uses the `__unstableInserterMenuExtension`, a slot-fill area hooked into the block types list. When the user runs a search and there are no results currently installed, it fires off a request to WordPress.org for matching blocks. These are listed for the user to install with a one-click process that [installs, activates, and injects the block into the post.](./src/store/actions.js#L49) When the post is saved, if the block was not used, it will be [silently uninstalled](./src/store/actions.js#L129) to avoid clutter.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

These two components allow rendering editor UI by the block (in a popover) but outside the canvas. This is important to avoid messing with the style and layout of the block list.

For example, it's used to render the contextual block toolbar and the in-between block inserter.
For example, it's used to render the contextual block toolbar and the in-between Block Inserter.

## BlockPopover

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useSelect } from '@wordpress/data';
import { store as blockEditorStore } from '../../store';

/**
* Returns props for the selected block tools and empty block inserter.
* Returns props for the selected block tools and empty Block Inserter.
*
* @param {string} clientId Selected block client ID.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `BlockTypesList` component lets users display a list of blocks in different

This component is present in the block insertion tab, the reusable blocks tab and the quick block insertion modal in the editor.

![Block types list in the block inserter tab](https://make.wordpress.org/core/files/2020/09/block-types-list-emplacement-1.png)
![Block types list in the Block Inserter tab](https://make.wordpress.org/core/files/2020/09/block-types-list-emplacement-1.png)

![Block types list in the reusables blocks tab](https://make.wordpress.org/core/files/2020/09/block-types-list-emplacement-2.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function ButtonBlockAppender(
} else {
label = _x(
'Add block',
'Generic label for block inserter button'
'Generic label for Block Inserter button'
);
}
const isToggleButton = ! hasSingleBlockType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}

// Since this appender will only ever appear on an entirely empty document, we don't account for last-child.
// This is also because it will never be the last child, the block inserter that sits in this appender is the last child.
// This is also because it will never be the last child, the Block Inserter that sits in this appender is the last child.
}

// Dropzone.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ For example, a button block, deeply nested in several levels of block `X` that u
### `prioritizedInserterBlocks`

- **Type:** `Array`
- **Default:** - `undefined`. Determines which block types should be shown in the block inserter. For example, when inserting a block within the Navigation block we specify `core/navigation-link` and `core/navigation-link/page` as these are the most commonly used inner blocks. `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.
- **Default:** - `undefined`. Determines which block types should be shown in the Block Inserter. For example, when inserting a block within the Navigation block we specify `core/navigation-link` and `core/navigation-link/page` as these are the most commonly used inner blocks. `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.

### `defaultBlock`

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const defaultRenderToggle = ( {
} else if ( ! label && prioritizePatterns ) {
label = __( 'Add pattern' );
} else if ( ! label ) {
label = _x( 'Add block', 'Generic label for block inserter button' );
label = _x( 'Add block', 'Generic label for Block Inserter button' );
}

// Handle both onClick functions from the toggle and the parent component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const defaultRenderToggle = ( {
<ToolbarButton
title={ _x(
'Add block',
'Generic label for block inserter button'
'Generic label for Block Inserter button'
) }
icon={ <Icon icon={ plus } style={ iconStyle } /> }
onClick={ onToggle }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ $block-inserter-tabs-height: 44px;
border-top: $border-width solid $gray-300;
padding: $grid-unit-20;
flex-shrink: 0;
position: relative; // prevents overscroll when block library is open
position: relative; // prevents overscroll when Block Inserter is open
}

.block-editor-inserter__quick-inserter {
Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/inserter/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ const { Tabs } = unlock( componentsPrivateApis );

const blocksTab = {
name: 'blocks',
/* translators: Blocks tab title in the block inserter. */
/* translators: Blocks tab title in the Block Inserter. */
title: __( 'Blocks' ),
};
const patternsTab = {
name: 'patterns',
/* translators: Theme and Directory Patterns tab title in the block inserter. */
/* translators: Theme and Directory Patterns tab title in the Block Inserter. */
title: __( 'Patterns' ),
};

const mediaTab = {
name: 'media',
/* translators: Media tab title in the block inserter. */
/* translators: Media tab title in the Block Inserter. */
title: __( 'Media' ),
};

Expand All @@ -43,7 +43,7 @@ function InserterTabs( { onSelect, children, onClose }, ref ) {
<Button
className="block-editor-inserter-sidebar__close-button"
icon={ closeSmall }
label={ __( 'Close block inserter' ) }
label={ __( 'Close' ) }
onClick={ () => onClose() }
size="small"
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/buttons/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe( 'Buttons block', () => {
const buttonBlock = await getBlock( screen, 'Button' );
fireEvent.press( buttonBlock );

// Open the block inserter
// Open the Block Inserter
fireEvent.press( screen.getByLabelText( 'Add block' ) );

const blockList = screen.getByTestId( 'InserterUI-Blocks' );
Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ _Parameters_
- _namespace_ `string`: The namespace to group blocks by in the inserter; corresponds to the block namespace.
- _settings_ `Object`: The block collection settings.
- _settings.title_ `string`: The title to display in the block inserter.
- _settings.icon_ `[Object]`: The icon to display in the block inserter.
- _settings.title_ `string`: The title to display in the Block Inserter.
- _settings.icon_ `[Object]`: The icon to display in the Block Inserter.
### registerBlockStyle
Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ function translateBlockSettingUsingI18nSchema(
*
* @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace.
* @param {Object} settings The block collection settings.
* @param {string} settings.title The title to display in the block inserter.
* @param {Object} [settings.icon] The icon to display in the block inserter.
* @param {string} settings.title The title to display in the Block Inserter.
* @param {Object} [settings.icon] The icon to display in the Block Inserter.
*
* @example
* ```js
Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ export function updateCategory( slug, category ) {
* @ignore
*
* @param {string} namespace The namespace of the blocks to put in the collection
* @param {string} title The title to display in the block inserter
* @param {Object} icon (optional) The icon to display in the block inserter
* @param {string} title The title to display in the Block Inserter
* @param {Object} icon (optional) The icon to display in the Block Inserter
*
* @return {Object} Action object.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/customize-widgets/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function Header( {
icon={ plus }
label={ _x(
'Add block',
'Generic label for block inserter button'
'Generic label for Block Inserter button'
) }
onClick={ () => {
setIsInserterOpened( ( isOpen ) => ! isOpen );
Expand Down
12 changes: 6 additions & 6 deletions packages/e2e-test-utils/src/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ async function isGlobalInserterOpen() {
return !! document.querySelector(
'.edit-post-header [aria-label="Add block"].is-pressed,' +
'.edit-site-header-edit-mode [aria-label="Add block"].is-pressed,' +
'.edit-post-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-site-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Toggle block inserter"].is-pressed,' +
'.edit-post-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-site-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Block Inserter"].is-pressed,' +
'.edit-widgets-header [aria-label="Add block"].is-pressed,' +
'.edit-site-header-edit-mode__inserter-toggle.is-pressed'
);
Expand All @@ -67,10 +67,10 @@ export async function toggleGlobalBlockInserter() {
'.editor-document-tools__inserter-toggle,' +
'.edit-post-header [aria-label="Add block"],' +
'.edit-site-header [aria-label="Add block"],' +
'.edit-post-header [aria-label="Toggle block inserter"],' +
'.edit-site-header [aria-label="Toggle block inserter"],' +
'.edit-post-header [aria-label="Block Inserter"],' +
'.edit-site-header [aria-label="Block Inserter"],' +
'.edit-widgets-header [aria-label="Add block"],' +
'.edit-widgets-header [aria-label="Toggle block inserter"],' +
'.edit-widgets-header [aria-label="Block Inserter"],' +
'.edit-site-header-edit-mode__inserter-toggle'
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function DocumentTools() {
/* translators: button label text should, if possible, be under 16
characters. */
label={ _x(
'Toggle block inserter',
'Generic label for block inserter button'
'Block Inserter',
'Generic label for Block Inserter button'
) }
size="compact"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function InserterSidebar() {
<Button
icon={ close }
onClick={ closeInserter }
label={ __( 'Close block inserter' ) }
label={ __( 'Close' ) }
/>
</TagName>
<div className="edit-widgets-layout__inserter-panel-content">
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function widgetAreasOpenState( state = {}, action ) {
}

/**
* Reducer to set the block inserter panel open or closed.
* Reducer to set the Block Inserter panel open or closed.
*
* Note: this reducer interacts with the list view panel reducer
* to make sure that only one of the two panels is open at the same time.
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/components/document-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ function DocumentTools( {

/* translators: button label text should, if possible, be under 16 characters. */
const longLabel = _x(
'Toggle block inserter',
'Generic label for block inserter button'
'Block Inserter',
'Generic label for Block Inserter button'
);
const shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export function removedPanels( state = [], action ) {
}

/**
* Reducer to set the block inserter panel open or closed.
* Reducer to set the Block Inserter panel open or closed.
*
* Note: this reducer interacts with the list view panel reducer
* to make sure that only one of the two panels is open at the same time.
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ describe( 'selectors', () => {
} );

describe( 'isInserterOpened', () => {
it( 'returns the block inserter panel isOpened state', () => {
it( 'returns the Block Inserter panel isOpened state', () => {
const state = {
blockInserterPanel: true,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class EditorPage {
return x > width || y > height;
}

// Attempts to find the given block button in the block inserter control.
// Attempts to find the given block button in the Block Inserter control.
async findBlockButton( blockName ) {
await this.waitForInserter();
const blockAccessibilityLabel = `${ blockName } block`;
Expand Down
Loading

0 comments on commit 327d470

Please sign in to comment.