@wordpress/editor 13.0.0 → 13.2.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 (50) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/editor-help/index.native.js +10 -8
  4. package/build/components/editor-help/index.native.js.map +1 -1
  5. package/build/components/post-author/select.js +1 -0
  6. package/build/components/post-author/select.js.map +1 -1
  7. package/build/components/post-excerpt/index.js +1 -0
  8. package/build/components/post-excerpt/index.js.map +1 -1
  9. package/build/components/post-format/index.js +1 -0
  10. package/build/components/post-format/index.js.map +1 -1
  11. package/build/components/post-template/index.js +1 -0
  12. package/build/components/post-template/index.js.map +1 -1
  13. package/build/components/provider/index.native.js +2 -1
  14. package/build/components/provider/index.native.js.map +1 -1
  15. package/build/components/provider/use-block-editor-settings.js +1 -1
  16. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  17. package/build/hooks/custom-sources-backwards-compatibility.js +16 -8
  18. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  19. package/build-module/components/editor-help/index.native.js +11 -9
  20. package/build-module/components/editor-help/index.native.js.map +1 -1
  21. package/build-module/components/post-author/select.js +1 -0
  22. package/build-module/components/post-author/select.js.map +1 -1
  23. package/build-module/components/post-excerpt/index.js +1 -0
  24. package/build-module/components/post-excerpt/index.js.map +1 -1
  25. package/build-module/components/post-format/index.js +1 -0
  26. package/build-module/components/post-format/index.js.map +1 -1
  27. package/build-module/components/post-template/index.js +1 -0
  28. package/build-module/components/post-template/index.js.map +1 -1
  29. package/build-module/components/provider/index.native.js +2 -1
  30. package/build-module/components/provider/index.native.js.map +1 -1
  31. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  32. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  33. package/build-module/hooks/custom-sources-backwards-compatibility.js +17 -9
  34. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  35. package/build-style/style-rtl.css +3 -3
  36. package/build-style/style.css +3 -3
  37. package/package.json +29 -29
  38. package/src/components/editor-help/index.native.js +17 -26
  39. package/src/components/page-attributes/test/order.js +2 -0
  40. package/src/components/post-author/select.js +1 -0
  41. package/src/components/post-excerpt/index.js +1 -0
  42. package/src/components/post-format/index.js +1 -0
  43. package/src/components/post-preview-button/test/index.js +2 -0
  44. package/src/components/post-publish-button/test/index.js +2 -0
  45. package/src/components/post-saved-state/test/index.js +2 -0
  46. package/src/components/post-slug/test/index.js +3 -5
  47. package/src/components/post-template/index.js +1 -0
  48. package/src/components/provider/index.native.js +1 -0
  49. package/src/components/provider/use-block-editor-settings.js +1 -1
  50. package/src/hooks/custom-sources-backwards-compatibility.js +16 -13
@@ -59,15 +59,15 @@
59
59
  * @param {string} hex - the hexadecimal value to convert
60
60
  * @return {string} comma separated rgb values
61
61
  */
62
- /**
63
- * Breakpoint mixins
64
- */
65
62
  /**
66
63
  * Long content fade mixin
67
64
  *
68
65
  * Creates a fading overlay to signify that the content is longer
69
66
  * than the space allows.
70
67
  */
68
+ /**
69
+ * Breakpoint mixins
70
+ */
71
71
  /**
72
72
  * Focus styles.
73
73
  */
@@ -59,15 +59,15 @@
59
59
  * @param {string} hex - the hexadecimal value to convert
60
60
  * @return {string} comma separated rgb values
61
61
  */
62
- /**
63
- * Breakpoint mixins
64
- */
65
62
  /**
66
63
  * Long content fade mixin
67
64
  *
68
65
  * Creates a fading overlay to signify that the content is longer
69
66
  * than the space allows.
70
67
  */
