@wordpress/edit-post 6.16.0 → 6.18.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 (107) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-manager/category.js +2 -2
  3. package/build/components/block-manager/category.js.map +1 -1
  4. package/build/components/block-manager/index.js +1 -1
  5. package/build/components/block-manager/index.js.map +1 -1
  6. package/build/components/device-preview/index.js +3 -0
  7. package/build/components/device-preview/index.js.map +1 -1
  8. package/build/components/header/header-toolbar/index.js +0 -6
  9. package/build/components/header/header-toolbar/index.js.map +1 -1
  10. package/build/components/header/index.js +52 -8
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/writing-menu/index.js +49 -1
  13. package/build/components/header/writing-menu/index.js.map +1 -1
  14. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
  15. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  16. package/build/components/keyboard-shortcuts/index.js +41 -2
  17. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  18. package/build/components/layout/index.js +9 -8
  19. package/build/components/layout/index.js.map +1 -1
  20. package/build/components/preferences-modal/index.js +27 -8
  21. package/build/components/preferences-modal/index.js.map +1 -1
  22. package/build/components/preferences-modal/options/enable-feature.js +6 -2
  23. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  24. package/build/components/secondary-sidebar/list-view-outline.js +119 -0
  25. package/build/components/secondary-sidebar/list-view-outline.js.map +1 -0
  26. package/build/components/secondary-sidebar/list-view-sidebar.js +36 -11
  27. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  28. package/build/components/visual-editor/index.js +4 -1
  29. package/build/components/visual-editor/index.js.map +1 -1
  30. package/build/editor.js +5 -5
  31. package/build/editor.js.map +1 -1
  32. package/build/editor.native.js +1 -1
  33. package/build/editor.native.js.map +1 -1
  34. package/build/store/actions.js +23 -34
  35. package/build/store/actions.js.map +1 -1
  36. package/build/store/reducer.js +30 -9
  37. package/build/store/reducer.js.map +1 -1
  38. package/build-module/components/block-manager/category.js +3 -3
  39. package/build-module/components/block-manager/category.js.map +1 -1
  40. package/build-module/components/block-manager/index.js +2 -2
  41. package/build-module/components/block-manager/index.js.map +1 -1
  42. package/build-module/components/device-preview/index.js +3 -0
  43. package/build-module/components/device-preview/index.js.map +1 -1
  44. package/build-module/components/header/header-toolbar/index.js +1 -7
  45. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  46. package/build-module/components/header/index.js +51 -8
  47. package/build-module/components/header/index.js.map +1 -1
  48. package/build-module/components/header/writing-menu/index.js +47 -2
  49. package/build-module/components/header/writing-menu/index.js.map +1 -1
  50. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  51. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  52. package/build-module/components/keyboard-shortcuts/index.js +39 -2
  53. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  54. package/build-module/components/layout/index.js +10 -9
  55. package/build-module/components/layout/index.js.map +1 -1
  56. package/build-module/components/preferences-modal/index.js +26 -8
  57. package/build-module/components/preferences-modal/index.js.map +1 -1
  58. package/build-module/components/preferences-modal/options/enable-feature.js +6 -2
  59. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  60. package/build-module/components/secondary-sidebar/list-view-outline.js +108 -0
  61. package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -0
  62. package/build-module/components/secondary-sidebar/list-view-sidebar.js +34 -12
  63. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  64. package/build-module/components/visual-editor/index.js +3 -1
  65. package/build-module/components/visual-editor/index.js.map +1 -1
  66. package/build-module/editor.js +6 -6
  67. package/build-module/editor.js.map +1 -1
  68. package/build-module/editor.native.js +2 -2
  69. package/build-module/editor.native.js.map +1 -1
  70. package/build-module/store/actions.js +22 -32
  71. package/build-module/store/actions.js.map +1 -1
  72. package/build-module/store/reducer.js +31 -8
  73. package/build-module/store/reducer.js.map +1 -1
  74. package/build-style/style-rtl.css +92 -6
  75. package/build-style/style.css +92 -6
  76. package/package.json +27 -27
  77. package/src/components/block-manager/category.js +4 -5
  78. package/src/components/block-manager/index.js +2 -2
  79. package/src/components/device-preview/index.js +2 -0
  80. package/src/components/editor-initialization/test/listener-hooks.js +47 -49
  81. package/src/components/header/fullscreen-mode-close/test/__snapshots__/index.js.snap +26 -0
  82. package/src/components/header/fullscreen-mode-close/test/index.js +10 -12
  83. package/src/components/header/header-toolbar/index.js +0 -8
  84. package/src/components/header/index.js +33 -11
  85. package/src/components/header/style.scss +43 -0
  86. package/src/components/header/writing-menu/index.js +53 -2
  87. package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
  88. package/src/components/keyboard-shortcuts/index.js +46 -2
  89. package/src/components/layout/index.js +10 -7
  90. package/src/components/layout/style.scss +7 -0
  91. package/src/components/preferences-modal/index.js +35 -19
  92. package/src/components/preferences-modal/options/enable-feature.js +5 -2
  93. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +128 -132
  94. package/src/components/preferences-modal/options/test/enable-custom-fields.js +35 -30
  95. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -9
  96. package/src/components/preferences-modal/test/index.js +3 -3
  97. package/src/components/secondary-sidebar/list-view-outline.js +98 -0
  98. package/src/components/secondary-sidebar/list-view-sidebar.js +47 -8
  99. package/src/components/secondary-sidebar/style.scss +64 -8
  100. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +6 -4
  101. package/src/components/sidebar/plugin-post-status-info/test/index.js +4 -4
  102. package/src/components/visual-editor/index.js +9 -3
  103. package/src/editor.js +7 -8
  104. package/src/editor.native.js +3 -4
  105. package/src/store/actions.js +17 -23
  106. package/src/store/reducer.js +29 -9
  107. package/src/store/test/reducer.js +32 -2
