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 } ) {
2626 const { baseOverlay, customOverlay } = useSelect (
2727 ( select ) => {
2828 const themeSlug = select ( coreStore ) . getCurrentTheme ( ) ?. stylesheet ;
29- console . log ( 'themeSlug' , themeSlug ) ;
29+
3030 const _baseOverlay = themeSlug
3131 ? select ( coreStore ) . getEntityRecord (
3232 'postType' ,
@@ -66,6 +66,14 @@ export default function EditOverlayButton( { navRef } ) {
6666 return null ;
6767 }
6868
69+ function goToEditOverlay ( overlayId ) {
70+ history . push ( {
71+ postId : overlayId ,
72+ postType : 'wp_template_part' ,
73+ canvas : 'edit' ,
74+ } ) ;
75+ }
76+
6977 if ( ! history && ! baseOverlay && ! customOverlay ) {
7078 return null ;
7179 }
@@ -79,11 +87,7 @@ export default function EditOverlayButton( { navRef } ) {
7987 // If there is an overlay already
8088 // then just show it.
8189 if ( customOverlay ) {
82- history . push ( {
83- postId : customOverlay . id ,
84- postType : 'wp_template_part' ,
85- canvas : 'edit' ,
86- } ) ;
90+ goToEditOverlay ( customOverlay . id ) ;
8791 return ;
8892 }
8993
@@ -110,12 +114,7 @@ export default function EditOverlayButton( { navRef } ) {
110114 { throwOnError : true }
111115 ) ;
112116
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 ) ;
119118 } }
120119 >
121120 { __ ( 'Edit Overlay' ) }
You can’t perform that action at this time.
0 commit comments