68
+ /**
69
+ * Breakpoint mixins
70
+ */
71
71
  /**
72
72
  * Focus styles.
73
73
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.0.0",
3
+ "version": "13.2.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,33 +31,33 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.23.0",
35
- "@wordpress/api-fetch": "^6.20.0",
36
- "@wordpress/blob": "^3.23.0",
37
- "@wordpress/block-editor": "^11.0.0",
38
- "@wordpress/blocks": "^12.0.0",
39
- "@wordpress/components": "^23.0.0",
40
- "@wordpress/compose": "^6.0.0",
41
- "@wordpress/core-data": "^6.0.0",
42
- "@wordpress/data": "^8.0.0",
43
- "@wordpress/date": "^4.23.0",
44
- "@wordpress/deprecated": "^3.23.0",
45
- "@wordpress/dom": "^3.23.0",
46
- "@wordpress/element": "^5.0.0",
47
- "@wordpress/hooks": "^3.23.0",
48
- "@wordpress/html-entities": "^3.23.0",
49
- "@wordpress/i18n": "^4.23.0",
50
- "@wordpress/icons": "^9.14.0",
51
- "@wordpress/keyboard-shortcuts": "^4.0.0",
52
- "@wordpress/keycodes": "^3.23.0",
53
- "@wordpress/media-utils": "^4.14.0",
54
- "@wordpress/notices": "^3.23.0",
55
- "@wordpress/preferences": "^3.0.0",
56
- "@wordpress/reusable-blocks": "^4.0.0",
57
- "@wordpress/rich-text": "^6.0.0",
58
- "@wordpress/server-side-render": "^4.0.0",
59
- "@wordpress/url": "^3.24.0",
60
- "@wordpress/wordcount": "^3.23.0",
34
+ "@wordpress/a11y": "^3.25.0",
35
+ "@wordpress/api-fetch": "^6.22.0",
36
+ "@wordpress/blob": "^3.25.0",
37
+ "@wordpress/block-editor": "^11.2.0",
38
+ "@wordpress/blocks": "^12.2.0",
39
+ "@wordpress/components": "^23.2.0",
40
+ "@wordpress/compose": "^6.2.0",
41
+ "@wordpress/core-data": "^6.2.0",
42
+ "@wordpress/data": "^8.2.0",
43
+ "@wordpress/date": "^4.25.0",
44
+ "@wordpress/deprecated": "^3.25.0",
45
+ "@wordpress/dom": "^3.25.0",
46
+ "@wordpress/element": "^5.2.0",
47
+ "@wordpress/hooks": "^3.25.0",
48
+ "@wordpress/html-entities": "^3.25.0",
49
+ "@wordpress/i18n": "^4.25.0",
50
+ "@wordpress/icons": "^9.16.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.2.0",
52
+ "@wordpress/keycodes": "^3.25.0",
53
+ "@wordpress/media-utils": "^4.16.0",
54
+ "@wordpress/notices": "^3.25.0",
55
+ "@wordpress/preferences": "^3.2.0",
56
+ "@wordpress/reusable-blocks": "^4.2.0",
57
+ "@wordpress/rich-text": "^6.2.0",
58
+ "@wordpress/server-side-render": "^4.2.0",
59
+ "@wordpress/url": "^3.26.0",
60
+ "@wordpress/wordcount": "^3.25.0",
61
61
  "classnames": "^2.3.1",
62
62
  "date-fns": "^2.28.0",
63
63
  "escape-html": "^1.0.3",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
77
+ "gitHead": "204c880ff65295768e9695dfee6c7a9fee1fdd05"
78
78
  }
@@ -57,7 +57,7 @@ const HELP_TOPICS = [
57
57
  },
58
58
  ];
59
59
 
60
- function EditorHelpTopics( { close, isVisible, onClose } ) {
60
+ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
61
61
  const { postType } = useSelect( ( select ) => ( {
62
62
  postType: select( editorStore ).getEditedPostAttribute( 'type' ),
63
63
  } ) );
@@ -67,6 +67,20 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
67
67
  ? __( 'How to edit your page' )
68
68
  : __( 'How to edit your post' );
69
69
 
70
+ const supportSection = (
71
+ <>
72
+ <HelpSectionTitle>{ __( 'Get support' ) }</HelpSectionTitle>
73
+ <HelpGetSupportButton
74
+ title={ __( 'Contact support' ) }
75
+ onPress={ requestContactCustomerSupport }
76
+ />
77
+ <HelpGetSupportButton
78
+ title={ __( 'More support options' ) }
79
+ onPress={ requestGotoCustomerSupportOptions }
80
+ />
81
+ </>
82
+ );
83
+
70
84
  return (
71
85
  <BottomSheet
72
86
  isVisible={ isVisible }
@@ -153,31 +167,8 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
153
167
  );
154
168
  }
155
169
  ) }
156
- {
157
- <HelpSectionTitle>
158
- { __( 'Get support' ) }
159
- </HelpSectionTitle>
160
- }
161
- {
162
- <HelpGetSupportButton
163
- title={ __(
164
- 'Contact support'
165
- ) }
166
- onPress={
167
- requestContactCustomerSupport
168
- }
169
- />
170
- }
171
- {
172
- <HelpGetSupportButton
173
- title={ __(
174
- 'More support options'
175
- ) }
176
- onPress={
177
- requestGotoCustomerSupportOptions
178
- }
179
- />
180
- }
170
+ { showSupport &&
171
+ supportSection }
181
172
  </PanelBody>
182
173
  </ScrollView>
183
174
  );
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import { PageAttributesOrder } from '../order';
11
11
 
12
+ jest.useFakeTimers();
13
+
12
14
  describe( 'PageAttributesOrder', () => {
13
15
  /**
14
16
  * When starting to type inside the spinbutton, select the current value
@@ -40,6 +40,7 @@ function PostAuthorSelect() {
40
40
 
41
41
  return (
42
42
  <SelectControl
43
+ __nextHasNoMarginBottom
43
44
  className="post-author-selector"
44
45
  label={ __( 'Author' ) }
45
46
  options={ authorOptions }
@@ -15,6 +15,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
15
15
  return (
16
16
  <div className="editor-post-excerpt">
17
17
  <TextareaControl
18
+ __nextHasNoMarginBottom
18
19
  label={ __( 'Write an excerpt (optional)' ) }
19
20
  className="editor-post-excerpt__textarea"
20
21
  onChange={ ( value ) => onUpdateExcerpt( value ) }
@@ -76,6 +76,7 @@ export default function PostFormat() {
76
76
  <PostFormatCheck>
77
77
  <div className="editor-post-format">
78
78
  <SelectControl
79
+ __nextHasNoMarginBottom
79
80
  label={ __( 'Post Format' ) }
80
81
  value={ postFormat }
81
82
  onChange={ ( format ) => onUpdatePostFormat( format ) }
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import { PostPreviewButton } from '../';
11
11
 
12
+ jest.useFakeTimers();
13
+
12
14
  describe( 'PostPreviewButton', () => {
13
15
  const documentWrite = jest.fn();
14
16
  const documentTitle = jest.fn();
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
9
9
  */
