@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
@@ -14,11 +14,6 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
14
14
  import { useState } from '@wordpress/element';
15
15
  import { isBlobURL } from '@wordpress/blob';
16
16
 
17
- /**
18
- * Internal dependencies
19
- */
20
- import { store as editorStore } from '../../store';
21
-
22
17
  function flattenBlocks( blocks ) {
23
18
  const result = [];
24
19
 
@@ -65,9 +60,11 @@ function Image( block ) {
65
60
 
66
61
  export default function PostFormatPanel() {
67
62
  const [ isUploading, setIsUploading ] = useState( false );
63
+ const [ isAnimating, setIsAnimating ] = useState( false );
64
+ const [ hadUploadError, setHadUploadError ] = useState( false );
68
65
  const { editorBlocks, mediaUpload } = useSelect(
69
66
  ( select ) => ( {
70
- editorBlocks: select( editorStore ).getEditorBlocks(),
67
+ editorBlocks: select( blockEditorStore ).getBlocks(),
71
68
  mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
72
69
  } ),
73
70
  []
@@ -93,6 +90,7 @@ export default function PostFormatPanel() {
93
90
 
94
91
  function uploadImages() {
95
92
  setIsUploading( true );
93
+ setHadUploadError( false );
96
94
  Promise.all(
97
95
  externalImages.map( ( image ) =>
98
96
  window
@@ -102,28 +100,30 @@ export default function PostFormatPanel() {
102
100
  : image.attributes.url + '?'
103
101
  )
104
102
  .then( ( response ) => response.blob() )
105
- .then(
106
- ( blob ) =>
107
- new Promise( ( resolve, reject ) => {
108
- mediaUpload( {
109
- filesList: [ blob ],
110
- onFileChange: ( [ media ] ) => {
111
- if ( isBlobURL( media.url ) ) {
112
- return;
113
- }
103
+ .then( ( blob ) =>
104
+ new Promise( ( resolve, reject ) => {
105
+ mediaUpload( {
106
+ filesList: [ blob ],
107
+ onFileChange: ( [ media ] ) => {
108
+ if ( isBlobURL( media.url ) ) {
109
+ return;
110
+ }
114
111
 
115
- updateBlockAttributes( image.clientId, {
116
- id: media.id,
117
- url: media.url,
118
- } );
119
- resolve();
120
- },
121
- onError() {
122
- reject();
123
- },
124
- } );
125
- } )
112
+ updateBlockAttributes( image.clientId, {
113
+ id: media.id,
114
+ url: media.url,
115
+ } );
116
+ resolve();
117
+ },
118
+ onError() {
119
+ reject();
120
+ },
121
+ } );
122
+ } ).then( () => setIsAnimating( true ) )
126
123
  )
124
+ .catch( () => {
125
+ setHadUploadError( true );
126
+ } )
127
127
  )
128
128
  ).finally( () => {
129
129
  setIsUploading( false );
@@ -144,19 +144,27 @@ export default function PostFormatPanel() {
144
144
  gap: '8px',
145
145
  } }
146
146
  >
147
- <AnimatePresence>
147
+ <AnimatePresence
148
+ onExitComplete={ () => setIsAnimating( false ) }
149
+ >
148
150
  { externalImages.map( ( image ) => {
149
151
  return <Image key={ image.clientId } { ...image } />;
150
152
  } ) }
151
153
  </AnimatePresence>
152
- { isUploading ? (
154
+ { isUploading || isAnimating ? (
153
155
  <Spinner />
154
156
  ) : (
155
- <Button variant="primary" onClick={ uploadImages }>
157
+ <Button
158
+ // TODO: Switch to `true` (40px size) if possible
159
+ __next40pxDefaultSize={ false }
160
+ variant="primary"
161
+ onClick={ uploadImages }
162
+ >
156
163
  { __( 'Upload' ) }
157
164
  </Button>
158
165
  ) }
159
166
  </div>
167
+ { hadUploadError && <p>{ __( 'Upload failed, try again.' ) }</p> }
160
168
  </PanelBody>
161
169
  );
162
170
  }
@@ -37,8 +37,9 @@
37
37
 
38
38
  .components-site-icon {
39
39
  border: none;
40
- border-radius: $radius-block-ui;
40
+ border-radius: $radius-small;
41
41
  margin-right: $grid-unit-15;
42
+ flex-shrink: 0;
42
43
 
43
44
  // Same size as in the Site menu.
44
45
  height: 36px;
@@ -54,6 +55,7 @@
54
55
  display: block;
55
56
  color: $gray-700;
56
57
  font-size: $helptext-font-size;
58
+ word-break: break-word;
57
59
  }
58
60
 
59
61
  .editor-post-publish-panel__header-publish-button,
@@ -171,7 +171,7 @@ export default function PostStatus() {
171
171
  contentClassName="editor-change-status__content"
172
172
  popoverProps={ popoverProps }
173
173
  focusOnMount
174
- renderToggle={ ( { onToggle } ) => (
174
+ renderToggle={ ( { onToggle, isOpen } ) => (
175
175
  <Button
176
176
  variant="tertiary"
177
177
  size="compact"
@@ -179,9 +179,10 @@ export default function PostStatus() {
179
179
  icon={ postStatusesInfo[ status ]?.icon }
180
180
  aria-label={ sprintf(
181
181
  // translators: %s: Current post status.
182
- __( 'Change post status: %s' ),
182
+ __( 'Change status: %s' ),
183
183
  postStatusesInfo[ status ]?.label
184
184
  ) }
185
+ aria-expanded={ isOpen }
185
186
  >
186
187
  { postStatusesInfo[ status ]?.label }
187
188
  </Button>
@@ -428,6 +428,8 @@ export function HierarchicalTermSelector( { slug } ) {
428
428
  { ! loading && hasCreateAction && (
429
429
  <FlexItem>
430
430
  <Button
431
+ // TODO: Switch to `true` (40px size) if possible
432
+ __next40pxDefaultSize={ false }
431
433
  onClick={ onToggleForm }
432
434
  className="editor-post-taxonomies__hierarchical-terms-add"
433
435
  aria-expanded={ showForm }
@@ -62,6 +62,8 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
62
62
  { terms.map( ( term ) => (
63
63
  <li key={ term.id }>
64
64
  <Button
65
+ // TODO: Switch to `true` (40px size) if possible
66
+ __next40pxDefaultSize={ false }
65
67
  variant="link"
66
68
  onClick={ () => onSelect( term ) }
67
69
  >
@@ -8,6 +8,7 @@ import { __ } from '@wordpress/i18n';
8
8
  import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
9
9
  import { check } from '@wordpress/icons';
10
10
  import { store as noticesStore } from '@wordpress/notices';
11
+ import { store as preferencesStore } from '@wordpress/preferences';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
@@ -43,6 +44,8 @@ export default function BlockThemeControl( { id } ) {
43
44
  };
44
45
  }, [] );
45
46
 
47
+ const { get: getPreference } = useSelect( preferencesStore );
48
+
46
49
  const { editedRecord: template, hasResolved } = useEntityRecord(
47
50
  'postType',
48
51
  'wp_template',
@@ -75,6 +78,17 @@ export default function BlockThemeControl( { id } ) {
75
78
  },
76
79
  ]
77
80
  : undefined;
81
+
82
+ const mayShowTemplateEditNotice = () => {
83
+ if ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {
84
+ createSuccessNotice(
85
+ __(
86
+ 'Editing template. Changes made here affect all posts and pages that use the template.'
87
+ ),
88
+ { type: 'snackbar', actions: notificationAction }
89
+ );
90
+ }
91
+ };
78
92
  return (
79
93
  <DropdownMenu
80
94
  popoverProps={ POPOVER_PROPS }
@@ -99,15 +113,7 @@ export default function BlockThemeControl( { id } ) {
99
113
  postType: 'wp_template',
100
114
  } );
101
115
  onClose();
102
- createSuccessNotice(
103
- __(
104
- 'Editing template. Changes made here affect all posts and pages that use the template.'
105
- ),
106
- {
107
- type: 'snackbar',
108
- actions: notificationAction,
109
- }
110
- );
116
+ mayShowTemplateEditNotice();
111
117
  } }
112
118
  >
113
119
  { __( 'Edit template' ) }
@@ -177,6 +177,8 @@ function PostTemplateDropdownContent( { onClose } ) {
177
177
  { canEdit && onNavigateToEntityRecord && (
178
178
  <p>
179
179
  <Button
180
+ // TODO: Switch to `true` (40px size) if possible
181
+ __next40pxDefaultSize={ false }
180
182
  variant="link"
181
183
  onClick={ () => {
182
184
  onNavigateToEntityRecord( {
@@ -15,7 +15,6 @@ import { pasteHandler } from '@wordpress/blocks';
15
15
  import {
16
16
  __unstableUseRichText as useRichText,
17
17
  create,
18
- toHTMLString,
19
18
  insert,
20
19
  } from '@wordpress/rich-text';
21
20
  import { useMergeRefs } from '@wordpress/compose';
@@ -50,9 +49,35 @@ function PostTitle( _, forwardedRef ) {
50
49
  const { clearSelectedBlock, insertBlocks, insertDefaultBlock } =
51
50
  useDispatch( blockEditorStore );
52
51
 
53
- function onChange( value ) {
54
- onUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );
55
- }
52
+ const decodedPlaceholder =
53
+ decodeEntities( placeholder ) || __( 'Add title' );
54
+
55
+ const {
56
+ value,
57
+ onChange,
58
+ ref: richTextRef,
59
+ } = useRichText( {
60
+ value: title,
61
+ onChange( newValue ) {
62
+ onUpdate( newValue.replace( REGEXP_NEWLINES, ' ' ) );
63
+ },
64
+ placeholder: decodedPlaceholder,
65
+ selectionStart: selection.start,
66
+ selectionEnd: selection.end,
67
+ onSelectionChange( newStart, newEnd ) {
68
+ setSelection( ( sel ) => {
69
+ const { start, end } = sel;
70
+ if ( start === newStart && end === newEnd ) {
71
+ return sel;
72
+ }
73
+ return {
74
+ start: newStart,
75
+ end: newEnd,
76
+ };
77
+ } );
78
+ },
79
+ __unstableDisableFormats: false,
80
+ } );
56
81
 
57
82
  function onInsertBlockAfter( blocks ) {
58
83
  insertBlocks( blocks, 0 );
@@ -130,49 +155,14 @@ function PostTitle( _, forwardedRef ) {
130
155
  onInsertBlockAfter( content );
131
156
  }
132
157
  } else {
133
- const value = {
134
- ...create( { html: title } ),
135
- ...selection,
136
- };
137
-
138
158
  // Strip HTML to avoid unwanted HTML being added to the title.
139
159
  // In the majority of cases it is assumed that HTML in the title
140
160
  // is undesirable.
141
161
  const contentNoHTML = stripHTML( content );
142
-
143
- const newValue = insert( value, create( { html: contentNoHTML } ) );
144
- onUpdate( toHTMLString( { value: newValue } ) );
145
- setSelection( {
146
- start: newValue.start,
147
- end: newValue.end,
148
- } );
162
+ onChange( insert( value, create( { html: contentNoHTML } ) ) );
149
163
  }
150
164
  }
151
165
 
152
- const decodedPlaceholder =
153
- decodeEntities( placeholder ) || __( 'Add title' );
154
-
155
- const { ref: richTextRef } = useRichText( {
156
- value: title,
157
- onChange,
158
- placeholder: decodedPlaceholder,
159
- selectionStart: selection.start,
160
- selectionEnd: selection.end,
161
- onSelectionChange( newStart, newEnd ) {
162
- setSelection( ( sel ) => {
163
- const { start, end } = sel;
164
- if ( start === newStart && end === newEnd ) {
165
- return sel;
166
- }
167
- return {
168
- start: newStart,
169
- end: newEnd,
170
- };
171
- } );
172
- },
173
- __unstableDisableFormats: false,
174
- } );
175
-
176
166
  // The wp-block className is important for editor styles.
177
167
  // This same block is used in both the visual and the code editor.
178
168
  const className = clsx( DEFAULT_CLASSNAMES, {
@@ -192,7 +182,6 @@ function PostTitle( _, forwardedRef ) {
192
182
  onFocus={ onSelect }
193
183
  onBlur={ onUnselect }
194
184
  onKeyDown={ onKeyDown }
195
- onKeyPress={ onUnselect }
196
185
  onPaste={ onPaste }
197
186
  />
198
187
  </PostTypeSupportCheck>
@@ -110,6 +110,8 @@ export default function PostURL( { onClose } ) {
110
110
  }
111
111
  suffix={
112
112
  <Button
113
+ // TODO: Switch to `true` (40px size) if possible
114
+ __next40pxDefaultSize={ false }
113
115
  icon={ copySmall }
114
116
  ref={ copyButtonRef }
115
117
  label={ __( 'Copy' ) }
@@ -22,6 +22,7 @@ import { store as coreStore } from '@wordpress/core-data';
22
22
  import { useEffect, useRef } from '@wordpress/element';
23
23
  import { store as preferencesStore } from '@wordpress/preferences';
24
24
  import { store as blockEditorStore } from '@wordpress/block-editor';
25
+ import { ActionItem } from '@wordpress/interface';
25
26
 
26
27
  /**
27
28
  * Internal dependencies
@@ -39,14 +40,14 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
39
40
  showIconLabels,
40
41
  } = useSelect( ( select ) => {
41
42
  const { getDeviceType, getCurrentPostType } = select( editorStore );
42
- const { getUnstableBase, getPostType } = select( coreStore );
43
+ const { getEntityRecord, getPostType } = select( coreStore );
43
44
  const { get } = select( preferencesStore );
44
45
  const { __unstableGetEditorMode } = select( blockEditorStore );
45
46
  const _currentPostType = getCurrentPostType();
46
47
  return {
47
48
  deviceType: getDeviceType(),
48
49
  editorMode: __unstableGetEditorMode(),
49
- homeUrl: getUnstableBase()?.home,
50
+ homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
50
51
  isTemplate: _currentPostType === 'wp_template',
51
52
  isViewable: getPostType( _currentPostType )?.viewable ?? false,
52
53
  showIconLabels: get( 'core', 'showIconLabels' ),
@@ -58,18 +59,18 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
58
59
  /**
59
60
  * Save the original editing mode in a ref to restore it when we exit zoom out.
60
61
  */
61
- const originalEditingMode = useRef( editorMode );
62
+ const originalEditingModeRef = useRef( editorMode );
62
63
  useEffect( () => {
63
64
  if ( editorMode !== 'zoom-out' ) {
64
- originalEditingMode.current = editorMode;
65
+ originalEditingModeRef.current = editorMode;
65
66
  }
66
67
 
67
68
  return () => {
68
69
  if (
69
70
  editorMode === 'zoom-out' &&
70
- editorMode !== originalEditingMode.current
71
+ editorMode !== originalEditingModeRef.current
71
72
  ) {
72
- __unstableSetEditorMode( originalEditingMode.current );
73
+ __unstableSetEditorMode( originalEditingModeRef.current );
73
74
  }
74
75
  };
75
76
  }, [ editorMode, __unstableSetEditorMode ] );
@@ -111,22 +112,24 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
111
112
  label: __( 'Desktop' ),
112
113
  icon: desktop,
113
114
  },
114
- {
115
+ ];
116
+ if ( window.__experimentalEnableZoomOutExperiment ) {
117
+ choices.push( {
115
118
  value: 'ZoomOut',
116
119
  label: __( 'Desktop (50%)' ),
117
120
  icon: desktop,
118
- },
119
- {
120
- value: 'Tablet',
121
- label: __( 'Tablet' ),
122
- icon: tablet,
123
- },
124
- {
125
- value: 'Mobile',
126
- label: __( 'Mobile' ),
127
- icon: mobile,
128
- },
129
- ];
121
+ } );
122
+ }
123
+ choices.push( {
124
+ value: 'Tablet',
125
+ label: __( 'Tablet' ),
126
+ icon: tablet,
127
+ } );
128
+ choices.push( {
129
+ value: 'Mobile',
130
+ label: __( 'Mobile' ),
131
+ icon: mobile,
132
+ } );
130
133
 
131
134
  const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;
132
135
 
@@ -136,7 +139,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
136
139
  * @param {string} value The device type.
137
140
  */
138
141
  const onSelect = ( value ) => {
139
- let newEditorMode = originalEditingMode.current;
142
+ let newEditorMode = originalEditingModeRef.current;
140
143
 
141
144
  if ( value === 'ZoomOut' ) {
142
145
  newEditorMode = 'zoom-out';
@@ -206,6 +209,11 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
206
209
  />
207
210
  </MenuGroup>
208
211
  ) }
212
+ <ActionItem.Slot
213
+ name="core/plugin-preview-menu"
214
+ as={ MenuGroup }
215
+ fillProps={ { onClick: onClose } }
216
+ />
209
217
  </>
210
218
  ) }
211
219
  </DropdownMenu>
@@ -23,7 +23,7 @@ import {
23
23
  import inserterMediaCategories from '../media-categories';
24
24
  import { mediaUpload } from '../../utils';
25
25
  import { store as editorStore } from '../../store';
26
- import { lock, unlock } from '../../lock-unlock';
26
+ import { unlock } from '../../lock-unlock';
27
27
  import { useGlobalStylesContext } from '../global-styles-provider';
28
28
 
29
29
  const EMPTY_BLOCKS_LIST = [];
@@ -47,6 +47,7 @@ const BLOCK_EDITOR_SETTINGS = [
47
47
  'allowedMimeTypes',
48
48
  'bodyPlaceholder',
49
49
  'canLockBlocks',
50
+ 'canUpdateBlockBindings',
50
51
  'capabilities',
51
52
  'clearBlockSelection',
52
53
  'codeEditingEnabled',
@@ -74,7 +75,6 @@ const BLOCK_EDITOR_SETTINGS = [
74
75
  'postContentAttributes',
75
76
  'postsPerPage',
76
77
  'readOnly',
77
- 'sectionRootClientId',
78
78
  'styles',
79
79
  'titlePlaceholder',
80
80
  'supportsLayout',
@@ -90,6 +90,7 @@ const {
90
90
  globalStylesLinksDataKey,
91
91
  selectBlockPatternsKey,
92
92
  reusableBlocksSelectKey,
93
+ sectionRootClientIdKey,
93
94
  } = unlock( privateApis );
94
95
 
95
96
  /**
@@ -325,10 +326,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
325
326
  ? [ [ 'core/navigation', {}, [] ] ]
326
327
  : settings.template,
327
328
  __experimentalSetIsInserterOpened: setIsInserterOpened,
329
+ [ sectionRootClientIdKey ]: sectionRootClientId,
328
330
  };
329
- lock( blockEditorSettings, {
330
- sectionRootClientId,
331
- } );
331
+
332
332
  return blockEditorSettings;
333
333
  }, [
334
334
  allowedBlockTypes,
@@ -16,7 +16,7 @@
16
16
  cursor: ew-resize;
17
17
  outline: none;
18
18
  background: none;
19
- border-radius: $radius-block-ui;
19
+ border-radius: $radius-full;
20
20
  border: 0;
21
21
  height: 100px;
22
22
 
@@ -29,7 +29,7 @@
29
29
  content: "";
30
30
  width: $grid-unit-05;
31
31
  background-color: rgba($gray-700, 0.4);
32
- border-radius: $radius-block-ui;
32
+ border-radius: $radius-full;
33
33
  }
34
34
 
35
35
  &.is-left {
@@ -71,6 +71,8 @@ export default function SavePublishPanels( {
71
71
  unmountableContent = (
72
72
  <div className="editor-layout__toggle-publish-panel">
73
73
  <Button
74
+ // TODO: Switch to `true` (40px size) if possible
75
+ __next40pxDefaultSize={ false }
74
76
  variant="secondary"
75
77
  className="editor-layout__toggle-publish-panel-button"
76
78
  onClick={ togglePublishSidebar }
@@ -84,6 +86,8 @@ export default function SavePublishPanels( {
84
86
  unmountableContent = (
85
87
  <div className="editor-layout__toggle-entities-saved-states-panel">
86
88
  <Button
89
+ // TODO: Switch to `true` (40px size) if possible
90
+ __next40pxDefaultSize={ false }
87
91
  variant="secondary"
88
92
  className="editor-layout__toggle-entities-saved-states-panel-button"
89
93
  onClick={ openEntitiesSavedStates }
@@ -155,7 +155,12 @@ function StartModal( { slug, isCustom, onClose, postType } ) {
155
155
  expanded={ false }
156
156
  >
157
157
  <FlexItem>
158
- <Button variant="tertiary" onClick={ onClose }>
158
+ <Button
159
+ // TODO: Switch to `true` (40px size) if possible
160
+ __next40pxDefaultSize={ false }
161
+ variant="tertiary"
162
+ onClick={ onClose }
163
+ >
159
164
  { __( 'Skip' ) }
160
165
  </Button>
161
166
  </FlexItem>
@@ -30,6 +30,8 @@ function TableOfContents(
30
30
  contentClassName="table-of-contents__popover"
31
31
  renderToggle={ ( { isOpen, onToggle } ) => (
32
32
  <Button
33
+ // TODO: Switch to `true` (40px size) if possible
34
+ __next40pxDefaultSize={ false }
33
35
  { ...props }
34
36
  ref={ ref }
35
37
  onClick={ hasBlocks ? onToggle : undefined }
@@ -40,6 +40,8 @@ export default function TextEditor( { autoFocus = false } ) {
40
40
  <div className="editor-text-editor__toolbar">
41
41
  <h2>{ __( 'Editing code' ) }</h2>
42
42
  <Button
43
+ // TODO: Switch to `true` (40px size) if possible
44
+ __next40pxDefaultSize={ false }
43
45
  variant="tertiary"
44
46
  onClick={ () => switchEditorMode( 'visual' ) }
45
47
  shortcut={ shortcut }
@@ -128,8 +128,7 @@ function VisualEditor( {
128
128
  getRenderingMode,
129
129
  getDeviceType,
130
130
  } = select( editorStore );
131
- const { getPostType, canUser, getEditedEntityRecord } =
132
- select( coreStore );
131
+ const { getPostType, getEditedEntityRecord } = select( coreStore );
133
132
  const postTypeSlug = getCurrentPostType();
134
133
  const _renderingMode = getRenderingMode();
135
134
  let _wrapperBlockName;
@@ -143,10 +142,6 @@ function VisualEditor( {
143
142
  const editorSettings = getEditorSettings();
144
143
  const supportsTemplateMode = editorSettings.supportsTemplateMode;
145
144
  const postTypeObject = getPostType( postTypeSlug );
146
- const canEditTemplate = canUser( 'create', {
147
- kind: 'postType',
148
- name: 'wp_template',
149
- } );
150
145
  const currentTemplateId = getCurrentTemplateId();
151
146
  const template = currentTemplateId
152
147
  ? getEditedEntityRecord(
@@ -163,9 +158,7 @@ function VisualEditor( {
163
158
  // Post template fetch returns a 404 on classic themes, which
164
159
  // messes with e2e tests, so check it's a block theme first.
165
160
  editedPostTemplate:
166
- postTypeObject?.viewable &&
167
- supportsTemplateMode &&
168
- canEditTemplate
161
+ postTypeObject?.viewable && supportsTemplateMode
169
162
  ? template
170
163
  : undefined,
171
164
  wrapperBlockName: _wrapperBlockName,
@@ -9,6 +9,7 @@ import { downloadZip } from 'client-zip';
9
9
  */
10
10
  import { downloadBlob } from '@wordpress/blob';
11
11
  import { __ } from '@wordpress/i18n';
12
+ import { download } from '@wordpress/icons';
12
13
  import type { Action } from '@wordpress/dataviews';
13
14
 
14
15
  /**
@@ -36,6 +37,7 @@ function getJsonFromItem( item: Pattern ) {
36
37
  const exportPattern: Action< Pattern > = {
37
38
  id: 'export-pattern',
38
39
  label: __( 'Export as JSON' ),
40
+ icon: download,
39
41
  supportsBulk: true,
40
42
  isEligible: ( item ) => item.type === 'wp_block',
41
43
  callback: async ( items ) => {
@@ -5,6 +5,7 @@ import { store as coreStore } from '@wordpress/core-data';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
7
  import type { Action } from '@wordpress/dataviews';
8
+ import { trash } from '@wordpress/icons';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
@@ -16,6 +17,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
16
17
  id: 'permanently-delete',
17
18
  label: __( 'Permanently delete' ),
18
19
  supportsBulk: true,
20
+ icon: trash,
19
21
  isEligible( item ) {
20
22
  if ( isTemplateOrTemplatePart( item ) || item.type === 'wp_block' ) {
21
23
  return false;
@@ -114,6 +114,8 @@ const resetPost: Action< Post > = {
114
114
  </Text>
115
115
  <HStack justify="right">
116
116
  <Button
117
+ // TODO: Switch to `true` (40px size) if possible
118
+ __next40pxDefaultSize={ false }
117
119
  variant="tertiary"
118
120
  onClick={ closeModal }
119
121
  disabled={ isBusy }
@@ -122,6 +124,8 @@ const resetPost: Action< Post > = {
122
124
  { __( 'Cancel' ) }
123
125
  </Button>
124
126
  <Button
127
+ // TODO: Switch to `true` (40px size) if possible
128
+ __next40pxDefaultSize={ false }
125
129
  variant="primary"
126
130
  onClick={ async () => {
127
131
  setIsBusy( true );
@@ -67,6 +67,8 @@ const trashPost: Action< PostWithPermissions > = {
67
67
  </Text>
68
68
  <HStack justify="right">
69
69
  <Button
70
+ // TODO: Switch to `true` (40px size) if possible
71
+ __next40pxDefaultSize={ false }
70
72
  variant="tertiary"
71
73
  onClick={ closeModal }
72
74
  disabled={ isBusy }
@@ -75,6 +77,8 @@ const trashPost: Action< PostWithPermissions > = {
75
77
  { __( 'Cancel' ) }
76
78
  </Button>
77
79
  <Button
80
+ // TODO: Switch to `true` (40px size) if possible
81
+ __next40pxDefaultSize={ false }
78
82
  variant="primary"
79
83
  onClick={ async () => {
80
84
  setIsBusy( true );