@wordpress/edit-site 5.3.5 → 5.3.6

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 (125) hide show
  1. package/build/components/add-new-template/add-custom-template-modal.js +12 -3
  2. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  3. package/build/components/add-new-template/new-template-part.js +5 -1
  4. package/build/components/add-new-template/new-template-part.js.map +1 -1
  5. package/build/components/editor/index.js +3 -3
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/global-styles/screen-variations.js +1 -1
  8. package/build/components/global-styles/screen-variations.js.map +1 -1
  9. package/build/components/global-styles/shadow-panel.js +6 -4
  10. package/build/components/global-styles/shadow-panel.js.map +1 -1
  11. package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
  12. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  13. package/build/components/keyboard-shortcuts/global.js +48 -0
  14. package/build/components/keyboard-shortcuts/global.js.map +1 -0
  15. package/build/components/keyboard-shortcuts/register.js +153 -0
  16. package/build/components/keyboard-shortcuts/register.js.map +1 -0
  17. package/build/components/layout/index.js +5 -1
  18. package/build/components/layout/index.js.map +1 -1
  19. package/build/components/list/added-by.js +41 -42
  20. package/build/components/list/added-by.js.map +1 -1
  21. package/build/components/list/table.js +3 -1
  22. package/build/components/list/table.js.map +1 -1
  23. package/build/components/save-button/index.js +5 -2
  24. package/build/components/save-button/index.js.map +1 -1
  25. package/build/components/sidebar/index.js +15 -3
  26. package/build/components/sidebar/index.js.map +1 -1
  27. package/build/components/sidebar-button/index.js +30 -0
  28. package/build/components/sidebar-button/index.js.map +1 -0
  29. package/build/components/sidebar-navigation-screen/index.js +6 -3
  30. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  31. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -4
  32. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  33. package/build/components/sidebar-navigation-screen-template/index.js +8 -5
  34. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen-templates/index.js +17 -3
  36. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  37. package/build/components/style-book/index.js +17 -2
  38. package/build/components/style-book/index.js.map +1 -1
  39. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -7
  40. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  41. package/build/components/sync-state-with-url/use-sync-path-with-url.js +23 -25
  42. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  43. package/build/components/template-details/index.js +7 -9
  44. package/build/components/template-details/index.js.map +1 -1
  45. package/build/index.js +10 -22
  46. package/build/index.js.map +1 -1
  47. package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
  48. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  49. package/build-module/components/add-new-template/new-template-part.js +5 -1
  50. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  51. package/build-module/components/editor/index.js +3 -3
  52. package/build-module/components/editor/index.js.map +1 -1
  53. package/build-module/components/global-styles/screen-variations.js +1 -1
  54. package/build-module/components/global-styles/screen-variations.js.map +1 -1
  55. package/build-module/components/global-styles/shadow-panel.js +6 -4
  56. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  57. package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
  58. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  59. package/build-module/components/keyboard-shortcuts/global.js +37 -0
  60. package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
  61. package/build-module/components/keyboard-shortcuts/register.js +141 -0
  62. package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
  63. package/build-module/components/layout/index.js +3 -1
  64. package/build-module/components/layout/index.js.map +1 -1
  65. package/build-module/components/list/added-by.js +43 -44
  66. package/build-module/components/list/added-by.js.map +1 -1
  67. package/build-module/components/list/table.js +3 -1
  68. package/build-module/components/list/table.js.map +1 -1
  69. package/build-module/components/save-button/index.js +5 -2
  70. package/build-module/components/save-button/index.js.map +1 -1
  71. package/build-module/components/sidebar/index.js +11 -4
  72. package/build-module/components/sidebar/index.js.map +1 -1
  73. package/build-module/components/sidebar-button/index.js +18 -0
  74. package/build-module/components/sidebar-button/index.js.map +1 -0
  75. package/build-module/components/sidebar-navigation-screen/index.js +4 -4
  76. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  77. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +8 -5
  78. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  79. package/build-module/components/sidebar-navigation-screen-template/index.js +7 -5
  80. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  81. package/build-module/components/sidebar-navigation-screen-templates/index.js +14 -3
  82. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  83. package/build-module/components/style-book/index.js +17 -3
  84. package/build-module/components/style-book/index.js.map +1 -1
  85. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -7
  86. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  87. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +21 -25
  88. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  89. package/build-module/components/template-details/index.js +7 -8
  90. package/build-module/components/template-details/index.js.map +1 -1
  91. package/build-module/index.js +12 -22
  92. package/build-module/index.js.map +1 -1
  93. package/build-style/style-rtl.css +23 -30
  94. package/build-style/style.css +23 -30
  95. package/package.json +10 -10
  96. package/src/components/add-new-template/add-custom-template-modal.js +14 -10
  97. package/src/components/add-new-template/new-template-part.js +4 -3
  98. package/src/components/add-new-template/style.scss +0 -5
  99. package/src/components/block-editor/style.scss +1 -1
  100. package/src/components/editor/index.js +4 -3
  101. package/src/components/global-styles/screen-variations.js +0 -1
  102. package/src/components/global-styles/shadow-panel.js +4 -3
  103. package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
  104. package/src/components/keyboard-shortcuts/global.js +35 -0
  105. package/src/components/keyboard-shortcuts/register.js +157 -0
  106. package/src/components/layout/index.js +4 -0
  107. package/src/components/list/added-by.js +48 -55
  108. package/src/components/list/style.scss +5 -13
  109. package/src/components/list/table.js +4 -1
  110. package/src/components/save-button/index.js +2 -2
  111. package/src/components/sidebar/index.js +10 -4
  112. package/src/components/sidebar-button/index.js +21 -0
  113. package/src/components/sidebar-button/style.scss +23 -0
  114. package/src/components/sidebar-navigation-screen/index.js +3 -4
  115. package/src/components/sidebar-navigation-screen/style.scss +1 -10
  116. package/src/components/sidebar-navigation-screen-navigation-item/index.js +7 -9
  117. package/src/components/sidebar-navigation-screen-template/index.js +6 -6
  118. package/src/components/sidebar-navigation-screen-templates/index.js +16 -4
  119. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
  120. package/src/components/style-book/index.js +25 -1
  121. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -9
  122. package/src/components/sync-state-with-url/use-sync-path-with-url.js +24 -30
  123. package/src/components/template-details/index.js +5 -6
  124. package/src/index.js +6 -21
  125. package/src/style.scss +1 -0
