@wordpress/editor 12.12.0 → 12.14.1-next.d6164808d3.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 (83) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/editor-history/redo.js +2 -1
  3. package/build/components/editor-history/redo.js.map +1 -1
  4. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +11 -1
  5. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  6. package/build/components/page-attributes/parent.js +6 -2
  7. package/build/components/page-attributes/parent.js.map +1 -1
  8. package/build/components/post-locked-modal/index.js +1 -1
  9. package/build/components/post-locked-modal/index.js.map +1 -1
  10. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  11. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  12. package/build/components/post-taxonomies/flat-term-selector.js +7 -1
  13. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  14. package/build/components/post-title/index.js +22 -2
  15. package/build/components/post-title/index.js.map +1 -1
  16. package/build/components/post-url/label.js +1 -1
  17. package/build/components/post-url/label.js.map +1 -1
  18. package/build/components/provider/index.native.js +3 -1
  19. package/build/components/provider/index.native.js.map +1 -1
  20. package/build/components/provider/use-block-editor-settings.js +2 -2
  21. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  22. package/build/hooks/custom-sources-backwards-compatibility.js +8 -5
  23. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  24. package/build/store/actions.js +1 -7
  25. package/build/store/actions.js.map +1 -1
  26. package/build/store/reducer.js +17 -9
  27. package/build/store/reducer.js.map +1 -1
  28. package/build/store/selectors.js +37 -17
  29. package/build/store/selectors.js.map +1 -1
  30. package/build-module/components/editor-history/redo.js +3 -2
  31. package/build-module/components/editor-history/redo.js.map +1 -1
  32. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +10 -1
  33. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  34. package/build-module/components/page-attributes/parent.js +4 -3
  35. package/build-module/components/page-attributes/parent.js.map +1 -1
  36. package/build-module/components/post-locked-modal/index.js +1 -1
  37. package/build-module/components/post-locked-modal/index.js.map +1 -1
  38. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  39. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  40. package/build-module/components/post-taxonomies/flat-term-selector.js +8 -2
  41. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  42. package/build-module/components/post-title/index.js +23 -3
  43. package/build-module/components/post-title/index.js.map +1 -1
  44. package/build-module/components/post-url/label.js +2 -2
  45. package/build-module/components/post-url/label.js.map +1 -1
  46. package/build-module/components/provider/index.native.js +3 -1
  47. package/build-module/components/provider/index.native.js.map +1 -1
  48. package/build-module/components/provider/use-block-editor-settings.js +2 -2
  49. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  50. package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -6
  51. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  52. package/build-module/store/actions.js +1 -6
  53. package/build-module/store/actions.js.map +1 -1
  54. package/build-module/store/reducer.js +17 -8
  55. package/build-module/store/reducer.js.map +1 -1
  56. package/build-module/store/selectors.js +37 -16
  57. package/build-module/store/selectors.js.map +1 -1
  58. package/build-style/style-rtl.css +3 -0
  59. package/build-style/style.css +3 -0
  60. package/package.json +30 -29
  61. package/src/components/README.md +1 -1
  62. package/src/components/editor-history/redo.js +6 -2
  63. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +13 -0
  64. package/src/components/page-attributes/parent.js +4 -9
  65. package/src/components/post-author/test/check.js +7 -7
  66. package/src/components/post-last-revision/test/check.js +7 -7
  67. package/src/components/post-locked-modal/index.js +1 -1
  68. package/src/components/post-pending-status/test/check.js +5 -5
  69. package/src/components/post-publish-panel/maybe-category-panel.js +3 -5
  70. package/src/components/post-schedule/test/check.js +5 -5
  71. package/src/components/post-slug/test/check.js +3 -3
  72. package/src/components/post-sticky/test/index.js +11 -7
  73. package/src/components/post-taxonomies/flat-term-selector.js +10 -2
  74. package/src/components/post-title/index.js +23 -3
  75. package/src/components/post-trash/style.scss +3 -0
  76. package/src/components/post-url/label.js +2 -2
  77. package/src/components/post-visibility/test/check.js +16 -8
  78. package/src/components/provider/index.native.js +3 -1
  79. package/src/components/provider/use-block-editor-settings.js +6 -1
  80. package/src/hooks/custom-sources-backwards-compatibility.js +14 -12
  81. package/src/store/actions.js +1 -6
  82. package/src/store/reducer.js +16 -10
  83. package/src/store/selectors.js +30 -29
