@wordpress/edit-post 5.0.27 → 6.0.1-next.f435e9e01b.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 (112) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +10 -4
  4. package/build/components/block-manager/category.js +42 -47
  5. package/build/components/block-manager/category.js.map +1 -1
  6. package/build/components/block-manager/index.js +18 -1
  7. package/build/components/block-manager/index.js.map +1 -1
  8. package/build/components/header/index.native.js +4 -6
  9. package/build/components/header/index.native.js.map +1 -1
  10. package/build/components/header/plugin-more-menu-item/index.js +1 -1
  11. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  12. package/build/components/layout/index.js +17 -2
  13. package/build/components/layout/index.js.map +1 -1
  14. package/build/components/layout/index.native.js +3 -3
  15. package/build/components/layout/index.native.js.map +1 -1
  16. package/build/components/preferences-modal/index.js +27 -9
  17. package/build/components/preferences-modal/index.js.map +1 -1
  18. package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
  19. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  20. package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
  21. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  22. package/build/components/sidebar/post-author/index.js +3 -1
  23. package/build/components/sidebar/post-author/index.js.map +1 -1
  24. package/build/components/sidebar/template/actions.js +5 -2
  25. package/build/components/sidebar/template/actions.js.map +1 -1
  26. package/build/components/sidebar/template/index.js +23 -12
  27. package/build/components/sidebar/template/index.js.map +1 -1
  28. package/build/components/visual-editor/index.js +14 -6
  29. package/build/components/visual-editor/index.js.map +1 -1
  30. package/build/components/welcome-guide/template.js +1 -1
  31. package/build/components/welcome-guide/template.js.map +1 -1
  32. package/build/editor.js +6 -11
  33. package/build/editor.js.map +1 -1
  34. package/build/index.js +1 -1
  35. package/build/index.js.map +1 -1
  36. package/build/index.native.js +3 -9
  37. package/build/index.native.js.map +1 -1
  38. package/build-module/components/block-manager/category.js +44 -48
  39. package/build-module/components/block-manager/category.js.map +1 -1
  40. package/build-module/components/block-manager/index.js +17 -2
  41. package/build-module/components/block-manager/index.js.map +1 -1
  42. package/build-module/components/header/index.native.js +4 -4
  43. package/build-module/components/header/index.native.js.map +1 -1
  44. package/build-module/components/header/plugin-more-menu-item/index.js +1 -1
  45. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  46. package/build-module/components/layout/index.js +18 -4
  47. package/build-module/components/layout/index.js.map +1 -1
  48. package/build-module/components/layout/index.native.js +4 -2
  49. package/build-module/components/layout/index.native.js.map +1 -1
  50. package/build-module/components/preferences-modal/index.js +27 -9
  51. package/build-module/components/preferences-modal/index.js.map +1 -1
  52. package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
  53. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  54. package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
  55. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  56. package/build-module/components/sidebar/post-author/index.js +3 -1
  57. package/build-module/components/sidebar/post-author/index.js.map +1 -1
  58. package/build-module/components/sidebar/template/actions.js +5 -2
  59. package/build-module/components/sidebar/template/actions.js.map +1 -1
  60. package/build-module/components/sidebar/template/index.js +24 -13
  61. package/build-module/components/sidebar/template/index.js.map +1 -1
  62. package/build-module/components/visual-editor/index.js +15 -7
  63. package/build-module/components/visual-editor/index.js.map +1 -1
  64. package/build-module/components/welcome-guide/template.js +1 -1
  65. package/build-module/components/welcome-guide/template.js.map +1 -1
  66. package/build-module/editor.js +7 -10
  67. package/build-module/editor.js.map +1 -1
  68. package/build-module/index.js +1 -1
  69. package/build-module/index.js.map +1 -1
  70. package/build-module/index.native.js +2 -9
  71. package/build-module/index.native.js.map +1 -1
  72. package/build-style/style-rtl.css +25 -16
  73. package/build-style/style.css +25 -16
  74. package/package.json +26 -29
  75. package/src/components/block-manager/category.js +41 -48
  76. package/src/components/block-manager/index.js +18 -1
  77. package/src/components/header/index.native.js +10 -4
  78. package/src/components/header/plugin-more-menu-item/index.js +1 -1
  79. package/src/components/header/template-title/style.scss +1 -1
  80. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +2 -2
  81. package/src/components/layout/index.js +18 -3
  82. package/src/components/layout/index.native.js +2 -5
  83. package/src/components/preferences-modal/index.js +23 -12
  84. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +7 -13
  85. package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
  86. package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
  87. package/src/components/secondary-sidebar/style.scss +0 -4
  88. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  89. package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +1 -1
  90. package/src/components/sidebar/post-author/index.js +1 -1
  91. package/src/components/sidebar/template/actions.js +12 -7
  92. package/src/components/sidebar/template/index.js +55 -31
  93. package/src/components/sidebar/template/style.scss +8 -0
  94. package/src/components/visual-editor/index.js +16 -6
  95. package/src/components/visual-editor/style.scss +1 -0
  96. package/src/components/welcome-guide/style.scss +8 -1
  97. package/src/components/welcome-guide/template.js +1 -1
  98. package/src/editor.js +22 -26
  99. package/src/index.js +1 -1
  100. package/src/index.native.js +1 -10
  101. package/src/style.scss +1 -2
  102. package/src/test/editor.native.js +4 -4
  103. package/build/components/edit-post-settings/index.js +0 -16
  104. package/build/components/edit-post-settings/index.js.map +0 -1
  105. package/build/prevent-event-discovery.js +0 -24
  106. package/build/prevent-event-discovery.js.map +0 -1
  107. package/build-module/components/edit-post-settings/index.js +0 -7
  108. package/build-module/components/edit-post-settings/index.js.map +0 -1
  109. package/build-module/prevent-event-discovery.js +0 -17
  110. package/build-module/prevent-event-discovery.js.map +0 -1
  111. package/src/components/edit-post-settings/index.js +0 -7
  112. package/src/prevent-event-discovery.js +0 -21
