88 */
99
1010import { subscribe , select , dispatch } from '@wordpress/data' ;
11- import { unregisterPlugin , registerPlugin } from '@wordpress/plugins' ;
11+ import { unregisterPlugin } from '@wordpress/plugins' ;
1212import { FORM_POST_TYPE } from '../blocks/shared/util/constants.js' ;
13- import { useFormRenameCommand } from './use-form-rename-command.tsx' ;
1413import {
1514 findFormBlock ,
1615 getInsertionIndex ,
@@ -24,21 +23,6 @@ import {
2423
2524import './style.scss' ;
2625
27- /**
28- * Form Rename Command Component
29- * Renders the rename modal and registers the command
30- *
31- * @return {JSX.Element|null } The rename modal component or null
32- */
33- function FormRenameCommand ( ) {
34- return useFormRenameCommand ( ) ;
35- }
36-
37- // Register the rename command plugin
38- registerPlugin ( 'jetpack-form-rename-command' , {
39- render : FormRenameCommand ,
40- } ) ;
41-
4226/**
4327 * Move the Jetpack contact form block category to the front in the editor.
4428 */
@@ -101,7 +85,6 @@ const lockFormBlock = () => {
10185 }
10286
10387 if ( shouldLockBlock ( formBlock ) ) {
104- // Lock the block to prevent removal and moving
10588 updateBlockAttributes ( formBlockClientId , {
10689 lock : {
10790 remove : true ,
@@ -199,9 +182,6 @@ const setupFormEditorSubscription = () => {
199182 const { getCurrentPostType } = select ( 'core/editor' ) ;
200183 const isCurrentPostTypeJetpackForm = getCurrentPostType ( ) === FORM_POST_TYPE ;
201184 if ( isCurrentPostTypeJetpackForm ) {
202- if ( ! formBlockClientId ) {
203- locateFormBlock ( ) ; // Locate the form block if we haven't
204- }
205185 // Check if root blocks changed by comparing their IDs
206186 // This detects when blocks are added, removed, or reordered at the root level
207187 const { getBlocks } = select ( 'core/block-editor' ) ;
@@ -235,6 +215,10 @@ const setupFormEditorSubscription = () => {
235215 }
236216 }
237217
218+ if ( ! formBlockClientId ) {
219+ locateFormBlock ( ) ;
220+ }
221+
238222 if ( ! categoriesFiltered ) {
239223 categoriesFiltered = true ;
240224 moveFormsCategoryToFront ( ) ;
0 commit comments