@wordpress/edit-site 5.12.7 → 5.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/build/components/block-editor/editor-canvas.js +1 -1
  2. package/build/components/block-editor/editor-canvas.js.map +1 -1
  3. package/build/components/block-editor/index.js +0 -4
  4. package/build/components/block-editor/index.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +12 -6
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/create-pattern-modal/index.js +7 -3
  8. package/build/components/create-pattern-modal/index.js.map +1 -1
  9. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  10. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  11. package/build/components/page-patterns/grid-item.js +83 -59
  12. package/build/components/page-patterns/grid-item.js.map +1 -1
  13. package/build/components/page-patterns/grid.js +81 -13
  14. package/build/components/page-patterns/grid.js.map +1 -1
  15. package/build/components/page-patterns/header.js +69 -0
  16. package/build/components/page-patterns/header.js.map +1 -0
  17. package/build/components/page-patterns/index.js +3 -1
  18. package/build/components/page-patterns/index.js.map +1 -1
  19. package/build/components/page-patterns/patterns-list.js +66 -27
  20. package/build/components/page-patterns/patterns-list.js.map +1 -1
  21. package/build/components/page-patterns/rename-menu-item.js +109 -0
  22. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  23. package/build/components/page-patterns/use-patterns.js +99 -118
  24. package/build/components/page-patterns/use-patterns.js.map +1 -1
  25. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  26. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  27. package/build/components/page-template-parts/index.js +2 -23
  28. package/build/components/page-template-parts/index.js.map +1 -1
  29. package/build/components/resizable-frame/index.js +75 -32
  30. package/build/components/resizable-frame/index.js.map +1 -1
  31. package/build/components/sidebar-navigation-screen/index.js +14 -8
  32. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  33. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  34. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  36. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  38. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
  40. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
  42. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  44. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  45. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  46. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  47. package/build/components/sidebar-navigation-screen-patterns/index.js +5 -6
  48. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  49. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  50. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  51. package/build/components/site-hub/index.js +4 -2
  52. package/build/components/site-hub/index.js.map +1 -1
  53. package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
  54. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  55. package/build/components/template-actions/index.js +3 -1
  56. package/build/components/template-actions/index.js.map +1 -1
  57. package/build/components/template-actions/rename-menu-item.js +9 -6
  58. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  59. package/build/hooks/push-changes-to-global-styles/index.js +3 -1
  60. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  61. package/build/utils/use-activate-theme.js +1 -1
  62. package/build/utils/use-activate-theme.js.map +1 -1
  63. package/build-module/components/block-editor/editor-canvas.js +1 -1
  64. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  65. package/build-module/components/block-editor/index.js +0 -4
  66. package/build-module/components/block-editor/index.js.map +1 -1
  67. package/build-module/components/block-editor/use-site-editor-settings.js +13 -7
  68. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  69. package/build-module/components/create-pattern-modal/index.js +6 -3
  70. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  71. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  72. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  73. package/build-module/components/page-patterns/grid-item.js +84 -65
  74. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  75. package/build-module/components/page-patterns/grid.js +82 -15
  76. package/build-module/components/page-patterns/grid.js.map +1 -1
  77. package/build-module/components/page-patterns/header.js +54 -0
  78. package/build-module/components/page-patterns/header.js.map +1 -0
  79. package/build-module/components/page-patterns/index.js +3 -1
  80. package/build-module/components/page-patterns/index.js.map +1 -1
  81. package/build-module/components/page-patterns/patterns-list.js +68 -30
  82. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  83. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  84. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  85. package/build-module/components/page-patterns/use-patterns.js +100 -119
  86. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  87. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  88. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  89. package/build-module/components/page-template-parts/index.js +3 -22
  90. package/build-module/components/page-template-parts/index.js.map +1 -1
  91. package/build-module/components/resizable-frame/index.js +76 -35
  92. package/build-module/components/resizable-frame/index.js.map +1 -1
  93. package/build-module/components/sidebar-navigation-screen/index.js +15 -9
  94. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  95. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  96. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  97. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  98. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  99. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  100. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  101. package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
  102. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  103. package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
  104. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  105. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  106. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  107. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  108. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  109. package/build-module/components/sidebar-navigation-screen-patterns/index.js +5 -6
  110. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  111. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  112. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  113. package/build-module/components/site-hub/index.js +4 -2
  114. package/build-module/components/site-hub/index.js.map +1 -1
  115. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
  116. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  117. package/build-module/components/template-actions/index.js +2 -1
  118. package/build-module/components/template-actions/index.js.map +1 -1
  119. package/build-module/components/template-actions/rename-menu-item.js +8 -6
  120. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  121. package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
  122. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  123. package/build-module/utils/use-activate-theme.js +1 -1
  124. package/build-module/utils/use-activate-theme.js.map +1 -1
  125. package/build-style/style-rtl.css +150 -54
  126. package/build-style/style.css +150 -54
  127. package/package.json +14 -14
  128. package/src/components/block-editor/editor-canvas.js +1 -1
  129. package/src/components/block-editor/index.js +0 -4
  130. package/src/components/block-editor/use-site-editor-settings.js +16 -11
  131. package/src/components/create-pattern-modal/index.js +5 -2
  132. package/src/components/header-edit-mode/document-actions/style.scss +4 -0
  133. package/src/components/layout/style.scss +1 -0
  134. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  135. package/src/components/page-patterns/grid-item.js +187 -137
  136. package/src/components/page-patterns/grid.js +118 -20
  137. package/src/components/page-patterns/header.js +69 -0
  138. package/src/components/page-patterns/index.js +6 -1
  139. package/src/components/page-patterns/patterns-list.js +87 -46
  140. package/src/components/page-patterns/rename-menu-item.js +115 -0
  141. package/src/components/page-patterns/style.scss +106 -26
  142. package/src/components/page-patterns/use-patterns.js +96 -167
  143. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  144. package/src/components/page-template-parts/index.js +3 -22
  145. package/src/components/resizable-frame/index.js +100 -31
  146. package/src/components/resizable-frame/style.scss +26 -9
  147. package/src/components/sidebar-navigation-item/style.scss +10 -1
  148. package/src/components/sidebar-navigation-screen/index.js +14 -7
  149. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +1 -3
  150. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  151. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
  152. package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
  153. package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
  154. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
  155. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  156. package/src/components/sidebar-navigation-screen-patterns/index.js +20 -24
  157. package/src/components/sidebar-navigation-screen-patterns/style.scss +0 -3
  158. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
  159. package/src/components/site-hub/index.js +6 -2
  160. package/src/components/site-hub/style.scss +5 -0
  161. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
  162. package/src/components/template-actions/index.js +2 -1
  163. package/src/components/template-actions/rename-menu-item.js +8 -6
  164. package/src/hooks/push-changes-to-global-styles/index.js +8 -1
  165. package/src/style.scss +10 -12
  166. package/src/utils/use-activate-theme.js +1 -1