@@ -733,6 +733,34 @@ body.is-fullscreen-mode .interface-interface-skeleton {
733
733
  margin-left: 8px;
734
734
  }
735
735
 
736
+ .is-distraction-free .interface-interface-skeleton__header {
737
+ border-bottom: none;
738
+ }
739
+ .is-distraction-free .edit-post-header {
740
+ -webkit-backdrop-filter: blur(20px) !important;
741
+ backdrop-filter: blur(20px) !important;
742
+ background-color: rgba(255, 255, 255, 0.9);
743
+ border-bottom: 1px solid #e0e0e0;
744
+ position: absolute;
745
+ width: 100%;
746
+ }
747
+ .is-distraction-free .edit-post-header > .edit-post-header__settings > .editor-post-preview {
748
+ visibility: hidden;
749
+ }
750
+ .is-distraction-free .edit-post-header > .edit-post-header__toolbar .edit-post-header-toolbar__inserter-toggle, .is-distraction-free .edit-post-header > .edit-post-header__toolbar .edit-post-header-toolbar__list-view-toggle, .is-distraction-free .edit-post-header > .edit-post-header__settings > .block-editor-post-preview__dropdown, .is-distraction-free .edit-post-header > .edit-post-header__settings > .interface-pinned-items {
751
+ display: none;
752
+ }
753
+ .is-distraction-free .interface-interface-skeleton__header:focus-within {
754
+ opacity: 1 !important;
755
+ }
756
+ .is-distraction-free .interface-interface-skeleton__header:focus-within div {
757
+ transform: translateX(0) translateZ(0) !important;
758
+ }
759
+ .is-distraction-free .components-editor-notices__dismissible {
760
+ position: absolute;
761
+ z-index: 35;
762
+ }
763
+
736
764
  .edit-post-fullscreen-mode-close.components-button {
737
765
  display: none;
738
766
  }
@@ -1051,6 +1079,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1051
1079
  padding-left: 16px;
1052
1080
  }
1053
1081
 
1082
+ .is-distraction-free .components-editor-notices__snackbar {
1083
+ bottom: 20px;
1084
+ }
1085
+
1054
1086
  .edit-post-layout .components-editor-notices__snackbar {
1055
1087
  /* Set left position when auto-fold is not on the body element. */
1056
1088
  right: 0;
@@ -1341,7 +1373,10 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1341
1373
  }
1342
1374
 
