File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
packages/block-library/src/navigation/edit Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export default function EditOverlayButton( { navRef } ) {
26
26
const { baseOverlay, customOverlay } = useSelect (
27
27
( select ) => {
28
28
const themeSlug = select ( coreStore ) . getCurrentTheme ( ) ?. stylesheet ;
29
- console . log ( 'themeSlug' , themeSlug ) ;
29
+
30
30
const _baseOverlay = themeSlug
31
31
? select ( coreStore ) . getEntityRecord (
32
32
'postType' ,
@@ -66,6 +66,14 @@ export default function EditOverlayButton( { navRef } ) {
66
66
return null ;
67
67
}
68
68
69
+ function goToEditOverlay ( overlayId ) {
70
+ history . push ( {
71
+ postId : overlayId ,
72
+ postType : 'wp_template_part' ,
73
+ canvas : 'edit' ,
74
+ } ) ;
75
+ }
76
+
69
77
if ( ! history && ! baseOverlay && ! customOverlay ) {
70
78
return null ;
71
79
}
@@ -79,11 +87,7 @@ export default function EditOverlayButton( { navRef } ) {
79
87
// If there is an overlay already
80
88
// then just show it.
81
89
if ( customOverlay ) {
82
- history . push ( {
83
- postId : customOverlay . id ,
84
- postType : 'wp_template_part' ,
85
- canvas : 'edit' ,
86
- } ) ;
90
+ goToEditOverlay ( customOverlay . id ) ;
87
91
return ;
88
92
}
89
93
@@ -110,12 +114,7 @@ export default function EditOverlayButton( { navRef } ) {
110
114
{ throwOnError : true }
111
115
) ;
112
116
113
- // 2. Redirect to template editor
114
- history . push ( {
115
- postId : newOverlay . id ,
116
- postType : 'wp_template_part' ,
117
- canvas : 'edit' ,
118
- } ) ;
117
+ goToEditOverlay ( newOverlay ) ;
119
118
} }
120
119
>
121
120
{ __ ( 'Edit Overlay' ) }
You can’t perform that action at this time.
0 commit comments