@wordpress/editor 14.30.1-next.a730c9c8c.0 → 14.31.1-next.f56bd8138.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 (55) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/comment-author-info.js +2 -2
  3. package/build/components/collab-sidebar/comment-author-info.js.map +1 -1
  4. package/build/components/collab-sidebar/comments.js +87 -25
  5. package/build/components/collab-sidebar/comments.js.map +1 -1
  6. package/build/components/collab-sidebar/index.js +4 -1
  7. package/build/components/collab-sidebar/index.js.map +1 -1
  8. package/build/components/post-excerpt/panel.js +5 -2
  9. package/build/components/post-excerpt/panel.js.map +1 -1
  10. package/build/components/post-template/hooks.js +20 -5
  11. package/build/components/post-template/hooks.js.map +1 -1
  12. package/build/components/post-type-support-check/index.js +12 -1
  13. package/build/components/post-type-support-check/index.js.map +1 -1
  14. package/build/components/provider/index.js +1 -1
  15. package/build/components/provider/index.js.map +1 -1
  16. package/build/dataviews/store/private-actions.js +1 -1
  17. package/build/dataviews/store/private-actions.js.map +1 -1
  18. package/build-module/components/collab-sidebar/comment-author-info.js +3 -3
  19. package/build-module/components/collab-sidebar/comment-author-info.js.map +1 -1
  20. package/build-module/components/collab-sidebar/comments.js +91 -30
  21. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  22. package/build-module/components/collab-sidebar/index.js +4 -1
  23. package/build-module/components/collab-sidebar/index.js.map +1 -1
  24. package/build-module/components/post-excerpt/panel.js +5 -2
  25. package/build-module/components/post-excerpt/panel.js.map +1 -1
  26. package/build-module/components/post-template/hooks.js +20 -5
  27. package/build-module/components/post-template/hooks.js.map +1 -1
  28. package/build-module/components/post-type-support-check/index.js +11 -1
  29. package/build-module/components/post-type-support-check/index.js.map +1 -1
  30. package/build-module/components/provider/index.js +1 -1
  31. package/build-module/components/provider/index.js.map +1 -1
  32. package/build-module/dataviews/store/private-actions.js +1 -1
  33. package/build-module/dataviews/store/private-actions.js.map +1 -1
  34. package/build-style/style-rtl.css +13 -0
  35. package/build-style/style.css +13 -0
  36. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  37. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  38. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  39. package/build-types/components/post-template/hooks.d.ts +1 -1
  40. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  41. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  42. package/build-types/components/provider/index.d.ts.map +1 -1
  43. package/package.json +37 -37
  44. package/src/components/collab-sidebar/comment-author-info.js +4 -1
  45. package/src/components/collab-sidebar/comments.js +97 -39
  46. package/src/components/collab-sidebar/index.js +3 -1
  47. package/src/components/collab-sidebar/style.scss +84 -84
  48. package/src/components/post-excerpt/panel.js +6 -1
  49. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  50. package/src/components/post-template/hooks.js +23 -7
  51. package/src/components/post-type-support-check/index.js +18 -1
  52. package/src/components/post-type-support-check/test/index.js +37 -0
  53. package/src/components/provider/index.js +4 -1
  54. package/src/dataviews/store/private-actions.ts +1 -1
  55. package/tsconfig.tsbuildinfo +1 -1