1343
1375
  .edit-post-editor__list-view-panel {
1344
- min-width: 350px;
1376
+ width: 350px;
1377
+ }
1378
+ .edit-post-editor__list-view-panel .edit-post-sidebar__panel-tabs {
1379
+ flex-direction: row-reverse;
1345
1380
  }
1346
1381
 
1347
1382
  .edit-post-editor__inserter-panel-header {
@@ -1351,11 +1386,9 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1351
1386
  justify-content: flex-end;
1352
1387
  }
1353
1388
 
1354
- .edit-post-editor__inserter-panel-content,
1355
- .edit-post-editor__list-view-panel-content {
1389
+ .edit-post-editor__inserter-panel-content {
1356
1390
  height: calc(100% - 36px - 8px);
1357
1391
  }
1358
-
1359
1392
  @media (min-width: 782px) {
1360
1393
  .edit-post-editor__inserter-panel-content {
1361
1394
  height: 100%;
@@ -1363,7 +1396,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1363
1396
  }
1364
1397
 
1365
1398
  .edit-post-editor__list-view-panel-header {
1366
- align-items: center;
1367
1399
  border-bottom: 1px solid #ddd;
1368
1400
  display: flex;
1369
1401
  justify-content: space-between;
@@ -1371,12 +1403,66 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1371
1403
  padding-right: 16px;
1372
1404
  padding-left: 4px;
1373
1405
  }
1406
+ .edit-post-editor__list-view-panel-header ul {
1407
+ width: calc(100% - 40px);
1408
+ }
1409
+ .edit-post-editor__list-view-panel-header li {
1410
+ width: 50%;
1411
+ }
1412
+ .edit-post-editor__list-view-panel-header li button {
1413
+ width: 100%;
1414
+ text-align: initial;
1415
+ }
1416
+ .edit-post-editor__list-view-panel-header li:only-child {
1417
+ width: 100%;
1418
+ }
1374
1419
 
1375
- .edit-post-editor__list-view-panel-content {
1420
+ .edit-post-editor__list-view-panel-content,
1421
+ .edit-post-editor__list-view-container > .document-outline,
1422
+ .edit-post-editor__list-view-empty-headings {
1423
+ overflow-x: hidden;
1376
1424
  overflow-y: auto;
1425
+ height: 100%;
1377
1426
  padding: 8px 6px;
1378
1427
  }
1379
1428
 
1429
+ .edit-post-editor__list-view-empty-headings {
1430
+ text-align: center;
1431
+ color: #757575;
1432
+ }
1433
+ .edit-post-editor__list-view-empty-headings > svg {
1434
+ margin-top: 28px;
1435
+ }
1436
+ .edit-post-editor__list-view-empty-headings > p {
1437
+ padding-right: 32px;
1438
+ padding-left: 32px;
1439
+ }
1440
+
1441
+ .edit-post-editor__list-view-overview {
1442
+ border-top: 1px solid #ddd;
1443
+ width: calc(100% - 32px);
1444
+ padding: 16px;
1445
+ height: 72px;
1446
+ }
1447
+ .edit-post-editor__list-view-overview > div > span:first-child {
1448
+ width: 90px;
1449
+ display: inline-block;
1450
+ }
1451
+ .edit-post-editor__list-view-overview > div {
1452
+ padding: 0 0 8px;
1453
+ }
1454
+ .edit-post-editor__list-view-overview > div > span {
1455
+ font-size: 12px;
1456
+ line-height: 1.4;
1457
+ color: #757575;
1458
+ }
1459
+
1460
+ .edit-post-editor__list-view-container {
1461
+ display: flex;
1462
+ flex-direction: column;
1463
+ height: calc(100% - 48px);
1464
+ }
1465
+
1380
1466
  .components-panel__header.edit-post-sidebar__panel-tabs {
1381
1467
  justify-content: flex-start;
1382
1468
  padding-right: 0;
@@ -733,6 +733,34 @@ body.is-fullscreen-mode .interface-interface-skeleton {
733
733
  margin-right: 8px;
734
734
  }
735
735
 
736
+ .is-distraction-free .interface-interface-skeleton__header {
737
+ border-bottom: none;
738
+ }
739
+ .is-distraction-free .edit-post-header {
740
+ -webkit-backdrop-filter: blur(20px) !important;
741
+ backdrop-filter: blur(20px) !important;
742
+ background-color: rgba(255, 255, 255, 0.9);
743
+ border-bottom: 1px solid #e0e0e0;
744
+ position: absolute;
745
+ width: 100%;
746
+ }
747
+ .is-distraction-free .edit-post-header > .edit-post-header__settings > .editor-post-preview {
748
+ visibility: hidden;
749
+ }
750
+ .is-distraction-free .edit-post-header > .edit-post-header__toolbar .edit-post-header-toolbar__inserter-toggle, .is-distraction-free .edit-post-header > .edit-post-header__toolbar .edit-post-header-toolbar__list-view-toggle, .is-distraction-free .edit-post-header > .edit-post-header__settings > .block-editor-post-preview__dropdown, .is-distraction-free .edit-post-header > .edit-post-header__settings > .interface-pinned-items {
751
+ display: none;
752
+ }
753
+ .is-distraction-free .interface-interface-skeleton__header:focus-within {
754
+ opacity: 1 !important;
755
+ }
756
+ .is-distraction-free .interface-interface-skeleton__header:focus-within div {
757
+ transform: translateX(0) translateZ(0) !important;
758
+ }
759
+ .is-distraction-free .components-editor-notices__dismissible {
760
+ position: absolute;
761
+ z-index: 35;
762
+ }
763
+
736
764
  .edit-post-fullscreen-mode-close.components-button {
737
765
  display: none;
738
766
  }
@@ -1051,6 +1079,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1051
1079
  padding-right: 16px;
1052
1080
  }
1053
1081
 
1082
+ .is-distraction-free .components-editor-notices__snackbar {
1083
+ bottom: 20px;
1084
+ }
1085
+
1054
1086
  .edit-post-layout .components-editor-notices__snackbar {
1055
1087
  /* Set left position when auto-fold is not on the body element. */
1056
1088
  left: 0;
@@ -1341,7 +1373,10 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1341
1373
  }
1342
1374
 
1343
1375
  .edit-post-editor__list-view-panel {
1344
- min-width: 350px;
1376
+ width: 350px;
1377
+ }
1378
+ .edit-post-editor__list-view-panel .edit-post-sidebar__panel-tabs {
1379
+ flex-direction: row-reverse;
1345
1380
  }
1346
1381
 
1347
1382
  .edit-post-editor__inserter-panel-header {
@@ -1351,11 +1386,9 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1351
1386
  justify-content: flex-end;
1352
1387
  }
1353
1388
 
1354
- .edit-post-editor__inserter-panel-content,
1355
- .edit-post-editor__list-view-panel-content {
1389
+ .edit-post-editor__inserter-panel-content {
1356
1390
  height: calc(100% - 36px - 8px);
1357
1391
  }
1358
-
1359
1392
  @media (min-width: 782px) {
1360
1393
  .edit-post-editor__inserter-panel-content {
1361
1394
  height: 100%;
@@ -1363,7 +1396,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1363
1396
  }
1364
1397
 
1365
1398
  .edit-post-editor__list-view-panel-header {
1366
- align-items: center;
1367
1399
  border-bottom: 1px solid #ddd;
1368
1400
  display: flex;
1369
1401
  justify-content: space-between;
@@ -1371,12 +1403,66 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1371
1403
  padding-left: 16px;
1372
1404
  padding-right: 4px;
1373
1405
  }
1406
+ .edit-post-editor__list-view-panel-header ul {
1407
+ width: calc(100% - 40px);
1408
+ }
1409
+ .edit-post-editor__list-view-panel-header li {
1410
+ width: 50%;
1411
+ }
1412
+ .edit-post-editor__list-view-panel-header li button {
1413
+ width: 100%;
1414
+ text-align: initial;
1415
+ }
1416
+ .edit-post-editor__list-view-panel-header li:only-child {
1417
+ width: 100%;
1418
+ }
1374
1419
 
1375
- .edit-post-editor__list-view-panel-content {
1420
+ .edit-post-editor__list-view-panel-content,
1421
+ .edit-post-editor__list-view-container > .document-outline,
1422
+ .edit-post-editor__list-view-empty-headings {
1423
+ overflow-x: hidden;
1376
1424
  overflow-y: auto;
1425
+ height: 100%;
1377
1426
  padding: 8px 6px;
1378
1427
  }
1379
1428
 
1429
+ .edit-post-editor__list-view-empty-headings {
1430
+ text-align: center;
1431
+ color: #757575;
1432
+ }
1433
+ .edit-post-editor__list-view-empty-headings > svg {
1434
+ margin-top: 28px;
1435
+ }
1436
+ .edit-post-editor__list-view-empty-headings > p {
1437
+ padding-left: 32px;
1438
+ padding-right: 32px;
1439
+ }
1440
+
1441
+ .edit-post-editor__list-view-overview {
1442
+ border-top: 1px solid #ddd;
1443
+ width: calc(100% - 32px);
1444
+ padding: 16px;
1445
+ height: 72px;
1446
+ }
1447
+ .edit-post-editor__list-view-overview > div > span:first-child {
1448
+ width: 90px;
1449
+ display: inline-block;
1450
+ }
1451
+ .edit-post-editor__list-view-overview > div {
1452
+ padding: 0 0 8px;
1453
+ }
1454
+ .edit-post-editor__list-view-overview > div > span {
1455
+ font-size: 12px;
1456
+ line-height: 1.4;
1457
+ color: #757575;
1458
+ }
1459
+
1460
+ .edit-post-editor__list-view-container {
1461
+ display: flex;
1462
+ flex-direction: column;
1463
+ height: calc(100% - 48px);
1464
+ }
1465
+
1380
1466
  .components-panel__header.edit-post-sidebar__panel-tabs {
1381
1467
  justify-content: flex-start;
1382
1468
  padding-left: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "6.16.0",
3
+ "version": "6.18.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,31 +27,31 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.19.0",
31
- "@wordpress/api-fetch": "^6.16.0",
32
- "@wordpress/block-editor": "^10.2.0",
33
- "@wordpress/block-library": "^7.16.0",
34
- "@wordpress/blocks": "^11.18.0",
35
- "@wordpress/components": "^21.2.0",
36
- "@wordpress/compose": "^5.17.0",
37
- "@wordpress/core-data": "^5.2.0",
38
- "@wordpress/data": "^7.3.0",
39
- "@wordpress/deprecated": "^3.19.0",
40
- "@wordpress/editor": "^12.18.0",
41
- "@wordpress/element": "^4.17.0",
42
- "@wordpress/hooks": "^3.19.0",
43
- "@wordpress/i18n": "^4.19.0",
44
- "@wordpress/icons": "^9.10.0",
45
- "@wordpress/interface": "^4.18.0",
46
- "@wordpress/keyboard-shortcuts": "^3.17.0",
47
- "@wordpress/keycodes": "^3.19.0",
48
- "@wordpress/media-utils": "^4.10.0",
49
- "@wordpress/notices": "^3.19.0",
50
- "@wordpress/plugins": "^4.17.0",
51
- "@wordpress/preferences": "^2.11.0",
52
- "@wordpress/url": "^3.20.0",
53
- "@wordpress/viewport": "^4.17.0",
54
- "@wordpress/warning": "^2.19.0",
30
+ "@wordpress/a11y": "^3.21.0",
31
+ "@wordpress/api-fetch": "^6.18.0",
32
+ "@wordpress/block-editor": "^10.4.0",
33
+ "@wordpress/block-library": "^7.18.0",
34
+ "@wordpress/blocks": "^11.20.0",
35
+ "@wordpress/components": "^22.0.0",
36
+ "@wordpress/compose": "^5.19.0",
37
+ "@wordpress/core-data": "^5.4.0",
38
+ "@wordpress/data": "^7.5.0",
39
+ "@wordpress/deprecated": "^3.21.0",
40
+ "@wordpress/editor": "^12.20.0",
41
+ "@wordpress/element": "^4.19.0",
42
+ "@wordpress/hooks": "^3.21.0",
43
+ "@wordpress/i18n": "^4.21.0",
44
+ "@wordpress/icons": "^9.12.0",
45
+ "@wordpress/interface": "^4.20.0",
46
+ "@wordpress/keyboard-shortcuts": "^3.19.0",
47
+ "@wordpress/keycodes": "^3.21.0",
48
+ "@wordpress/media-utils": "^4.12.0",
49
+ "@wordpress/notices": "^3.21.0",
50
+ "@wordpress/plugins": "^4.19.0",
51
+ "@wordpress/preferences": "^2.13.0",
52
+ "@wordpress/url": "^3.22.0",
53
+ "@wordpress/viewport": "^4.19.0",
54
+ "@wordpress/warning": "^2.21.0",
55
55
  "classnames": "^2.3.1",
56
56
  "lodash": "^4.17.21",
57
57
  "memize": "^1.1.0",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "8d42d2febb7d0ba8372a33e560a62f5a5f6a9112"
67
+ "gitHead": "511f4cc1f0138641bc4394bc1cf36e833109c791"
68
68
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { includes, map, without } from 'lodash';
4
+ import { map } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -37,7 +37,7 @@ function BlockManagerCategory( { title, blockTypes } ) {
37
37
  return blockTypes;
38
38
  }
39
39
  return blockTypes.filter( ( { name } ) => {
40
- return includes( defaultAllowedBlockTypes || [], name );
40
+ return defaultAllowedBlockTypes?.includes( name );
41
41
  } );
42
42
  }, [ defaultAllowedBlockTypes, blockTypes ] );
43
43
  const { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );
@@ -64,9 +64,8 @@ function BlockManagerCategory( { title, blockTypes } ) {
64
64
  return null;
65
65
  }
66
66
 
67
- const checkedBlockNames = without(
68
- map( filteredBlockTypes, 'name' ),
69
- ...hiddenBlockTypes
67
+ const checkedBlockNames = map( filteredBlockTypes, 'name' ).filter(
68
+ ( type ) => ! hiddenBlockTypes.includes( type )
70
69
  );
71
70
 
72
71
  const titleId = 'edit-post-block-manager__category-title-' + instanceId;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { filter, includes } from 'lodash';
4
+ import { filter } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -38,7 +38,7 @@ function BlockManager( {
38
38
  hasBlockSupport( blockType, 'inserter', true ) &&
39
39
  ( ! search || isMatchingSearchTerm( blockType, search ) ) &&
40
40
  ( ! blockType.parent ||
41
- includes( blockType.parent, 'core/post-content' ) )
41
+ blockType.parent.includes( 'core/post-content' ) )
42
42
  );
43
43
 
44
44
  // Announce search results on change
@@ -49,6 +49,8 @@ export default function DevicePreview() {
49
49
  className="edit-post-post-preview-dropdown"
50
50
  deviceType={ deviceType }
51
51
  setDeviceType={ setPreviewDeviceType }
52
+ /* translators: button label text should, if possible, be under 16 characters. */
53
+ viewLabel={ __( 'Preview' ) }
52
54
  >
53
55
  { isViewable && (
54
56
  <MenuGroup>
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import TestRenderer, { act } from 'react-test-renderer';
4
+ import { render, act } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -62,11 +62,6 @@ describe( 'listener hook tests', () => {
62
62
  },
63
63
  };
64
64
 
65
- let registry;
66
- beforeEach( () => {
67
- registry = createRegistry( mockStores );
68
- } );
69
-
70
65
  const setMockReturnValue = ( store, functionName, value ) => {
71
66
  mockStores[ store ].selectors[ functionName ].mockReturnValue( value );
72
67
  };
@@ -74,20 +69,7 @@ describe( 'listener hook tests', () => {
74
69
  mockStores[ store ].selectors[ functionName ];
75
70
  const getSpyedAction = ( store, actionName ) =>
76
71
  mockStores[ store ].actions[ actionName ];
77
- const renderComponent = ( testedHook, id, renderer = null ) => {
78
- const TestComponent = ( { postId } ) => {
79
- testedHook( postId );
80
- return null;
81
- };
82
- const TestedOutput = (
83
- <RegistryProvider value={ registry }>
84
- <TestComponent postId={ id } />
85
- </RegistryProvider>
86
- );
87
- return renderer === null
88
- ? TestRenderer.create( TestedOutput )
89
- : renderer.update( TestedOutput );
90
- };
72
+
91
73
  afterEach( () => {
92
74
  Object.values( mockStores ).forEach( ( storeMocks ) => {
93
75
  Object.values( storeMocks.selectors ).forEach( ( mock ) => {
@@ -99,17 +81,29 @@ describe( 'listener hook tests', () => {
99
81
  } );
100
82
  } );
101
83
  describe( 'useBlockSelectionListener', () => {
84
+ const registry = createRegistry( mockStores );
85
+ const TestComponent = ( { postId } ) => {
86
+ useBlockSelectionListener( postId );
87
+ return null;
88
+ };
89
+ const TestedOutput = () => {
90
+ return (
91
+ <RegistryProvider value={ registry }>
92
+ <TestComponent postId={ 10 } />
93
+ </RegistryProvider>
94
+ );
95
+ };
96
+
102
97
  it( 'does nothing when editor sidebar is not open', () => {
103
98
  setMockReturnValue( STORE_NAME, 'isEditorSidebarOpened', false );
104
- act( () => {
105
- renderComponent( useBlockSelectionListener, 10 );
106
- } );
99
+ render( <TestedOutput /> );
100
+
107
101
  expect(
108
102
  getSpyedFunction( STORE_NAME, 'isEditorSidebarOpened' )
109
103
  ).toHaveBeenCalled();
110
104
  expect(
111
105
  getSpyedAction( STORE_NAME, 'openGeneralSidebar' )
112
- ).toHaveBeenCalledTimes( 0 );
106
+ ).not.toHaveBeenCalled();
113
107
  } );
114
108
  it( 'opens block sidebar if block is selected', () => {
115
109
  setMockReturnValue( STORE_NAME, 'isEditorSidebarOpened', true );
@@ -118,9 +112,9 @@ describe( 'listener hook tests', () => {
118
112
  'getBlockSelectionStart',
119
113
  true
120
114
  );
121
- act( () => {
122
- renderComponent( useBlockSelectionListener, 10 );
123
- } );
115
+
116
+ render( <TestedOutput /> );
117
+
124
118
  expect(
125
119
  getSpyedAction( STORE_NAME, 'openGeneralSidebar' )
126
120
  ).toHaveBeenCalledWith( 'edit-post/block' );
@@ -132,9 +126,9 @@ describe( 'listener hook tests', () => {
132
126
  'getBlockSelectionStart',
133
127
  false
134
128
  );
135
- act( () => {
136
- renderComponent( useBlockSelectionListener, 10 );
137
- } );
129
+
130
+ render( <TestedOutput /> );
131
+
138
132
  expect(
139
133
  getSpyedAction( STORE_NAME, 'openGeneralSidebar' )
140
134
  ).toHaveBeenCalledWith( 'edit-post/document' );
@@ -142,6 +136,19 @@ describe( 'listener hook tests', () => {
142
136
  } );
143
137
 
144
138
  describe( 'useUpdatePostLinkListener', () => {
139
+ const registry = createRegistry( mockStores );
140
+ const TestComponent = ( { postId } ) => {
141
+ useUpdatePostLinkListener( postId );
142
+ return null;
143
+ };
144
+ const TestedOutput = ( { postId = 10 } ) => {
145
+ return (
146
+ <RegistryProvider value={ registry }>
147
+ <TestComponent postId={ postId } />
148
+ </RegistryProvider>
149
+ );
150
+ };
151
+
145
152
  const setAttribute = jest.fn();
146
153
  const mockSelector = jest.fn();
147
154
  beforeEach( () => {
@@ -158,29 +165,24 @@ describe( 'listener hook tests', () => {
158
165
  setMockReturnValue( 'core/editor', 'getCurrentPost', {
159
166
  link: 'foo',
160
167
  } );
161
- act( () => {
162
- renderComponent( useUpdatePostLinkListener, 10 );
163
- } );
168
+ render( <TestedOutput /> );
169
+
164
170
  expect( setAttribute ).not.toHaveBeenCalled();
165
171
  } );
166
172
  it( 'updates nothing if there is no permalink', () => {
167
173
  setMockReturnValue( 'core/editor', 'getCurrentPost', { link: '' } );
168
- act( () => {
169
- renderComponent( useUpdatePostLinkListener, 10 );
170
- } );
174
+ render( <TestedOutput /> );
175
+
171
176
  expect( setAttribute ).not.toHaveBeenCalled();
172
177
  } );
173
178
  it( 'only calls document query selector once across renders', () => {
174
179
  setMockReturnValue( 'core/editor', 'getCurrentPost', {
175
180
  link: 'foo',
176
181
  } );
177
- act( () => {
178
- const renderer = renderComponent(
179
- useUpdatePostLinkListener,
180
- 10
181
- );
182
- renderComponent( useUpdatePostLinkListener, 20, renderer );
183
- } );
182
+ const { rerender } = render( <TestedOutput /> );
183
+
184
+ rerender( <TestedOutput id={ 20 } /> );
185
+
184
186
  expect( mockSelector ).toHaveBeenCalledTimes( 1 );
185
187
  act( () => {
186
188
  registry.dispatch( 'core/editor' ).forceUpdate();
@@ -191,9 +193,7 @@ describe( 'listener hook tests', () => {
191
193
  setMockReturnValue( 'core/editor', 'getCurrentPost', {
192
194
  link: 'foo',
193
195
  } );
194
- act( () => {
195
- renderComponent( useUpdatePostLinkListener, 10 );
196
- } );
196
+ render( <TestedOutput /> );
197
197
  expect( setAttribute ).toHaveBeenCalledTimes( 1 );
198
198
  act( () => {
199
199
  registry.dispatch( 'core/editor' ).forceUpdate();
@@ -204,9 +204,7 @@ describe( 'listener hook tests', () => {
204
204
  setMockReturnValue( 'core/editor', 'getCurrentPost', {
205
205
  link: 'foo',
206
206
  } );
207
- act( () => {
208
- renderComponent( useUpdatePostLinkListener, 10 );
209
- } );
207
+ render( <TestedOutput /> );
210
208
  expect( setAttribute ).toHaveBeenCalledTimes( 1 );
211
209
  expect( setAttribute ).toHaveBeenCalledWith( 'href', 'foo' );
212
210
 
@@ -0,0 +1,26 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`FullscreenModeClose when in full screen mode should display a default site icon if no user uploaded site icon exists 1`] = `
4
+ <div>
5
+ <div>
6
+ <a
7
+ aria-label="Back"
8
+ class="components-button edit-post-fullscreen-mode-close"
9
+ href="edit.php?"
10
+ >
11
+ <svg
12
+ aria-hidden="true"
13
+ focusable="false"
14
+ height="36px"
15
+ viewBox="-2 -2 24 24"
16
+ width="36px"
17
+ xmlns="http://www.w3.org/2000/svg"
18
+ >
19
+ <path
20
+ d="M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
21
+ />
22
+ </svg>
23
+ </a>
24
+ </div>
25
+ </div>
26
+ `;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render } from '@testing-library/react';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -36,12 +36,11 @@ describe( 'FullscreenModeClose', () => {
36
36
  } ) );
37
37
  } );
38
38
 
39
- const { container } = render( <FullscreenModeClose /> );
40
- const siteIcon = container.querySelector(
41
- '.edit-post-fullscreen-mode-close_site-icon'
42
- );
39
+ render( <FullscreenModeClose /> );
40
+
41
+ const siteIcon = screen.getByAltText( 'Site Icon' );
43
42
 
44
- expect( siteIcon ).toBeTruthy();
43
+ expect( siteIcon ).toBeVisible();
45
44
  } );
46
45
 
47
46
  it( 'should display a default site icon if no user uploaded site icon exists', () => {
@@ -58,13 +57,12 @@ describe( 'FullscreenModeClose', () => {
58
57
  } );
59
58
 
60
59
  const { container } = render( <FullscreenModeClose /> );
61
- const siteIcon = container.querySelector(
62
- '.edit-post-fullscreen-mode-close_site-icon'
63
- );
64
- const defaultIcon = container.querySelector( 'svg' );
65
60
 
66
- expect( siteIcon ).toBeFalsy();
67
- expect( defaultIcon ).toBeTruthy();
61
+ expect(
62
+ screen.queryByAltText( 'Site Icon' )
63
+ ).not.toBeInTheDocument();
64
+
65
+ expect( container ).toMatchSnapshot();
68
66
  } );
69
67
  } );
70
68
  } );