@@ -6,12 +6,10 @@ import {
66 store as blockEditorStore ,
77 BlockList ,
88 BlockTools ,
9- __experimentalLinkControl as LinkControl ,
109} from '@wordpress/block-editor' ;
1110import { useDispatch , useSelect } from '@wordpress/data' ;
1211import { createBlock } from '@wordpress/blocks' ;
13- import { Popover , VisuallyHidden } from '@wordpress/components' ;
14- import { __unstableStripHTML as stripHTML } from '@wordpress/dom' ;
12+ import { VisuallyHidden } from '@wordpress/components' ;
1513import { useCallback , useEffect , useState } from '@wordpress/element' ;
1614import { store as coreStore } from '@wordpress/core-data' ;
1715
@@ -21,33 +19,6 @@ import { store as coreStore } from '@wordpress/core-data';
2119import { unlock } from '../../private-apis' ;
2220import LeafMoreMenu from './leaf-more-menu' ;
2321
24- function CustomLinkAdditionalBlockUI ( { block, onClose } ) {
25- const { updateBlockAttributes } = useDispatch ( blockEditorStore ) ;
26- const { label, url, opensInNewTab } = block . attributes ;
27- const link = {
28- url,
29- opensInNewTab,
30- title : label && stripHTML ( label ) ,
31- } ;
32- return (
33- < Popover placement = "bottom" shift onClose = { onClose } >
34- < LinkControl
35- hasTextControl
36- hasRichPreviews
37- value = { link }
38- onChange = { ( updatedValue ) => {
39- updateBlockAttributes ( block . clientId , {
40- label : updatedValue . title ,
41- url : updatedValue . url ,
42- opensInNewTab : updatedValue . opensInNewTab ,
43- } ) ;
44- onClose ( ) ;
45- } }
46- onCancel = { onClose }
47- />
48- </ Popover >
49- ) ;
50- }
5122// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
5223const MAX_PAGE_COUNT = 100 ;
5324const PAGES_QUERY = [
@@ -102,29 +73,6 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
10273 const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =
10374 useDispatch ( blockEditorStore ) ;
10475
105- const [ customLinkEditPopoverOpenId , setIsCustomLinkEditPopoverOpenId ] =
106- useState ( false ) ;
107-
108- const renderAdditionalBlockUICallback = useCallback (
109- ( block ) => {
110- if (
111- customLinkEditPopoverOpenId &&
112- block . clientId === customLinkEditPopoverOpenId
113- ) {
114- return (
115- < CustomLinkAdditionalBlockUI
116- block = { block }
117- onClose = { ( ) => {
118- setIsCustomLinkEditPopoverOpenId ( false ) ;
119- } }
120- />
121- ) ;
122- }
123- return null ;
124- } ,
125- [ customLinkEditPopoverOpenId , setIsCustomLinkEditPopoverOpenId ]
126- ) ;
127-
12876 // Delay loading stop by 50ms to avoid flickering.
12977 useEffect ( ( ) => {
13078 let timeoutId ;
@@ -156,22 +104,11 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
156104 block . clientId ,
157105 createBlock ( 'core/navigation-link' , block . attributes )
158106 ) ;
159- } else if (
160- block . name === 'core/navigation-link' &&
161- block . attributes . kind === 'custom' &&
162- block . attributes . url
163- ) {
164- setIsCustomLinkEditPopoverOpenId ( block . clientId ) ;
165107 } else {
166108 onSelect ( block ) ;
167109 }
168110 } ,
169- [
170- onSelect ,
171- __unstableMarkNextChangeAsNotPersistent ,
172- replaceBlock ,
173- setIsCustomLinkEditPopoverOpenId ,
174- ]
111+ [ onSelect , __unstableMarkNextChangeAsNotPersistent , replaceBlock ]
175112 ) ;
176113
177114 // The hidden block is needed because it makes block edit side effects trigger.
@@ -188,7 +125,6 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
188125 onSelect = { offCanvasOnselect }
189126 blockSettingsMenu = { LeafMoreMenu }
190127 showAppender = { false }
191- renderAdditionalBlockUI = { renderAdditionalBlockUICallback }
192128 />
193129 ) }
194130 < VisuallyHidden aria-hidden = "true" >
0 commit comments