@@ -6,7 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useState, RawHTML } from '@wordpress/element';
9
+ import { useState, RawHTML, useEffect, useMemo } from '@wordpress/element';
10
10
  import {
11
11
  __experimentalHStack as HStack,
12
12
  __experimentalVStack as VStack,
@@ -14,17 +14,46 @@ import {
14
14
  Button,
15
15
  DropdownMenu,
16
16
  } from '@wordpress/components';
17
+
17
18
  import { published, moreVertical } from '@wordpress/icons';
18
- import { __, _x, _n, sprintf } from '@wordpress/i18n';
19
- import { useSelect } from '@wordpress/data';
20
- import { store as blockEditorStore } from '@wordpress/block-editor';
19
+ import { __, _x, sprintf, _n } from '@wordpress/i18n';
20
+ import { useSelect, useDispatch } from '@wordpress/data';
21
+ import {
22
+ store as blockEditorStore,
23
+ privateApis as blockEditorPrivateApis,
24
+ } from '@wordpress/block-editor';
21
25
 
22
26
  /**
23
27
  * Internal dependencies
24
28
  */
29
+ import { unlock } from '../../lock-unlock';
25
30
  import CommentAuthorInfo from './comment-author-info';
26
31
  import CommentForm from './comment-form';
27
32
 
33
+ const { useBlockElement } = unlock( blockEditorPrivateApis );
34
+
35
+ /**
36
+ * Finds the first block that has the specified comment ID.
37
+ *
38
+ * @param {string} commentId - The comment ID to search for.
39
+ * @param {Array} blockList - The list of blocks to search through.
40
+ * @return {string|null} The client ID of the found block, or null if not found.
41
+ */
42
+ const findBlockByCommentId = ( commentId, blockList ) => {
43
+ for ( const block of blockList ) {
44
+ if ( block.attributes?.blockCommentId === commentId ) {
45
+ return block.clientId;
46
+ }
47
+ if ( block.innerBlocks ) {
48
+ const found = findBlockByCommentId( commentId, block.innerBlocks );
49
+ if ( found ) {
50
+ return found;
51
+ }
52
+ }
53
+ }
54
+ return null;
55
+ };
56
+
28
57
  /**
29
58
  * Renders the Comments component.
30
59
  *
@@ -49,27 +78,36 @@ export function Comments( {
49
78
  showCommentBoard,
50
79
  setShowCommentBoard,
51
80
  } ) {
52
- const { blockCommentId } = useSelect( ( select ) => {
53
- const { getBlockAttributes, getSelectedBlockClientId } =
81
+ const { blockCommentId, blocks } = useSelect( ( select ) => {
82
+ const { getBlockAttributes, getSelectedBlockClientId, getBlocks } =
54
83
  select( blockEditorStore );
55
84
  const _clientId = getSelectedBlockClientId();
56
-
57
85
  return {
58
86
  blockCommentId: _clientId
59
87
  ? getBlockAttributes( _clientId )?.blockCommentId
60
88
  : null,
89
+ blocks: getBlocks(),
61
90
  };
62
91
  }, [] );
63
92
 
64
- const [ focusThread, setFocusThread ] = useState(
65
- showCommentBoard && blockCommentId ? blockCommentId : null
66
- );
93
+ const { flashBlock } = useDispatch( blockEditorStore );
67
94
 
68
95
  const clearThreadFocus = () => {
69
96
  setFocusThread( null );
70
97
  setShowCommentBoard( false );
71
98
  };
72
99
 
100
+ const [ focusThread, setFocusThread ] = useState(
101
+ showCommentBoard && blockCommentId ? blockCommentId : null
102
+ );
103
+
104
+ useEffect( () => {
105
+ // Highlight comment when block is selected.
106
+ if ( blockCommentId && ! focusThread ) {
107
+ setFocusThread( blockCommentId );
108
+ }
109
+ }, [ blockCommentId, focusThread, blocks, setFocusThread ] );
110
+
73
111
  return (
74
112
  <>
75
113
  {
@@ -91,34 +129,22 @@ export function Comments( {
91
129
  { Array.isArray( threads ) &&
92
130
  threads.length > 0 &&
93
131
  threads.map( ( thread ) => (
94
- <VStack
132
+ <Thread
95
133
  key={ thread.id }
96
- className={ clsx(
97
- 'editor-collab-sidebar-panel__thread',
98
- {
99
- 'editor-collab-sidebar-panel__active-thread':
100
- blockCommentId &&
101
- blockCommentId === thread.id,
102
- 'editor-collab-sidebar-panel__focus-thread':
103
- focusThread && focusThread === thread.id,
104
- }
105
- ) }
106
- id={ thread.id }
107
- spacing="3"
108
- onClick={ () => setFocusThread( thread.id ) }
109
- >
110
- <Thread
111
- thread={ thread }
112
- onAddReply={ onAddReply }
113
- onCommentDelete={ onCommentDelete }
114
- onCommentResolve={ onCommentResolve }
115
- onCommentReopen={ onCommentReopen }
116
- onEditComment={ onEditComment }
117
- isFocused={ focusThread === thread.id }
118
- clearThreadFocus={ clearThreadFocus }
119
- setFocusThread={ setFocusThread }
120
- />
121
- </VStack>
134
+ thread={ thread }
135
+ onAddReply={ onAddReply }
136
+ onCommentDelete={ onCommentDelete }
137
+ onCommentResolve={ onCommentResolve }
138
+ onCommentReopen={ onCommentReopen }
139
+ onEditComment={ onEditComment }
140
+ isFocused={ focusThread === thread.id }
141
+ clearThreadFocus={ clearThreadFocus }
142
+ setFocusThread={ setFocusThread }
143
+ blockCommentId={ blockCommentId }
144
+ blocks={ blocks }
145
+ flashBlock={ flashBlock }
146
+ setShowCommentBoard={ setShowCommentBoard }
147
+ />
122
148
  ) ) }
123
149
  </>
124
150
  );
@@ -134,9 +160,41 @@ function Thread( {
134
160
  isFocused,
135
161
  clearThreadFocus,
136
162
  setFocusThread,
163
+ blocks,
164
+ flashBlock,
165
+ setShowCommentBoard,
137
166
  } ) {
167
+ // Find first block that has this comment ID - run at component root level.
168
+ const relatedBlock = useMemo( () => {
169
+ if ( ! thread.id || ! blocks ) {
170
+ return null;
171
+ }
172
+ return findBlockByCommentId( thread.id, blocks );
173
+ }, [ thread.id, blocks ] );
174
+
175
+ const relatedBlockElement = useBlockElement( relatedBlock );
176
+
177
+ const handleCommentSelect = ( threadId ) => {
178
+ setShowCommentBoard( false );
179
+ setFocusThread( threadId );
180
+ if ( relatedBlock && relatedBlockElement ) {
181
+ relatedBlockElement.scrollIntoView( {
182
+ behavior: 'instant',
183
+ block: 'center',
184
+ } );
185
+ flashBlock( relatedBlock );
186
+ }
187
+ };
188
+
138
189
  return (
139
- <>
190
+ <VStack
191
+ className={ clsx( 'editor-collab-sidebar-panel__thread', {
192
+ 'editor-collab-sidebar-panel__focus-thread': isFocused,
193
+ } ) }
194
+ id={ thread.id }
195
+ spacing="3"
196
+ onClick={ () => handleCommentSelect( thread.id ) }
197
+ >
140
198
  <CommentBoard
141
199
  thread={ thread }
142
200
  onResolve={ onCommentResolve }
@@ -230,7 +288,7 @@ function Thread( {
230
288
  </VStack>
231
289
  </VStack>
232
290
  ) }
233
- </>
291
+ </VStack>
234
292
  );
235
293
  }
236
294
 
@@ -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;
@@ -377,6 +378,7 @@ export default function CollabSidebar() {
377
378
  // translators: Comments sidebar title
378
379
  title={ __( 'Comments' ) }
379
380
  icon={ commentIcon }
381
+ closeLabel={ __( 'Close Comments' ) }
380
382
  >
381
383
  <CollabSidebarContent
382
384
  comments={ resultComments }
@@ -13,112 +13,112 @@
13
13
  .editor-collab-sidebar-panel {
14
14
  padding: $grid-unit-20;
15
15
  height: 100%;
16
+ }
16
17
 
17
- &__thread {
18
- position: relative;
19
- padding: $grid-unit-20;
20
- border-radius: $radius-large;
21
- border: 1.5px solid $gray-300;
22
- background-color: $gray-100;
23
- margin-bottom: $grid-unit-20;
24
- }
18
+ .editor-collab-sidebar-panel__thread {
19
+ position: relative;
20
+ padding: $grid-unit-20;
21
+ border-radius: $radius-large;
22
+ border: 1.5px solid $gray-300;
23
+ background-color: $gray-100;
24
+ margin-bottom: $grid-unit-20;
25
+ }
25
26
 
26
- &__active-thread {
27
- border: 1.5px solid #3858e9;
28
- }
27
+ .editor-collab-sidebar-panel__active-thread {
28
+ border: 1.5px solid #3858e9;
29
+ }
29
30
 
30
- &__focus-thread {
31
- border: 1.5px solid #3858e9;
32
- background-color: $white;
33
- box-shadow: 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.102);
34
- }
31
+ .editor-collab-sidebar-panel__focus-thread {
32
+ border: 1.5px solid #3858e9;
33
+ background-color: $white;
34
+ box-shadow: 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.102);
35
+ }
35
36
 
36
- &__comment-field {
37
- flex: 1;
37
+ .editor-collab-sidebar-panel__comment-field {
38
+ flex: 1;
38
39
 
39
- button {
40
- flex-grow: 1;
41
- justify-content: center;
42
- }
40
+ button {
41
+ flex-grow: 1;
42
+ justify-content: center;
43
43
  }
44
+ }
44
45
 
45
- &__child-thread {
46
- margin-top: 15px;
47
- }
46
+ .editor-collab-sidebar-panel__child-thread {
47
+ margin-top: 15px;
48
+ }
48
49
 
49
- &__user-name {
50
- font-size: 12px;
51
- font-weight: 400;
52
- line-height: 16px;
53
- text-align: left;
54
- color: $gray-700;
55
- text-transform: capitalize;
56
- }
50
+ .editor-collab-sidebar-panel__user-name {
51
+ font-size: 12px;
52
+ font-weight: 400;
53
+ line-height: 16px;
54
+ text-align: left;
55
+ color: $gray-700;
56
+ text-transform: capitalize;
57
+ }
57
58
 
58
- &__user-time {
59
- font-size: 12px;
60
- font-weight: 400;
61
- line-height: 16px;
62
- text-align: left;
63
- color: $gray-700;
64
- }
59
+ .editor-collab-sidebar-panel__user-time {
60
+ font-size: 12px;
61
+ font-weight: 400;
62
+ line-height: 16px;
63
+ text-align: left;
64
+ color: $gray-700;
65
+ }
65
66
 
66
- &__user-comment {
67
- p:last-child {
68
- margin-bottom: 0;
69
- }
67
+ .editor-collab-sidebar-panel__user-comment {
68
+ p:last-child {
69
+ margin-bottom: 0;
70
70
  }
71
+ }
71
72
 
72
- &__user-avatar {
73
- border-radius: $radius-round;
74
- flex-shrink: 0;
75
- }
73
+ .editor-collab-sidebar-panel__user-avatar {
74
+ border-radius: $radius-round;
75
+ flex-shrink: 0;
76
+ }
76
77
 
77
- &__thread-overlay {
78
- background-color: rgba(0, 0, 0, 0.7);
79
- width: 100%;
80
- height: 100%;
81
- text-align: center;
82
- position: absolute;
83
- top: 0;
84
- left: 0;
85
- z-index: 1;
86
- padding: 15px;
87
- border-radius: $radius-large;
88
- color: $white;
78
+ .editor-collab-sidebar-panel__thread-overlay {
79
+ background-color: rgba(0, 0, 0, 0.7);
80
+ width: 100%;
81
+ height: 100%;
82
+ text-align: center;
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ z-index: 1;
87
+ padding: 15px;
88
+ border-radius: $radius-large;
89
+ color: $white;
89
90
 
90
- p {
91
- margin-bottom: 15px;
92
- }
91
+ p {
92
+ margin-bottom: 15px;
93
+ }
93
94
 
94
- button {
95
- padding: 4px 10px;
96
- color: $white;
97
- }
95
+ button {
96
+ padding: 4px 10px;
97
+ color: $white;
98
98
  }
99
+ }
99
100
 
100
- &__comment-status {
101
- margin-left: auto;
101
+ .editor-collab-sidebar-panel__comment-status {
102
+ margin-left: auto;
102
103
 
103
- button {
104
- &.has-icon:not(.has-text) {
105
- min-width: 24px;
106
- padding: 0;
107
- width: 24px;
108
- height: 24px;
109
- flex-shrink: 0;
110
- }
104
+ button {
105
+ &.has-icon:not(.has-text) {
106
+ min-width: 24px;
107
+ padding: 0;
108
+ width: 24px;
109
+ height: 24px;
110
+ flex-shrink: 0;
111
111
  }
112
112
  }
113
+ }
113
114
 
114
- &__comment-dropdown-menu {
115
- flex-shrink: 0;
116
- }
115
+ .editor-collab-sidebar-panel__comment-dropdown-menu {
116
+ flex-shrink: 0;
117
+ }
117
118
 
118
- &__show-more-reply {
119
- font-weight: 500;
120
- font-style: italic;
121
- }
119
+ .editor-collab-sidebar-panel__show-more-reply {
120
+ font-weight: 500;
121
+ font-style: italic;
122
122
  }
123
123
 
124
124
  // Comment avatar indicators.
@@ -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.
@@ -156,7 +156,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
156
156
  class="post-publish-panel__postpublish-buttons"
157
157
  >
158
158
  <a
159
- class="components-button is-next-40px-default-size is-primary has-icon"
159
+ class="components-button is-next-40px-default-size is-primary has-icon has-icon-right"
160
160
  href="https://wordpress.local/sample-page/"
161
161
  target="_blank"
162
162
  >
@@ -383,7 +383,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
383
383
  class="post-publish-panel__postpublish-buttons"
384
384
  >
385
385
  <a
386
- class="components-button is-next-40px-default-size is-primary has-icon"
386
+ class="components-button is-next-40px-default-size is-primary has-icon has-icon-right"
387
387
  href="https://wordpress.local/sample-page/"
388
388
  target="_blank"
389
389
  >
@@ -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
  ),
@@ -9,6 +9,23 @@ import { store as coreStore } from '@wordpress/core-data';
9
9
  */
10
10
  import { store as editorStore } from '../../store';
11
11
 
12
+ function checkSupport( supports = {}, key ) {
13
+ // Check for top-level support keys.
14
+ if ( supports[ key ] !== undefined ) {
15
+ return !! supports[ key ];
16
+ }
17
+
18
+ const [ topKey, subKey ] = key.split( '.' );
19
+ // Try to unwrap sub-properties from the superfluous array.
20
+ const [ subProperties ] = Array.isArray( supports[ topKey ] )
21
+ ? supports[ topKey ]
22
+ : [];
23
+
24
+ return Array.isArray( subProperties )
25
+ ? subProperties.includes( subKey )
26
+ : !! subProperties?.[ subKey ];
27
+ }
28
+
12
29
  /**
13
30
  * A component which renders its own children only if the current editor post
14
31
  * type supports one of the given `supportKeys` prop.
@@ -31,7 +48,7 @@ function PostTypeSupportCheck( { children, supportKeys } ) {
31
48
  if ( postType ) {
32
49
  isSupported = (
33
50
  Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
34
- ).some( ( key ) => !! postType.supports[ key ] );
51
+ ).some( ( key ) => checkSupport( postType.supports, key ) );
35
52
  }
36
53
 
37
54
  if ( ! isSupported ) {
@@ -96,4 +96,41 @@ describe( 'PostTypeSupportCheck', () => {
96
96
 
97
97
  expect( container ).not.toHaveTextContent( 'Supported' );
98
98
  } );
99
+
100
+ it( 'renders its children when post type supports a sub-feature', () => {
101
+ setupUseSelectMock( {
102
+ supports: {
103
+ editor: [ [ 'block-comments' ] ],
104
+ },
105
+ } );
106
+ const { container } = render(
107
+ <PostTypeSupportCheck supportKeys="editor.block-comments">
108
+ Supported
109
+ </PostTypeSupportCheck>
110
+ );
111
+
112
+ expect( container ).toHaveTextContent( 'Supported' );
113
+ } );
114
+
115
+ it( 'renders its children when post type supports some of the sub-features', () => {
116
+ setupUseSelectMock( {
117
+ supports: {
118
+ editor: [ [ 'block-comments' ] ],
119
+ test: [
120
+ {
121
+ example: false,
122
+ },
123
+ ],
124
+ },
125
+ } );
126
+ const { container } = render(
127
+ <PostTypeSupportCheck
128
+ supportKeys={ [ 'editor.block-comments', 'test.example' ] }
129
+ >
130
+ Supported
131
+ </PostTypeSupportCheck>
132
+ );
133
+
134
+ expect( container ).toHaveTextContent( 'Supported' );
135
+ } );
99
136
  } );
@@ -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 &&