Skip to content

Commit

Permalink
Mark the inserter slot as unstable (#31417)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored May 7, 2021
1 parent b7fd98e commit d312574
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/block-directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If

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 `__experimentalInserterMenuExtension`, 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.
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.

See also the API endpoints for searching WordPress.org: `/wp/v2/block-directory/search`, and installing & activating plugins: `/wp/v2/plugins/`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { debounce } from 'lodash';
/**
* WordPress dependencies
*/
import { __experimentalInserterMenuExtension } from '@wordpress/block-editor';
import { __unstableInserterMenuExtension } from '@wordpress/block-editor';
import { useState } from '@wordpress/element';

/**
Expand All @@ -19,7 +19,7 @@ function InserterMenuDownloadableBlocksPanel() {
const debouncedSetFilterValue = debounce( setFilterValue, 400 );

return (
<__experimentalInserterMenuExtension>
<__unstableInserterMenuExtension>
{ ( {
onSelect,
onHover,
Expand All @@ -46,7 +46,7 @@ function InserterMenuDownloadableBlocksPanel() {
/>
);
} }
</__experimentalInserterMenuExtension>
</__unstableInserterMenuExtension>
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export { default as withColorContext } from './color-palette/with-color-context'
*/

export { default as __unstableBlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';
export { default as __experimentalInserterMenuExtension } from './inserter-menu-extension';
export { default as __unstableInserterMenuExtension } from './inserter-menu-extension';
export { default as __experimentalPreviewOptions } from './preview-options';
export { default as __experimentalUseResizeCanvas } from './use-resize-canvas';
export { default as BlockInspector } from './block-inspector';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import { createSlotFill } from '@wordpress/components';

const { Fill: __experimentalInserterMenuExtension, Slot } = createSlotFill(
'__experimentalInserterMenuExtension'
const { Fill: __unstableInserterMenuExtension, Slot } = createSlotFill(
'__unstableInserterMenuExtension'
);

__experimentalInserterMenuExtension.Slot = Slot;
__unstableInserterMenuExtension.Slot = Slot;

export default __experimentalInserterMenuExtension;
export default __unstableInserterMenuExtension;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { speak } from '@wordpress/a11y';
*/
import BlockTypesList from '../block-types-list';
import BlockPatternsList from '../block-patterns-list';
import __experimentalInserterMenuExtension from '../inserter-menu-extension';
import __unstableInserterMenuExtension from '../inserter-menu-extension';
import InserterPanel from './panel';
import InserterNoResults from './no-results';
import useInsertionPoint from './hooks/use-insertion-point';
Expand Down Expand Up @@ -151,7 +151,7 @@ function InserterSearchResults( {
) }

{ showBlockDirectory && (
<__experimentalInserterMenuExtension.Slot
<__unstableInserterMenuExtension.Slot
fillProps={ {
onSelect: onSelectBlockType,
onHover,
Expand All @@ -169,7 +169,7 @@ function InserterSearchResults( {
}
return null;
} }
</__experimentalInserterMenuExtension.Slot>
</__unstableInserterMenuExtension.Slot>
) }
</InserterListbox>
);
Expand Down

0 comments on commit d312574

Please sign in to comment.