@wordpress/editor 14.6.0 → 14.7.0

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 (267) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +37 -0
  3. package/build/bindings/post-meta.js +10 -8
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/block-manager/index.js +4 -1
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  9. package/build/components/document-bar/index.js +4 -4
  10. package/build/components/document-bar/index.js.map +1 -1
  11. package/build/components/editor-history/redo.js +4 -1
  12. package/build/components/editor-history/redo.js.map +1 -1
  13. package/build/components/editor-history/undo.js +4 -1
  14. package/build/components/editor-history/undo.js.map +1 -1
  15. package/build/components/editor-interface/index.js +2 -3
  16. package/build/components/editor-interface/index.js.map +1 -1
  17. package/build/components/error-boundary/index.js +4 -1
  18. package/build/components/error-boundary/index.js.map +1 -1
  19. package/build/components/index.js +8 -0
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/inserter-sidebar/index.js +3 -5
  22. package/build/components/inserter-sidebar/index.js.map +1 -1
  23. package/build/components/local-autosave-monitor/index.js +5 -5
  24. package/build/components/local-autosave-monitor/index.js.map +1 -1
  25. package/build/components/page-attributes/parent.js +4 -1
  26. package/build/components/page-attributes/parent.js.map +1 -1
  27. package/build/components/plugin-preview-menu-item/index.js +57 -0
  28. package/build/components/plugin-preview-menu-item/index.js.map +1 -0
  29. package/build/components/post-actions/index.js +5 -8
  30. package/build/components/post-actions/index.js.map +1 -1
  31. package/build/components/post-excerpt/panel.js +4 -1
  32. package/build/components/post-excerpt/panel.js.map +1 -1
  33. package/build/components/post-featured-image/index.js +12 -3
  34. package/build/components/post-featured-image/index.js.map +1 -1
  35. package/build/components/post-format/index.js +4 -1
  36. package/build/components/post-format/index.js.map +1 -1
  37. package/build/components/post-last-revision/index.js +4 -1
  38. package/build/components/post-last-revision/index.js.map +1 -1
  39. package/build/components/post-locked-modal/index.js +12 -3
  40. package/build/components/post-locked-modal/index.js.map +1 -1
  41. package/build/components/post-publish-panel/index.js +4 -1
  42. package/build/components/post-publish-panel/index.js.map +1 -1
  43. package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  44. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  45. package/build/components/post-publish-panel/maybe-upload-media.js +14 -8
  46. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  47. package/build/components/post-status/index.js +4 -2
  48. package/build/components/post-status/index.js.map +1 -1
  49. package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  50. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  51. package/build/components/post-taxonomies/most-used-terms.js +4 -1
  52. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  53. package/build/components/post-template/block-theme.js +13 -4
  54. package/build/components/post-template/block-theme.js.map +1 -1
  55. package/build/components/post-template/classic-theme.js +4 -1
  56. package/build/components/post-template/classic-theme.js.map +1 -1
  57. package/build/components/post-title/index.js +32 -46
  58. package/build/components/post-title/index.js.map +1 -1
  59. package/build/components/post-url/index.js +4 -1
  60. package/build/components/post-url/index.js.map +1 -1
  61. package/build/components/preview-dropdown/index.js +26 -14
  62. package/build/components/preview-dropdown/index.js.map +1 -1
  63. package/build/components/provider/use-block-editor-settings.js +5 -6
  64. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  65. package/build/components/save-publish-panels/index.js +8 -2
  66. package/build/components/save-publish-panels/index.js.map +1 -1
  67. package/build/components/start-template-options/index.js +4 -1
  68. package/build/components/start-template-options/index.js.map +1 -1
  69. package/build/components/table-of-contents/index.js +4 -1
  70. package/build/components/table-of-contents/index.js.map +1 -1
  71. package/build/components/text-editor/index.js +4 -1
  72. package/build/components/text-editor/index.js.map +1 -1
  73. package/build/components/visual-editor/index.js +1 -6
  74. package/build/components/visual-editor/index.js.map +1 -1
  75. package/build/dataviews/actions/export-pattern.js +2 -0
  76. package/build/dataviews/actions/export-pattern.js.map +1 -1
  77. package/build/dataviews/actions/permanently-delete-post.js +2 -0
  78. package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
  79. package/build/dataviews/actions/reset-post.js +8 -2
  80. package/build/dataviews/actions/reset-post.js.map +1 -1
  81. package/build/dataviews/actions/trash-post.js +8 -2
  82. package/build/dataviews/actions/trash-post.js.map +1 -1
  83. package/build/dataviews/actions/view-post.js +1 -1
  84. package/build/dataviews/actions/view-post.js.map +1 -1
  85. package/build/private-apis.js +0 -2
  86. package/build/private-apis.js.map +1 -1
  87. package/build/store/private-actions.js +1 -1
  88. package/build/store/private-actions.js.map +1 -1
  89. package/build-module/bindings/post-meta.js +10 -8
  90. package/build-module/bindings/post-meta.js.map +1 -1
  91. package/build-module/components/block-manager/index.js +4 -1
  92. package/build-module/components/block-manager/index.js.map +1 -1
  93. package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
  94. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  95. package/build-module/components/document-bar/index.js +4 -4
  96. package/build-module/components/document-bar/index.js.map +1 -1
  97. package/build-module/components/editor-history/redo.js +4 -1
  98. package/build-module/components/editor-history/redo.js.map +1 -1
  99. package/build-module/components/editor-history/undo.js +4 -1
  100. package/build-module/components/editor-history/undo.js.map +1 -1
  101. package/build-module/components/editor-interface/index.js +2 -3
  102. package/build-module/components/editor-interface/index.js.map +1 -1
  103. package/build-module/components/error-boundary/index.js +4 -1
  104. package/build-module/components/error-boundary/index.js.map +1 -1
  105. package/build-module/components/index.js +1 -0
  106. package/build-module/components/index.js.map +1 -1
  107. package/build-module/components/inserter-sidebar/index.js +3 -5
  108. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  109. package/build-module/components/local-autosave-monitor/index.js +5 -5
  110. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  111. package/build-module/components/page-attributes/parent.js +4 -1
  112. package/build-module/components/page-attributes/parent.js.map +1 -1
  113. package/build-module/components/plugin-preview-menu-item/index.js +52 -0
  114. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
  115. package/build-module/components/post-actions/index.js +5 -8
  116. package/build-module/components/post-actions/index.js.map +1 -1
  117. package/build-module/components/post-excerpt/panel.js +4 -1
  118. package/build-module/components/post-excerpt/panel.js.map +1 -1
  119. package/build-module/components/post-featured-image/index.js +12 -3
  120. package/build-module/components/post-featured-image/index.js.map +1 -1
  121. package/build-module/components/post-format/index.js +4 -1
  122. package/build-module/components/post-format/index.js.map +1 -1
  123. package/build-module/components/post-last-revision/index.js +4 -1
  124. package/build-module/components/post-last-revision/index.js.map +1 -1
  125. package/build-module/components/post-locked-modal/index.js +12 -3
  126. package/build-module/components/post-locked-modal/index.js.map +1 -1
  127. package/build-module/components/post-publish-panel/index.js +4 -1
  128. package/build-module/components/post-publish-panel/index.js.map +1 -1
  129. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  130. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  131. package/build-module/components/post-publish-panel/maybe-upload-media.js +14 -8
  132. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  133. package/build-module/components/post-status/index.js +4 -2
  134. package/build-module/components/post-status/index.js.map +1 -1
  135. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  136. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  137. package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
  138. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  139. package/build-module/components/post-template/block-theme.js +13 -4
  140. package/build-module/components/post-template/block-theme.js.map +1 -1
  141. package/build-module/components/post-template/classic-theme.js +4 -1
  142. package/build-module/components/post-template/classic-theme.js.map +1 -1
  143. package/build-module/components/post-title/index.js +33 -47
  144. package/build-module/components/post-title/index.js.map +1 -1
  145. package/build-module/components/post-url/index.js +4 -1
  146. package/build-module/components/post-url/index.js.map +1 -1
  147. package/build-module/components/preview-dropdown/index.js +26 -14
  148. package/build-module/components/preview-dropdown/index.js.map +1 -1
  149. package/build-module/components/provider/use-block-editor-settings.js +6 -7
  150. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  151. package/build-module/components/save-publish-panels/index.js +8 -2
  152. package/build-module/components/save-publish-panels/index.js.map +1 -1
  153. package/build-module/components/start-template-options/index.js +4 -1
  154. package/build-module/components/start-template-options/index.js.map +1 -1
  155. package/build-module/components/table-of-contents/index.js +4 -1
  156. package/build-module/components/table-of-contents/index.js.map +1 -1
  157. package/build-module/components/text-editor/index.js +4 -1
  158. package/build-module/components/text-editor/index.js.map +1 -1
  159. package/build-module/components/visual-editor/index.js +1 -6
  160. package/build-module/components/visual-editor/index.js.map +1 -1
  161. package/build-module/dataviews/actions/export-pattern.js +2 -0
  162. package/build-module/dataviews/actions/export-pattern.js.map +1 -1
  163. package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
  164. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
  165. package/build-module/dataviews/actions/reset-post.js +8 -2
  166. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  167. package/build-module/dataviews/actions/trash-post.js +8 -2
  168. package/build-module/dataviews/actions/trash-post.js.map +1 -1
  169. package/build-module/dataviews/actions/view-post.js +2 -2
  170. package/build-module/dataviews/actions/view-post.js.map +1 -1
  171. package/build-module/private-apis.js +0 -2
  172. package/build-module/private-apis.js.map +1 -1
  173. package/build-module/store/private-actions.js +1 -1
  174. package/build-module/store/private-actions.js.map +1 -1
  175. package/build-style/style-rtl.css +12 -7
  176. package/build-style/style.css +12 -7
  177. package/build-types/bindings/post-meta.d.ts +0 -3
  178. package/build-types/bindings/post-meta.d.ts.map +1 -1
  179. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
  180. package/build-types/components/editor-history/redo.d.ts.map +1 -1
  181. package/build-types/components/editor-history/undo.d.ts.map +1 -1
  182. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  183. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  184. package/build-types/components/index.d.ts +1 -0
  185. package/build-types/components/index.d.ts.map +1 -1
  186. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  187. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  188. package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
  189. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
  190. package/build-types/components/post-actions/index.d.ts.map +1 -1
  191. package/build-types/components/post-format/index.d.ts.map +1 -1
  192. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  193. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  194. package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
  195. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
  196. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  197. package/build-types/components/post-status/index.d.ts.map +1 -1
  198. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  199. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
  200. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  201. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  202. package/build-types/components/post-url/index.d.ts.map +1 -1
  203. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  204. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  205. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  206. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  207. package/build-types/components/text-editor/index.d.ts.map +1 -1
  208. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  209. package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
  210. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
  211. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  212. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
  213. package/build-types/private-apis.d.ts.map +1 -1
  214. package/build-types/store/private-actions.d.ts.map +1 -1
  215. package/package.json +36 -36
  216. package/src/bindings/post-meta.js +12 -6
  217. package/src/components/block-manager/index.js +2 -0
  218. package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
  219. package/src/components/create-template-part-modal/style.scss +1 -1
  220. package/src/components/document-bar/index.js +4 -4
  221. package/src/components/document-outline/style.scss +1 -1
  222. package/src/components/editor-history/redo.js +2 -0
  223. package/src/components/editor-history/undo.js +2 -0
  224. package/src/components/editor-interface/index.js +2 -4
  225. package/src/components/error-boundary/index.js +6 -1
  226. package/src/components/header/style.scss +6 -3
  227. package/src/components/index.js +1 -0
  228. package/src/components/inserter-sidebar/index.js +4 -3
  229. package/src/components/local-autosave-monitor/index.js +6 -6
  230. package/src/components/page-attributes/parent.js +5 -4
  231. package/src/components/plugin-preview-menu-item/index.js +52 -0
  232. package/src/components/post-actions/index.js +8 -14
  233. package/src/components/post-card-panel/style.scss +1 -1
  234. package/src/components/post-excerpt/panel.js +2 -0
  235. package/src/components/post-featured-image/index.js +6 -0
  236. package/src/components/post-featured-image/style.scss +1 -2
  237. package/src/components/post-format/index.js +2 -0
  238. package/src/components/post-last-revision/index.js +2 -0
  239. package/src/components/post-locked-modal/index.js +14 -2
  240. package/src/components/post-locked-modal/style.scss +1 -1
  241. package/src/components/post-publish-panel/index.js +2 -0
  242. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
  243. package/src/components/post-publish-panel/maybe-upload-media.js +37 -29
  244. package/src/components/post-publish-panel/style.scss +3 -1
  245. package/src/components/post-status/index.js +3 -2
  246. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
  247. package/src/components/post-taxonomies/most-used-terms.js +2 -0
  248. package/src/components/post-template/block-theme.js +15 -9
  249. package/src/components/post-template/classic-theme.js +2 -0
  250. package/src/components/post-title/index.js +30 -41
  251. package/src/components/post-url/index.js +2 -0
  252. package/src/components/preview-dropdown/index.js +28 -20
  253. package/src/components/provider/use-block-editor-settings.js +5 -5
  254. package/src/components/resizable-editor/style.scss +2 -2
  255. package/src/components/save-publish-panels/index.js +4 -0
  256. package/src/components/start-template-options/index.js +6 -1
  257. package/src/components/table-of-contents/index.js +2 -0
  258. package/src/components/text-editor/index.js +2 -0
  259. package/src/components/visual-editor/index.js +2 -9
  260. package/src/dataviews/actions/export-pattern.tsx +2 -0
  261. package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
  262. package/src/dataviews/actions/reset-post.tsx +4 -0
  263. package/src/dataviews/actions/trash-post.tsx +4 -0
  264. package/src/dataviews/actions/view-post.tsx +2 -2
  265. package/src/private-apis.js +0 -2
  266. package/src/store/private-actions.js +3 -1
  267. package/tsconfig.tsbuildinfo +1 -1
