@wordpress/editor 14.30.1-next.a730c9c8c.0 → 14.31.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 (32) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/index.js +3 -1
  3. package/build/components/collab-sidebar/index.js.map +1 -1
  4. package/build/components/post-excerpt/panel.js +5 -2
  5. package/build/components/post-excerpt/panel.js.map +1 -1
  6. package/build/components/post-template/hooks.js +20 -5
  7. package/build/components/post-template/hooks.js.map +1 -1
  8. package/build/components/provider/index.js +1 -1
  9. package/build/components/provider/index.js.map +1 -1
  10. package/build/dataviews/store/private-actions.js +1 -1
  11. package/build/dataviews/store/private-actions.js.map +1 -1
  12. package/build-module/components/collab-sidebar/index.js +3 -1
  13. package/build-module/components/collab-sidebar/index.js.map +1 -1
  14. package/build-module/components/post-excerpt/panel.js +5 -2
  15. package/build-module/components/post-excerpt/panel.js.map +1 -1
  16. package/build-module/components/post-template/hooks.js +20 -5
  17. package/build-module/components/post-template/hooks.js.map +1 -1
  18. package/build-module/components/provider/index.js +1 -1
  19. package/build-module/components/provider/index.js.map +1 -1
  20. package/build-module/dataviews/store/private-actions.js +1 -1
  21. package/build-module/dataviews/store/private-actions.js.map +1 -1
  22. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  23. package/build-types/components/post-template/hooks.d.ts +1 -1
  24. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  25. package/build-types/components/provider/index.d.ts.map +1 -1
  26. package/package.json +37 -37
  27. package/src/components/collab-sidebar/index.js +2 -1
  28. package/src/components/post-excerpt/panel.js +6 -1
  29. package/src/components/post-template/hooks.js +23 -7
  30. package/src/components/provider/index.js +4 -1
  31. package/src/dataviews/store/private-actions.ts +1 -1
  32. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.30.1-next.a730c9c8c.0",
