Skip to content

Commit

Permalink
Update coreDeviceTypes docs
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed May 24, 2021
1 parent d7c329e commit 18f2596
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
16 changes: 15 additions & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,21 @@ Undocumented declaration.

<a name="coreDeviceTypes" href="#coreDeviceTypes">#</a> **coreDeviceTypes**

Undocumented declaration.
An array of strings that represent `deviceType` values that belong to the
block editor core system.

When the `deviceType` returned by `__experimentalGetPreviewDeviceType()`, is
one of these values, the built-in `VisualEditor` is responsible for rendering
a preview of that type.

When the `deviceType` is something other than one of the `coreDeviceTypes`,
we are rendering a custom preview registered by the
`<PluginPreviewMenuItem />` and `<PluginPreview />` components, and defer to
a `<Slot />` filled by the plugin to draw the preview.

_Type_

- `Array`

<a name="createCustomColorsHOC" href="#createCustomColorsHOC">#</a> **createCustomColorsHOC**

Expand Down
25 changes: 14 additions & 11 deletions packages/block-editor/src/components/preview-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ const {

export { PluginPreviewMenuFill };

/*
* coreDeviceTypes: An array of strings. The strings returned represent
* deviceType values that belong to the core system. When the deviceType,
* returned by `__experimentalGetPreviewDeviceType()`, is one of these values,
* the built in VisualEditor is responsible for rendering a preview of that
* type.
* When the deviceType is something other than one of the coreDeviceTypes, we are
* rendering a custom deviceType registered by the <PluginPreviewMenuItem /> and
* <PluginPreview /> components, and defer to a <Slot /> filled by the plugin to
* draw the preview.
/**
* An array of strings that represent `deviceType` values that belong to the
* block editor core system.
*
* When the `deviceType` returned by `__experimentalGetPreviewDeviceType()`, is
* one of these values, the built-in `VisualEditor` is responsible for rendering
* a preview of that type.
*
* When the `deviceType` is something other than one of the `coreDeviceTypes`,
* we are rendering a custom preview registered by the
* `<PluginPreviewMenuItem />` and `<PluginPreview />` components, and defer to
* a `<Slot />` filled by the plugin to draw the preview.
*
* @type {Array}
*/
export const coreDeviceTypes = [ 'Desktop', 'Tablet', 'Mobile' ];

Expand Down

0 comments on commit 18f2596

Please sign in to comment.