@wordpress/edit-site 5.12.6 → 5.12.8

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 (209) 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/use-site-editor-settings.js +10 -5
  4. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  5. package/build/components/create-pattern-modal/index.js +8 -4
  6. package/build/components/create-pattern-modal/index.js.map +1 -1
  7. package/build/components/global-styles/palette.js +1 -1
  8. package/build/components/global-styles/palette.js.map +1 -1
  9. package/build/components/header-edit-mode/index.js +6 -2
  10. package/build/components/header-edit-mode/index.js.map +1 -1
  11. package/build/components/layout/index.js +1 -1
  12. package/build/components/layout/index.js.map +1 -1
  13. package/build/components/page/header.js +1 -1
  14. package/build/components/page/header.js.map +1 -1
  15. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
  16. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  17. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  18. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  19. package/build/components/page-patterns/grid-item.js +84 -60
  20. package/build/components/page-patterns/grid-item.js.map +1 -1
  21. package/build/components/page-patterns/grid.js +21 -13
  22. package/build/components/page-patterns/grid.js.map +1 -1
  23. package/build/components/page-patterns/header.js +69 -0
  24. package/build/components/page-patterns/header.js.map +1 -0
  25. package/build/components/page-patterns/index.js +3 -1
  26. package/build/components/page-patterns/index.js.map +1 -1
  27. package/build/components/page-patterns/patterns-list.js +67 -27
  28. package/build/components/page-patterns/patterns-list.js.map +1 -1
  29. package/build/components/page-patterns/rename-menu-item.js +109 -0
  30. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  31. package/build/components/page-patterns/use-patterns.js +99 -126
  32. package/build/components/page-patterns/use-patterns.js.map +1 -1
  33. package/build/components/page-template-parts/index.js +1 -0
  34. package/build/components/page-template-parts/index.js.map +1 -1
  35. package/build/components/page-templates/index.js +1 -0
  36. package/build/components/page-templates/index.js.map +1 -1
  37. package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
  38. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen/index.js +1 -1
  40. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -17
  42. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-main/index.js +4 -2
  44. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  45. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
  46. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  47. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
  48. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  49. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
  50. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  51. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
  52. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  53. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
  54. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  55. package/build/components/sidebar-navigation-screen-patterns/index.js +68 -43
  56. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  57. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  58. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  59. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
  60. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  61. package/build/components/site-hub/index.js +2 -2
  62. package/build/components/site-hub/index.js.map +1 -1
  63. package/build/components/template-actions/index.js +25 -7
  64. package/build/components/template-actions/index.js.map +1 -1
  65. package/build/components/template-actions/rename-menu-item.js +9 -6
  66. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  67. package/build/components/welcome-guide/page.js +2 -2
  68. package/build/components/welcome-guide/page.js.map +1 -1
  69. package/build/components/welcome-guide/template.js +2 -2
  70. package/build/components/welcome-guide/template.js.map +1 -1
  71. package/build/hooks/commands/use-edit-mode-commands.js +1 -2
  72. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  73. package/build/hooks/push-changes-to-global-styles/index.js +3 -1
  74. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  75. package/build/store/private-actions.js +7 -1
  76. package/build/store/private-actions.js.map +1 -1
  77. package/build/utils/use-activate-theme.js +1 -1
  78. package/build/utils/use-activate-theme.js.map +1 -1
  79. package/build-module/components/block-editor/editor-canvas.js +1 -1
  80. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  81. package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
  82. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  83. package/build-module/components/create-pattern-modal/index.js +7 -4
  84. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  85. package/build-module/components/global-styles/palette.js +1 -1
  86. package/build-module/components/global-styles/palette.js.map +1 -1
  87. package/build-module/components/header-edit-mode/index.js +6 -2
  88. package/build-module/components/header-edit-mode/index.js.map +1 -1
  89. package/build-module/components/layout/index.js +1 -1
  90. package/build-module/components/layout/index.js.map +1 -1
  91. package/build-module/components/page/header.js +1 -1
  92. package/build-module/components/page/header.js.map +1 -1
  93. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
  94. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  95. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  96. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  97. package/build-module/components/page-patterns/grid-item.js +85 -66
  98. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  99. package/build-module/components/page-patterns/grid.js +22 -15
  100. package/build-module/components/page-patterns/grid.js.map +1 -1
  101. package/build-module/components/page-patterns/header.js +54 -0
  102. package/build-module/components/page-patterns/header.js.map +1 -0
  103. package/build-module/components/page-patterns/index.js +3 -1
  104. package/build-module/components/page-patterns/index.js.map +1 -1
  105. package/build-module/components/page-patterns/patterns-list.js +70 -31
  106. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  107. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  108. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  109. package/build-module/components/page-patterns/use-patterns.js +100 -127
  110. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  111. package/build-module/components/page-template-parts/index.js +1 -0
  112. package/build-module/components/page-template-parts/index.js.map +1 -1
  113. package/build-module/components/page-templates/index.js +1 -0
  114. package/build-module/components/page-templates/index.js.map +1 -1
  115. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
  116. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  117. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  118. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  119. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +57 -17
  120. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  121. package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
  122. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  123. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
  124. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  125. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
  126. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  127. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
  128. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  129. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
  130. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  131. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
  132. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  133. package/build-module/components/sidebar-navigation-screen-patterns/index.js +71 -44
  134. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  135. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  136. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  137. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
  138. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  139. package/build-module/components/site-hub/index.js +2 -2
  140. package/build-module/components/site-hub/index.js.map +1 -1
  141. package/build-module/components/template-actions/index.js +26 -8
  142. package/build-module/components/template-actions/index.js.map +1 -1
  143. package/build-module/components/template-actions/rename-menu-item.js +8 -6
  144. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  145. package/build-module/components/welcome-guide/page.js +2 -2
  146. package/build-module/components/welcome-guide/page.js.map +1 -1
  147. package/build-module/components/welcome-guide/template.js +2 -2
  148. package/build-module/components/welcome-guide/template.js.map +1 -1
  149. package/build-module/hooks/commands/use-edit-mode-commands.js +1 -2
  150. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  151. package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
  152. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  153. package/build-module/store/private-actions.js +7 -1
  154. package/build-module/store/private-actions.js.map +1 -1
  155. package/build-module/utils/use-activate-theme.js +1 -1
  156. package/build-module/utils/use-activate-theme.js.map +1 -1
  157. package/build-style/style-rtl.css +149 -50
  158. package/build-style/style.css +149 -50
  159. package/package.json +19 -19
  160. package/src/components/block-editor/editor-canvas.js +1 -1
  161. package/src/components/block-editor/use-site-editor-settings.js +8 -4
  162. package/src/components/create-pattern-modal/index.js +6 -3
  163. package/src/components/global-styles/palette.js +10 -9
  164. package/src/components/header-edit-mode/document-actions/style.scss +12 -0
  165. package/src/components/header-edit-mode/index.js +17 -9
  166. package/src/components/layout/index.js +1 -1
  167. package/src/components/layout/style.scss +0 -11
  168. package/src/components/page/header.js +1 -1
  169. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
  170. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  171. package/src/components/page-patterns/grid-item.js +187 -132
  172. package/src/components/page-patterns/grid.js +35 -22
  173. package/src/components/page-patterns/header.js +69 -0
  174. package/src/components/page-patterns/index.js +6 -1
  175. package/src/components/page-patterns/patterns-list.js +89 -47
  176. package/src/components/page-patterns/rename-menu-item.js +115 -0
  177. package/src/components/page-patterns/style.scss +86 -26
  178. package/src/components/page-patterns/use-patterns.js +99 -176
  179. package/src/components/page-template-parts/index.js +1 -1
  180. package/src/components/page-templates/index.js +1 -1
  181. package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  182. package/src/components/sidebar-navigation-screen/index.js +1 -1
  183. package/src/components/sidebar-navigation-screen/style.scss +19 -1
  184. package/src/components/sidebar-navigation-screen-global-styles/index.js +56 -39
  185. package/src/components/sidebar-navigation-screen-main/index.js +44 -40
  186. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
  187. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
  188. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
  189. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
  190. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
  191. package/src/components/sidebar-navigation-screen-patterns/index.js +79 -75
  192. package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -1
  193. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
  194. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
  195. package/src/components/site-hub/index.js +2 -2
  196. package/src/components/template-actions/index.js +40 -9
  197. package/src/components/template-actions/rename-menu-item.js +8 -6
  198. package/src/components/welcome-guide/page.js +2 -2
  199. package/src/components/welcome-guide/template.js +2 -2
  200. package/src/hooks/commands/use-edit-mode-commands.js +0 -1
  201. package/src/hooks/push-changes-to-global-styles/index.js +8 -1
  202. package/src/store/private-actions.js +5 -1
  203. package/src/style.scss +10 -12
  204. package/src/utils/use-activate-theme.js +1 -1
  205. package/build/components/page-content-focus-manager/constants.js +0 -9
  206. package/build/components/page-content-focus-manager/constants.js.map +0 -1
  207. package/build-module/components/page-content-focus-manager/constants.js +0 -2
  208. package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
  209. package/src/components/page-content-focus-manager/constants.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.12.6",