@@ -10,9 +10,6 @@ import { store as editorStore } from '../store';
10
10
 
11
11
  export default {
12
12
  name: 'core/post-meta',
13
- getPlaceholder( { args } ) {
14
- return args.key;
15
- },
16
13
  getValues( { registry, context, bindings } ) {
17
14
  const meta = registry
18
15
  .select( coreDataStore )
@@ -23,7 +20,9 @@ export default {
23
20
  )?.meta;
24
21
  const newValues = {};
25
22
  for ( const [ attributeName, source ] of Object.entries( bindings ) ) {
26
- newValues[ attributeName ] = meta?.[ source.args.key ];
23
+ // Use the key if the value is not set.
24
+ newValues[ attributeName ] =
25
+ meta?.[ source.args.key ] || source.args.key;
27
26
  }
28
27
  return newValues;
29
28
  },
@@ -53,13 +52,20 @@ export default {
53
52
  }
54
53
 
55
54
  // Check that the custom field is not protected and available in the REST API.
56
- const isFieldExposed = !! select( coreDataStore ).getEntityRecord(
55
+ // Empty string or `false` could be a valid value, so we need to check if the field value is undefined.
56
+ const fieldValue = select( coreDataStore ).getEntityRecord(
57
57
  'postType',
58
58
  postType,
59
59
  context?.postId
60
60
  )?.meta?.[ args.key ];
61
61
 
62
- if ( ! isFieldExposed ) {
62
+ if ( fieldValue === undefined ) {
63
+ return false;
64
+ }
65
+ // Check that custom fields metabox is not enabled.
66
+ const areCustomFieldsEnabled =
67
+ select( editorStore ).getEditorSettings().enableCustomFields;
68
+ if ( areCustomFieldsEnabled ) {
63
69
  return false;
64
70
  }
65
71
 
@@ -67,6 +67,8 @@ function BlockManager( {
67
67
  numberOfHiddenBlocks
68
68
  ) }
69
69
  <Button
70
+ // TODO: Switch to `true` (40px size) if possible
71
+ __next40pxDefaultSize={ false }
70
72
  variant="link"
71
73
  onClick={ () => enableAllBlockTypes( blockTypes ) }
72
74
  >
@@ -10,7 +10,7 @@ import {
10
10
  import { store as coreStore } from '@wordpress/core-data';
11
11
  import { __experimentalText as Text, MenuItem } from '@wordpress/components';
12
12
  import { useSelect, useDispatch } from '@wordpress/data';
13
- import { __ } from '@wordpress/i18n';
13
+ import { __, _x } from '@wordpress/i18n';
14
14
 
15
15
  /**
16
16
  * Internal dependencies
@@ -137,27 +137,23 @@ function TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {
137
137
  );
138
138
  const blockDisplayInformation =
139
139
  useBlockDisplayInformation( contentLockingParent );
140
- // Disable reason: We're using a hook here so it has to be on top-level.
141
- // eslint-disable-next-line @wordpress/no-unused-vars-before-return
142
- const { modifyContentLockBlock, selectBlock } = unlock(
143
- useDispatch( blockEditorStore )
144
- );
145
-
140
+ const blockEditorActions = useDispatch( blockEditorStore );
146
141
  if ( ! blockDisplayInformation?.title ) {
147
142
  return null;
148
143
  }
149
144
 
145
+ const { modifyContentLockBlock } = unlock( blockEditorActions );
146
+
150
147
  return (
151
148
  <>
152
149
  <BlockSettingsMenuFirstItem>
153
150
  <MenuItem
154
151
  onClick={ () => {
155
- selectBlock( contentLockingParent );
156
152
  modifyContentLockBlock( contentLockingParent );
157
153
  onClose();
158
154
  } }
159
155
  >
160
- { __( 'Unlock' ) }
156
+ { _x( 'Unlock', 'Unlock content locked blocks' ) }
161
157
  </MenuItem>
162
158
  </BlockSettingsMenuFirstItem>
163
159
  <Text
@@ -5,7 +5,7 @@
5
5
  .editor-create-template-part-modal__area-radio-group {
6
6
  width: 100%;
7
7
  border: $border-width solid $gray-700;
8
- border-radius: 2px;
8
+ border-radius: $radius-small;
9
9
 
10
10
  .components-button.editor-create-template-part-modal__area-radio {
11
11
  display: block;
@@ -120,9 +120,9 @@ export default function DocumentBar( props ) {
120
120
  const title = props.title || entityTitle;
121
121
  const icon = props.icon || templateIcon;
122
122
 
123
- const mounted = useRef( false );
123
+ const mountedRef = useRef( false );
124
124
  useEffect( () => {
125
- mounted.current = true;
125
+ mountedRef.current = true;
126
126
  }, [] );
127
127
 
128
128
  return (
@@ -143,7 +143,7 @@ export default function DocumentBar( props ) {
143
143
  } }
144
144
  size="compact"
145
145
  initial={
146
- mounted.current
146
+ mountedRef.current
147
147
  ? { opacity: 0, transform: 'translateX(15%)' }
148
148
  : false // Don't show entry animation when DocumentBar mounts.
149
149
  }
@@ -170,7 +170,7 @@ export default function DocumentBar( props ) {
170
170
  // Force entry animation when the back button is added or removed.
171
171
  key={ hasBackButton }
172
172
  initial={
173
- mounted.current
173
+ mountedRef.current
174
174
  ? {
175
175
  opacity: 0,
176
176
  transform: hasBackButton
@@ -51,7 +51,7 @@
51
51
  padding: 2px 5px 2px 1px;
52
52
  color: $gray-900;
53
53
  text-align: left;
54
- border-radius: $radius-block-ui;
54
+ border-radius: $radius-small;
55
55
 
56
56
  &:disabled {
57
57
  cursor: default;
@@ -25,6 +25,8 @@ function EditorHistoryRedo( props, ref ) {
25
25
  const { redo } = useDispatch( editorStore );
26
26
  return (
27
27
  <Button
28
+ // TODO: Switch to `true` (40px size) if possible
29
+ __next40pxDefaultSize={ false }
28
30
  { ...props }
29
31
  ref={ ref }
30
32
  icon={ ! isRTL() ? redoIcon : undoIcon }
@@ -21,6 +21,8 @@ function EditorHistoryUndo( props, ref ) {
21
21
  const { undo } = useDispatch( editorStore );
22
22
  return (
23
23
  <Button
24
+ // TODO: Switch to `true` (40px size) if possible
25
+ __next40pxDefaultSize={ false }
24
26
  { ...props }
25
27
  ref={ ref }
26
28
  icon={ ! isRTL() ? undoIcon : redoIcon }
@@ -99,7 +99,6 @@ export default function EditorInterface( {
99
99
  select( blockEditorStore ).__unstableGetEditorMode(),
100
100
  };
101
101
  }, [] );
102
- const isWideViewport = useViewportMatch( 'large' );
103
102
  const isLargeViewport = useViewportMatch( 'medium' );
104
103
  const secondarySidebarLabel = isListViewOpened
105
104
  ? __( 'Document Overview' )
@@ -122,11 +121,10 @@ export default function EditorInterface( {
122
121
  return (
123
122
  <InterfaceSkeleton
124
123
  enableRegionNavigation={ enableRegionNavigation }
125
- isDistractionFree={ isDistractionFree && isWideViewport }
124
+ isDistractionFree={ isDistractionFree }
126
125
  className={ clsx( 'editor-editor-interface', className, {
127
126
  'is-entity-save-view-open': !! entitiesSavedStatesCallback,
128
- 'is-distraction-free':
129
- isDistractionFree && isWideViewport && ! isPreviewMode,
127
+ 'is-distraction-free': isDistractionFree && ! isPreviewMode,
130
128
  } ) }
131
129
  labels={ {
132
130
  ...interfaceLabels,
@@ -29,7 +29,12 @@ function getContent() {
29
29
  function CopyButton( { text, children } ) {
30
30
  const ref = useCopyToClipboard( text );
31
31
  return (
32
- <Button variant="secondary" ref={ ref }>
32
+ <Button
33
+ // TODO: Switch to `true` (40px size) if possible
34
+ __next40pxDefaultSize={ false }
35
+ variant="secondary"
36
+ ref={ ref }
37
+ >
33
38
  { children }
34
39
  </Button>
35
40
  );
@@ -228,7 +228,7 @@
228
228
  }
229
229
 
230
230
  .editor-header__post-preview-button {
231
- @include break-small {
231
+ @include break-mobile {
232
232
  display: none;
233
233
  }
234
234
  }
@@ -240,10 +240,13 @@
240
240
 
241
241
  .editor-header {
242
242
  background-color: $white;
243
- border-bottom: 1px solid #e0e0e0;
244
- position: absolute;
245
243
  width: 100%;
246
244
 
245
+ @include break-medium {
246
+ border-bottom: 1px solid #e0e0e0;
247
+ position: absolute;
248
+ }
249
+
247
250
 
248
251
  // hide some parts
249
252
  & > .edit-post-header__settings > .edit-post-header__post-preview-button {
@@ -32,6 +32,7 @@ export { default as PluginMoreMenuItem } from './plugin-more-menu-item';
32
32
  export { default as PluginPostPublishPanel } from './plugin-post-publish-panel';
33
33
  export { default as PluginPostStatusInfo } from './plugin-post-status-info';
34
34
  export { default as PluginPrePublishPanel } from './plugin-pre-publish-panel';
35
+ export { default as PluginPreviewMenuItem } from './plugin-preview-menu-item';
35
36
  export { default as PluginSidebar } from './plugin-sidebar';
36
37
  export { default as PluginSidebarMoreMenuItem } from './plugin-sidebar-more-menu-item';
37
38
  export { default as PostTemplatePanel } from './post-template/panel';
@@ -38,13 +38,14 @@ export default function InserterSidebar() {
38
38
  getBlockInsertionPoint,
39
39
  getBlockRootClientId,
40
40
  __unstableGetEditorMode,
41
- getSettings,
42
- } = select( blockEditorStore );
41
+ getSectionRootClientId,
42
+ } = unlock( select( blockEditorStore ) );
43
43
  const { get } = select( preferencesStore );
44
44
  const { getActiveComplementaryArea } = select( interfaceStore );
45
45
  const getBlockSectionRootClientId = () => {
46
46
  if ( __unstableGetEditorMode() === 'zoom-out' ) {
47
- const { sectionRootClientId } = unlock( getSettings() );
47
+ const sectionRootClientId = getSectionRootClientId();
48
+
48
49
  if ( sectionRootClientId ) {
49
50
  return sectionRootClientId;
50
51
  }
@@ -144,20 +144,20 @@ function useAutosavePurge() {
144
144
  []
145
145
  );
146
146
 
147
- const lastIsDirty = useRef( isDirty );
148
- const lastIsAutosaving = useRef( isAutosaving );
147
+ const lastIsDirtyRef = useRef( isDirty );
148
+ const lastIsAutosavingRef = useRef( isAutosaving );
149
149
 
150
150
  useEffect( () => {
151
151
  if (
152
152
  ! didError &&
153
- ( ( lastIsAutosaving.current && ! isAutosaving ) ||
154
- ( lastIsDirty.current && ! isDirty ) )
153
+ ( ( lastIsAutosavingRef.current && ! isAutosaving ) ||
154
+ ( lastIsDirtyRef.current && ! isDirty ) )
155
155
  ) {
156
156
  localAutosaveClear( postId, isEditedPostNew );
157
157
  }
158
158
 
159
- lastIsDirty.current = isDirty;
160
- lastIsAutosaving.current = isAutosaving;
159
+ lastIsDirtyRef.current = isDirty;
160
+ lastIsAutosavingRef.current = isAutosaving;
161
161
  }, [ isDirty, isAutosaving, didError ] );
162
162
 
163
163
  // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
@@ -222,10 +222,11 @@ function PostParentToggle( { isOpen, onClick } ) {
222
222
  }
223
223
 
224
224
  export function ParentRow() {
225
- const homeUrl = useSelect(
226
- ( select ) => select( coreStore ).getUnstableBase()?.home,
227
- []
228
- );
225
+ const homeUrl = useSelect( ( select ) => {
226
+ // Site index.
227
+ return select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
228
+ ?.home;
229
+ }, [] );
229
230
  // Use internal state instead of a ref to make sure that the component
230
231
  // re-renders when the popover's anchor updates.
231
232
  const [ popoverAnchor, setPopoverAnchor ] = useState( null );
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { compose } from '@wordpress/compose';
5
+ import { MenuItem } from '@wordpress/components';
6
+ import { withPluginContext } from '@wordpress/plugins';
7
+ import { ActionItem } from '@wordpress/interface';
8
+
9
+ /**
10
+ * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.
11
+ * The text within the component appears as the menu item label.
12
+ *
13
+ * @param {Object} props Component properties.
14
+ * @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.
15
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.
16
+ * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.
17
+ * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component.
18
+ *
19
+ * @example
20
+ * ```jsx
21
+ * import { __ } from '@wordpress/i18n';
22
+ * import { PluginPreviewMenuItem } from '@wordpress/editor';
23
+ * import { external } from '@wordpress/icons';
24
+ *
25
+ * function onPreviewClick() {
26
+ * // Handle preview action
27
+ * }
28
+ *
29
+ * const ExternalPreviewMenuItem = () => (
30
+ * <PreviewDropdownMenuItem
31
+ * icon={ external }
32
+ * onClick={ onPreviewClick }
33
+ * >
34
+ * { __( 'Preview in new tab' ) }
35
+ * </PreviewDropdownMenuItem>
36
+ * );
37
+ * registerPlugin( 'external-preview-menu-item', {
38
+ * render: ExternalPreviewMenuItem,
39
+ * } );
40
+ * ```
41
+ *
42
+ * @return {Component} The rendered menu item component.
43
+ */
44
+ export default compose(
45
+ withPluginContext( ( context, ownProps ) => {
46
+ return {
47
+ as: ownProps.as ?? MenuItem,
48
+ icon: ownProps.icon || context.icon,
49
+ name: 'core/plugin-preview-menu',
50
+ };
51
+ } )
52
+ )( ActionItem );
@@ -18,13 +18,7 @@ import { store as coreStore } from '@wordpress/core-data';
18
18
  import { unlock } from '../../lock-unlock';
19
19
  import { usePostActions } from './actions';
20
20
 
21
- const {
22
- DropdownMenuV2: DropdownMenu,
23
- DropdownMenuGroupV2: DropdownMenuGroup,
24
- DropdownMenuItemV2: DropdownMenuItem,
25
- DropdownMenuItemLabelV2: DropdownMenuItemLabel,
26
- kebabCase,
27
- } = unlock( componentsPrivateApis );
21
+ const { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );
28
22
 
29
23
  export default function PostActions( { postType, postId, onActionPerformed } ) {
30
24
  const [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );
@@ -60,7 +54,7 @@ export default function PostActions( { postType, postId, onActionPerformed } ) {
60
54
  }, [ allActions, itemWithPermissions ] );
61
55
 
62
56
  return (
63
- <DropdownMenu
57
+ <DropdownMenuV2
64
58
  open={ isActionsMenuOpen }
65
59
  trigger={
66
60
  <Button
@@ -85,7 +79,7 @@ export default function PostActions( { postType, postId, onActionPerformed } ) {
85
79
  setIsActionsMenuOpen( false );
86
80
  } }
87
81
  />
88
- </DropdownMenu>
82
+ </DropdownMenuV2>
89
83
  );
90
84
  }
91
85
 
@@ -99,12 +93,12 @@ function DropdownMenuItemTrigger( { action, onClick, items } ) {
99
93
  const label =
100
94
  typeof action.label === 'string' ? action.label : action.label( items );
101
95
  return (
102
- <DropdownMenuItem
96
+ <DropdownMenuV2.Item
103
97
  onClick={ onClick }
104
98
  hideOnClick={ ! action.RenderModal }
105
99
  >
106
- <DropdownMenuItemLabel>{ label }</DropdownMenuItemLabel>
107
- </DropdownMenuItem>
100
+ <DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>
101
+ </DropdownMenuV2.Item>
108
102
  );
109
103
  }
110
104
 
@@ -151,7 +145,7 @@ function ActionWithModal( { action, item, ActionTrigger, onClose } ) {
151
145
  // With an added onClose prop.
152
146
  function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
153
147
  return (
154
- <DropdownMenuGroup>
148
+ <DropdownMenuV2.Group>
155
149
  { actions.map( ( action ) => {
156
150
  if ( action.RenderModal ) {
157
151
  return (
@@ -173,6 +167,6 @@ function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
173
167
  />
174
168
  );
175
169
  } ) }
176
- </DropdownMenuGroup>
170
+ </DropdownMenuV2.Group>
177
171
  );
178
172
  }
@@ -46,7 +46,7 @@
46
46
  background: $gray-100;
47
47
  color: $gray-700;
48
48
  padding: 0 $grid-unit-05;
49
- border-radius: $radius-block-ui;
49
+ border-radius: $radius-small;
50
50
  font-size: 12px;
51
51
  font-weight: 400;
52
52
  flex-shrink: 0;
@@ -198,6 +198,8 @@ function PrivateExcerpt() {
198
198
  ref={ setPopoverAnchor }
199
199
  renderToggle={ ( { onToggle } ) => (
200
200
  <Button
201
+ // TODO: Switch to `true` (40px size) if possible
202
+ __next40pxDefaultSize={ false }
201
203
  className="editor-post-excerpt__dropdown__trigger"
202
204
  onClick={ onToggle }
203
205
  variant="link"
@@ -160,6 +160,8 @@ function PostFeaturedImage( {
160
160
  render={ ( { open } ) => (
161
161
  <div className="editor-post-featured-image__container">
162
162
  <Button
163
+ // TODO: Switch to `true` (40px size) if possible
164
+ __next40pxDefaultSize={ false }
163
165
  ref={ toggleRef }
164
166
  className={
165
167
  ! featuredImageId
@@ -200,6 +202,8 @@ function PostFeaturedImage( {
200
202
  { !! featuredImageId && (
201
203
  <HStack className="editor-post-featured-image__actions">
202
204
  <Button
205
+ // TODO: Switch to `true` (40px size) if possible
206
+ __next40pxDefaultSize={ false }
203
207
  className="editor-post-featured-image__action"
204
208
  onClick={ open }
205
209
  aria-haspopup="dialog"
@@ -207,6 +211,8 @@ function PostFeaturedImage( {
207
211
  { __( 'Replace' ) }
208
212
  </Button>
209
213
  <Button
214
+ // TODO: Switch to `true` (40px size) if possible
215
+ __next40pxDefaultSize={ false }
210
216
  className="editor-post-featured-image__action"
211
217
  onClick={ () => {
212
218
  onRemoveImage();
@@ -22,7 +22,7 @@
22
22
  }
23
23
 
24
24
  .components-drop-zone__content {
25
- border-radius: $radius-block-ui;
25
+ border-radius: $radius-small;
26
26
  }
27
27
 
28
28
  // Align text and icons horizontally to avoid clipping when the featured image is not set.
@@ -65,7 +65,6 @@
65
65
  }
66
66
 
67
67
  .editor-post-featured-image__toggle {
68
- border-radius: $radius-block-ui;
69
68
  height: 100%;
70
69
  line-height: 20px;
71
70
  padding: $grid-unit-10 0;
@@ -100,6 +100,8 @@ export default function PostFormat() {
100
100
  { suggestion && suggestion.id !== postFormat && (
101
101
  <p className="editor-post-format__suggestion">
102
102
  <Button
103
+ // TODO: Switch to `true` (40px size) if possible
104
+ __next40pxDefaultSize={ false }
103
105
  variant="link"
104
106
  onClick={ () =>
105
107
  onUpdatePostFormat( suggestion.id )
@@ -36,6 +36,8 @@ function PostLastRevision() {
36
36
  return (
37
37
  <PostLastRevisionCheck>
38
38
  <Button
39
+ // TODO: Switch to `true` (40px size) if possible
40
+ __next40pxDefaultSize={ false }
39
41
  href={ addQueryArgs( 'revision.php', {
40
42
  revision: lastRevisionId,
41
43
  } ) }
@@ -178,6 +178,8 @@ export default function PostLockedModal() {
178
178
  shouldCloseOnClickOutside={ false }
179
179
  shouldCloseOnEsc={ false }
180
180
  isDismissible={ false }
181
+ // Do not remove this class, as this class is used by third party plugins.
182
+ className="editor-post-locked-modal"
181
183
  size="medium"
182
184
  >
183
185
  <HStack alignment="top" spacing={ 6 }>
@@ -254,11 +256,21 @@ export default function PostLockedModal() {
254
256
  justify="flex-end"
255
257
  >
256
258
  { ! isTakeover && (
257
- <Button variant="tertiary" href={ unlockUrl }>
259
+ <Button
260
+ // TODO: Switch to `true` (40px size) if possible
261
+ __next40pxDefaultSize={ false }
262
+ variant="tertiary"
263
+ href={ unlockUrl }
264
+ >
258
265
  { __( 'Take over' ) }
259
266
  </Button>
260
267
  ) }
261
- <Button variant="primary" href={ allPostsUrl }>
268
+ <Button
269
+ // TODO: Switch to `true` (40px size) if possible
270
+ __next40pxDefaultSize={ false }
271
+ variant="primary"
272
+ href={ allPostsUrl }
273
+ >
262
274
  { allPostsLabel }
263
275
  </Button>
264
276
  </HStack>
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .editor-post-locked-modal__avatar {
6
- border-radius: $radius-block-ui;
6
+ border-radius: $radius-round;
7
7
  margin-top: $grid-unit-20;
8
8
  min-width: initial !important;
9
9
  }
@@ -78,6 +78,8 @@ export class PostPublishPanel extends Component {
78
78
  <div className="editor-post-publish-panel__header">
79
79
  { isPostPublish ? (
80
80
  <Button
81
+ // TODO: Switch to `true` (40px size) if possible
82
+ __next40pxDefaultSize={ false }
81
83
  onClick={ onClose }
82
84
  icon={ closeSmall }
83
85
  label={ __( 'Close panel' ) }
@@ -25,6 +25,8 @@ const PostFormatSuggestion = ( {
25
25
  onUpdatePostFormat,
26
26
  } ) => (
27
27
  <Button
28
+ // TODO: Switch to `true` (40px size) if possible
29
+ __next40pxDefaultSize={ false }
28
30
  variant="link"
29
31
  onClick={ () => onUpdatePostFormat( suggestedPostFormat ) }
30
32
  >