@@ -6,18 +6,19 @@ import { useSelect } from '@wordpress/data';
6
6
  import { __ } from '@wordpress/i18n';
7
7
 
8
8
  export default function useMyPatterns() {
9
- const myPatterns = useSelect( ( select ) =>
10
- select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
11
- per_page: -1,
12
- } )
9
+ const myPatternsCount = useSelect(
10
+ ( select ) =>
11
+ select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
12
+ per_page: -1,
13
+ } )?.length ?? 0
13
14
  );
14
15
 
15
16
  return {
16
17
  myPatterns: {
17
- count: myPatterns?.length || 0,
18
+ count: myPatternsCount,
18
19
  name: 'my-patterns',
19
20
  label: __( 'My patterns' ),
20
21
  },
21
- hasPatterns: !! myPatterns?.length,
22
+ hasPatterns: myPatternsCount > 0,
22
23
  };
23
24
  }
@@ -51,13 +51,16 @@ const SiteHub = forwardRef( ( props, ref ) => {
51
51
  const { open: openCommandCenter } = useDispatch( commandsStore );
52
52
 
53
53
  const disableMotion = useReducedMotion();
54
- const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
54
+ const {
55
+ setCanvasMode,
56
+ __experimentalSetPreviewDeviceType: setPreviewDeviceType,
57
+ } = unlock( useDispatch( editSiteStore ) );
55
58
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
56
59
  const isBackToDashboardButton = canvasMode === 'view';
57
60
  const siteIconButtonProps = isBackToDashboardButton
58
61
  ? {
59
62
  href: dashboardLink,
60
- label: __( 'Go back to the Dashboard' ),
63
+ label: __( 'Go to the Dashboard' ),
61
64
  }
62
65
  : {
63
66
  href: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
@@ -67,6 +70,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
67
70
  event.preventDefault();
68
71
  if ( canvasMode === 'edit' ) {
69
72
  clearSelectedBlock();
73
+ setPreviewDeviceType( 'desktop' );
70
74
  setCanvasMode( 'view' );
71
75
  }
72
76
  },
@@ -8,6 +8,11 @@
8
8
  gap: 0;
9
9
  }
10
10
 
11
+ .edit-site-site-hub__site-title,
12
+ .edit-site-site-hub_toggle-command-center {
13
+ transition: opacity ease 0.1s;
14
+ }
15
+
11
16
  .edit-site-site-hub__site-view-link {
12
17
  flex-grow: 0;
13
18
  @include break-mobile() {
@@ -36,6 +36,12 @@ export function getPathFromURL( urlParams ) {
36
36
  return path;
37
37
  }
38
38
 
39
+ function isSubset( subset, superset ) {
40
+ return Object.entries( subset ).every( ( [ key, value ] ) => {
41
+ return superset[ key ] === value;
42
+ } );
43
+ }
44
+
39
45
  export default function useSyncPathWithURL() {
40
46
  const history = useHistory();
41
47
  const { params: urlParams } = useLocation();
@@ -44,76 +50,77 @@ export default function useSyncPathWithURL() {
44
50
  params: navigatorParams,
45
51
  goTo,
46
52
  } = useNavigator();
47
- const currentUrlParams = useRef( urlParams );
48
- const currentPath = useRef( navigatorLocation.path );
49
53
  const isMounting = useRef( true );
50
54
 
51
- useEffect( () => {
52
- // The navigatorParams are only initially filled properly when the
53
- // navigator screens mount. so we ignore the first synchronisation.
54
- if ( isMounting.current ) {
55
- isMounting.current = false;
56
- return;
57
- }
58
-
59
- function updateUrlParams( newUrlParams ) {
60
- if (
61
- Object.entries( newUrlParams ).every( ( [ key, value ] ) => {
62
- return currentUrlParams.current[ key ] === value;
63
- } )
64
- ) {
55
+ useEffect(
56
+ () => {
57
+ // The navigatorParams are only initially filled properly when the
58
+ // navigator screens mount. so we ignore the first synchronisation.
59
+ if ( isMounting.current ) {
60
+ isMounting.current = false;
65
61
  return;
66
62
  }
67
- const updatedParams = {
68
- ...currentUrlParams.current,
69
- ...newUrlParams,
70
- };
71
- currentUrlParams.current = updatedParams;
72
- history.push( updatedParams );
73
- }
74
63
 
75
- if ( navigatorParams?.postType && navigatorParams?.postId ) {
76
- updateUrlParams( {
77
- postType: navigatorParams?.postType,
78
- postId: navigatorParams?.postId,
79
- path: undefined,
80
- } );
81
- } else if (
82
- navigatorLocation.path.startsWith( '/page/' ) &&
83
- navigatorParams?.postId
84
- ) {
85
- updateUrlParams( {
86
- postType: 'page',
87
- postId: navigatorParams?.postId,
88
- path: undefined,
89
- } );
90
- } else if ( navigatorLocation.path === '/patterns' ) {
91
- updateUrlParams( {
92
- postType: undefined,
93
- postId: undefined,
94
- canvas: undefined,
95
- path: navigatorLocation.path,
96
- } );
97
- } else {
98
- updateUrlParams( {
99
- postType: undefined,
100
- postId: undefined,
101
- categoryType: undefined,
102
- categoryId: undefined,
103
- path:
104
- navigatorLocation.path === '/'
105
- ? undefined
106
- : navigatorLocation.path,
107
- } );
108
- }
109
- }, [ navigatorLocation?.path, navigatorParams, history ] );
64
+ function updateUrlParams( newUrlParams ) {
65
+ if ( isSubset( newUrlParams, urlParams ) ) {
66
+ return;
67
+ }
68
+ const updatedParams = {
69
+ ...urlParams,
70
+ ...newUrlParams,
71
+ };
72
+ history.push( updatedParams );
73
+ }
110
74
 
111
- useEffect( () => {
112
- currentUrlParams.current = urlParams;
113
- const path = getPathFromURL( urlParams );
114
- if ( currentPath.current !== path ) {
115
- currentPath.current = path;
116
- goTo( path );
117
- }
118
- }, [ urlParams, goTo ] );
75
+ if ( navigatorParams?.postType && navigatorParams?.postId ) {
76
+ updateUrlParams( {
77
+ postType: navigatorParams?.postType,
78
+ postId: navigatorParams?.postId,
79
+ path: undefined,
80
+ } );
81
+ } else if (
82
+ navigatorLocation.path.startsWith( '/page/' ) &&
83
+ navigatorParams?.postId
84
+ ) {
85
+ updateUrlParams( {
86
+ postType: 'page',
87
+ postId: navigatorParams?.postId,
88
+ path: undefined,
89
+ } );
90
+ } else if ( navigatorLocation.path === '/patterns' ) {
91
+ updateUrlParams( {
92
+ postType: undefined,
93
+ postId: undefined,
94
+ canvas: undefined,
95
+ path: navigatorLocation.path,
96
+ } );
97
+ } else {
98
+ updateUrlParams( {
99
+ postType: undefined,
100
+ postId: undefined,
101
+ categoryType: undefined,
102
+ categoryId: undefined,
103
+ path:
104
+ navigatorLocation.path === '/'
105
+ ? undefined
106
+ : navigatorLocation.path,
107
+ } );
108
+ }
109
+ },
110
+ // Trigger only when navigator changes to prevent infinite loops.
111
+ // eslint-disable-next-line react-hooks/exhaustive-deps
112
+ [ navigatorLocation?.path, navigatorParams ]
113
+ );
114
+
115
+ useEffect(
116
+ () => {
117
+ const path = getPathFromURL( urlParams );
118
+ if ( navigatorLocation.path !== path ) {
119
+ goTo( path );
120
+ }
121
+ },
122
+ // Trigger only when URL changes to prevent infinite loops.
123
+ // eslint-disable-next-line react-hooks/exhaustive-deps
124
+ [ urlParams ]
125
+ );
119
126
  }
@@ -13,6 +13,7 @@ import {
13
13
  } from '@wordpress/components';
14
14
  import { moreVertical } from '@wordpress/icons';
15
15
  import { store as noticesStore } from '@wordpress/notices';
16
+ import { decodeEntities } from '@wordpress/html-entities';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
@@ -58,7 +59,7 @@ export default function TemplateActions( {
58
59
  sprintf(
59
60
  /* translators: The template/part's name. */
60
61
  __( '"%s" reverted.' ),
61
- template.title.rendered
62
+ decodeEntities( template.title.rendered )
62
63
  ),
63
64
  {
64
65
  type: 'snackbar',
@@ -14,9 +14,11 @@ import {
14
14
  } from '@wordpress/components';
15
15
  import { store as coreStore } from '@wordpress/core-data';
16
16
  import { store as noticesStore } from '@wordpress/notices';
17
+ import { decodeEntities } from '@wordpress/html-entities';
17
18
 
18
19
  export default function RenameMenuItem( { template, onClose } ) {
19
- const [ title, setTitle ] = useState( () => template.title.rendered );
20
+ const title = decodeEntities( template.title.rendered );
21
+ const [ editedTitle, setEditedTitle ] = useState( title );
20
22
  const [ isModalOpen, setIsModalOpen ] = useState( false );
21
23
 
22
24
  const { editEntityRecord, saveEditedEntityRecord } =
@@ -33,11 +35,11 @@ export default function RenameMenuItem( { template, onClose } ) {
33
35
 
34
36
  try {
35
37
  await editEntityRecord( 'postType', template.type, template.id, {
36
- title,
38
+ title: editedTitle,
37
39
  } );
38
40
 
39
41
  // Update state before saving rerenders the list.
40
- setTitle( '' );
42
+ setEditedTitle( '' );
41
43
  setIsModalOpen( false );
42
44
  onClose();
43
45
 
@@ -67,7 +69,7 @@ export default function RenameMenuItem( { template, onClose } ) {
67
69
  <MenuItem
68
70
  onClick={ () => {
69
71
  setIsModalOpen( true );
70
- setTitle( template.title.rendered );
72
+ setEditedTitle( title );
71
73
  } }
72
74
  >
73
75
  { __( 'Rename' ) }
@@ -85,8 +87,8 @@ export default function RenameMenuItem( { template, onClose } ) {
85
87
  <TextControl
86
88
  __nextHasNoMarginBottom
87
89
  label={ __( 'Name' ) }
88
- value={ title }
89
- onChange={ setTitle }
90
+ value={ editedTitle }
91
+ onChange={ setEditedTitle }
90
92
  required
91
93
  />
92
94
 
@@ -18,6 +18,7 @@ import { __, sprintf } from '@wordpress/i18n';
18
18
  import {
19
19
  __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
20
20
  getBlockType,
21
+ hasBlockSupport,
21
22
  } from '@wordpress/blocks';
22
23
  import { useContext, useMemo, useCallback } from '@wordpress/element';
23
24
  import { useDispatch } from '@wordpress/data';
@@ -93,6 +94,8 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
93
94
  'typography.fontFamily': 'fontFamily',
94
95
  };
95
96
 
97
+ const SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];
98
+
96
99
  function useChangesToPush( name, attributes ) {
97
100
  const supports = useSupportedStyles( name );
98
101
 
@@ -212,10 +215,14 @@ function PushChangesToGlobalStylesControl( {
212
215
  const withPushChangesToGlobalStyles = createHigherOrderComponent(
213
216
  ( BlockEdit ) => ( props ) => {
214
217
  const blockEditingMode = useBlockEditingMode();
218
+ const supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>
219
+ hasBlockSupport( props.name, feature )
220
+ );
221
+
215
222
  return (
216
223
  <>
217
224
  <BlockEdit { ...props } />
218
- { blockEditingMode === 'default' && (
225
+ { blockEditingMode === 'default' && supportsStyles && (
219
226
  <InspectorAdvancedControls>
220
227
  <PushChangesToGlobalStylesControl { ...props } />
221
228
  </InspectorAdvancedControls>
package/src/style.scss CHANGED
@@ -47,27 +47,20 @@
47
47
  @import "./components/resizable-frame/style.scss";
48
48
  @import "./hooks/push-changes-to-global-styles/style.scss";
49
49
 
50
- html #wpadminbar {
50
+ body.js #wpadminbar {
51
51
  display: none;
52
52
  }
53
53
 
54
- html #wpbody {
54
+ body.js #wpbody {
55
55
  padding-top: 0;
56
56
  }
57
57
 
58
- // In order to use mix-blend-mode, this element needs to have an explicitly set background-color.
59
- // We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations.
60
- html.wp-toolbar {
61
- background: $white;
62
- padding-top: 0;
63
- }
64
-
65
- body.appearance_page_gutenberg-template-parts,
66
- body.site-editor-php {
58
+ body.js.appearance_page_gutenberg-template-parts,
59
+ body.js.site-editor-php {
67
60
  @include wp-admin-reset(".edit-site");
68
61
  }
69
62
 
70
- body.site-editor-php {
63
+ body.js.site-editor-php {
71
64
  background: $gray-900;
72
65
  }
73
66
 
@@ -91,6 +84,11 @@ body.site-editor-php {
91
84
  top: 0;
92
85
  }
93
86
 
87
+ .no-js & {
88
+ min-height: 0;
89
+ position: static;
90
+ }
91
+
94
92
  .interface-interface-skeleton {
95
93
  top: 0;
96
94
  }
@@ -29,7 +29,7 @@ export function useActivateTheme() {
29
29
  'themes.php?action=activate&stylesheet=' +
30
30
  currentlyPreviewingTheme() +
31
31
  '&_wpnonce=' +
32
- window.BLOCK_THEME_ACTIVATE_NONCE;
32
+ window.WP_BLOCK_THEME_ACTIVATE_NONCE;
33
33
  await window.fetch( activationURL );
34
34
  const { wp_theme_preview: themePreview, ...params } =
35
35
  location.params;