3
+ "version": "5.12.8",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,40 +29,40 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.35.1",
31
31
  "@wordpress/api-fetch": "^6.32.1",
32
- "@wordpress/block-editor": "^12.3.4",
33
- "@wordpress/block-library": "^8.12.6",
34
- "@wordpress/blocks": "^12.12.2",
35
- "@wordpress/commands": "^0.6.4",
36
- "@wordpress/components": "^25.1.4",
32
+ "@wordpress/block-editor": "^12.3.6",
33
+ "@wordpress/block-library": "^8.12.8",
34
+ "@wordpress/blocks": "^12.12.3",
35
+ "@wordpress/commands": "^0.6.6",
36
+ "@wordpress/components": "^25.1.6",
37
37
  "@wordpress/compose": "^6.12.1",
38
- "@wordpress/core-commands": "^0.4.4",
39
- "@wordpress/core-data": "^6.12.4",
40
- "@wordpress/data": "^9.5.2",
38
+ "@wordpress/core-commands": "^0.4.6",
39
+ "@wordpress/core-data": "^6.12.6",
40
+ "@wordpress/data": "^9.5.3",
41
41
  "@wordpress/date": "^4.35.1",
42
42
  "@wordpress/deprecated": "^3.35.1",
43
43
  "@wordpress/dom": "^3.35.1",