3
+ "version": "14.31.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,41 +34,41 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@babel/runtime": "7.25.7",
37
- "@wordpress/a11y": "^4.30.1-next.a730c9c8c.0",
38
- "@wordpress/api-fetch": "^7.30.1-next.a730c9c8c.0",
39
- "@wordpress/blob": "^4.30.1-next.a730c9c8c.0",
40
- "@wordpress/block-editor": "^15.3.1-next.a730c9c8c.0",
41
- "@wordpress/blocks": "^15.3.1-next.a730c9c8c.0",
42
- "@wordpress/commands": "^1.30.1-next.a730c9c8c.0",
43
- "@wordpress/components": "^30.3.2-next.a730c9c8c.0",
44
- "@wordpress/compose": "^7.30.1-next.a730c9c8c.0",
45
- "@wordpress/core-data": "^7.30.1-next.a730c9c8c.0",
46
- "@wordpress/data": "^10.30.1-next.a730c9c8c.0",
47
- "@wordpress/dataviews": "^9.0.1-next.a730c9c8c.0",
48
- "@wordpress/date": "^5.30.1-next.a730c9c8c.0",
49
- "@wordpress/deprecated": "^4.30.1-next.a730c9c8c.0",
50
- "@wordpress/dom": "^4.30.1-next.a730c9c8c.0",
51
- "@wordpress/element": "^6.30.1-next.a730c9c8c.0",
52
- "@wordpress/fields": "^0.22.1-next.a730c9c8c.0",
53
- "@wordpress/hooks": "^4.30.1-next.a730c9c8c.0",
54
- "@wordpress/html-entities": "^4.30.1-next.a730c9c8c.0",
55
- "@wordpress/i18n": "^6.3.1-next.a730c9c8c.0",
56
- "@wordpress/icons": "^10.30.1-next.a730c9c8c.0",
57
- "@wordpress/interface": "^9.15.1-next.a730c9c8c.0",
58
- "@wordpress/keyboard-shortcuts": "^5.30.1-next.a730c9c8c.0",
59
- "@wordpress/keycodes": "^4.30.1-next.a730c9c8c.0",
60
- "@wordpress/media-utils": "^5.30.1-next.a730c9c8c.0",
61
- "@wordpress/notices": "^5.30.1-next.a730c9c8c.0",
62
- "@wordpress/patterns": "^2.30.1-next.a730c9c8c.0",
63
- "@wordpress/plugins": "^7.30.1-next.a730c9c8c.0",
64
- "@wordpress/preferences": "^4.30.1-next.a730c9c8c.0",
65
- "@wordpress/private-apis": "^1.30.1-next.a730c9c8c.0",
66
- "@wordpress/reusable-blocks": "^5.30.1-next.a730c9c8c.0",
67
- "@wordpress/rich-text": "^7.30.1-next.a730c9c8c.0",
68
- "@wordpress/server-side-render": "^6.6.1-next.a730c9c8c.0",
69
- "@wordpress/url": "^4.30.1-next.a730c9c8c.0",
70
- "@wordpress/warning": "^3.30.1-next.a730c9c8c.0",
71
- "@wordpress/wordcount": "^4.30.1-next.a730c9c8c.0",
37
+ "@wordpress/a11y": "^4.31.0",
38
+ "@wordpress/api-fetch": "^7.31.0",
39
+ "@wordpress/blob": "^4.31.0",
40
+ "@wordpress/block-editor": "^15.4.0",
41
+ "@wordpress/blocks": "^15.4.0",
42
+ "@wordpress/commands": "^1.31.0",
43
+ "@wordpress/components": "^30.4.0",
44
+ "@wordpress/compose": "^7.31.0",
45
+ "@wordpress/core-data": "^7.31.0",
46
+ "@wordpress/data": "^10.31.0",
47
+ "@wordpress/dataviews": "^9.0.0",
48
+ "@wordpress/date": "^5.31.0",
49
+ "@wordpress/deprecated": "^4.31.0",
50
+ "@wordpress/dom": "^4.31.0",
51
+ "@wordpress/element": "^6.31.0",
52
+ "@wordpress/fields": "^0.23.0",
53
+ "@wordpress/hooks": "^4.31.0",
54
+ "@wordpress/html-entities": "^4.31.0",
55
+ "@wordpress/i18n": "^6.4.0",
56
+ "@wordpress/icons": "^10.31.0",
57
+ "@wordpress/interface": "^9.16.0",
58
+ "@wordpress/keyboard-shortcuts": "^5.31.0",
59
+ "@wordpress/keycodes": "^4.31.0",
60
+ "@wordpress/media-utils": "^5.31.0",
61
+ "@wordpress/notices": "^5.31.0",
62
+ "@wordpress/patterns": "^2.31.0",
63
+ "@wordpress/plugins": "^7.31.0",
64
+ "@wordpress/preferences": "^4.31.0",
65
+ "@wordpress/private-apis": "^1.31.0",
66
+ "@wordpress/reusable-blocks": "^5.31.0",
67
+ "@wordpress/rich-text": "^7.31.0",
68
+ "@wordpress/server-side-render": "^6.7.0",
69
+ "@wordpress/url": "^4.31.0",
70
+ "@wordpress/warning": "^3.31.0",
71
+ "@wordpress/wordcount": "^4.31.0",
72
72
  "change-case": "^4.1.2",
73
73
  "client-zip": "^2.4.5",
74
74
  "clsx": "^2.1.1",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "85a580bd2c55f811c8969b42dbb10209d19d514e"
91
+ "gitHead": "d7601d30d49462ea942168e8ab6bf449fb93097e"
92
92
  }
