From 564d12e08e35f5b7d36f22e5dbdc88dd8c582de4 Mon Sep 17 00:00:00 2001 From: David Jensen Date: Thu, 1 Aug 2024 08:34:01 -0400 Subject: [PATCH] feat: compatibility with WP 6.6 --- src/edit.js | 11 +++-------- src/sidebar/render.js | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/edit.js b/src/edit.js index 0711c10..0182050 100644 --- a/src/edit.js +++ b/src/edit.js @@ -13,7 +13,7 @@ import { InspectorControls, __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown, __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, - useSetting, + useSettings, store as blockEditorStore, } from '@wordpress/block-editor'; import { useEffect, useRef, useState } from '@wordpress/element'; @@ -78,14 +78,9 @@ export function Edit( props ) { setOpen( false ); }; + const [ availableUnits ] = useSettings( 'spacing.units' ); const units = useCustomUnits( { - availableUnits: useSetting( 'spacing.units' ) || [ - '%', - 'px', - 'em', - 'rem', - 'vw', - ], + availableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ], } ); const widthWithUnit = Number.isFinite( width ) ? width + '%' : width; diff --git a/src/sidebar/render.js b/src/sidebar/render.js index 43c0a6f..16a3c2a 100644 --- a/src/sidebar/render.js +++ b/src/sidebar/render.js @@ -1,5 +1,5 @@ import { __ } from '@wordpress/i18n'; -import { PluginSidebar } from '@wordpress/edit-post'; +import { PluginSidebar } from '@wordpress/editor'; import { useSelect, useDispatch } from '@wordpress/data'; import { store as blockEditorStore } from '@wordpress/block-editor'; import {