44
- "@wordpress/editor": "^13.12.4",
44
+ "@wordpress/editor": "^13.12.6",
45
45
  "@wordpress/element": "^5.12.1",
46
46
  "@wordpress/escape-html": "^2.35.1",
47
47
  "@wordpress/hooks": "^3.35.1",
48
48
  "@wordpress/html-entities": "^3.35.1",
49
49
  "@wordpress/i18n": "^4.35.1",
50
50
  "@wordpress/icons": "^9.26.2",
51
- "@wordpress/interface": "^5.12.4",
52
- "@wordpress/keyboard-shortcuts": "^4.12.2",
51
+ "@wordpress/interface": "^5.12.6",
52
+ "@wordpress/keyboard-shortcuts": "^4.12.3",
53
53
  "@wordpress/keycodes": "^3.35.1",
54
54
  "@wordpress/media-utils": "^4.26.1",
55
- "@wordpress/notices": "^4.3.2",
56
- "@wordpress/plugins": "^6.3.4",
57
- "@wordpress/preferences": "^3.12.4",
55
+ "@wordpress/notices": "^4.3.3",
56
+ "@wordpress/plugins": "^6.3.6",
57
+ "@wordpress/preferences": "^3.12.6",
58
58
  "@wordpress/primitives": "^3.33.1",
59
59
  "@wordpress/private-apis": "^0.17.1",
60
- "@wordpress/reusable-blocks": "^4.12.4",
60
+ "@wordpress/reusable-blocks": "^4.12.6",
61
61
  "@wordpress/router": "^0.4.1",
62
62
  "@wordpress/style-engine": "^1.18.1",
63
63
  "@wordpress/url": "^3.36.1",
64
- "@wordpress/viewport": "^5.12.2",
65
- "@wordpress/widgets": "^3.12.4",
64
+ "@wordpress/viewport": "^5.12.3",
65
+ "@wordpress/widgets": "^3.12.6",
66
66
  "@wordpress/wordcount": "^3.35.1",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "65fb4cd5187a47ca274c24c04a220bcdb2ddfa67"