@@ -5,14 +5,12 @@ import { createElement } from "@wordpress/element";
5
5
  */
6
6
  import '@wordpress/core-data';
7
7
  import '@wordpress/format-library';
8
- import { render } from '@wordpress/element';
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
12
11
 
13
12
  export { store } from './store';
14
13
  import Editor from './editor';
15
- let editorInitialized = false;
16
14
  /**
17
15
  * Initializes the Editor and returns a componentProvider
18
16
  * that can be registered with `AppRegistry.registerComponent`
@@ -23,14 +21,9 @@ let editorInitialized = false;
23
21
  */
24
22
 
25
23
  export function initializeEditor(id, postType, postId) {
26
- if (editorInitialized) {
27
- return;
28
- }
29
-
30
- editorInitialized = true;
31
- render(createElement(Editor, {
24
+ return createElement(Editor, {
32
25
  postId: postId,
33
26
  postType: postType
34
- }), id);
27
+ });
35
28
  }
36
29
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/index.native.js"],"names":["render","store","Editor","editorInitialized","initializeEditor","id","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,sBAAP;AACA,OAAO,2BAAP;AACA,SAASA,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,IAAIC,iBAAiB,GAAG,KAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAAyCC,MAAzC,EAAkD;AACxD,MAAKJ,iBAAL,EAAyB;AACxB;AACA;;AAEDA,EAAAA,iBAAiB,GAAG,IAApB;AAEAH,EAAAA,MAAM,CAAE,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGO,MAAjB;AAA0B,IAAA,QAAQ,EAAGD;AAArC,IAAF,EAAsDD,EAAtD,CAAN;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { render } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\nlet editorInitialized = false;\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tif ( editorInitialized ) {\n\t\treturn;\n\t}\n\n\teditorInitialized = true;\n\n\trender( <Editor postId={ postId } postType={ postType } />, id );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/index.native.js"],"names":["store","Editor","initializeEditor","id","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,sBAAP;AACA,OAAO,2BAAP;AAEA;AACA;AACA;;AACA,SAASA,KAAT,QAAsB,SAAtB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAAyCC,MAAzC,EAAkD;AACxD,SAAO,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGA,MAAjB;AAA0B,IAAA,QAAQ,EAAGD;AAArC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"]}
@@ -925,7 +925,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
925
925
  }
