diff --git a/.eslintrc.js b/.eslintrc.js index b613ac6c6f6d82..7c89b96e997f61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -50,6 +50,7 @@ const restrictedImports = [ 'castArray', 'chunk', 'clamp', + 'clone', 'cloneDeep', 'compact', 'concat', @@ -122,6 +123,7 @@ const restrictedImports = [ 'reject', 'repeat', 'reverse', + 'setWith', 'size', 'snakeCase', 'some', diff --git a/package-lock.json b/package-lock.json index e5095432624b79..c196eed47005ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17416,6 +17416,7 @@ "@wordpress/dom": "file:packages/dom", "@wordpress/element": "file:packages/element", "@wordpress/escape-html": "file:packages/escape-html", + "@wordpress/experiments": "file:packages/experiments", "@wordpress/hooks": "file:packages/hooks", "@wordpress/html-entities": "file:packages/html-entities", "@wordpress/i18n": "file:packages/i18n", @@ -17886,6 +17887,7 @@ "@wordpress/deprecated": "file:packages/deprecated", "@wordpress/editor": "file:packages/editor", "@wordpress/element": "file:packages/element", + "@wordpress/experiments": "file:packages/experiments", "@wordpress/hooks": "file:packages/hooks", "@wordpress/html-entities": "file:packages/html-entities", "@wordpress/i18n": "file:packages/i18n", diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 5a861eaa1acad7..7ccac465a336a1 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -348,6 +348,10 @@ _Returns_ Undocumented declaration. +### experiments + +Experimental @wordpress/block-editor APIs. + ### FontSizePicker _Related_ diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index d33c015ad77dd4..00e570a3fefc42 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -45,6 +45,7 @@ "@wordpress/dom": "file:../dom", "@wordpress/element": "file:../element", "@wordpress/escape-html": "file:../escape-html", + "@wordpress/experiments": "file:../experiments", "@wordpress/hooks": "file:../hooks", "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", diff --git a/packages/block-editor/src/components/autocomplete/index.js b/packages/block-editor/src/components/autocomplete/index.js index da211838089f52..91cc3aa4e7cf03 100644 --- a/packages/block-editor/src/components/autocomplete/index.js +++ b/packages/block-editor/src/components/autocomplete/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { clone } from 'lodash'; - /** * WordPress dependencies */ @@ -44,7 +39,9 @@ function useCompleters( { completers = EMPTY_ARRAY } ) { if ( hasFilter( 'editor.Autocomplete.completers' ) ) { // Provide copies so filters may directly modify them. if ( filteredCompleters === completers ) { - filteredCompleters = filteredCompleters.map( clone ); + filteredCompleters = filteredCompleters.map( + ( completer ) => ( { ...completer } ) + ); } filteredCompleters = applyFilters( diff --git a/packages/block-editor/src/components/block-pattern-setup/index.js b/packages/block-editor/src/components/block-pattern-setup/index.js index b39aa070c529e3..22d51466b3b6e9 100644 --- a/packages/block-editor/src/components/block-pattern-setup/index.js +++ b/packages/block-editor/src/components/block-pattern-setup/index.js @@ -127,10 +127,7 @@ function BlockPatternSlide( { className, pattern, minHeight } ) { aria-label={ title } aria-describedby={ description ? descriptionId : undefined } > - + { !! description && ( { description } diff --git a/packages/block-editor/src/components/block-preview/README.md b/packages/block-editor/src/components/block-preview/README.md index 6ae8cfe97514a2..5cce2e45cb54ff 100644 --- a/packages/block-editor/src/components/block-preview/README.md +++ b/packages/block-editor/src/components/block-preview/README.md @@ -30,26 +30,26 @@ Width of the preview container in pixels. Controls at what size the blocks will Set `viewportWidth` to `0` to make the viewport the same width as the container. -### `__experimentalPadding` +### minHeight -- **Type** `Int` -- **Default** `undefined` +Minimum height of the preview iframe in pixels. -Padding for the preview container body. +- **Type:** `Int` +- **Default:** `undefined` -### `__experimentalStyles` +### `additionalStyles` List of additional editor styles to load into the preview iframe. Each object should contain a `css` attribute. See `EditorStyles` for more info. ```jsx ``` -- **Type** `Int` +- **Type** `Array` - **Default** `[]` diff --git a/packages/block-editor/src/components/block-preview/auto.js b/packages/block-editor/src/components/block-preview/auto.js index fb763ed466629c..287bcd5b185662 100644 --- a/packages/block-editor/src/components/block-preview/auto.js +++ b/packages/block-editor/src/components/block-preview/auto.js @@ -23,9 +23,8 @@ const MAX_HEIGHT = 2000; function ScaledBlockPreview( { viewportWidth, containerWidth, - __experimentalPadding, - __experimentalMinHeight, - __experimentalStyles, + minHeight, + additionalStyles = [], } ) { if ( ! viewportWidth ) { viewportWidth = containerWidth; @@ -46,16 +45,16 @@ function ScaledBlockPreview( { if ( styles ) { return [ ...styles, - ...__experimentalStyles, { - css: 'body{height:auto;overflow:hidden;border:none;}', + css: 'body{height:auto;overflow:hidden;border:none;padding:0;}', __unstableType: 'presets', }, + ...additionalStyles, ]; } return styles; - }, [ styles, __experimentalStyles ] ); + }, [ styles, additionalStyles ] ); const svgFilters = useMemo( () => { return [ ...( duotone?.default ?? [] ), ...( duotone?.theme ?? [] ) ]; @@ -73,7 +72,7 @@ function ScaledBlockPreview( { height: contentHeight * scale, maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined, - minHeight: __experimentalMinHeight, + minHeight, } } >