@wordpress/edit-post 8.3.0 → 8.4.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 (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/back-button/fullscreen-mode-close.js +2 -13
  3. package/build/components/back-button/fullscreen-mode-close.js.map +1 -1
  4. package/build/components/init-pattern-modal/index.js +1 -10
  5. package/build/components/init-pattern-modal/index.js.map +1 -1
  6. package/build/components/layout/index.js +9 -4
  7. package/build/components/layout/index.js.map +1 -1
  8. package/build/components/more-menu/manage-patterns-menu-item.js +4 -1
  9. package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -1
  10. package/build/index.js +5 -1
  11. package/build/index.js.map +1 -1
  12. package/build/store/private-selectors.js +6 -2
  13. package/build/store/private-selectors.js.map +1 -1
  14. package/build-module/components/back-button/fullscreen-mode-close.js +2 -13
  15. package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -1
  16. package/build-module/components/init-pattern-modal/index.js +1 -11
  17. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  18. package/build-module/components/layout/index.js +9 -4
  19. package/build-module/components/layout/index.js.map +1 -1
  20. package/build-module/components/more-menu/manage-patterns-menu-item.js +4 -1
  21. package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -1
  22. package/build-module/index.js +5 -1
  23. package/build-module/index.js.map +1 -1
  24. package/build-module/store/private-selectors.js +6 -2
  25. package/build-module/store/private-selectors.js.map +1 -1
  26. package/build-style/style-rtl.css +0 -8
  27. package/build-style/style.css +0 -8
  28. package/package.json +31 -31
  29. package/src/components/back-button/fullscreen-mode-close.js +3 -11
  30. package/src/components/back-button/style.scss +0 -4
  31. package/src/components/init-pattern-modal/index.js +0 -10
  32. package/src/components/layout/index.js +12 -2
  33. package/src/components/layout/style.scss +0 -5
  34. package/src/components/more-menu/manage-patterns-menu-item.js +6 -1
  35. package/src/components/preferences-modal/test/__snapshots__/enable-custom-fields.js.snap +4 -4
  36. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +3 -3
  37. package/src/index.js +4 -0
  38. package/src/store/private-selectors.js +7 -2
@@ -37,6 +37,7 @@ import { addQueryArgs } from '@wordpress/url';
37
37
  import { decodeEntities } from '@wordpress/html-entities';
38
38
  import { store as coreStore } from '@wordpress/core-data';
39
39
  import { SlotFillProvider } from '@wordpress/components';
40
+ import { useViewportMatch } from '@wordpress/compose';
40
41
 
41
42
  /**
42
43
  * Internal dependencies
@@ -198,7 +199,10 @@ function Layout( {
198
199
  const supportsTemplateMode = settings.supportsTemplateMode;
199
200
  const isViewable =
200
201
  getPostType( currentPost.postType )?.viewable ?? false;
201
- const canViewTemplate = canUser( 'read', 'templates' );
202
+ const canViewTemplate = canUser( 'read', {
203
+ kind: 'postType',
204
+ name: 'wp_template',
205
+ } );
202
206
 
203
207
  return {
204
208
  mode: select( editorStore ).getEditorMode(),
@@ -324,6 +328,12 @@ function Layout( {
324
328
  id: initialPostId,
325
329
  };
326
330
  }, [ initialPostType, initialPostId ] );
331
+
332
+ const backButton =
333
+ useViewportMatch( 'medium' ) && isFullscreenActive ? (
334
+ <BackButton initialPost={ initialPost } />
335
+ ) : null;
336
+
327
337
  return (
328
338
  <SlotFillProvider>
329
339
  <ErrorBoundary>
@@ -370,7 +380,7 @@ function Layout( {
370
380
  <InitPatternModal />
371
381
  <PluginArea onError={ onPluginAreaError } />
372
382
  <PostEditorMoreMenu />
373
- <BackButton initialPost={ initialPost } />
383
+ { backButton }
374
384
  <EditorSnackbars />
375
385
  </Editor>
376
386
  </ErrorBoundary>
@@ -1,8 +1,3 @@
1
- .edit-post-visual-editor:not(.is-iframed) {
2
- flex: 1 0 auto;
3
- height: auto;
4
- }
5
-
6
1
  .edit-post-layout__metaboxes {
7
2
  flex-shrink: 0;
8
3
  clear: both;
@@ -20,7 +20,12 @@ function ManagePatternsMenuItem() {
20
20
  // The site editor and templates both check whether the user has
21
21
  // edit_theme_options capabilities. We can leverage that here and not
22
22
  // display the manage patterns link if the user can't access it.
23
- return canUser( 'create', 'templates' ) ? patternsUrl : defaultUrl;
23
+ return canUser( 'create', {
24
+ kind: 'postType',
25
+ name: 'wp_template',
26
+ } )
27
+ ? patternsUrl
28
+ : defaultUrl;
24
29
  }, [] );
25
30
 
26
31
  return (
@@ -29,7 +29,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
29
29
  -webkit-flex-direction: row;
30
30
  -ms-flex-direction: row;
31
31
  flex-direction: row;
32
- gap: calc(4px * 3);
32
+ gap: calc(4px * 2);
33
33
  -webkit-box-pack: start;
34
34
  -ms-flex-pack: start;
35
35
  -webkit-justify-content: flex-start;
@@ -135,7 +135,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
135
135
  -webkit-flex-direction: row;
136
136
  -ms-flex-direction: row;
137
137
  flex-direction: row;
138
- gap: calc(4px * 3);
138
+ gap: calc(4px * 2);
139
139
  -webkit-box-pack: start;
140
140
  -ms-flex-pack: start;
141
141
  -webkit-justify-content: flex-start;
@@ -231,7 +231,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
231
231
  -webkit-flex-direction: row;
232
232
  -ms-flex-direction: row;
233
233
  flex-direction: row;
234
- gap: calc(4px * 3);
234
+ gap: calc(4px * 2);
235
235
  -webkit-box-pack: start;
236
236
  -ms-flex-pack: start;
237
237
  -webkit-justify-content: flex-start;
@@ -338,7 +338,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
338
338
  -webkit-flex-direction: row;
339
339
  -ms-flex-direction: row;
340
340
  flex-direction: row;
341
- gap: calc(4px * 3);
341
+ gap: calc(4px * 2);
342
342
  -webkit-box-pack: start;
343
343
  -ms-flex-pack: start;
344
344
  -webkit-justify-content: flex-start;
@@ -29,7 +29,7 @@ exports[`MetaBoxesSection renders a Custom Fields option 1`] = `
29
29
  -webkit-flex-direction: row;
30
30
  -ms-flex-direction: row;
31
31
  flex-direction: row;
32
- gap: calc(4px * 3);
32
+ gap: calc(4px * 2);
33
33
  -webkit-box-pack: start;
34
34
  -ms-flex-pack: start;
35
35
  -webkit-justify-content: flex-start;
@@ -141,7 +141,7 @@ exports[`MetaBoxesSection renders a Custom Fields option and meta box options 1`
141
141
  -webkit-flex-direction: row;
142
142
  -ms-flex-direction: row;
143
143
  flex-direction: row;
144
- gap: calc(4px * 3);
144
+ gap: calc(4px * 2);
145
145
  -webkit-box-pack: start;
146
146
  -ms-flex-pack: start;
147
147
  -webkit-justify-content: flex-start;
@@ -337,7 +337,7 @@ exports[`MetaBoxesSection renders meta box options 1`] = `
337
337
  -webkit-flex-direction: row;
338
338
  -ms-flex-direction: row;
339
339
  flex-direction: row;
340
- gap: calc(4px * 3);
340
+ gap: calc(4px * 2);
341
341
  -webkit-box-pack: start;
342
342
  -ms-flex-pack: start;
343
343
  -webkit-justify-content: flex-start;
package/src/index.js CHANGED
@@ -28,6 +28,8 @@ import { unlock } from './lock-unlock';
28
28
  const {
29
29
  BackButton: __experimentalMainDashboardButton,
30
30
  registerDefaultActions,
31
+ registerCoreBlockBindingsSources,
32
+ bootstrapBlockBindingsSourcesFromServer,
31
33
  } = unlock( editorPrivateApis );
32
34
 
33
35
  /**
@@ -86,6 +88,8 @@ export function initializeEditor(
86
88
  }
87
89
 
88
90
  registerCoreBlocks();
91
+ bootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );
92
+ registerCoreBlockBindingsSources();
89
93
  registerLegacyWidgetBlock( { inserter: false } );
90
94
  registerWidgetGroupBlock( { inserter: false } );
91
95
  if ( globalThis.IS_GUTENBERG_PLUGIN ) {
@@ -12,8 +12,13 @@ export const getEditedPostTemplateId = createRegistrySelector(
12
12
  type: postType,
13
13
  slug,
14
14
  } = select( editorStore ).getCurrentPost();
15
- const { getSite, getEntityRecords } = select( coreStore );
16
- const siteSettings = getSite();
15
+ const { getSite, getEntityRecords, canUser } = select( coreStore );
16
+ const siteSettings = canUser( 'read', {
17
+ kind: 'root',
18
+ name: 'site',
19
+ } )
20
+ ? getSite()
21
+ : undefined;
17
22
  // First check if the current page is set as the posts page.
18
23
  const isPostsPage = +postId === siteSettings?.page_for_posts;
19
24
  if ( isPostsPage ) {