926
926
  @media (min-width: 1080px) {
927
927
  .edit-post-template-top-area .edit-post-template-post-title {
928
- max-width: none;
928
+ max-width: 400px;
929
929
  }
930
930
  }
931
931
 
@@ -1415,11 +1415,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1415
1415
  display: flex;
1416
1416
  justify-content: flex-end;
1417
1417
  }
1418
- @media (min-width: 782px) {
1419
- .edit-post-editor__inserter-panel-header {
1420
- display: none;
1421
- }
1422
- }
1423
1418
 
1424
1419
  .edit-post-editor__inserter-panel-content,
1425
1420
  .edit-post-editor__list-view-panel-content {
@@ -1650,6 +1645,13 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1650
1645
  }
1651
1646
  }
1652
1647
 
1648
+ .edit-post-template__notice {
1649
+ margin: 0 0 8px 0;
1650
+ }
1651
+ .edit-post-template__notice .components-notice__content {
1652
+ margin: 0;
1653
+ }
1654
+
1653
1655
  .edit-post-template__actions button:not(:last-child) {
1654
1656
  margin-left: 8px;
1655
1657
  }
@@ -1768,41 +1770,52 @@ h2.edit-post-template-summary__title {
1768
1770
  width: 100%;
1769
1771
  height: 100%;
1770
1772
  position: relative;
1773
+ box-sizing: border-box;
1771
1774
  display: flex;
1772
1775
  flex-grow: 1;
1773
1776
  }
1774
1777
 