@@ -618,9 +618,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
618
618
  }
619
619
  }
620
620
 
621
- .edit-site-custom-template-modal__suggestions_list {
622
- margin-top: 16px;
623
- }
624
621
  @media (min-width: 600px) {
625
622
  .edit-site-custom-template-modal__suggestions_list {
626
623
  height: 232px;
@@ -671,8 +668,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
671
668
  border: 1px solid #ccc;
672
669
  border-radius: 2px;
673
670
  padding: 16px;
674
- margin-bottom: 0;
675
- margin-top: 16px;
676
671
  }
677
672
 
678
673
  @media (min-width: 782px) {
@@ -719,7 +714,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
719
714
  height: 100%;
720
715
  display: block;
721
716
  overflow: hidden;
722
- background-color: #2f2f2f;
717
+ background-color: #1e1e1e;
723
718
  align-items: center;
724
719
  /*
725
720
  Temporary to hide the contextual toolbar in view mode.
@@ -1530,7 +1525,6 @@ body.is-fullscreen-mode .edit-site-list-header {
1530
1525
  .edit-site-list-added-by__icon {
1531
1526
  display: flex;
1532
1527
  flex-shrink: 0;
1533
- position: relative;
1534
1528
  align-items: center;
1535
1529
  justify-content: center;
1536
1530
  width: 32px;
@@ -1541,17 +1535,6 @@ body.is-fullscreen-mode .edit-site-list-header {
1541
1535
  .edit-site-list-added-by__icon svg {
1542
1536
  fill: #fff;
1543
1537
  }
1544
- .edit-site-list-added-by__icon.is-customized::after {
1545
- position: absolute;
1546
- content: "";
1547
- background: var(--wp-admin-theme-color);
1548
- height: 8px;
1549
- width: 8px;
1550
- outline: 2px solid #fff;
1551
- border-radius: 100%;
1552
- top: -1px;
1553
- left: -1px;
1554
- }
1555
1538
 
1556
1539
  .edit-site-list-added-by__avatar {
1557
1540
  flex-shrink: 0;
@@ -1579,6 +1562,11 @@ body.is-fullscreen-mode .edit-site-list-header {
1579
1562
  opacity: 1;
1580
1563
  }
1581
1564
 
1565
+ .edit-site-list-added-by__customized-info {
1566
+ display: block;
1567
+ color: #757575;
1568
+ }
1569
+
1582
1570
  @keyframes loadingpulse {
1583
1571
  0% {
1584
1572
  opacity: 1;
@@ -2390,6 +2378,22 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2390
2378
  padding: 0 12px;
2391
2379
  }
2392
2380
 
2381
+ .edit-site-sidebar-button {
2382
+ color: #e0e0e0;
2383
+ flex-shrink: 0;
2384
+ }
2385
+ .edit-site-sidebar-button:focus:not(:disabled) {
2386
+ box-shadow: none;
2387
+ outline: none;
2388
+ }
2389
+ .edit-site-sidebar-button:focus-visible:not(:disabled) {
2390
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
2391
+ outline: 3px solid transparent;
2392
+ }
2393
+ .edit-site-sidebar-button:hover, .edit-site-sidebar-button:focus-visible, .edit-site-sidebar-button:focus, .edit-site-sidebar-button:not([aria-disabled=true]):active {
2394
+ color: #fff;
2395
+ }
2396
+
2393
2397
  .edit-site-sidebar-navigation-item.components-item {
2394
2398
  color: #949494;
2395
2399
  border-width: 1.5px;
@@ -2448,29 +2452,18 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2448
2452
 
2449
2453
  .edit-site-sidebar-navigation-screen__title {
2450
2454
  font-size: calc(1.56 * 13px);
2455
+ line-height: normal;
2451
2456
  font-weight: 500;
2452
2457
  flex-grow: 1;
2453
2458
  color: #fff;
2454
2459
  margin: 0;
2455
2460
  }
2456
2461
 
2457
- .edit-site-sidebar-navigation-screen__back {
2458
- color: #e0e0e0;
2459
- }
2460
- .edit-site-sidebar-navigation-screen__back:hover, .edit-site-sidebar-navigation-screen__back:focus, .edit-site-sidebar-navigation-screen__back:not([aria-disabled=true]):active {
2461
- color: #fff;
2462
- }
2463
-
2464
2462
  .edit-site-sidebar-navigation-screen-templates__see-all {
2465
2463
  /* Overrides the margin that comes from the Item component */
2466
2464
  margin-top: 16px !important;
2467
2465
  }
2468
2466
 
2469
- .edit-site-sidebar-navigation-screen-templates__add-button {
2470
- /* Overrides the color for all states of the button */
2471
- color: inherit !important;
2472
- }
2473
-
2474
2467
  .edit-site-site-hub {
2475
2468
  display: flex;
2476
2469
  align-items: center;
@@ -618,9 +618,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
618
618
  }
619
619
  }