10
10
  import { PostPublishButton } from '../';
11
11
 
12
+ jest.useFakeTimers();
13
+
12
14
  describe( 'PostPublishButton', () => {
13
15
  describe( 'aria-disabled', () => {
14
16
  it( 'should be true if post is currently saving', () => {
@@ -15,6 +15,8 @@ import { useSelect } from '@wordpress/data';
15
15
  */
16
16
  import PostSavedState from '../';
17
17
 
18
+ jest.useFakeTimers();
19
+
18
20
  const mockSavePost = jest.fn();
19
21
 
20
22
  jest.mock( '@wordpress/data/src/components/use-dispatch', () => {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render, screen } from '@testing-library/react';
4
+ import { act, render, screen } from '@testing-library/react';
5
5
  import userEvent from '@testing-library/user-event';
6
6
 
7
7
  /**
@@ -11,9 +11,7 @@ import { PostSlug } from '../';
11
11
 
12
12
  describe( 'PostSlug', () => {
13
13
  it( 'should update slug with sanitized input', async () => {
14
- const user = userEvent.setup( {
15
- advanceTimers: jest.advanceTimersByTime,
16
- } );
14
+ const user = userEvent.setup();
17
15
  const onUpdateSlug = jest.fn();
18
16
 
19
17
  render( <PostSlug postSlug="index" onUpdateSlug={ onUpdateSlug } /> );
@@ -21,7 +19,7 @@ describe( 'PostSlug', () => {
21
19
  const input = screen.getByRole( 'textbox', { name: 'Slug' } );
22
20
  await user.clear( input );
23
21
  await user.type( input, 'Foo Bar-Baz 9!' );
24
- input.blur();
22
+ act( () => input.blur() );
25
23
 
26
24
  expect( onUpdateSlug ).toHaveBeenCalledWith( 'foo-bar-baz-9' );
27
25
  } );
@@ -44,6 +44,7 @@ export function PostTemplate() {
44
44
 
45
45
  return (
46
46
  <SelectControl
47
+ __nextHasNoMarginBottom
47
48
  label={ __( 'Template:' ) }
48
49
  value={ selectedTemplate }
49
50
  onChange={ ( templateSlug ) => {
@@ -338,6 +338,7 @@ class NativeEditorProvider extends Component {
338
338
  isVisible={ this.state.isHelpVisible }
339
339
  onClose={ () => this.setState( { isHelpVisible: false } ) }
340
340
  close={ () => this.setState( { isHelpVisible: false } ) }
341
+ showSupport={ capabilities?.supportSection === true }
341
342
  />
342
343
  </>
343
344
  );
@@ -135,7 +135,6 @@ function useBlockEditorSettings( settings, hasTemplate ) {
135
135
  Object.entries( settings ).filter( ( [ key ] ) =>
136
136
  [
137
137
  '__experimentalBlockDirectory',
138
- '__experimentalBlockInspectorTabs',
139
138
  '__experimentalDiscussionSettings',
140
139
  '__experimentalFeatures',
141
140
  '__experimentalPreferredStyleVariations',
@@ -143,6 +142,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
143
142
  '__unstableGalleryWithImageBlocks',
144
143
  'alignWide',
145
144
  'allowedBlockTypes',
145
+ 'blockInspectorTabs',
146
146
  'bodyPlaceholder',
147
147
  'canLockBlocks',
148
148
  'codeEditingEnabled',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { pickBy, mapValues, isEmpty } from 'lodash';
4
+ import { mapValues, isEmpty } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -70,18 +70,17 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
70
70
  attributes={ mergedAttributes }
71
71
  setAttributes={ ( nextAttributes ) => {
72
72
  const nextMeta = Object.fromEntries(
73
- Object.entries(
74
- // Filter to intersection of keys between the updated
75
- // attributes and those with an associated meta key.
76
- pickBy(
77
- nextAttributes,
78
- ( value, key ) => metaAttributes[ key ]
73
+ Object.entries( nextAttributes ?? {} )
74
+ .filter(
75
+ // Filter to intersection of keys between the updated
76
+ // attributes and those with an associated meta key.
77
+ ( [ key ] ) => key in metaAttributes
79
78
  )
80
- ).map( ( [ attributeKey, value ] ) => [
81
- // Rename the keys to the expected meta key name.
82
- metaAttributes[ attributeKey ],
83
- value,
84
- ] )
79
+ .map( ( [ attributeKey, value ] ) => [
80
+ // Rename the keys to the expected meta key name.
81
+ metaAttributes[ attributeKey ],
82
+ value,
83
+ ] )
85
84
  );
86
85
 
87
86
  if ( ! isEmpty( nextMeta ) ) {
@@ -108,7 +107,11 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
108
107
  function shimAttributeSource( settings ) {
109
108
  /** @type {WPMetaAttributeMapping} */
110
109
  const metaAttributes = mapValues(
111
- pickBy( settings.attributes, { source: 'meta' } ),
110
+ Object.fromEntries(
111
+ Object.entries( settings.attributes ?? {} ).filter(
112
+ ( [ , { source } ] ) => source === 'meta'
113
+ )
114
+ ),
112
115
  'meta'
113
116
  );
114
117
  if ( ! isEmpty( metaAttributes ) ) {