@@ -257,7 +257,8 @@ export default function CollabSidebar() {
257
257
  const { records: threads, totalPages } = useEntityRecords(
258
258
  'root',
259
259
  'comment',
260
- queryArgs
260
+ queryArgs,
261
+ { enabled: !! postId && typeof postId === 'number' }
261
262
  );
262
263
 
263
264
  const hasMoreComments = totalPages && totalPages > 1;
@@ -109,6 +109,7 @@ function PrivateExcerpt() {
109
109
  getCurrentPostId,
110
110
  getEditedPostAttribute,
111
111
  isEditorPanelEnabled,
112
+ __experimentalGetDefaultTemplateType,
112
113
  } = select( editorStore );
113
114
  const postType = getCurrentPostType();
114
115
  const isTemplateOrTemplatePart = [
@@ -131,13 +132,17 @@ function PrivateExcerpt() {
131
132
  postType,
132
133
  getCurrentPostId()
133
134
  );
135
+ const fallback = isTemplateOrTemplatePart
136
+ ? __experimentalGetDefaultTemplateType( template.slug )
137
+ .description
138
+ : undefined;
134
139
  // For post types that use excerpt as description, we do not abide
135
140
  // by the `isEnabled` panel flag in order to render them as text.
136
141
  const _shouldRender =
137
142
  isEditorPanelEnabled( PANEL_NAME ) ||
138
143
  _shouldBeUsedAsDescription;
139
144
  return {
140
- excerpt: getEditedPostAttribute( _usedAttribute ),
145
+ excerpt: getEditedPostAttribute( _usedAttribute ) ?? fallback,
141
146
  shouldRender: _shouldRender,
142
147
  shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
143
148
  // If we should render, allow editing for all post types that are not used as description.
@@ -52,14 +52,30 @@ export function useAllowSwitchingTemplates() {
52
52
  }
53
53
 
54
54
  function useTemplates( postType ) {
55
- return useSelect(
56
- ( select ) =>
57
- select( coreStore ).getEntityRecords( 'postType', 'wp_template', {
58
- per_page: -1,
59
- post_type: postType,
60
- } ),
55
+ // To do: create a new selector to checks if templates exist at all instead
56
+ // of and unbound request. In the modal, the user templates should be
57
+ // paginated and we should not make an unbound request.
58
+ const { staticTemplates, templates } = useSelect(
59
+ ( select ) => {
60
+ return {
61
+ staticTemplates: select( coreStore ).getEntityRecords(
62
+ 'postType',
63
+ 'wp_registered_template',
64
+ { per_page: -1, post_type: postType }
65
+ ),
66
+ templates: select( coreStore ).getEntityRecords(
67
+ 'postType',
68
+ 'wp_template',
69
+ { per_page: -1, post_type: postType }
70
+ ),
71
+ };
72
+ },
61
73
  [ postType ]
62
74
  );
75
+ return useMemo(
76
+ () => [ ...( staticTemplates || [] ), ...( templates || [] ) ],
77
+ [ staticTemplates, templates ]
78
+ );
63
79
  }
64
80
 
65
81
  export function useAvailableTemplates( postType ) {
@@ -71,7 +87,7 @@ export function useAvailableTemplates( postType ) {
71
87
  allowSwitchingTemplate &&
72
88
  templates?.filter(
73
89
  ( template ) =>
74
- template.is_custom &&
90
+ ( template.is_custom || template.type === 'wp_template' ) &&
75
91
  template.slug !== currentTemplateSlug &&
76
92
  !! template.content.raw // Skip empty templates.
77
93
  ),
@@ -220,7 +220,10 @@ export const ExperimentalEditorProvider = withRegistryProvider(
220
220
  const defaultBlockContext = useMemo( () => {
221
221
  const postContext = {};
222
222
  // If it is a template, try to inherit the post type from the name.
223
- if ( post.type === 'wp_template' ) {
223
+ if (
224
+ post.type === 'wp_template' ||
225
+ post.type === 'wp_registered_template'
226
+ ) {
224
227
  if ( post.slug === 'page' ) {
225
228
  postContext.postType = 'page';
226
229
  } else if ( post.slug === 'single' ) {
@@ -138,7 +138,7 @@ export const registerPostTypeSchema =
138
138
  : undefined,
139
139
  // @ts-ignore
140
140
  globalThis.IS_GUTENBERG_PLUGIN
141
- ? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(
141
+ ? ! [ 'wp_block', 'wp_template_part' ].includes(
142
142
  postTypeConfig.slug
143
143
  ) &&
144
144
  canCreate &&