@@ -895,7 +895,10 @@
895
895
  }
896
896
 
897
897
  .editor-post-trash.components-button {
898
+ display: flex;
899
+ justify-content: center;
898
900
  margin-top: 4px;
901
+ width: 100%;
899
902
  }
900
903
 
901
904
  .table-of-contents__popover.components-popover .components-popover__content {
@@ -899,7 +899,10 @@
899
899
  }
900
900
 
901
901
  .editor-post-trash.components-button {
902
+ display: flex;
903
+ justify-content: center;
902
904
  margin-top: 4px;
905
+ width: 100%;
903
906
  }
904
907
 
905
908
  .table-of-contents__popover.components-popover .components-popover__content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "12.12.0",
3
+ "version": "12.14.1-next.d6164808d3.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,37 +31,38 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.13.0",
35
- "@wordpress/api-fetch": "^6.10.0",
36
- "@wordpress/blob": "^3.13.0",
37
- "@wordpress/block-editor": "^9.5.0",
38
- "@wordpress/blocks": "^11.12.0",
39
- "@wordpress/components": "^19.15.0",
40
- "@wordpress/compose": "^5.11.0",
41
- "@wordpress/core-data": "^4.11.0",
42
- "@wordpress/data": "^6.13.0",
43
- "@wordpress/date": "^4.13.0",
44
- "@wordpress/deprecated": "^3.13.0",
45
- "@wordpress/element": "^4.11.0",
46
- "@wordpress/hooks": "^3.13.0",
47
- "@wordpress/html-entities": "^3.13.0",
48
- "@wordpress/i18n": "^4.13.0",
49
- "@wordpress/icons": "^9.4.0",
50
- "@wordpress/keyboard-shortcuts": "^3.11.0",
51
- "@wordpress/keycodes": "^3.13.0",
52
- "@wordpress/media-utils": "^4.4.0",
53
- "@wordpress/notices": "^3.13.0",
54
- "@wordpress/preferences": "^2.5.0",
55
- "@wordpress/reusable-blocks": "^3.11.0",
56
- "@wordpress/rich-text": "^5.11.0",
57
- "@wordpress/server-side-render": "^3.11.0",
58
- "@wordpress/url": "^3.14.0",
59
- "@wordpress/wordcount": "^3.13.0",
34
+ "@wordpress/a11y": "^3.15.1-next.d6164808d3.0",
35
+ "@wordpress/api-fetch": "^6.12.1-next.d6164808d3.0",
36
+ "@wordpress/blob": "^3.15.1-next.d6164808d3.0",
37
+ "@wordpress/block-editor": "^9.7.1-next.d6164808d3.0",
38
+ "@wordpress/blocks": "^11.14.1-next.d6164808d3.0",
39
+ "@wordpress/components": "^20.0.1-next.d6164808d3.0",
40
+ "@wordpress/compose": "^5.13.1-next.d6164808d3.0",
41
+ "@wordpress/core-data": "^4.14.1-next.d6164808d3.0",
42
+ "@wordpress/data": "^7.0.1-next.d6164808d3.0",
43
+ "@wordpress/date": "^4.15.1-next.d6164808d3.0",
44
+ "@wordpress/deprecated": "^3.15.1-next.d6164808d3.0",
45
+ "@wordpress/element": "^4.13.1-next.d6164808d3.0",
46
+ "@wordpress/hooks": "^3.15.1-next.d6164808d3.0",
47
+ "@wordpress/html-entities": "^3.15.1-next.d6164808d3.0",
48
+ "@wordpress/i18n": "^4.15.1-next.d6164808d3.0",
49
+ "@wordpress/icons": "^9.6.1-next.d6164808d3.0",
50
+ "@wordpress/keyboard-shortcuts": "^3.13.1-next.d6164808d3.0",
51
+ "@wordpress/keycodes": "^3.15.1-next.d6164808d3.0",
52
+ "@wordpress/media-utils": "^4.6.1-next.d6164808d3.0",
53
+ "@wordpress/notices": "^3.15.1-next.d6164808d3.0",
54
+ "@wordpress/preferences": "^2.7.1-next.d6164808d3.0",
55
+ "@wordpress/reusable-blocks": "^3.13.1-next.d6164808d3.0",
56
+ "@wordpress/rich-text": "^5.13.1-next.d6164808d3.0",
57
+ "@wordpress/server-side-render": "^3.13.1-next.d6164808d3.0",
58
+ "@wordpress/url": "^3.16.1-next.d6164808d3.0",
59
+ "@wordpress/wordcount": "^3.15.1-next.d6164808d3.0",
60
60
  "classnames": "^2.3.1",
