@wordpress/editor 12.6.0 → 12.9.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 (103) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/editor-help/help-section-title.native.js +43 -0
  3. package/build/components/editor-help/help-section-title.native.js.map +1 -0
  4. package/build/components/editor-help/help-topic-row.native.js +3 -2
  5. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  6. package/build/components/editor-help/icon-move-blocks.native.js +23 -0
  7. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -0
  8. package/build/components/editor-help/index.native.js +10 -11
  9. package/build/components/editor-help/index.native.js.map +1 -1
  10. package/build/components/editor-help/move-blocks.native.js +14 -2
  11. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  12. package/build/components/editor-help/view-sections.native.js +21 -5
  13. package/build/components/editor-help/view-sections.native.js.map +1 -1
  14. package/build/components/post-featured-image/index.js +84 -41
  15. package/build/components/post-featured-image/index.js.map +1 -1
  16. package/build/components/post-schedule/index.js +11 -18
  17. package/build/components/post-schedule/index.js.map +1 -1
  18. package/build/components/post-taxonomies/flat-term-selector.js +2 -2
  19. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  20. package/build/components/post-taxonomies/index.js +7 -1
  21. package/build/components/post-taxonomies/index.js.map +1 -1
  22. package/build/components/post-text-editor/index.js +12 -1
  23. package/build/components/post-text-editor/index.js.map +1 -1
  24. package/build/components/post-visibility/index.js +132 -167
  25. package/build/components/post-visibility/index.js.map +1 -1
  26. package/build/components/post-visibility/label.js +5 -22
  27. package/build/components/post-visibility/label.js.map +1 -1
  28. package/build/components/post-visibility/utils.js +14 -13
  29. package/build/components/post-visibility/utils.js.map +1 -1
  30. package/build/components/provider/index.native.js +3 -1
  31. package/build/components/provider/index.native.js.map +1 -1
  32. package/build/components/provider/use-block-editor-settings.js +15 -9
  33. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  34. package/build/store/selectors.js +2 -2
  35. package/build/store/selectors.js.map +1 -1
  36. package/build-module/components/editor-help/help-section-title.native.js +31 -0
  37. package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
  38. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  39. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  40. package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
  41. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
  42. package/build-module/components/editor-help/index.native.js +10 -12
  43. package/build-module/components/editor-help/index.native.js.map +1 -1
  44. package/build-module/components/editor-help/move-blocks.native.js +15 -3
  45. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  46. package/build-module/components/editor-help/view-sections.native.js +22 -6
  47. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  48. package/build-module/components/post-featured-image/index.js +86 -42
  49. package/build-module/components/post-featured-image/index.js.map +1 -1
  50. package/build-module/components/post-schedule/index.js +12 -19
  51. package/build-module/components/post-schedule/index.js.map +1 -1
  52. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -2
  53. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  54. package/build-module/components/post-taxonomies/index.js +7 -1
  55. package/build-module/components/post-taxonomies/index.js.map +1 -1
  56. package/build-module/components/post-text-editor/index.js +13 -2
  57. package/build-module/components/post-text-editor/index.js.map +1 -1
  58. package/build-module/components/post-visibility/index.js +132 -166
  59. package/build-module/components/post-visibility/index.js.map +1 -1
  60. package/build-module/components/post-visibility/label.js +5 -20
  61. package/build-module/components/post-visibility/label.js.map +1 -1
  62. package/build-module/components/post-visibility/utils.js +14 -13
  63. package/build-module/components/post-visibility/utils.js.map +1 -1
  64. package/build-module/components/provider/index.native.js +2 -1
  65. package/build-module/components/provider/index.native.js.map +1 -1
  66. package/build-module/components/provider/use-block-editor-settings.js +16 -10
  67. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  68. package/build-module/store/selectors.js +2 -2
  69. package/build-module/store/selectors.js.map +1 -1
  70. package/build-style/style-rtl.css +51 -52
  71. package/build-style/style.css +51 -52
  72. package/package.json +29 -28
  73. package/src/components/autosave-monitor/test/index.js +3 -0
  74. package/src/components/editor-help/help-section-title.native.js +29 -0
  75. package/src/components/editor-help/help-topic-row.native.js +2 -2
  76. package/src/components/editor-help/icon-move-blocks.native.js +10 -0
  77. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  78. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  79. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  80. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  81. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  82. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  83. package/src/components/editor-help/index.native.js +20 -22
  84. package/src/components/editor-help/move-blocks.native.js +22 -2
  85. package/src/components/editor-help/style.scss +36 -4
  86. package/src/components/editor-help/test/index.native.js +1 -1
  87. package/src/components/editor-help/view-sections.native.js +23 -8
  88. package/src/components/post-featured-image/index.js +102 -69
  89. package/src/components/post-saved-state/style.scss +9 -0
  90. package/src/components/post-schedule/index.js +6 -13
  91. package/src/components/post-slug/test/index.js +4 -4
  92. package/src/components/post-taxonomies/flat-term-selector.js +5 -2
  93. package/src/components/post-taxonomies/index.js +3 -1
  94. package/src/components/post-text-editor/index.js +13 -1
  95. package/src/components/post-visibility/index.js +130 -150
  96. package/src/components/post-visibility/label.js +6 -15
  97. package/src/components/post-visibility/style.scss +25 -20
  98. package/src/components/post-visibility/utils.js +7 -12
  99. package/src/components/provider/index.native.js +2 -1
  100. package/src/components/provider/use-block-editor-settings.js +28 -12
  101. package/src/components/table-of-contents/style.scss +1 -3
  102. package/src/store/selectors.js +4 -2
  103. package/src/store/test/selectors.js +5 -5
