From e6fa033ddc279dc51e2cd326723f85db46dab9e6 Mon Sep 17 00:00:00 2001 From: Ella Date: Mon, 11 Dec 2023 20:58:48 +0100 Subject: [PATCH] Block editor: hooks: avoid BlockEdit filter for content locking UI --- .../block-editor/src/hooks/content-lock-ui.js | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/packages/block-editor/src/hooks/content-lock-ui.js b/packages/block-editor/src/hooks/content-lock-ui.js index 8f95c14d118e56..1bcd0d7ce80163 100644 --- a/packages/block-editor/src/hooks/content-lock-ui.js +++ b/packages/block-editor/src/hooks/content-lock-ui.js @@ -2,9 +2,7 @@ * WordPress dependencies */ import { ToolbarButton, MenuItem } from '@wordpress/components'; -import { createHigherOrderComponent, pure } from '@wordpress/compose'; import { useDispatch, useSelect } from '@wordpress/data'; -import { addFilter } from '@wordpress/hooks'; import { __ } from '@wordpress/i18n'; import { useEffect, useRef, useCallback } from '@wordpress/element'; @@ -147,28 +145,9 @@ function ContentLockControlsPure( { clientId, isSelected } ) { ); } -// We don't want block controls to re-render when typing inside a block. `pure` -// will prevent re-renders unless props change, so only pass the needed props -// and not the whole attributes object. -const ContentLockControls = pure( ContentLockControlsPure ); - -export const withContentLockControls = createHigherOrderComponent( - ( BlockEdit ) => ( props ) => { - return ( - <> - - - - ); +export default { + edit: ContentLockControlsPure, + hasSupport() { + return true; }, - 'withContentLockControls' -); - -addFilter( - 'editor.BlockEdit', - 'core/content-lock-ui/with-block-controls', - withContentLockControls -); +};