1775
- .edit-post-welcome-guide {
1778
+ .edit-post-welcome-guide,
1779
+ .edit-template-welcome-guide {
1776
1780
  width: 312px;
1777
1781
  }
1778
- .edit-post-welcome-guide__image {
1782
+ .edit-post-welcome-guide__image,
1783
+ .edit-template-welcome-guide__image {
1779
1784
  background: #00a0d2;
1780
1785
  margin: 0 0 16px;
1781
1786
  }
1782
- .edit-post-welcome-guide__image > img {
1787
+ .edit-post-welcome-guide__image > img,
1788
+ .edit-template-welcome-guide__image > img {
1783
1789
  display: block;
1784
1790
  max-width: 100%;
1785
1791
  -o-object-fit: cover;
1786
1792
  object-fit: cover;
1787
1793
  }
1788
- .edit-post-welcome-guide__heading {
1794
+ .edit-post-welcome-guide__heading,
1795
+ .edit-template-welcome-guide__heading {
1789
1796
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
1790
1797
  font-size: 24px;
1791
1798
  line-height: 1.4;
1792
1799
  margin: 16px 0 16px 0;
1793
1800
  padding: 0 32px;
1794
1801
  }
1795
- .edit-post-welcome-guide__text {
1802
+ .edit-post-welcome-guide__text,
1803
+ .edit-template-welcome-guide__text {
1796
1804
  font-size: 13px;
1797
1805
  line-height: 1.4;
1798
1806
  margin: 0 0 24px 0;
1799
1807
  padding: 0 32px;
1800
1808
  }
1801
- .edit-post-welcome-guide__inserter-icon {
1809
+ .edit-post-welcome-guide__inserter-icon,
1810
+ .edit-template-welcome-guide__inserter-icon {
1802
1811
  margin: 0 4px;
1803
1812
  vertical-align: text-top;
1804
1813
  }
1805
1814
 
1815
+ .edit-template-welcome-guide .components-button svg {
1816
+ fill: #fff;
1817
+ }
1818
+
1806
1819
  /**
1807
1820
  * Animations
1808
1821
  */
@@ -1858,7 +1871,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1858
1871
  }
1859
1872
 
1860
1873
  .edit-post-header,
1861
- .edit-post-visual-editor,
1862
1874
  .edit-post-text-editor,
1863
1875
  .edit-post-sidebar,
1864
1876
  .editor-post-publish-panel,
@@ -1870,9 +1882,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1870
1882
  .edit-post-header *,
1871
1883
  .edit-post-header *::before,
1872
1884
  .edit-post-header *::after,
1873
- .edit-post-visual-editor *,
1874
- .edit-post-visual-editor *::before,
1875
- .edit-post-visual-editor *::after,
1876
1885
  .edit-post-text-editor *,
1877
1886
  .edit-post-text-editor *::before,
1878
1887
  .edit-post-text-editor *::after,
@@ -925,7 +925,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
925
925
  }
926
926
  @media (min-width: 1080px) {
927
927
  .edit-post-template-top-area .edit-post-template-post-title {
928
- max-width: none;
928
+ max-width: 400px;
929
929
  }
930
930
  }
931
931
 
@@ -1415,11 +1415,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1415
1415
  display: flex;
1416
1416
  justify-content: flex-end;
1417
1417
  }
1418
- @media (min-width: 782px) {
1419
- .edit-post-editor__inserter-panel-header {
1420
- display: none;
1421
- }
1422
- }
1423
1418
 
1424
1419
  .edit-post-editor__inserter-panel-content,
1425
1420
  .edit-post-editor__list-view-panel-content {
@@ -1654,6 +1649,13 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1654
1649
  }
1655
1650
  }
1656
1651
 
1652
+ .edit-post-template__notice {
1653
+ margin: 0 0 8px 0;
1654
+ }
1655
+ .edit-post-template__notice .components-notice__content {
1656
+ margin: 0;
1657
+ }
1658
+
1657
1659
  .edit-post-template__actions button:not(:last-child) {
1658
1660
  margin-right: 8px;
1659
1661
  }
@@ -1772,41 +1774,52 @@ h2.edit-post-template-summary__title {
1772
1774
  width: 100%;
1773
1775
  height: 100%;
1774
1776
  position: relative;
1777
+ box-sizing: border-box;
1775
1778
  display: flex;
1776
1779
  flex-grow: 1;
1777
1780
  }
1778
1781
 
1779
- .edit-post-welcome-guide {
1782
+ .edit-post-welcome-guide,
1783
+ .edit-template-welcome-guide {
1780
1784
  width: 312px;
1781
1785
  }
1782
- .edit-post-welcome-guide__image {
1786
+ .edit-post-welcome-guide__image,
1787
+ .edit-template-welcome-guide__image {
1783
1788
  background: #00a0d2;
1784
1789
  margin: 0 0 16px;
1785
1790
  }
1786
- .edit-post-welcome-guide__image > img {
1791
+ .edit-post-welcome-guide__image > img,
1792
+ .edit-template-welcome-guide__image > img {
1787
1793
  display: block;
1788
1794
  max-width: 100%;
1789
1795
  -o-object-fit: cover;
1790
1796
  object-fit: cover;
1791
1797
  }
1792
- .edit-post-welcome-guide__heading {
1798
+ .edit-post-welcome-guide__heading,
1799
+ .edit-template-welcome-guide__heading {
1793
1800
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
1794
1801
  font-size: 24px;
1795
1802
  line-height: 1.4;
1796
1803
  margin: 16px 0 16px 0;
1797
1804
  padding: 0 32px;
1798
1805
  }
1799
- .edit-post-welcome-guide__text {
1806
+ .edit-post-welcome-guide__text,
1807
+ .edit-template-welcome-guide__text {
1800
1808
  font-size: 13px;
1801
1809
  line-height: 1.4;
1802
1810
  margin: 0 0 24px 0;
1803
1811
  padding: 0 32px;
1804
1812
  }
1805
- .edit-post-welcome-guide__inserter-icon {
1813
+ .edit-post-welcome-guide__inserter-icon,
1814
+ .edit-template-welcome-guide__inserter-icon {
1806
1815
  margin: 0 4px;
1807
1816
  vertical-align: text-top;
1808
1817
  }
1809
1818
 
1819
+ .edit-template-welcome-guide .components-button svg {
1820
+ fill: #fff;
1821
+ }
1822
+
1810
1823
  /**
1811
1824
  * Animations
1812
1825
  */
@@ -1862,7 +1875,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1862
1875
  }
1863
1876
 
1864
1877
  .edit-post-header,
1865
- .edit-post-visual-editor,
1866
1878
  .edit-post-text-editor,
1867
1879
  .edit-post-sidebar,
1868
1880
  .editor-post-publish-panel,
@@ -1874,9 +1886,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
1874
1886
  .edit-post-header *,
1875
1887
  .edit-post-header *::before,
1876
1888
  .edit-post-header *::after,
1877
- .edit-post-visual-editor *,
1878
- .edit-post-visual-editor *::before,
1879
- .edit-post-visual-editor *::after,
1880
1889
  .edit-post-text-editor *,
1881
1890
  .edit-post-text-editor *::before,
1882
1891
  .edit-post-text-editor *::after,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "5.0.27",
3
+ "version": "6.0.1-next.f435e9e01b.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,39 +27,36 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.2.4",
31
- "@wordpress/api-fetch": "^5.2.6",
32
- "@wordpress/block-editor": "^8.0.17",
33
- "@wordpress/block-library": "^6.0.26",
34
- "@wordpress/blocks": "^11.1.5",
35
- "@wordpress/components": "^19.2.3",
36
- "@wordpress/compose": "^5.0.7",
37
- "@wordpress/core-data": "^4.0.10",
38
- "@wordpress/data": "^6.1.5",
39
- "@wordpress/data-controls": "^2.2.8",
40
- "@wordpress/editor": "^12.0.21",
41
- "@wordpress/element": "^4.0.4",
42
- "@wordpress/hooks": "^3.2.2",
43
- "@wordpress/i18n": "^4.2.4",
44
- "@wordpress/icons": "^6.1.1",
45
- "@wordpress/interface": "^4.1.18",
46
- "@wordpress/keyboard-shortcuts": "^3.0.7",
47
- "@wordpress/keycodes": "^3.2.4",
48
- "@wordpress/media-utils": "^3.0.5",
49
- "@wordpress/notices": "^3.2.8",
50
- "@wordpress/plugins": "^4.0.7",
51
- "@wordpress/primitives": "^3.0.4",
52
- "@wordpress/url": "^3.3.1",
53
- "@wordpress/viewport": "^4.0.7",
54
- "@wordpress/warning": "^2.2.2",
30
+ "@wordpress/a11y": "^3.3.1-next.f435e9e01b.0",
31
+ "@wordpress/block-editor": "^8.1.2-next.f435e9e01b.0",
32
+ "@wordpress/block-library": "^7.0.1-next.f435e9e01b.0",
33
+ "@wordpress/blocks": "^11.2.1-next.f435e9e01b.0",
34
+ "@wordpress/components": "^19.4.1-next.f435e9e01b.0",
35
+ "@wordpress/compose": "^5.1.1-next.f435e9e01b.0",
36
+ "@wordpress/core-data": "^4.1.1-next.f435e9e01b.0",
37
+ "@wordpress/data": "^6.2.2-next.f435e9e01b.0",
38
+ "@wordpress/data-controls": "^2.3.1-next.f435e9e01b.0",
39
+ "@wordpress/editor": "^12.2.1-next.f435e9e01b.0",
40
+ "@wordpress/element": "^4.1.1-next.f435e9e01b.0",
41
+ "@wordpress/hooks": "^3.3.1-next.f435e9e01b.0",
42
+ "@wordpress/i18n": "^4.3.1-next.f435e9e01b.0",
43
+ "@wordpress/icons": "^6.3.1-next.f435e9e01b.0",
44
+ "@wordpress/interface": "^4.2.2-next.f435e9e01b.0",
45
+ "@wordpress/keyboard-shortcuts": "^3.1.2-next.f435e9e01b.0",
46
+ "@wordpress/keycodes": "^3.3.1-next.f435e9e01b.0",
47
+ "@wordpress/media-utils": "^3.1.1-next.f435e9e01b.0",
48
+ "@wordpress/notices": "^3.3.1-next.f435e9e01b.0",
49
+ "@wordpress/plugins": "^4.1.1-next.f435e9e01b.0",
50
+ "@wordpress/url": "^3.4.1-next.f435e9e01b.0",
51
+ "@wordpress/viewport": "^4.1.1-next.f435e9e01b.0",
52
+ "@wordpress/warning": "^2.3.1-next.f435e9e01b.0",
55
53
  "classnames": "^2.3.1",
56
54
  "lodash": "^4.17.21",
57
55
  "memize": "^1.1.0",
58
- "rememo": "^3.0.0",
59
- "uuid": "8.3.0"
56
+ "rememo": "^3.0.0"
60
57
  },
61
58
  "publishConfig": {
62
59
  "access": "public"
63
60
  },
64
- "gitHead": "1246a52b9fdfecf592a9fa1d33a2804a6cc2d257"
61
+ "gitHead": "14b2846015dfb1b440ce93accdd03842ebe5f1cd"
65
62
  }
@@ -6,36 +6,59 @@ import { includes, map, without } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useContext, useMemo } from '@wordpress/element';
10
- import { withSelect, withDispatch } from '@wordpress/data';
11
- import { compose, withInstanceId } from '@wordpress/compose';
9
+ import { useMemo, useCallback } from '@wordpress/element';
10
+ import { useDispatch, useSelect } from '@wordpress/data';
11
+ import { useInstanceId } from '@wordpress/compose';
12
12
  import { CheckboxControl } from '@wordpress/components';
13
+ import { store as editorStore } from '@wordpress/editor';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
  import BlockTypesChecklist from './checklist';
18
- import EditPostSettings from '../edit-post-settings';
19
19
  import { store as editPostStore } from '../../store';
20
20
 
21
- function BlockManagerCategory( {
22
- instanceId,
23
- title,
24
- blockTypes,
25
- hiddenBlockTypes,
26
- toggleVisible,
27
- toggleAllVisible,
28
- } ) {
29
- const settings = useContext( EditPostSettings );
30
- const { allowedBlockTypes } = settings;
21
+ function BlockManagerCategory( { title, blockTypes } ) {
22
+ const instanceId = useInstanceId( BlockManagerCategory );
23
+ const { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(
24
+ ( select ) => {
25
+ const { getEditorSettings } = select( editorStore );
26
+ const { getPreference } = select( editPostStore );
27
+ return {
28
+ defaultAllowedBlockTypes: getEditorSettings()
29
+ .defaultAllowedBlockTypes,
30
+ hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),
31
+ };
32
+ },
33
+ []
34
+ );
31
35
  const filteredBlockTypes = useMemo( () => {
32
- if ( allowedBlockTypes === true ) {
36
+ if ( defaultAllowedBlockTypes === true ) {
33
37
  return blockTypes;
34
38
  }
35
39
  return blockTypes.filter( ( { name } ) => {
36
- return includes( allowedBlockTypes || [], name );
40
+ return includes( defaultAllowedBlockTypes || [], name );
37
41
  } );
38
- }, [ allowedBlockTypes, blockTypes ] );
42
+ }, [ defaultAllowedBlockTypes, blockTypes ] );
43
+ const { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );
44
+ const toggleVisible = useCallback( ( blockName, nextIsChecked ) => {
45
+ if ( nextIsChecked ) {
46
+ showBlockTypes( blockName );
47
+ } else {
48
+ hideBlockTypes( blockName );
49
+ }
50
+ }, [] );
51
+ const toggleAllVisible = useCallback(
52
+ ( nextIsChecked ) => {
53
+ const blockNames = map( blockTypes, 'name' );
54
+ if ( nextIsChecked ) {
55
+ showBlockTypes( blockNames );
56
+ } else {
57
+ hideBlockTypes( blockNames );
58
+ }
59
+ },
60
+ [ blockTypes ]
61
+ );
39
62
 
40
63
  if ( ! filteredBlockTypes.length ) {
41
64
  return null;
@@ -81,34 +104,4 @@ function BlockManagerCategory( {
81
104
  );
82
105
  }
83
106
 
84
- export default compose( [
85
- withInstanceId,
86
- withSelect( ( select ) => {
87
- const { getPreference } = select( editPostStore );
88
-
89
- return {
90
- hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),
91
- };
92
- } ),
93
- withDispatch( ( dispatch, ownProps ) => {
94
- const { showBlockTypes, hideBlockTypes } = dispatch( editPostStore );
95
-
96
- return {
97
- toggleVisible( blockName, nextIsChecked ) {
98
- if ( nextIsChecked ) {
99
- showBlockTypes( blockName );
100
- } else {
101
- hideBlockTypes( blockName );
102
- }
103
- },
104
- toggleAllVisible( nextIsChecked ) {
105
- const blockNames = map( ownProps.blockTypes, 'name' );
106
- if ( nextIsChecked ) {
107
- showBlockTypes( blockNames );
108
- } else {
109
- hideBlockTypes( blockNames );
110
- }
111
- },
112
- };
113
- } ),
114
- ] )( BlockManagerCategory );
107
+ export default BlockManagerCategory;
@@ -10,7 +10,9 @@ import { store as blocksStore } from '@wordpress/blocks';
10
10
  import { withSelect } from '@wordpress/data';
11
11
  import { SearchControl } from '@wordpress/components';
12
12
  import { __, _n, sprintf } from '@wordpress/i18n';
13
- import { useState } from '@wordpress/element';
13
+ import { useEffect, useState } from '@wordpress/element';
14
+ import { useDebounce } from '@wordpress/compose';
15
+ import { speak } from '@wordpress/a11y';
14
16
 
15
17
  /**
16
18
  * Internal dependencies
@@ -25,6 +27,7 @@ function BlockManager( {
25
27
  isMatchingSearchTerm,
26
28
  numberOfHiddenBlocks,
27
29
  } ) {
30
+ const debouncedSpeak = useDebounce( speak, 500 );
28
31
  const [ search, setSearch ] = useState( '' );
29
32
 
30
33
  // Filtering occurs here (as opposed to `withSelect`) to avoid
@@ -38,6 +41,20 @@ function BlockManager( {
38
41
  includes( blockType.parent, 'core/post-content' ) )
39
42
  );
40
43
 
44
+ // Announce search results on change
45
+ useEffect( () => {
46
+ if ( ! search ) {
47
+ return;
48
+ }
49
+ const count = blockTypes.length;
50
+ const resultsFoundMessage = sprintf(
51
+ /* translators: %d: number of results. */
52
+ _n( '%d result found.', '%d results found.', count ),
53
+ count
54
+ );
55
+ debouncedSpeak( resultsFoundMessage );
56
+ }, [ blockTypes.length, search, debouncedSpeak ] );
57
+
41
58
  return (
42
59
  <div className="edit-post-block-manager__content">
43
60
  { !! numberOfHiddenBlocks && (
@@ -27,13 +27,19 @@ export default class Header extends Component {
27
27
  }
28
28
 
29
29
  componentDidMount() {
30
- Keyboard.addListener( 'keyboardDidShow', this.keyboardDidShow );
31
- Keyboard.addListener( 'keyboardDidHide', this.keyboardDidHide );
30
+ this.keyboardShowSubscription = Keyboard.addListener(
31
+ 'keyboardDidShow',
32
+ this.keyboardDidShow
33
+ );
34
+ this.keyboardHideSubscription = Keyboard.addListener(
35
+ 'keyboardDidHide',
36
+ this.keyboardDidHide
37
+ );
32
38
  }
33
39
 
34
40
  componentWillUnmount() {
35
- Keyboard.removeListener( 'keyboardDidShow', this.keyboardDidShow );
36
- Keyboard.removeListener( 'keyboardDidHide', this.keyboardDidHide );
41
+ this.keyboardShowSubscription.remove();
42
+ this.keyboardHideSubscription.remove();
37
43
  }
38
44
 
39
45
  keyboardDidShow() {
@@ -13,7 +13,7 @@ import { withPluginContext } from '@wordpress/plugins';
13
13
  * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
14
14
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
15
15
  * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
16
- * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.
16
+ * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
17
17
  *
18
18
  * @example
19
19
  * ```js
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  @include break-xlarge() {
44
- max-width: none;
44
+ max-width: 400px;
45
45
  }
46
46
  }
47
47
  }
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`KeyboardShortcutHelpModal should match snapshot when the modal is active 1`] = `
4
- <Modal
4
+ <ForwardRef(Modal)
5
5
  className="edit-post-keyboard-shortcut-help-modal"
6
6
  closeLabel="Close"
7
7
  onRequestClose={[Function]}
@@ -80,7 +80,7 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
80
80
  }
81
81
  title="Text formatting"
82
82
  />
83
- </Modal>
83
+ </ForwardRef(Modal)>
84
84
  `;
85
85
 
86
86
  exports[`KeyboardShortcutHelpModal should match snapshot when the modal is not active 1`] = `""`;
@@ -16,11 +16,11 @@ import {
16
16
  store as editorStore,
17
17
  } from '@wordpress/editor';
18
18
  import { useSelect, useDispatch } from '@wordpress/data';
19
- import { BlockBreadcrumb } from '@wordpress/block-editor';
19
+ import { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';
20
20
  import { Button, ScrollLock, Popover } from '@wordpress/components';
21
21
  import { useViewportMatch } from '@wordpress/compose';
22
22
  import { PluginArea } from '@wordpress/plugins';
23
- import { __, _x } from '@wordpress/i18n';
23
+ import { __, _x, sprintf } from '@wordpress/i18n';
24
24
  import {
25
25
  ComplementaryArea,
26
26
  FullscreenMode,
@@ -29,6 +29,7 @@ import {
29
29
  } from '@wordpress/interface';
30
30
  import { useState, useEffect, useCallback } from '@wordpress/element';
31
31
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
32
+ import { store as noticesStore } from '@wordpress/notices';
32
33
 
33
34
  /**
34
35
  * Internal dependencies
@@ -70,6 +71,7 @@ function Layout( { styles } ) {
70
71
  closeGeneralSidebar,
71
72
  setIsInserterOpened,
72
73
  } = useDispatch( editPostStore );
74
+ const { createErrorNotice } = useDispatch( noticesStore );
73
75
  const {
74
76
  mode,
75
77
  isFullscreenActive,
@@ -178,6 +180,18 @@ function Layout( { styles } ) {
178
180
  return null;
179
181
  };
180
182
 
183
+ function onPluginAreaError( name ) {
184
+ createErrorNotice(
185
+ sprintf(
186
+ /* translators: %s: plugin name */
187
+ __(
188
+ 'The "%s" plugin has encountered an error and cannot be rendered.'
189
+ ),
190
+ name
191
+ )
192
+ );
193
+ }
194
+
181
195
  return (
182
196
  <>
183
197
  <FullscreenMode isActive={ isFullscreenActive } />
@@ -239,6 +253,7 @@ function Layout( { styles } ) {
239
253
  { isMobileViewport && sidebarIsOpened && (
240
254
  <ScrollLock />
241
255
  ) }
256
+ <BlockStyles.Slot scope="core/block-inspector" />
242
257
  </>
243
258
  }
244
259
  footer={
@@ -272,7 +287,7 @@ function Layout( { styles } ) {
272
287
  <KeyboardShortcutHelpModal />
273
288
  <WelcomeGuide />
274
289
  <Popover.Slot />
275
- <PluginArea />
290
+ <PluginArea onError={ onPluginAreaError } />
276
291
  </>
277
292
  );
278
293
  }
@@ -53,17 +53,14 @@ class Layout extends Component {
53
53
 
54
54
  componentDidMount() {
55
55
  this._isMounted = true;
56
- SafeArea.addEventListener(
56
+ this.safeAreaSubscription = SafeArea.addEventListener(
57
57
  'safeAreaInsetsForRootViewDidChange',
58
58
  this.onSafeAreaInsetsUpdate
59
59
  );
60
60
  }
61
61
 
62
62
  componentWillUnmount() {
63
- SafeArea.removeEventListener(
64
- 'safeAreaInsetsForRootViewDidChange',
65
- this.onSafeAreaInsetsUpdate
66
- );
63
+ this.safeAreaSubscription?.remove();
67
64
  this._isMounted = false;
68
65
  }
69
66