61
61
  "lodash": "^4.17.21",
62
62
  "memize": "^1.1.0",
63
63
  "react-autosize-textarea": "^7.1.0",
64
- "rememo": "^4.0.0"
64
+ "rememo": "^4.0.0",
65
+ "remove-accents": "^0.4.2"
65
66
  },
66
67
  "peerDependencies": {
67
68
  "react": "^17.0.0",
@@ -70,5 +71,5 @@
70
71
  "publishConfig": {
71
72
  "access": "public"
72
73
  },
73
- "gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
74
+ "gitHead": "ba8a396d2f418e53a6c4c50575582f3f3eb11ff7"
74
75
  }
@@ -7,4 +7,4 @@ These components combined as children of the `EditorProvider` component can be u
7
7
 
8
8
  - A component in this folder is any component you can reuse to build your own editor's layout.
9
9
  - It shouldn't include any "layout styling".
10
- - the only requirement to use this component is to to be included as a children of EditorProvider in the elements' hierarchy.
10
+ - the only requirement to use this component is to be included as a children of EditorProvider in the elements' hierarchy.
@@ -4,7 +4,7 @@
4
4
  import { __, isRTL } from '@wordpress/i18n';
5
5
  import { Button } from '@wordpress/components';
6
6
  import { useSelect, useDispatch } from '@wordpress/data';