87
+ "gitHead": "86ecd96b3bcada6b4cc35bb2455b3029cebb0ff3"
88
88
  }
@@ -88,7 +88,7 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
88
88
  enableResizing ? 'min-height:0!important;' : ''
89
89
  }}body{position:relative; ${
90
90
  canvasMode === 'view'
91
- ? 'cursor: pointer; height: 100vh'
91
+ ? 'cursor: pointer; min-height: 100vh;'
92
92
  : ''
93
93
  }}}`
94
94
  }</style>
@@ -12,11 +12,13 @@ import { unlock } from '../../lock-unlock';
12
12
  import inserterMediaCategories from './inserter-media-categories';
13
13
 
14
14
  export default function useSiteEditorSettings( templateType ) {
15
- const { storedSettings } = useSelect( ( select ) => {
16
- const { getSettings } = unlock( select( editSiteStore ) );
17
-
15
+ const { storedSettings, canvasMode } = useSelect( ( select ) => {
16
+ const { getSettings, getCanvasMode } = unlock(
17
+ select( editSiteStore )
18
+ );
18
19
  return {
19
20
  storedSettings: getSettings(),
21
+ canvasMode: getCanvasMode(),
20
22
  };
21
23
  }, [] );
22
24
 
@@ -70,6 +72,7 @@ export default function useSiteEditorSettings( templateType ) {
70
72
  const {
71
73
  __experimentalAdditionalBlockPatterns,
72
74
  __experimentalAdditionalBlockPatternCategories,
75
+ focusMode,
73
76
  ...restStoredSettings
74
77
  } = storedSettings;
75
78
 
@@ -86,6 +89,7 @@ export default function useSiteEditorSettings( templateType ) {
86
89
  // active for all entities.
87
90
  templateLock: false,
88
91
  template: false,
92
+ focusMode: canvasMode === 'view' && focusMode ? false : focusMode,
89
93
  };
90
- }, [ storedSettings, blockPatterns, blockPatternCategories ] );
94
+ }, [ storedSettings, blockPatterns, blockPatternCategories, canvasMode ] );
91
95
  }
@@ -14,6 +14,7 @@ import { __ } from '@wordpress/i18n';
14
14
  import { useState } from '@wordpress/element';
15
15
  import { store as noticesStore } from '@wordpress/notices';
16
16
  import { useDispatch } from '@wordpress/data';
17
+ import { serialize } from '@wordpress/blocks';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -21,9 +22,11 @@ import { useDispatch } from '@wordpress/data';
21
22
  import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils';
22
23
 
23
24
  export default function CreatePatternModal( {
25
+ blocks = [],
24
26
  closeModal,
25
27
  onCreate,
26
28
  onError,
29
+ title,
27
30
  } ) {
28
31
  const [ name, setName ] = useState( '' );
29
32
  const [ syncType, setSyncType ] = useState( SYNC_TYPES.unsynced );
@@ -52,11 +55,11 @@ export default function CreatePatternModal( {
52
55
  'wp_block',
53
56
  {
54
57
  title: name || __( 'Untitled Pattern' ),
55
- content: '',
58
+ content: blocks?.length ? serialize( blocks ) : '',
56
59
  status: 'publish',
57
60
  meta:
58
61
  syncType === SYNC_TYPES.unsynced
59
- ? { sync_status: syncType }
62
+ ? { wp_pattern_sync_status: syncType }
60
63
  : undefined,
61
64
  },
62
65
  { throwOnError: true }
@@ -76,7 +79,7 @@ export default function CreatePatternModal( {
76
79
 
77
80
  return (
78
81
  <Modal
79
- title={ __( 'Create pattern' ) }
82
+ title={ title || __( 'Create pattern' ) }
80
83
  onRequestClose={ closeModal }
81
84
  overlayClassName="edit-site-create-pattern-modal"
82
85
  >
@@ -91,15 +91,16 @@ function Palette( { name } ) {
91
91
  </HStack>
92
92
  </NavigationButtonAsItem>
93
93
  </ItemGroup>
94
- { themeColors?.length > 0 && (
95
- <Button
96
- variant="secondary"
97
- icon={ shuffle }
98
- onClick={ randomizeThemeColors }
99
- >
100
- { __( 'Randomize colors' ) }
101
- </Button>
102
- ) }
94
+ { window.__experimentalEnableColorRandomizer &&
95
+ themeColors?.length > 0 && (
96
+ <Button
97
+ variant="secondary"
98
+ icon={ shuffle }
99
+ onClick={ randomizeThemeColors }
100
+ >
101
+ { __( 'Randomize colors' ) }
102
+ </Button>
103
+ ) }
103
104
  </VStack>
104
105
  );
105
106
  }
@@ -16,6 +16,14 @@
16
16
  color: currentColor;
17
17
  background: $gray-200;
18
18
  }
19
+
20
+ @include break-medium() {
21
+ width: 50%;
22
+ }
23
+
24
+ @include break-large() {
25
+ width: min(100%, 450px);
26
+ }
19
27
  }
20
28
 
21
29
  .edit-site-document-actions__command {
@@ -32,6 +40,10 @@
32
40
  overflow: hidden;
33
41
  grid-column: 2 / 3;
34
42
 
43
+ .block-editor-block-icon {
44
+ min-width: $grid-unit-30;
45
+ }
46
+
35
47
  h1 {
36
48
  white-space: nowrap;
37
49
  overflow: hidden;
@@ -108,6 +108,9 @@ export default function HeaderEditMode() {
108
108
  };
109
109
  }, [] );
110
110
 
111
+ const { get: getPreference } = useSelect( preferencesStore );
112
+ const hasFixedToolbar = getPreference( editSiteStore.name, 'fixedToolbar' );
113
+
111
114
  const {
112
115
  __experimentalSetPreviewDeviceType: setPreviewDeviceType,
113
116
  setIsInserterOpened,
@@ -213,14 +216,18 @@ export default function HeaderEditMode() {
213
216
  ) }
214
217
  { isLargeViewport && (
215
218
  <>
216
- <ToolbarItem
217
- as={ ToolSelector }
218
- showTooltip={ ! showIconLabels }
219
- variant={
220
- showIconLabels ? 'tertiary' : undefined
221
- }
222
- disabled={ ! isVisualMode }
223
- />
219
+ { ! hasFixedToolbar && (
220
+ <ToolbarItem
221
+ as={ ToolSelector }
222
+ showTooltip={ ! showIconLabels }
223
+ variant={
224
+ showIconLabels
225
+ ? 'tertiary'
226
+ : undefined
227
+ }
228
+ disabled={ ! isVisualMode }
229
+ />
230
+ ) }
224
231
  <ToolbarItem
225
232
  as={ UndoButton }
226
233
  showTooltip={ ! showIconLabels }
@@ -257,7 +264,8 @@ export default function HeaderEditMode() {
257
264
  />
258
265
  ) }
259
266
  { isZoomedOutViewExperimentEnabled &&
260
- ! isDistractionFree && (
267
+ ! isDistractionFree &&
268
+ ! hasFixedToolbar && (
261
269
  <ToolbarItem
262
270
  as={ Button }
263
271
  className="edit-site-header-edit-mode__zoom-out-view-toggle"
@@ -143,7 +143,7 @@ export default function Layout() {
143
143
  headerAnimationState = canvasMode; // edit, view, init
144
144
  }
145
145
 
146
- // Sets the right context for the command center
146
+ // Sets the right context for the command palette
147
147
  const commandContext =
148
148
  canvasMode === 'edit' && isEditorPage
149
149
  ? 'site-editor-edit'
@@ -4,17 +4,6 @@
4
4
  color: $gray-400;
5
5
  display: flex;
6
6
  flex-direction: column;
7
-
8
- // Expand the fixed block toolbar to cover the document title control.
9
- .block-editor-block-contextual-toolbar {
10
- @include break-medium() {
11
- &.is-fixed {
12
- // the combined with of the tools at the right of the header and the margin left
13
- width: calc(100% - 240px - #{$grid-unit-80} - #{$grid-unit-70});
14
- }
15
- }
16
- }
17
-
18
7
  }
19
8
 
20
9
  .edit-site-layout__hub {
@@ -18,7 +18,7 @@ export default function Header( { title, subTitle, actions } ) {
18
18
  <HStack as="header" alignment="left" className="edit-site-page-header">
19
19
  <FlexBlock className="edit-site-page-header__page-title">
20
20
  <Heading
21
- as="h1"
21
+ as="h2"
22
22
  level={ 4 }
23
23
  className="edit-site-page-header__title"
24
24
  >
@@ -10,16 +10,22 @@ import { useEffect } from '@wordpress/element';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { unlock } from '../../lock-unlock';
13
- import { PAGE_CONTENT_BLOCK_TYPES } from './constants';
14
13
 
15
14
  const { useBlockEditingMode } = unlock( blockEditorPrivateApis );
16
15
 
16
+ const PAGE_CONTENT_BLOCK_TYPES = [
17
+ 'core/post-title',
18
+ 'core/post-featured-image',
19
+ 'core/post-content',
20
+ ];
21
+
17
22
  /**
18
23
  * Component that when rendered, makes it so that the site editor allows only
19
24
  * page content to be edited.
20
25
  */
21
26
  export default function DisableNonPageContentBlocks() {
22
27
  useDisableNonPageContentBlocks();
28
+ return null;
23
29
  }
24
30
 
25
31
  /**
@@ -43,8 +49,11 @@ export function useDisableNonPageContentBlocks() {
43
49
 
44
50
  const withDisableNonPageContentBlocks = createHigherOrderComponent(
45
51
  ( BlockEdit ) => ( props ) => {
46
- const isContent = PAGE_CONTENT_BLOCK_TYPES.includes( props.name );
47
- const mode = isContent ? 'contentOnly' : undefined;
52
+ const isDescendentOfQueryLoop = !! props.context.queryId;
53
+ const isPageContent =
54
+ PAGE_CONTENT_BLOCK_TYPES.includes( props.name ) &&
55
+ ! isDescendentOfQueryLoop;
56
+ const mode = isPageContent ? 'contentOnly' : undefined;
48
57
  useBlockEditingMode( mode );
49
58
  return <BlockEdit { ...props } />;
50
59
  },
@@ -0,0 +1,196 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { MenuItem } from '@wordpress/components';
5
+ import { store as coreStore } from '@wordpress/core-data';
6
+ import { useDispatch } from '@wordpress/data';
7
+ import { __, sprintf } from '@wordpress/i18n';
8
+ import { store as noticesStore } from '@wordpress/notices';
9
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import {
15
+ TEMPLATE_PARTS,
16
+ PATTERNS,
17
+ SYNC_TYPES,
18
+ USER_PATTERNS,
19
+ USER_PATTERN_CATEGORY,
20
+ } from './utils';
21
+ import {
22
+ useExistingTemplateParts,
23
+ getUniqueTemplatePartTitle,
24
+ getCleanTemplatePartSlug,
25
+ } from '../../utils/template-part-create';
26
+ import { unlock } from '../../lock-unlock';
27
+
28
+ const { useHistory } = unlock( routerPrivateApis );
29
+
30
+ function getPatternMeta( item ) {
31
+ if ( item.type === PATTERNS ) {
32
+ return { wp_pattern_sync_status: SYNC_TYPES.unsynced };
33
+ }
34
+
35
+ const syncStatus = item.reusableBlock.wp_pattern_sync_status;
36
+ const isUnsynced = syncStatus === SYNC_TYPES.unsynced;
37
+
38
+ return {
39
+ ...item.reusableBlock.meta,
40
+ wp_pattern_sync_status: isUnsynced ? syncStatus : undefined,
41
+ };
42
+ }
43
+
44
+ export default function DuplicateMenuItem( {
45
+ categoryId,
46
+ item,
47
+ label = __( 'Duplicate' ),
48
+ onClose,
49
+ } ) {
50
+ const { saveEntityRecord } = useDispatch( coreStore );
51
+ const { createErrorNotice, createSuccessNotice } =
52
+ useDispatch( noticesStore );
53
+
54
+ const history = useHistory();
55
+ const existingTemplateParts = useExistingTemplateParts();
56
+
57
+ async function createTemplatePart() {
58
+ try {
59
+ const copiedTitle = sprintf(
60
+ /* translators: %s: Existing template part title */
61
+ __( '%s (Copy)' ),
62
+ item.title
63
+ );
64
+ const title = getUniqueTemplatePartTitle(
65
+ copiedTitle,
66
+ existingTemplateParts
67
+ );
68
+ const slug = getCleanTemplatePartSlug( title );
69
+ const { area, content } = item.templatePart;
70
+
71
+ const result = await saveEntityRecord(
72
+ 'postType',
73
+ 'wp_template_part',
74
+ { slug, title, content, area },
75
+ { throwOnError: true }
76
+ );
77
+
78
+ createSuccessNotice(
79
+ sprintf(
80
+ // translators: %s: The new template part's title e.g. 'Call to action (copy)'.
81
+ __( '"%s" created.' ),
82
+ title
83
+ ),
84
+ {
85
+ type: 'snackbar',
86
+ id: 'edit-site-patterns-success',
87
+ actions: [
88
+ {
89
+ label: __( 'Edit' ),
90
+ onClick: () =>
91
+ history.push( {
92
+ postType: TEMPLATE_PARTS,
93
+ postId: result?.id,
94
+ categoryType: TEMPLATE_PARTS,
95
+ categoryId,
96
+ } ),
97
+ },
98
+ ],
99
+ }
100
+ );
101
+
102
+ onClose();
103
+ } catch ( error ) {
104
+ const errorMessage =
105
+ error.message && error.code !== 'unknown_error'
106
+ ? error.message
107
+ : __(
108
+ 'An error occurred while creating the template part.'
109
+ );
110
+
111
+ createErrorNotice( errorMessage, {
112
+ type: 'snackbar',
113
+ id: 'edit-site-patterns-error',
114
+ } );
115
+ onClose();
116
+ }
117
+ }
118
+
119
+ async function createPattern() {
120
+ try {
121
+ const isThemePattern = item.type === PATTERNS;
122
+ const title = sprintf(
123
+ /* translators: %s: Existing pattern title */
124
+ __( '%s (Copy)' ),
125
+ item.title
126
+ );
127
+
128
+ const result = await saveEntityRecord(
129
+ 'postType',
130
+ 'wp_block',
131
+ {
132
+ content: isThemePattern
133
+ ? item.content
134
+ : item.reusableBlock.content,
135
+ meta: getPatternMeta( item ),
136
+ status: 'publish',
137
+ title,
138
+ },
139
+ { throwOnError: true }
140
+ );
141
+
142
+ const actionLabel = isThemePattern
143
+ ? __( 'View my patterns' )
144
+ : __( 'Edit' );
145
+
146
+ const newLocation = isThemePattern
147
+ ? {
148
+ categoryType: USER_PATTERNS,
149
+ categoryId: USER_PATTERN_CATEGORY,
150
+ path: '/patterns',
151
+ }
152
+ : {
153
+ categoryType: USER_PATTERNS,
154
+ categoryId: USER_PATTERN_CATEGORY,
155
+ postType: USER_PATTERNS,
156
+ postId: result?.id,
157
+ };
158
+
159
+ createSuccessNotice(
160
+ sprintf(
161
+ // translators: %s: The new pattern's title e.g. 'Call to action (copy)'.
162
+ __( '"%s" added to my patterns.' ),
163
+ title
164
+ ),
165
+ {
166
+ type: 'snackbar',
167
+ id: 'edit-site-patterns-success',
168
+ actions: [
169
+ {
170
+ label: actionLabel,
171
+ onClick: () => history.push( newLocation ),
172
+ },
173
+ ],
174
+ }
175
+ );
176
+
177
+ onClose();
178
+ } catch ( error ) {
179
+ const errorMessage =
180
+ error.message && error.code !== 'unknown_error'
181
+ ? error.message
182
+ : __( 'An error occurred while creating the pattern.' );
183
+
184
+ createErrorNotice( errorMessage, {
185
+ type: 'snackbar',
186
+ id: 'edit-site-patterns-error',
187
+ } );
188
+ onClose();
189
+ }
190
+ }
191
+
192
+ const createItem =
193
+ item.type === TEMPLATE_PARTS ? createTemplatePart : createPattern;
194
+
195
+ return <MenuItem onClick={ createItem }>{ label }</MenuItem>;
196
+ }