@@ -28,16 +28,14 @@ import {
28
28
getColorClassName ,
29
29
useInnerBlocksProps ,
30
30
useBlockEditingMode ,
31
- __unstableBlockToolbarLastItem as BlockToolbarLastItem ,
32
31
} from '@wordpress/block-editor' ;
33
32
import { isURL , prependHTTP , safeDecodeURI } from '@wordpress/url' ;
34
- import { useState , useEffect , useRef , useCallback } from '@wordpress/element' ;
33
+ import { useState , useEffect , useRef } from '@wordpress/element' ;
35
34
import { __unstableStripHTML as stripHTML } from '@wordpress/dom' ;
36
35
import { decodeEntities } from '@wordpress/html-entities' ;
37
36
import { link as linkIcon , addSubmenu } from '@wordpress/icons' ;
38
37
import { store as coreStore } from '@wordpress/core-data' ;
39
38
import { useMergeRefs , usePrevious } from '@wordpress/compose' ;
40
- import { privateApis as routerPrivateApis } from '@wordpress/router' ;
41
39
42
40
/**
43
41
* Internal dependencies
@@ -46,10 +44,6 @@ import { LinkUI } from './link-ui';
46
44
import { updateAttributes } from './update-attributes' ;
47
45
import { getColors } from '../navigation/edit/utils' ;
48
46
import { useToolsPanelDropdownMenuProps } from '../utils/hooks' ;
49
- import { unlock } from '../lock-unlock' ;
50
-
51
- // Safely access useHistory - it may not be available in all contexts
52
- const { useHistory } = routerPrivateApis ? unlock ( routerPrivateApis ) : { } ;
53
47
54
48
const DEFAULT_BLOCK = { name : 'core/navigation-link' } ;
55
49
const NESTING_BLOCK_NAMES = [
@@ -492,24 +486,6 @@ export default function NavigationLinkEdit( {
492
486
customBackgroundColor,
493
487
} = getColors ( context , ! isTopLevelLink ) ;
494
488
495
- const history = useHistory ( ) ;
496
-
497
- const onViewPage = useCallback ( ( ) => {
498
- if ( kind === 'post-type' && id && type ) {
499
- if ( history ) {
500
- // Site editor context
501
- history . navigate ( `/${ type } /${ id } ?canvas=edit` ) ;
502
- } else {
503
- // Post editor context - navigate to the post
504
-
505
- window . open (
506
- `/wp-admin/post.php?post=${ id } &action=edit` ,
507
- '_blank'
508
- ) ;
509
- }
510
- }
511
- } , [ kind , id , type , history ] ) ;
512
-
513
489
function onKeyDown ( event ) {
514
490
if ( isKeyboardEvent . primary ( event , 'k' ) ) {
515
491
// Required to prevent the command center from opening,
@@ -595,20 +571,6 @@ export default function NavigationLinkEdit( {
595
571
/>
596
572
) }
597
573
</ ToolbarGroup >
598
- { /* View button for page-type links */ }
599
- { kind === 'post-type' && id && type && (
600
- < BlockToolbarLastItem >
601
- < ToolbarGroup >
602
- < ToolbarButton
603
- name = "view"
604
- title = { __ ( 'View' ) }
605
- onClick = { onViewPage }
606
- >
607
- { __ ( 'View' ) }
608
- </ ToolbarButton >
609
- </ ToolbarGroup >
610
- </ BlockToolbarLastItem >
611
- ) }
612
574
</ BlockControls >
613
575
{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }
614
576
< InspectorControls >
0 commit comments