7
- import { displayShortcut } from '@wordpress/keycodes';
7
+ import { displayShortcut, isAppleOS } from '@wordpress/keycodes';
8
8
  import { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';
9
9
  import { forwardRef } from '@wordpress/element';
10
10
 
@@ -14,6 +14,10 @@ import { forwardRef } from '@wordpress/element';
14
14
  import { store as editorStore } from '../../store';
15
15
 
16
16
  function EditorHistoryRedo( props, ref ) {
17
+ const shortcut = isAppleOS()
18
+ ? displayShortcut.primaryShift( 'z' )
19
+ : displayShortcut.primary( 'y' );
20
+
17
21
  const hasRedo = useSelect(
18
22
  ( select ) => select( editorStore ).hasEditorRedo(),
19
23
  []
@@ -26,7 +30,7 @@ function EditorHistoryRedo( props, ref ) {
26
30
  icon={ ! isRTL() ? redoIcon : undoIcon }
27
31
  /* translators: button label text should, if possible, be under 16 characters. */
28
32
  label={ __( 'Redo' ) }
29
- shortcut={ displayShortcut.primaryShift( 'z' ) }
33
+ shortcut={ shortcut }
30
34
  // If there are no redo levels we don't want to actually disable this
31
35
  // button, because it will remove focus for keyboard users.
32
36
  // See: https://github.com/WordPress/gutenberg/issues/3486
@@ -6,6 +6,7 @@ import { useDispatch } from '@wordpress/data';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';
8
8
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
9
+ import { isAppleOS } from '@wordpress/keycodes';
9
10
 
10
11
  function EditorKeyboardShortcutsRegister() {
11
12
  // Registering the shortcuts.
@@ -39,6 +40,18 @@ function EditorKeyboardShortcutsRegister() {
39
40
  modifier: 'primaryShift',
40
41
  character: 'z',
41
42
  },
43
+ // Disable on Apple OS because it conflicts with the browser's
44
+ // history shortcut. It's a fine alias for both Windows and Linux.
45
+ // Since there's no conflict for Ctrl+Shift+Z on both Windows and
46
+ // Linux, we keep it as the default for consistency.
47
+ aliases: isAppleOS()
48
+ ? []
49
+ : [
50
+ {
51
+ modifier: 'primary',
52
+ character: 'y',
53
+ },
54
+ ],
42
55
  } );
43
56
  }, [ registerShortcut ] );
44
57
 
@@ -1,13 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import {
5
- get,
6
- unescape as unescapeString,
7
- debounce,
8
- find,
9
- deburr,
10
- } from 'lodash';
4
+ import { get, unescape as unescapeString, debounce, find } from 'lodash';
5
+ import removeAccents from 'remove-accents';
11
6
 
12
7
  /**
13
8
  * WordPress dependencies
@@ -32,8 +27,8 @@ function getTitle( post ) {
32
27
  }
33
28
 
34
29
  export const getItemPriority = ( name, searchValue ) => {
35
- const normalizedName = deburr( name ).toLowerCase();
36
- const normalizedSearch = deburr( searchValue ).toLowerCase();
30
+ const normalizedName = removeAccents( name || '' ).toLowerCase();
31
+ const normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();
37
32
  if ( normalizedName === normalizedSearch ) {
38
33
  return 0;
39
34
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -26,8 +26,8 @@ describe( 'PostAuthorCheck', () => {
26
26
  hasAssignAuthorAction: true,
27
27
  } ) );
28
28
 
29
- const wrapper = shallow( <PostAuthorCheck>authors</PostAuthorCheck> );
30
- expect( wrapper.type() ).toBe( null );
29
+ render( <PostAuthorCheck>authors</PostAuthorCheck> );
30
+ expect( screen.queryByText( 'authors' ) ).not.toBeInTheDocument();
31
31
  } );
32
32
 
33
33
  it( "should not render anything if doesn't have author action", () => {
@@ -36,8 +36,8 @@ describe( 'PostAuthorCheck', () => {
36
36
  hasAssignAuthorAction: false,
37
37
  } ) );
38
38
 
39
- const wrapper = shallow( <PostAuthorCheck>authors</PostAuthorCheck> );
40
- expect( wrapper.type() ).toBe( null );
39
+ render( <PostAuthorCheck>authors</PostAuthorCheck> );
40
+ expect( screen.queryByText( 'authors' ) ).not.toBeInTheDocument();
41
41
  } );
42
42
 
43
43
  it( 'should render control', () => {
@@ -46,7 +46,7 @@ describe( 'PostAuthorCheck', () => {
46
46
  hasAssignAuthorAction: true,
47
47
  } ) );
48
48
 
49
- const wrapper = shallow( <PostAuthorCheck>authors</PostAuthorCheck> );
50
- expect( wrapper.type() ).not.toBe( null );
49
+ render( <PostAuthorCheck>authors</PostAuthorCheck> );
50
+ expect( screen.getByText( 'authors' ) ).toBeVisible();
51
51
  } );
52
52
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,32 +10,32 @@ import { PostLastRevisionCheck } from '../check';
10
10
 
11
11
  describe( 'PostLastRevisionCheck', () => {
12
12
  it( 'should not render anything if the last revision ID is unknown', () => {
13
- const wrapper = shallow(
13
+ render(
14
14
  <PostLastRevisionCheck revisionsCount={ 2 }>
15
15
  Children
16
16
  </PostLastRevisionCheck>
17
17
  );
18
18
 
19
- expect( wrapper.type() ).toBe( null );
19
+ expect( screen.queryByText( 'Children' ) ).not.toBeInTheDocument();
20
20
  } );
21
21
 
22
22
  it( 'should not render anything if there is only one revision', () => {
23
- const wrapper = shallow(
23
+ render(
24
24
  <PostLastRevisionCheck lastRevisionId={ 1 } revisionsCount={ 1 }>
25
25
  Children
26
26
  </PostLastRevisionCheck>
27
27
  );
28
28
 
29
- expect( wrapper.type() ).toBe( null );
29
+ expect( screen.queryByText( 'Children' ) ).not.toBeInTheDocument();
30
30
  } );
31
31
 
32
32
  it( 'should render if there are two revisions', () => {
33
- const wrapper = shallow(
33
+ render(
34
34
  <PostLastRevisionCheck lastRevisionId={ 1 } revisionsCount={ 2 }>
35
35
  Children
36
36
  </PostLastRevisionCheck>
37
37
  );
38
38
 
39
- expect( wrapper.text() ).not.toBe( null );
39
+ expect( screen.getByText( 'Children' ) ).toBeVisible();
40
40
  } );
41
41
  } );
@@ -197,7 +197,7 @@ export default function PostLockedModal() {
197
197
  ? sprintf(
198
198
  /* translators: %s: user's display name */
199
199
  __(
200
- '<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
200
+ '<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
201
201
  ),
202
202
  userDisplayName
203
203
  )
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,20 +10,20 @@ import { PostPendingStatusCheck } from '../check';
10
10
 