@@ -2,13 +2,15 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { Component } from '@wordpress/element';
5
+ import { useState } from '@wordpress/element';
6
6
  import {
7
7
  VisuallyHidden,
8
8
  __experimentalConfirmDialog as ConfirmDialog,
9
+ Button,
9
10
  } from '@wordpress/components';
10
- import { withInstanceId, compose } from '@wordpress/compose';
11
- import { withSelect, withDispatch } from '@wordpress/data';
11
+ import { useInstanceId } from '@wordpress/compose';
12
+ import { useSelect, useDispatch } from '@wordpress/data';
13
+ import { close as closeIcon } from '@wordpress/icons';
12
14
 
13
15
  /**
14
16
  * Internal dependencies
@@ -16,172 +18,150 @@ import { withSelect, withDispatch } from '@wordpress/data';
16
18
  import { visibilityOptions } from './utils';
17
19
  import { store as editorStore } from '../../store';
18
20
 
19
- export class PostVisibility extends Component {
20
- constructor( props ) {
21
- super( ...arguments );
21
+ export default function PostVisibility( { onClose } ) {
22
+ const instanceId = useInstanceId( PostVisibility );
22
23
 
23
- this.setPublic = this.setPublic.bind( this );
24
- this.setPrivate = this.setPrivate.bind( this );
25
- this.setPasswordProtected = this.setPasswordProtected.bind( this );
26
- this.updatePassword = this.updatePassword.bind( this );
24
+ const { status, visibility, password } = useSelect( ( select ) => ( {
25
+ status: select( editorStore ).getEditedPostAttribute( 'status' ),
26
+ visibility: select( editorStore ).getEditedPostVisibility(),
27
+ password: select( editorStore ).getEditedPostAttribute( 'password' ),
28
+ } ) );
27
29
 
28
- this.state = {
29
- hasPassword: !! props.password,
30
- showPrivateConfirmDialog: false,
31
- };
32
- }
30
+ const { editPost, savePost } = useDispatch( editorStore );
33
31
 
34
- setPublic() {
35
- const { visibility, onUpdateVisibility, status } = this.props;
32
+ const [ hasPassword, setHasPassword ] = useState( !! password );
33
+ const [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] = useState(
34
+ false
35
+ );
36
36
 
37
- onUpdateVisibility( visibility === 'private' ? 'draft' : status );
38
- this.setState( { hasPassword: false } );
39
- }
40
-
41
- setPrivate() {
42
- this.setState( { showPrivateConfirmDialog: true } );
43
- }
44
-
45
- confirmPrivate = () => {
46
- const { onUpdateVisibility, onSave } = this.props;
47
-
48
- onUpdateVisibility( 'private' );
49
- this.setState( {
50
- hasPassword: false,
51
- showPrivateConfirmDialog: false,
37
+ const setPublic = () => {
38
+ editPost( {
39
+ status: visibility === 'private' ? 'draft' : status,
40
+ password: '',
52
41
  } );
53
- onSave();
42
+ setHasPassword( false );
54
43
  };
55
44
 
56
- handleDialogCancel = () => {
57
- this.setState( { showPrivateConfirmDialog: false } );
45
+ const setPrivate = () => {
46
+ setShowPrivateConfirmDialog( true );
58
47
  };
59
48
 
60
- setPasswordProtected() {
61
- const { visibility, onUpdateVisibility, status, password } = this.props;
62
-
63
- onUpdateVisibility(
64
- visibility === 'private' ? 'draft' : status,
65
- password || ''
66
- );
67
- this.setState( { hasPassword: true } );
68
- }
49
+ const confirmPrivate = () => {
50
+ editPost( { status: 'private', password: '' } );
51
+ setHasPassword( false );
52
+ setShowPrivateConfirmDialog( false );
53
+ savePost();
54
+ };
69
55
 
70
- updatePassword( event ) {
71
- const { status, onUpdateVisibility } = this.props;
72
- onUpdateVisibility( status, event.target.value );
73
- }
56
+ const handleDialogCancel = () => {
57
+ setShowPrivateConfirmDialog( false );
58
+ };
74
59
 
75
- render() {
76
- const { visibility, password, instanceId } = this.props;
60
+ const setPasswordProtected = () => {
61
+ editPost( {
62
+ status: visibility === 'private' ? 'draft' : status,
63
+ password: password || '',
64
+ } );
65
+ setHasPassword( true );
66
+ };
77
67
 
78
- const visibilityHandlers = {
79
- public: {
80
- onSelect: this.setPublic,
81
- checked: visibility === 'public' && ! this.state.hasPassword,
82
- },
83
- private: {
84
- onSelect: this.setPrivate,
85
- checked: visibility === 'private',
86
- },
87
- password: {
88
- onSelect: this.setPasswordProtected,
89
- checked: this.state.hasPassword,
90
- },
91
- };
68
+ const updatePassword = ( event ) => {
69
+ editPost( { password: event.target.value } );
70
+ };
92
71
 
93
- return [
94
- <fieldset
95
- key="visibility-selector"
96
- className="editor-post-visibility__dialog-fieldset"
97
- >
98
- <legend className="editor-post-visibility__dialog-legend">
99
- { __( 'Post Visibility' ) }
72
+ return (
73
+ <>
74
+ <Button
75
+ className="editor-post-visibility__close"
76
+ isSmall
77
+ icon={ closeIcon }
78
+ onClick={ onClose }
79
+ />
80
+ <fieldset className="editor-post-visibility__fieldset">
81
+ <legend className="editor-post-visibility__legend">
82
+ { __( 'Visibility' ) }
100
83
  </legend>
101
- { visibilityOptions.map( ( { value, label, info } ) => (
102
- <div
103
- key={ value }
104
- className="editor-post-visibility__choice"
105
- >
84
+ <p className="editor-post-visibility__description">
85
+ { __( 'Control how this post is viewed.' ) }
86
+ </p>
87
+ <PostVisibilityChoice
88
+ instanceId={ instanceId }
89
+ value="public"
90
+ label={ visibilityOptions.public.label }
91
+ info={ visibilityOptions.public.info }
92
+ checked={ visibility === 'public' && ! hasPassword }
93
+ onChange={ setPublic }
94
+ />
95
+ <PostVisibilityChoice
96
+ instanceId={ instanceId }
97
+ value="private"
98
+ label={ visibilityOptions.private.label }
99
+ info={ visibilityOptions.private.info }
100
+ checked={ visibility === 'private' }
101
+ onChange={ setPrivate }
102
+ />
103
+ <PostVisibilityChoice
104
+ instanceId={ instanceId }
105
+ value="password"
106
+ label={ visibilityOptions.password.label }
107
+ info={ visibilityOptions.password.info }
108
+ checked={ hasPassword }
109
+ onChange={ setPasswordProtected }
110
+ />
111
+ { hasPassword && (
112
+ <div className="editor-post-visibility__password">
113
+ <VisuallyHidden
114
+ as="label"
115
+ htmlFor={ `editor-post-visibility__password-input-${ instanceId }` }
116
+ >
117
+ { __( 'Create password' ) }
118
+ </VisuallyHidden>
106
119
  <input
107
- type="radio"
108
- name={ `editor-post-visibility__setting-${ instanceId }` }
109
- value={ value }
110
- onChange={ visibilityHandlers[ value ].onSelect }
111
- checked={ visibilityHandlers[ value ].checked }
112
- id={ `editor-post-${ value }-${ instanceId }` }
113
- aria-describedby={ `editor-post-${ value }-${ instanceId }-description` }
114
- className="editor-post-visibility__dialog-radio"
120
+ className="editor-post-visibility__password-input"
121
+ id={ `editor-post-visibility__password-input-${ instanceId }` }
122
+ type="text"
123
+ onChange={ updatePassword }
124
+ value={ password }
125
+ placeholder={ __( 'Use a secure password' ) }
115
126
  />
116
- <label
117
- htmlFor={ `editor-post-${ value }-${ instanceId }` }
118
- className="editor-post-visibility__dialog-label"
119
- >
120
- { label }
121
- </label>
122
- {
123
- <p
124
- id={ `editor-post-${ value }-${ instanceId }-description` }
125
- className="editor-post-visibility__dialog-info"
126
- >
127
- { info }
128
- </p>
129
- }
130
127
  </div>
131
- ) ) }
132
- </fieldset>,
133
- this.state.hasPassword && (
134
- <div
135
- className="editor-post-visibility__dialog-password"
136
- key="password-selector"
137
- >
138
- <VisuallyHidden
139
- as="label"
140
- htmlFor={ `editor-post-visibility__dialog-password-input-${ instanceId }` }
141
- >
142
- { __( 'Create password' ) }
143
- </VisuallyHidden>
144
- <input
145
- className="editor-post-visibility__dialog-password-input"
146
- id={ `editor-post-visibility__dialog-password-input-${ instanceId }` }
147
- type="text"
148
- onChange={ this.updatePassword }
149
- value={ password }
150
- placeholder={ __( 'Use a secure password' ) }
151
- />
152
- </div>
153
- ),
128
+ ) }
129
+ </fieldset>
154
130
  <ConfirmDialog
155
- key="private-publish-confirmation"
156
- isOpen={ this.state.showPrivateConfirmDialog }
157
- onConfirm={ this.confirmPrivate }
158
- onCancel={ this.handleDialogCancel }
131
+ isOpen={ showPrivateConfirmDialog }
132
+ onConfirm={ confirmPrivate }
133
+ onCancel={ handleDialogCancel }
159
134
  >
160
135
  { __( 'Would you like to privately publish this post now?' ) }
161
- </ConfirmDialog>,
162
- ];
163
- }
136
+ </ConfirmDialog>
137
+ </>
138
+ );
164
139
  }
165
140
 
166
- export default compose( [
167
- withSelect( ( select ) => {
168
- const { getEditedPostAttribute, getEditedPostVisibility } = select(
169
- editorStore
170
- );
171
- return {
172
- status: getEditedPostAttribute( 'status' ),
173
- visibility: getEditedPostVisibility(),
174
- password: getEditedPostAttribute( 'password' ),
175
- };
176
- } ),
177
- withDispatch( ( dispatch ) => {
178
- const { savePost, editPost } = dispatch( editorStore );
179
- return {
180
- onSave: savePost,
181
- onUpdateVisibility( status, password = '' ) {
182
- editPost( { status, password } );
183
- },
184
- };
185
- } ),
186
- withInstanceId,
187
- ] )( PostVisibility );
141
+ function PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {
142
+ return (
143
+ <div className="editor-post-visibility__choice">
144
+ <input
145
+ type="radio"
146
+ name={ `editor-post-visibility__setting-${ instanceId }` }
147
+ value={ value }
148
+ id={ `editor-post-${ value }-${ instanceId }` }
149
+ aria-describedby={ `editor-post-${ value }-${ instanceId }-description` }
150
+ className="editor-post-visibility__radio"
151
+ { ...props }
152
+ />
153
+ <label
154
+ htmlFor={ `editor-post-${ value }-${ instanceId }` }
155
+ className="editor-post-visibility__label"
156
+ >
157
+ { label }
158
+ </label>
159
+ <p
160
+ id={ `editor-post-${ value }-${ instanceId }-description` }
161
+ className="editor-post-visibility__info"
162
+ >
163
+ { info }
164
+ </p>
165
+ </div>
166
+ );
167
+ }
@@ -1,12 +1,7 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { find } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
- import { withSelect } from '@wordpress/data';
4
+ import { useSelect } from '@wordpress/data';
10
5
 
11
6
  /**
12
7
  * Internal dependencies
@@ -14,13 +9,9 @@ import { withSelect } from '@wordpress/data';
14
9
  import { visibilityOptions } from './utils';
15
10
  import { store as editorStore } from '../../store';
16
11
 
17
- function PostVisibilityLabel( { visibility } ) {
18
- const getVisibilityLabel = () =>
19
- find( visibilityOptions, { value: visibility } ).label;
20
-
21
- return getVisibilityLabel( visibility );
12
+ export default function PostVisibilityLabel() {
13
+ const visibility = useSelect( ( select ) =>
14
+ select( editorStore ).getEditedPostVisibility()
15
+ );
16
+ return visibilityOptions[ visibility ]?.label;
22
17
  }
23
-
24
- export default withSelect( ( select ) => ( {
25
- visibility: select( editorStore ).getEditedPostVisibility(),
26
- } ) )( PostVisibilityLabel );
@@ -1,39 +1,44 @@
1
- .edit-post-post-visibility__dialog,
2
- .editor-post-visibility__dialog-fieldset {
3
- padding: $grid-unit-05;
4
- padding-top: 0;
1
+ .editor-post-visibility__close {
2
+ position: absolute;
3
+ right: $grid-unit-20;
4
+ top: $grid-unit-20;
5
+ }
6
+
7
+ .editor-post-visibility__fieldset {
8
+ padding: $grid-unit-10;
5
9
 
6
- .editor-post-visibility__dialog-legend {
10
+ .editor-post-visibility__legend {
7
11
  font-weight: 600;
8
- margin-bottom: 1em;
12
+ padding: 1em 0 0 0;
13
+ }
14
+
15
+ .editor-post-visibility__description {
9
16
  margin-top: 0.5em;
10
- padding: 0;
11
17
  }
12
18
 
13
- .editor-post-visibility__dialog-radio[type="radio"] {
19
+ .editor-post-visibility__radio[type="radio"] {
14
20
  @include radio-control;
15
21
  margin-top: 2px;
16
22
  }
17
23
 
18
- .editor-post-visibility__dialog-label {
19
- font-weight: 600;
20
- }
24
+ .editor-post-visibility__info {
25
+ color: $gray-700;
26
+ margin-left: $grid-unit-15 + $radio-input-size-sm;
27
+ margin-top: 0.5em;
21
28
 
22
- .editor-post-visibility__dialog-info {
23
- margin-top: 0;
24
- margin-left: $grid-unit-40;
29
+ @include break-small {
30
+ margin-left: $grid-unit-15 + $radio-input-size;
31
+ }
25
32
  }
26
33
 
27
34
  // Remove bottom margin on the last label only.
28
- .editor-post-visibility__choice:last-child .editor-post-visibility__dialog-info {
35
+ .editor-post-visibility__choice:last-child .editor-post-visibility__info {
29
36
  margin-bottom: 0;
30
37
  }
31
- }
32
38
 
33
- .editor-post-visibility__dialog-password {
34
- .editor-post-visibility__dialog-password-input[type="text"] {
39
+ .editor-post-visibility__password .editor-post-visibility__password-input[type="text"] {
35
40
  @include input-control;
36
- margin-left: $grid-unit * 4.5;
37
- margin-top: $grid-unit-10;
41
+ margin-left: $grid-unit * 4;
42
+ width: calc(100% - #{$grid-unit * 4});
38
43
  }
39
44
  }
@@ -3,22 +3,17 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- export const visibilityOptions = [
7
- {
8
- value: 'public',
6
+ export const visibilityOptions = {
7
+ public: {
9
8
  label: __( 'Public' ),
10
9
  info: __( 'Visible to everyone.' ),
11
10
  },
12
- {
13
- value: 'private',
11
+ private: {
14
12
  label: __( 'Private' ),
15
13
  info: __( 'Only visible to site admins and editors.' ),
16
14
  },
17
- {
18
- value: 'password',
19
- label: __( 'Password Protected' ),
20
- info: __(
21
- 'Protected with a password you choose. Only those with the password can view this post.'
22
- ),
15
+ password: {
16
+ label: __( 'Password protected' ),
17
+ info: __( 'Only those with the password can view this post.' ),
23
18
  },
24
- ];
19
+ };
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import memize from 'memize';
5
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
@@ -333,7 +334,7 @@ class NativeEditorProvider extends Component {
333
334
  settings={ editorSettings }
334
335
  { ...props }
335
336
  >
336
- { children }
337
+ <SafeAreaProvider>{ children }</SafeAreaProvider>
337
338
  </EditorProvider>
338
339
  <EditorHelpTopics
339
340
  isVisible={ this.state.isHelpVisible }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { pick, defaultTo } from 'lodash';
4
+ import { pick, defaultTo, unionBy } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -61,20 +61,36 @@ function useBlockEditorSettings( settings, hasTemplate ) {
61
61
  };
62
62
  }, [] );
63
63
 
64
- const {
65
- __experimentalBlockPatterns: settingsBlockPatterns,
66
- __experimentalBlockPatternCategories: settingsBlockPatternCategories,
67
- } = settings;
64
+ const settingsBlockPatterns =
65
+ settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
66
+ settings.__experimentalBlockPatterns; // WP 5.9
67
+ const settingsBlockPatternCategories =
68
+ settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0
69
+ settings.__experimentalBlockPatternCategories; // WP 5.9
68
70
 
69
- const { blockPatterns, blockPatternCategories } = useSelect(
71
+ const { restBlockPatterns, restBlockPatternCategories } = useSelect(
70
72
  ( select ) => ( {
71
- blockPatterns:
72
- settingsBlockPatterns ?? select( coreStore ).getBlockPatterns(),
73
- blockPatternCategories:
74
- settingsBlockPatternCategories ??
75
- select( coreStore ).getBlockPatternCategories(),
73
+ restBlockPatterns: select( coreStore ).getBlockPatterns(),
74
+ restBlockPatternCategories: select(
75
+ coreStore
76
+ ).getBlockPatternCategories(),
76
77
  } ),
77
- [ settingsBlockPatterns, settingsBlockPatternCategories ]
78
+ []
79
+ );
80
+
81
+ const blockPatterns = useMemo(
82
+ () => unionBy( settingsBlockPatterns, restBlockPatterns, 'name' ),
83
+ [ settingsBlockPatterns, restBlockPatterns ]
84
+ );
85
+
86
+ const blockPatternCategories = useMemo(
87
+ () =>
88
+ unionBy(
89
+ settingsBlockPatternCategories,
90
+ restBlockPatternCategories,
91
+ 'name'
92
+ ),
93
+ [ settingsBlockPatternCategories, restBlockPatternCategories ]
78
94
  );
79
95
 
80
96
  const { undo } = useDispatch( editorStore );
@@ -8,9 +8,7 @@
8
8
 
9
9
  .table-of-contents__popover {
10
10
  .components-popover__content {
11
- > div {
12
- padding: $grid-unit-20;
13
- }
11
+ padding: $grid-unit-20;
14
12
 
15
13
  @include break-small {
16
14
  max-height: calc(100vh - 120px);
@@ -1606,14 +1606,16 @@ export function __experimentalGetTemplateInfo( state, template ) {
1606
1606
  return {};
1607
1607
  }
1608
1608
 
1609
- const { excerpt, slug, title, area } = template;
1609
+ const { description, slug, title, area } = template;
1610
1610
  const {
1611
1611
  title: defaultTitle,
1612
1612
  description: defaultDescription,
1613
1613
  } = __experimentalGetDefaultTemplateType( state, slug );
1614
1614
 
1615
1615
  const templateTitle = isString( title ) ? title : title?.rendered;
1616
- const templateDescription = isString( excerpt ) ? excerpt : excerpt?.raw;
1616
+ const templateDescription = isString( description )
1617
+ ? description
1618
+ : description?.raw;
1617
1619
  const templateIcon =
1618
1620
  __experimentalGetDefaultTemplatePartAreas( state ).find(
1619
1621
  ( item ) => area === item.area
@@ -2149,7 +2149,7 @@ describe( 'selectors', () => {
2149
2149
  expect( didPostSaveRequestSucceed( state ) ).toBe( true );
2150
2150
  } );
2151
2151
 
2152
- it( 'should return true if the post save request has failed', () => {
2152
+ it( 'should return false if the post save request has failed', () => {
2153
2153
  const state = {
2154
2154
  saving: {
2155
2155
  successful: false,
@@ -2171,7 +2171,7 @@ describe( 'selectors', () => {
2171
2171
  expect( didPostSaveRequestFail( state ) ).toBe( true );
2172
2172
  } );
2173
2173
 
2174
- it( 'should return true if the post save request is successful', () => {
2174
+ it( 'should return false if the post save request is successful', () => {
2175
2175
  const state = {
2176
2176
  saving: {
2177
2177
  error: false,
@@ -2968,7 +2968,7 @@ describe( 'selectors', () => {
2968
2968
  expect(
2969
2969
  __experimentalGetTemplateInfo( state, {
2970
2970
  slug: 'index',
2971
- excerpt: { raw: 'test description' },
2971
+ description: { raw: 'test description' },
2972
2972
  } ).description
2973
2973
  ).toEqual( 'test description' );
2974
2974
  } );
@@ -2996,7 +2996,7 @@ describe( 'selectors', () => {
2996
2996
  expect(
2997
2997
  __experimentalGetTemplateInfo( state, {
2998
2998
  slug: 'index',
2999
- excerpt: { raw: 'test description' },
2999
+ description: { raw: 'test description' },
3000
3000
  } )
3001
3001
  ).toEqual( {
3002
3002
  title: 'Default (Index)',
@@ -3008,7 +3008,7 @@ describe( 'selectors', () => {
3008
3008
  __experimentalGetTemplateInfo( state, {
3009
3009
  slug: 'index',
3010
3010
  title: { rendered: 'test title' },
3011
- excerpt: { raw: 'test description' },
3011
+ description: { raw: 'test description' },
3012
3012
  } )
3013
3013
  ).toEqual( {
3014
3014
  title: 'test title',