620
620
 
621
- .edit-site-custom-template-modal__suggestions_list {
622
- margin-top: 16px;
623
- }
624
621
  @media (min-width: 600px) {
625
622
  .edit-site-custom-template-modal__suggestions_list {
626
623
  height: 232px;
@@ -671,8 +668,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
671
668
  border: 1px solid #ccc;
672
669
  border-radius: 2px;
673
670
  padding: 16px;
674
- margin-bottom: 0;
675
- margin-top: 16px;
676
671
  }
677
672
 
678
673
  @media (min-width: 782px) {
@@ -719,7 +714,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
719
714
  height: 100%;
720
715
  display: block;
721
716
  overflow: hidden;
722
- background-color: #2f2f2f;
717
+ background-color: #1e1e1e;
723
718
  align-items: center;
724
719
  /*
725
720
  Temporary to hide the contextual toolbar in view mode.
@@ -1530,7 +1525,6 @@ body.is-fullscreen-mode .edit-site-list-header {
1530
1525
  .edit-site-list-added-by__icon {
1531
1526
  display: flex;
1532
1527
  flex-shrink: 0;
1533
- position: relative;
1534
1528
  align-items: center;
1535
1529
  justify-content: center;
1536
1530
  width: 32px;
@@ -1541,17 +1535,6 @@ body.is-fullscreen-mode .edit-site-list-header {
1541
1535
  .edit-site-list-added-by__icon svg {
1542
1536
  fill: #fff;
1543
1537
  }
1544
- .edit-site-list-added-by__icon.is-customized::after {
1545
- position: absolute;
1546
- content: "";
1547
- background: var(--wp-admin-theme-color);
1548
- height: 8px;
1549
- width: 8px;
1550
- outline: 2px solid #fff;
1551
- border-radius: 100%;
1552
- top: -1px;
1553
- right: -1px;
1554
- }
1555
1538
 
1556
1539
  .edit-site-list-added-by__avatar {
1557
1540
  flex-shrink: 0;
@@ -1579,6 +1562,11 @@ body.is-fullscreen-mode .edit-site-list-header {
1579
1562
  opacity: 1;
1580
1563
  }
1581
1564
 
1565
+ .edit-site-list-added-by__customized-info {
1566
+ display: block;
1567
+ color: #757575;
1568
+ }
1569
+
1582
1570
  @keyframes loadingpulse {
1583
1571
  0% {
1584
1572
  opacity: 1;
@@ -2390,6 +2378,22 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2390
2378
  padding: 0 12px;
2391
2379
  }
2392
2380
 
2381
+ .edit-site-sidebar-button {
2382
+ color: #e0e0e0;
2383
+ flex-shrink: 0;
2384
+ }
2385
+ .edit-site-sidebar-button:focus:not(:disabled) {
2386
+ box-shadow: none;
2387
+ outline: none;
2388
+ }
2389
+ .edit-site-sidebar-button:focus-visible:not(:disabled) {
2390
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
2391
+ outline: 3px solid transparent;
2392
+ }
2393
+ .edit-site-sidebar-button:hover, .edit-site-sidebar-button:focus-visible, .edit-site-sidebar-button:focus, .edit-site-sidebar-button:not([aria-disabled=true]):active {
2394
+ color: #fff;
2395
+ }
2396
+
2393
2397
  .edit-site-sidebar-navigation-item.components-item {
2394
2398
  color: #949494;
2395
2399
  border-width: 1.5px;
@@ -2448,29 +2452,18 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2448
2452
 
2449
2453
  .edit-site-sidebar-navigation-screen__title {
2450
2454
  font-size: calc(1.56 * 13px);
2455
+ line-height: normal;
2451
2456
  font-weight: 500;
2452
2457
  flex-grow: 1;
2453
2458
  color: #fff;
2454
2459
  margin: 0;
2455
2460
  }
2456
2461
 
2457
- .edit-site-sidebar-navigation-screen__back {
2458
- color: #e0e0e0;
2459
- }
2460
- .edit-site-sidebar-navigation-screen__back:hover, .edit-site-sidebar-navigation-screen__back:focus, .edit-site-sidebar-navigation-screen__back:not([aria-disabled=true]):active {
2461
- color: #fff;
2462
- }
2463
-
2464
2462
  .edit-site-sidebar-navigation-screen-templates__see-all {
2465
2463
  /* Overrides the margin that comes from the Item component */
2466
2464
  margin-top: 16px !important;
2467
2465
  }
2468
2466
 
2469
- .edit-site-sidebar-navigation-screen-templates__add-button {
2470
- /* Overrides the color for all states of the button */
2471
- color: inherit !important;
2472
- }
2473
-
2474
2467
  .edit-site-site-hub {
2475
2468
  display: flex;
2476
2469
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.3.5",
3
+ "version": "5.3.6",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,33 +29,33 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.26.1",
31
31
  "@wordpress/api-fetch": "^6.23.1",
32
- "@wordpress/block-editor": "^11.3.5",
33
- "@wordpress/block-library": "^8.3.5",
32
+ "@wordpress/block-editor": "^11.3.6",
33
+ "@wordpress/block-library": "^8.3.6",
34
34
  "@wordpress/blocks": "^12.3.3",
35
- "@wordpress/components": "^23.3.4",
35
+ "@wordpress/components": "^23.3.5",
36
36
  "@wordpress/compose": "^6.3.3",
37
37
  "@wordpress/core-data": "^6.3.3",
38
38
  "@wordpress/data": "^8.3.3",
39
39
  "@wordpress/deprecated": "^3.26.1",
40
- "@wordpress/editor": "^13.3.5",
40
+ "@wordpress/editor": "^13.3.6",
41
41
  "@wordpress/element": "^5.3.2",
42
42
  "@wordpress/hooks": "^3.26.1",
43
43
  "@wordpress/html-entities": "^3.26.1",
44
44
  "@wordpress/i18n": "^4.26.1",
45
45
  "@wordpress/icons": "^9.17.2",
46
- "@wordpress/interface": "^5.3.5",
46
+ "@wordpress/interface": "^5.3.6",
47
47
  "@wordpress/keyboard-shortcuts": "^4.3.3",
48
48
  "@wordpress/keycodes": "^3.26.2",
49
49
  "@wordpress/media-utils": "^4.17.2",
50
50
  "@wordpress/notices": "^3.26.3",
51
51
  "@wordpress/plugins": "^5.3.3",
52
- "@wordpress/preferences": "^3.3.4",
52
+ "@wordpress/preferences": "^3.3.5",
53
53
  "@wordpress/private-apis": "^0.8.1",
54
- "@wordpress/reusable-blocks": "^4.3.5",
54
+ "@wordpress/reusable-blocks": "^4.3.6",
55
55
  "@wordpress/style-engine": "^1.9.1",
56
56
  "@wordpress/url": "^3.27.1",
57
57
  "@wordpress/viewport": "^5.3.3",
58
- "@wordpress/widgets": "^3.3.5",
58
+ "@wordpress/widgets": "^3.3.6",
59
59
  "classnames": "^2.3.1",
60
60
  "colord": "^2.9.2",
61
61
  "downloadjs": "^1.4.7",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "1e2b2f680c6378f789d6660bc04b30e35e3a33a3"
76
+ "gitHead": "35f10c183655e9196d4ea12b8fa499a8ecbb7b6a"
77
77
  }
@@ -11,6 +11,7 @@ import {
11
11
  SearchControl,
12
12
  TextHighlight,
13
13
  __experimentalText as Text,
14
+ __experimentalVStack as VStack,
14
15
  __unstableComposite as Composite,
15
16
  __unstableUseCompositeState as useCompositeState,
16
17
  __unstableCompositeItem as CompositeItem,
@@ -158,9 +159,12 @@ function SuggestionList( { entityForSuggestions, onSelect } ) {
158
159
  </Composite>
159
160
  ) }
160
161
  { debouncedSearch && ! suggestions?.length && (
161
- <p className="edit-site-custom-template-modal__no-results">
162
+ <Text
163
+ as="p"
164
+ className="edit-site-custom-template-modal__no-results"
165
+ >
162
166
  { labels.not_found }
163
- </p>
167
+ </Text>
164
168
  ) }
165
169
  </>
166
170
  );