11
11
  describe( 'PostPendingStatusCheck', () => {
12
12
  it( "should not render anything if the user doesn't have the right capabilities", () => {
13
- const wrapper = shallow(
13
+ render(
14
14
  <PostPendingStatusCheck hasPublishAction={ false }>
15
15
  status
16
16
  </PostPendingStatusCheck>
17
17
  );
18
- expect( wrapper.type() ).toBe( null );
18
+ expect( screen.queryByText( 'status' ) ).not.toBeInTheDocument();
19
19
  } );
20
20
 
21
21
  it( 'should render if the user has the correct capability', () => {
22
- const wrapper = shallow(
22
+ render(
23
23
  <PostPendingStatusCheck hasPublishAction={ true }>
24
24
  status
25
25
  </PostPendingStatusCheck>
26
26
  );
27
- expect( wrapper.type() ).not.toBe( null );
27
+ expect( screen.getByText( 'status' ) ).toBeVisible();
28
28
  } );
29
29
  } );
@@ -27,13 +27,11 @@ function MaybeCategoryPanel() {
27
27
  'root',
28
28
  'site'
29
29
  )?.default_category;
30
- const defaultCategory = select( coreStore ).getEntityRecords(
30
+ const defaultCategory = select( coreStore ).getEntityRecord(
31
31
  'taxonomy',
32
32
  'category',
33
- {
34
- id: defaultCategoryId,
35
- }
36
- )?.[ 0 ];
33
+ defaultCategoryId
34
+ );
37
35
  const postTypeSupportsCategories =
38
36
  categoriesTaxonomy &&
39
37
  some( categoriesTaxonomy.types, ( type ) => type === postType );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,18 +10,18 @@ import { PostScheduleCheck } from '../check';
10
10
 
11
11
  describe( 'PostScheduleCheck', () => {
12
12
  it( "should not render anything if the user doesn't have the right capabilities", () => {
13
- const wrapper = shallow(
13
+ render(
14
14
  <PostScheduleCheck hasPublishAction={ false }>
15
15
  yes
16
16
  </PostScheduleCheck>
17
17
  );
18
- expect( wrapper.type() ).toBe( null );
18
+ expect( screen.queryByText( 'yes' ) ).not.toBeInTheDocument();
19
19
  } );
20
20
 
21
21
  it( 'should render if the user has the correct capability', () => {
22
- const wrapper = shallow(
22
+ render(
23
23
  <PostScheduleCheck hasPublishAction={ true }>yes</PostScheduleCheck>
24
24
  );
25
- expect( wrapper.type() ).not.toBe( null );
25
+ expect( screen.getByText( 'yes' ) ).toBeVisible();
26
26
  } );
27
27
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,8 +10,8 @@ import PostSlugCheck from '../check';
10
10
 
11
11
  describe( 'PostSlugCheck', () => {
12
12
  it( 'should render control', () => {
13
- const wrapper = shallow( <PostSlugCheck>slug</PostSlugCheck> );
13
+ render( <PostSlugCheck>slug</PostSlugCheck> );
14
14
 
15
- expect( wrapper.type() ).not.toBe( null );
15
+ expect( screen.getByText( 'slug' ) ).toBeVisible();
16
16
  } );
17
17
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -10,29 +10,33 @@ import { PostStickyCheck } from '../check';
10
10
 
11
11
  describe( 'PostSticky', () => {
12
12
  it( 'should not render anything if the post type is not "post"', () => {
13
- const wrapper = shallow(
13
+ render(
14
14
  <PostStickyCheck postType="page" hasStickyAction={ true }>
15
15
  Can Toggle Sticky
16
16
  </PostStickyCheck>
17
17
  );
18
- expect( wrapper.type() ).toBe( null );
18
+ expect(
19
+ screen.queryByText( 'Can Toggle Sticky' )
20
+ ).not.toBeInTheDocument();
19
21
  } );
20
22
 
21
23
  it( "should not render anything if post doesn't support stickying", () => {
22
- const wrapper = shallow(
24
+ render(
23
25
  <PostStickyCheck postType="post" hasStickyAction={ false }>
24
26
  Can Toggle Sticky
25
27
  </PostStickyCheck>
26
28
  );
27
- expect( wrapper.type() ).toBe( null );
29
+ expect(
30
+ screen.queryByText( 'Can Toggle Sticky' )
31
+ ).not.toBeInTheDocument();
28
32
  } );
29
33
 
30
34
  it( 'should render if the post supports stickying', () => {
31
- const wrapper = shallow(
35
+ render(
32
36
  <PostStickyCheck postType="post" hasStickyAction={ true }>
33
37
  Can Toggle Sticky
34
38
  </PostStickyCheck>
35
39
  );
36
- expect( wrapper.type() ).not.toBe( null );
40
+ expect( screen.getByText( 'Can Toggle Sticky' ) ).toBeVisible();
37
41
  } );
38
42
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { escape as escapeString, find, get, uniqBy } from 'lodash';
4
+ import { escape as escapeString, find, get } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -202,7 +202,15 @@ export function FlatTermSelector( { slug } ) {
202
202
  ...( terms ?? [] ),
203
203
  ...( searchResults ?? [] ),
204
204
  ];
205
- const uniqueTerms = uniqBy( termNames, ( term ) => term.toLowerCase() );
205
+ const uniqueTerms = termNames.reduce( ( acc, name ) => {
206
+ if (
207
+ ! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )
208
+ ) {
209
+ acc.push( name );
210
+ }
211
+ return acc;
212
+ }, [] );
213
+
206
214
  const newTermNames = uniqueTerms.filter(
207
215
  ( termName ) =>
208
216
  ! find( availableTerms, ( term ) =>
@@ -19,7 +19,12 @@ import { ENTER } from '@wordpress/keycodes';
19
19
  import { useSelect, useDispatch } from '@wordpress/data';
20
20
  import { pasteHandler } from '@wordpress/blocks';
21
21
  import { store as blockEditorStore } from '@wordpress/block-editor';
22
- import { __unstableUseRichText as useRichText } from '@wordpress/rich-text';
22
+ import {
23
+ __unstableUseRichText as useRichText,
24
+ create,
25
+ toHTMLString,
26
+ insert,
27
+ } from '@wordpress/rich-text';
23
28
  import { useMergeRefs } from '@wordpress/compose';
24
29
 
25
30
  /**
@@ -149,9 +154,13 @@ function PostTitle( _, forwardedRef ) {
149
154
  plainText,
150
155
  } );
151
156
 
152
- if ( typeof content !== 'string' && content.length ) {
153
- event.preventDefault();
157
+ event.preventDefault();
154
158
 
159
+ if ( ! content.length ) {
160
+ return;
161
+ }
162
+
163
+ if ( typeof content !== 'string' ) {
155
164
  const [ firstBlock ] = content;
156
165
 
157
166
  if (
@@ -164,6 +173,17 @@ function PostTitle( _, forwardedRef ) {
164
173
  } else {
165
174
  onInsertBlockAfter( content );
166
175
  }
176
+ } else {
177
+ const value = {
178
+ ...create( { html: title } ),
179
+ ...selection,
180
+ };
181
+ const newValue = insert( value, create( { html: content } ) );
182
+ onUpdate( toHTMLString( { value: newValue } ) );
183
+ setSelection( {
184
+ start: newValue.start,
185
+ end: newValue.end,
186
+ } );
167
187
  }
168
188
  }
169
189
 
@@ -1,3 +1,6 @@
1
1
  .editor-post-trash.components-button {
2
+ display: flex;
3
+ justify-content: center;
2
4
  margin-top: $grid-unit-05;
5
+ width: 100%;
3
6
  }
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { filterURLForDisplay } from '@wordpress/url';
5
+ import { filterURLForDisplay, safeDecodeURIComponent } from '@wordpress/url';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -18,5 +18,5 @@ export function usePostURLLabel() {
18
18
  ( select ) => select( editorStore ).getCurrentPost().link,
19
19
  []
20
20
  );
21
- return filterURLForDisplay( postLink );
21
+ return filterURLForDisplay( safeDecodeURIComponent( postLink ) );
22
22
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { shallow } from 'enzyme';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -9,19 +9,27 @@ import { shallow } from 'enzyme';
9
9
  import { PostVisibilityCheck } from '../check';
10
10
 
11
11
  describe( 'PostVisibilityCheck', () => {
12
- const render = ( { canEdit } ) => ( canEdit ? 'yes' : 'no' );
12
+ const renderProp = ( { canEdit } ) => ( canEdit ? 'yes' : 'no' );
13
13
 
14
14
  it( "should not render the edit link if the user doesn't have the right capability", () => {
15
- const wrapper = shallow(
16
- <PostVisibilityCheck hasPublishAction={ false } render={ render } />
15
+ render(
16
+ <PostVisibilityCheck
17
+ hasPublishAction={ false }
18
+ render={ renderProp }
19
+ />
17
20
  );
18
- expect( wrapper.text() ).toBe( 'no' );
21
+ expect( screen.queryByText( 'yes' ) ).not.toBeInTheDocument();
22
+ expect( screen.getByText( 'no' ) ).toBeVisible();
19
23
  } );
20
24
 
21
25
  it( 'should render if the user has the correct capability', () => {
22
- const wrapper = shallow(
23
- <PostVisibilityCheck hasPublishAction={ true } render={ render } />
26
+ render(
27
+ <PostVisibilityCheck
28
+ hasPublishAction={ true }
29
+ render={ renderProp }
30
+ />
24
31
  );
25
- expect( wrapper.text() ).toBe( 'yes' );
32
+ expect( screen.queryByText( 'no' ) ).not.toBeInTheDocument();
33
+ expect( screen.getByText( 'yes' ) ).toBeVisible();
26
34
  } );
27
35
  } );
@@ -91,12 +91,14 @@ class NativeEditorProvider extends Component {
91
91
  }
92
92
 
93
93
  componentDidMount() {
94
- const { capabilities, locale, updateSettings } = this.props;
94
+ const { capabilities, locale, hostAppNamespace, updateSettings } =
95
+ this.props;
95
96
 
96
97
  updateSettings( {
97
98
  ...capabilities,
98
99
  ...this.getThemeColors( this.props ),
99
100
  locale,
101
+ hostAppNamespace,
100
102
  } );
101
103
 
102
104
  this.subscriptionParentGetHtml = subscribeParentGetHtml( () => {
@@ -41,7 +41,9 @@ function useBlockEditorSettings( settings, hasTemplate ) {
41
41
  const isWeb = Platform.OS === 'web';
42
42
  const { canUser, getEntityRecord } = select( coreStore );
43
43
 
44
- const siteSettings = getEntityRecord( 'root', 'site' );
44
+ const siteSettings = canUser( 'read', 'settings' )
45
+ ? getEntityRecord( 'root', 'site' )
46
+ : undefined;
45
47
 
46
48
  return {
47
49
  canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
@@ -126,7 +128,9 @@ function useBlockEditorSettings( settings, hasTemplate ) {
126
128
  'colors',
127
129
  'disableCustomColors',
128
130
  'disableCustomFontSizes',
131
+ 'disableCustomSpacingSizes',
129
132
  'disableCustomGradients',
133
+ 'disableLayoutStyles',
130
134
  'enableCustomLineHeight',
131
135
  'enableCustomSpacing',
132
136
  'enableCustomUnits',
@@ -136,6 +140,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
136
140
  'generateAnchors',
137
141
  'hasFixedToolbar',
138
142
  'hasReducedUI',
143
+ 'hasInlineToolbar',
139
144
  'imageDefaultSize',
140
145
  'imageDimensions',
141
146
  'imageEditing',