@@ -188,12 +192,12 @@ function AddCustomTemplateModal( {
188
192
  >
189
193
  { isCreatingTemplate && <TemplateActionsLoadingScreen /> }
190
194
  { ! showSearchEntities && (
191
- <>
192
- <p>
195
+ <VStack spacing={ 4 }>
196
+ <Text as="p">
193
197
  { __(
194
198
  'Select whether to create a single template for all items or a specific one.'
195
199
  ) }
196
- </p>
200
+ </Text>
197
201
  <Flex
198
202
  className={ `${ baseCssClass }__contents` }
199
203
  gap="4"
@@ -245,20 +249,20 @@ function AddCustomTemplateModal( {
245
249
  </Text>
246
250
  </FlexItem>
247
251
  </Flex>
248
- </>
252
+ </VStack>
249
253
  ) }
250
254
  { showSearchEntities && (
251
- <>
252
- <p>
255
+ <VStack spacing={ 4 }>
256
+ <Text as="p">
253
257
  { __(
254
258
  'This template will be used only for the specific item chosen.'
255
259
  ) }
256
- </p>
260
+ </Text>
257
261
  <SuggestionList
258
262
  entityForSuggestions={ entityForSuggestions }
259
263
  onSelect={ onSelect }
260
264
  />
261
- </>
265
+ </VStack>
262
266
  ) }
263
267
  </Modal>
264
268
  );
@@ -86,11 +86,12 @@ export default function NewTemplatePart( {
86
86
  setIsModalOpen( false );
87
87
  }
88
88
  }
89
+ const { as: Toggle = Button, ...restToggleProps } = toggleProps ?? {};
89
90
 
90
91
  return (
91
92
  <>
92
- <Button
93
- { ...toggleProps }
93
+ <Toggle
94
+ { ...restToggleProps }
94
95
  onClick={ () => {
95
96
  setIsModalOpen( true );
96
97
  } }
@@ -98,7 +99,7 @@ export default function NewTemplatePart( {
98
99
  label={ postType.labels.add_new }
99
100
  >
100
101
  { showIcon ? null : postType.labels.add_new }
101
- </Button>
102
+ </Toggle>
102
103
  { isModalOpen && (
103
104
  <CreateTemplatePartModal
104
105
  closeModal={ () => setIsModalOpen( false ) }
@@ -69,8 +69,6 @@
69
69
  }
70
70
 
71
71
  .edit-site-custom-template-modal__suggestions_list {
72
- margin-top: $grid-unit-20;
73
-
74
72
  @include break-small() {
75
73
  height: 232px;
76
74
  overflow: scroll;
@@ -130,11 +128,8 @@
130
128
  border: 1px solid $gray-400;
131
129
  border-radius: $radius-block-ui;
132
130
  padding: $grid-unit-20;
133
- margin-bottom: 0;
134
- margin-top: $grid-unit-20;
135
131
  }
136
132
 
137
-
138
133
  .edit-site-custom-generic-template__modal {
139
134
  .components-base-control {
140
135
  @include break-medium() {
@@ -17,7 +17,7 @@
17
17
  height: 100%;
18
18
  display: block;
19
19
  overflow: hidden;
20
- background-color: $gray-800;
20
+ background-color: $gray-900;
21
21
  // Centralize the editor horizontally (flex-direction is column).
22
22
  align-items: center;
23
23
 
@@ -25,7 +25,7 @@ import { __, sprintf } from '@wordpress/i18n';
25
25
  import { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';
26
26
  import BlockEditor from '../block-editor';
27
27
  import CodeEditor from '../code-editor';
28
- import KeyboardShortcuts from '../keyboard-shortcuts';
28
+ import KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';
29
29
  import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
30
30
  import ListViewSidebar from '../secondary-sidebar/list-view-sidebar';
31
31
  import WelcomeGuide from '../welcome-guide';
@@ -150,7 +150,6 @@ export default function Editor() {
150
150
  return (
151
151
  <>
152
152
  { isEditMode && <WelcomeGuide /> }
153
- <KeyboardShortcuts.Register />
154
153
  <EntityProvider kind="root" type="site">
155
154
  <EntityProvider
156
155
  kind="postType"
@@ -186,7 +185,9 @@ export default function Editor() {
186
185
  ) }
187
186
  </Notice>
188
187
  ) }
189
- { isEditMode && <KeyboardShortcuts /> }
188
+ { isEditMode && (
189
+ <KeyboardShortcutsEditMode />
190
+ ) }
190
191
  </>
191
192
  }
192
193
  secondarySidebar={
@@ -24,7 +24,6 @@ export function ScreenVariations( { name, path = '' } ) {
24
24
  return (
25
25
  <div className="edit-site-global-styles-screen-variations">
26
26
  <VStack spacing={ 3 }>
27
- <p>Manage style variations, saved block appearence presets.</p>
28
27
  <Subtitle>{ __( 'Style Variations' ) }</Subtitle>
29
28
  <VariationsPanel name={ name } />
30
29
  </VStack>
@@ -143,9 +143,9 @@ function ShadowPopoverContainer( { shadow, onShadowChange } ) {
143
143
  function ShadowPresets( { presets, activeShadow, onSelect } ) {
144
144
  return ! presets ? null : (
145
145
  <Grid columns={ 6 } gap={ 0 } align="center" justify="center">
146
- { presets.map( ( { name, shadow }, i ) => (
146
+ { presets.map( ( { name, slug, shadow } ) => (
147
147
  <ShadowIndicator
148
- key={ i }
148
+ key={ slug }
149
149
  label={ name }
150
150
  isActive={ shadow === activeShadow }
151
151
  onSelect={ () =>
@@ -164,8 +164,9 @@ function ShadowIndicator( { label, isActive, onSelect, shadow } ) {
164
164
  <Button
165
165
  className="edit-site-global-styles__shadow-indicator"
166
166
  onClick={ onSelect }
167
- aria-label={ label }
167
+ label={ label }
168
168
  style={ { boxShadow: shadow } }
169
+ showTooltip
169
170
  >
170
171
  { isActive && <Icon icon={ check } /> }
171
172
  </Button>
@@ -0,0 +1,116 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useShortcut } from '@wordpress/keyboard-shortcuts';
5
+ import { useDispatch, useSelect } from '@wordpress/data';
6
+ import { store as coreStore } from '@wordpress/core-data';
7
+ import { store as blockEditorStore } from '@wordpress/block-editor';
8
+ import { store as interfaceStore } from '@wordpress/interface';
9
+ import { createBlock } from '@wordpress/blocks';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { store as editSiteStore } from '../../store';
15
+ import { SIDEBAR_BLOCK } from '../sidebar-edit-mode/constants';
16
+ import { STORE_NAME } from '../../store/constants';
17
+
18
+ function KeyboardShortcutsEditMode() {
19
+ const { getEditorMode } = useSelect( editSiteStore );
20
+ const isListViewOpen = useSelect(
21
+ ( select ) => select( editSiteStore ).isListViewOpened(),
22
+ []
23
+ );
24
+ const isBlockInspectorOpen = useSelect(
25
+ ( select ) =>
26
+ select( interfaceStore ).getActiveComplementaryArea(
27
+ editSiteStore.name
28
+ ) === SIDEBAR_BLOCK,
29
+ []
30
+ );
31
+ const { redo, undo } = useDispatch( coreStore );
32
+ const { setIsListViewOpened, switchEditorMode } =
33
+ useDispatch( editSiteStore );
34
+ const { enableComplementaryArea, disableComplementaryArea } =
35
+ useDispatch( interfaceStore );
36
+
37
+ const { replaceBlocks } = useDispatch( blockEditorStore );
38
+ const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
39
+ useSelect( blockEditorStore );
40
+
41
+ const handleTextLevelShortcut = ( event, level ) => {
42
+ event.preventDefault();
43
+ const destinationBlockName =
44
+ level === 0 ? 'core/paragraph' : 'core/heading';
45
+ const currentClientId = getSelectedBlockClientId();
46
+ if ( currentClientId === null ) {
47
+ return;
48
+ }
49
+ const blockName = getBlockName( currentClientId );
50
+ if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
51
+ return;
52
+ }
53
+ const attributes = getBlockAttributes( currentClientId );
54
+ const textAlign =
55
+ blockName === 'core/paragraph' ? 'align' : 'textAlign';
56
+ const destinationTextAlign =
57
+ destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
58
+
59
+ replaceBlocks(
60
+ currentClientId,
61
+ createBlock( destinationBlockName, {
62
+ level,
63
+ content: attributes.content,
64
+ ...{ [ destinationTextAlign ]: attributes[ textAlign ] },
65
+ } )
66
+ );
67
+ };
68
+
69
+ useShortcut( 'core/edit-site/undo', ( event ) => {
70
+ undo();
71
+ event.preventDefault();
72
+ } );
73
+
74
+ useShortcut( 'core/edit-site/redo', ( event ) => {
75
+ redo();
76
+ event.preventDefault();
77
+ } );
78
+
79
+ useShortcut( 'core/edit-site/toggle-list-view', () => {
80
+ setIsListViewOpened( ! isListViewOpen );
81
+ } );
82
+
83
+ useShortcut( 'core/edit-site/toggle-block-settings-sidebar', ( event ) => {
84
+ // This shortcut has no known clashes, but use preventDefault to prevent any
85
+ // obscure shortcuts from triggering.
86
+ event.preventDefault();
87
+
88
+ if ( isBlockInspectorOpen ) {
89
+ disableComplementaryArea( STORE_NAME );
90
+ } else {
91
+ enableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );
92
+ }
93
+ } );
94
+
95
+ useShortcut( 'core/edit-site/toggle-mode', () => {
96
+ switchEditorMode( getEditorMode() === 'visual' ? 'text' : 'visual' );
97
+ } );
98
+
99
+ useShortcut( 'core/edit-site/transform-heading-to-paragraph', ( event ) =>
100
+ handleTextLevelShortcut( event, 0 )
101
+ );
102
+
103
+ [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
104
+ //the loop is based off on a constant therefore
105
+ //the hook will execute the same way every time
106
+ //eslint-disable-next-line react-hooks/rules-of-hooks
107
+ useShortcut(
108
+ `core/edit-site/transform-paragraph-to-heading-${ level }`,
109
+ ( event ) => handleTextLevelShortcut( event, level )
110
+ );
111
+ } );
112
+
113
+ return null;
114
+ }
115
+
116
+ export default KeyboardShortcutsEditMode;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useShortcut } from '@wordpress/keyboard-shortcuts';
5
+ import { useDispatch, useSelect } from '@wordpress/data';
6
+ import { store as coreStore } from '@wordpress/core-data';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editSiteStore } from '../../store';
12
+
13
+ function KeyboardShortcutsGlobal() {
14
+ const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
15
+ useSelect( coreStore );
16
+ const { setIsSaveViewOpened } = useDispatch( editSiteStore );
17
+
18
+ useShortcut( 'core/edit-site/save', ( event ) => {
19
+ event.preventDefault();
20
+
21
+ const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
22
+ const isDirty = !! dirtyEntityRecords.length;
23
+ const isSaving = dirtyEntityRecords.some( ( record ) =>
24
+ isSavingEntityRecord( record.kind, record.name, record.key )
25
+ );
26
+
27
+ if ( ! isSaving && isDirty ) {
28
+ setIsSaveViewOpened( true );
29
+ }
30
+ } );
31
+
32
+ return null;
33
+ }
34
+
35
+ export default KeyboardShortcutsGlobal;