@wordpress/edit-post 7.22.0 → 7.24.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 (115) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/device-preview/index.js +6 -3
  3. package/build/components/device-preview/index.js.map +1 -1
  4. package/build/components/header/document-actions/index.js +3 -7
  5. package/build/components/header/document-actions/index.js.map +1 -1
  6. package/build/components/header/header-toolbar/index.js +3 -8
  7. package/build/components/header/header-toolbar/index.js.map +1 -1
  8. package/build/components/header/index.js +65 -11
  9. package/build/components/header/index.js.map +1 -1
  10. package/build/components/header/writing-menu/index.js +1 -1
  11. package/build/components/header/writing-menu/index.js.map +1 -1
  12. package/build/components/keyboard-shortcuts/index.js +2 -4
  13. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  14. package/build/components/preferences-modal/index.js +1 -1
  15. package/build/components/preferences-modal/index.js.map +1 -1
  16. package/build/components/sidebar/post-pending-status/index.js +9 -2
  17. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  18. package/build/components/sidebar/post-status/index.js +1 -4
  19. package/build/components/sidebar/post-status/index.js.map +1 -1
  20. package/build/components/sidebar/post-sticky/index.js +9 -2
  21. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  22. package/build/components/sidebar/post-template/index.js +7 -4
  23. package/build/components/sidebar/post-template/index.js.map +1 -1
  24. package/build/components/sidebar/post-visibility/index.js +12 -4
  25. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  26. package/build/components/start-page-options/index.js +11 -13
  27. package/build/components/start-page-options/index.js.map +1 -1
  28. package/build/components/text-editor/index.js +21 -1
  29. package/build/components/text-editor/index.js.map +1 -1
  30. package/build/components/view-link/index.js +11 -3
  31. package/build/components/view-link/index.js.map +1 -1
  32. package/build/components/visual-editor/index.js +5 -1
  33. package/build/components/visual-editor/index.js.map +1 -1
  34. package/build/store/actions.js +1 -1
  35. package/build/store/actions.js.map +1 -1
  36. package/build-module/components/device-preview/index.js +6 -3
  37. package/build-module/components/device-preview/index.js.map +1 -1
  38. package/build-module/components/header/document-actions/index.js +3 -7
  39. package/build-module/components/header/document-actions/index.js.map +1 -1
  40. package/build-module/components/header/header-toolbar/index.js +3 -8
  41. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  42. package/build-module/components/header/index.js +66 -12
  43. package/build-module/components/header/index.js.map +1 -1
  44. package/build-module/components/header/writing-menu/index.js +1 -1
  45. package/build-module/components/header/writing-menu/index.js.map +1 -1
  46. package/build-module/components/keyboard-shortcuts/index.js +2 -4
  47. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  48. package/build-module/components/preferences-modal/index.js +1 -1
  49. package/build-module/components/preferences-modal/index.js.map +1 -1
  50. package/build-module/components/sidebar/post-pending-status/index.js +10 -3
  51. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  52. package/build-module/components/sidebar/post-status/index.js +2 -5
  53. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  54. package/build-module/components/sidebar/post-sticky/index.js +10 -3
  55. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  56. package/build-module/components/sidebar/post-template/index.js +9 -6
  57. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  58. package/build-module/components/sidebar/post-visibility/index.js +14 -6
  59. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  60. package/build-module/components/start-page-options/index.js +12 -14
  61. package/build-module/components/start-page-options/index.js.map +1 -1
  62. package/build-module/components/text-editor/index.js +22 -2
  63. package/build-module/components/text-editor/index.js.map +1 -1
  64. package/build-module/components/view-link/index.js +11 -3
  65. package/build-module/components/view-link/index.js.map +1 -1
  66. package/build-module/components/visual-editor/index.js +5 -1
  67. package/build-module/components/visual-editor/index.js.map +1 -1
  68. package/build-module/store/actions.js +1 -1
  69. package/build-module/store/actions.js.map +1 -1
  70. package/build-style/style-rtl.css +31 -185
  71. package/build-style/style.css +31 -185
  72. package/package.json +32 -32
  73. package/src/components/device-preview/index.js +21 -15
  74. package/src/components/header/document-actions/index.js +4 -7
  75. package/src/components/header/header-toolbar/index.js +1 -5
  76. package/src/components/header/index.js +104 -17
  77. package/src/components/header/style.scss +31 -2
  78. package/src/components/header/writing-menu/index.js +1 -1
  79. package/src/components/keyboard-shortcuts/index.js +6 -3
  80. package/src/components/layout/style.scss +0 -11
  81. package/src/components/preferences-modal/index.js +1 -1
  82. package/src/components/sidebar/post-pending-status/index.js +10 -3
  83. package/src/components/sidebar/post-status/index.js +11 -8
  84. package/src/components/sidebar/post-sticky/index.js +10 -3
  85. package/src/components/sidebar/post-template/index.js +10 -6
  86. package/src/components/sidebar/post-template/style.scss +0 -16
  87. package/src/components/sidebar/post-visibility/index.js +12 -5
  88. package/src/components/sidebar/post-visibility/style.scss +0 -12
  89. package/src/components/start-page-options/index.js +8 -15
  90. package/src/components/text-editor/index.js +20 -2
  91. package/src/components/text-editor/style.scss +3 -1
  92. package/src/components/view-link/index.js +21 -10
  93. package/src/components/visual-editor/index.js +7 -0
  94. package/src/components/visual-editor/style.scss +0 -90
  95. package/src/store/actions.js +1 -1
  96. package/src/store/test/actions.js +1 -1
  97. package/src/style.scss +0 -3
  98. package/build/components/sidebar/post-author/index.js +0 -22
  99. package/build/components/sidebar/post-author/index.js.map +0 -1
  100. package/build/components/sidebar/post-schedule/index.js +0 -66
  101. package/build/components/sidebar/post-schedule/index.js.map +0 -1
  102. package/build/components/sidebar/post-url/index.js +0 -62
  103. package/build/components/sidebar/post-url/index.js.map +0 -1
  104. package/build-module/components/sidebar/post-author/index.js +0 -13
  105. package/build-module/components/sidebar/post-author/index.js.map +0 -1
  106. package/build-module/components/sidebar/post-schedule/index.js +0 -59
  107. package/build-module/components/sidebar/post-schedule/index.js.map +0 -1
  108. package/build-module/components/sidebar/post-url/index.js +0 -55
  109. package/build-module/components/sidebar/post-url/index.js.map +0 -1
  110. package/src/components/sidebar/post-author/index.js +0 -20
  111. package/src/components/sidebar/post-author/style.scss +0 -5
  112. package/src/components/sidebar/post-schedule/index.js +0 -66
  113. package/src/components/sidebar/post-schedule/style.scss +0 -34
  114. package/src/components/sidebar/post-url/index.js +0 -58
  115. package/src/components/sidebar/post-url/style.scss +0 -26
@@ -584,6 +584,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
584
584
  flex-wrap: wrap;
585
585
  align-items: center;
586
586
  max-width: 100vw;
587
+ justify-content: space-between;
587
588
  }
588
589
  @media (min-width: 280px) {
589
590
  .edit-post-header {
@@ -601,7 +602,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
601
602
 
602
603
  .edit-post-header__toolbar {
603
604
  display: flex;
604
- flex-grow: 1;
605
+ flex-shrink: 8;
606
+ flex-grow: 3;
607
+ overflow: hidden;
608
+ padding: 2px 0;
609
+ align-items: center;
605
610
  }
606
611
  .edit-post-header__toolbar .table-of-contents {
607
612
  display: none;
@@ -611,12 +616,28 @@ body.is-fullscreen-mode .interface-interface-skeleton {
611
616
  display: block;
612
617
  }
613
618
  }
619
+ .edit-post-header__toolbar .block-editor-block-contextual-toolbar.is-fixed {
620
+ border: none;
621
+ }
622
+ .edit-post-header__toolbar .selected-block-tools-wrapper {
623
+ overflow-x: hidden;
624
+ }
625
+ .edit-post-header__toolbar .selected-block-tools-wrapper.is-collapsed {
626
+ display: none;
627
+ }
628
+
629
+ .edit-post-header__block-tools-toggle {
630
+ margin-left: 2px;
631
+ }
614
632
 
615
633
  .edit-post-header__center {
616
634
  flex-grow: 1;
617
635
  display: flex;
618
636
  justify-content: center;
619
637
  }
638
+ .edit-post-header__center.is-collapsed {
639
+ display: none;
640
+ }
620
641
 
621
642
  /**
622
643
  * Buttons on the right side
@@ -624,7 +645,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
624
645
  .edit-post-header__settings {
625
646
  display: inline-flex;
626
647
  align-items: center;
627
- flex-wrap: wrap;
648
+ flex-wrap: nowrap;
628
649
  padding-right: 4px;
629
650
  gap: 4px;
630
651
  }
@@ -1222,12 +1243,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1222
1243
  height: 61px;
1223
1244
  }
1224
1245
 
1225
- @media (min-width: 782px) {
1226
- .edit-post-layout.has-fixed-toolbar .interface-interface-skeleton__header:not(:focus-within) {
1227
- z-index: 19;
1228
- }
1229
- }
1230
-
1231
1246
  .edit-post-block-manager__no-results {
1232
1247
  font-style: italic;
1233
1248
  padding: 24px 0;
@@ -1577,64 +1592,18 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1577
1592
  padding: 16px;
1578
1593
  }
1579
1594
 
1580
- .edit-post-post-author {
1581
- display: flex;
1582
- flex-direction: column;
1583
- align-items: stretch;
1584
- }
1585
-
1586
1595
  .edit-post-post-format {
1587
1596
  display: flex;
1588
1597
  flex-direction: column;
1589
1598
  align-items: stretch;
1590
1599
  }
1591
1600
 
1592
- .edit-post-post-schedule {
1593
- width: 100%;
1594
- position: relative;
1595
- justify-content: flex-start;
1596
- align-items: flex-start;
1597
- }
1598
- .edit-post-post-schedule span {
1599
- display: block;
1600
- width: 45%;
1601
- flex-shrink: 0;
1602
- padding: 6px 0;
1603
- }
1604
-
1605
- .components-button.edit-post-post-schedule__toggle {
1606
- text-align: left;
1607
- white-space: normal;
1608
- height: auto;
1609
- }
1610
- .components-button.edit-post-post-schedule__toggle span {
1611
- width: 0;
1612
- }
1613
-
1614
- .edit-post-post-schedule__dialog .block-editor-publish-date-time-picker {
1615
- margin: 8px;
1616
- }
1617
-
1618
1601
  .edit-post-post-slug {
1619
1602
  display: flex;
1620
1603
  flex-direction: column;
1621
1604
  align-items: stretch;
1622
1605
  }
1623
1606
 
1624
- .edit-post-post-template {
1625
- width: 100%;
1626
- justify-content: flex-start;
1627
- }
1628
- .edit-post-post-template span {
1629
- display: block;
1630
- width: 45%;
1631
- padding: 6px 0;
1632
- }
1633
-
1634
- .edit-post-post-template__dropdown {
1635
- max-width: 55%;
1636
- }
1637
-
1638
1607
  .components-button.edit-post-post-template__toggle {
1639
1608
  display: inline-block;
1640
1609
  width: 100%;
@@ -1657,40 +1626,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1657
1626
  }
1658
1627
  }
1659
1628
 
1660
- .edit-post-post-url {
1661
- width: 100%;
1662
- justify-content: flex-start;
1663
- align-items: flex-start;
1664
- }
1665
- .edit-post-post-url span {
1666
- display: block;
1667
- width: 45%;
1668
- flex-shrink: 0;
1669
- padding: 6px 0;
1670
- }
1671
-
1672
- .components-button.edit-post-post-url__toggle {
1673
- text-align: left;
1674
- white-space: normal;
1675
- height: auto;
1676
- word-break: break-word;
1677
- }
1678
-
1679
- .edit-post-post-url__dialog .editor-post-url {
1680
- min-width: 248px;
1681
- margin: 8px;
1682
- }
1683
-
1684
- .edit-post-post-visibility {
1685
- width: 100%;
1686
- justify-content: flex-start;
1687
- }
1688
- .edit-post-post-visibility span {
1689
- display: block;
1690
- width: 45%;
1691
- padding: 6px 0;
1692
- }
1693
-
1694
1629
  .edit-post-post-visibility__dialog .editor-post-visibility {
1695
1630
  min-width: 248px;
1696
1631
  margin: 8px;
@@ -1771,21 +1706,25 @@ h2.edit-post-template-summary__title {
1771
1706
  background-color: #fff;
1772
1707
  flex-grow: 1;
1773
1708
  }
1774
- .edit-post-text-editor .editor-post-title {
1709
+ .edit-post-text-editor .editor-post-title:not(.is-raw-text),
1710
+ .edit-post-text-editor .editor-post-title.is-raw-text textarea {
1775
1711
  max-width: none;
1776
1712
  line-height: 1.4;
1777
1713
  font-family: Menlo, Consolas, monaco, monospace;
1778
1714
  font-size: 2.5em;
1779
1715
  font-weight: normal;
1780
1716
  border: 1px solid #949494;
1717
+ border-radius: 0;
1781
1718
  padding: 16px;
1782
1719
  }
1783
1720
  @media (min-width: 600px) {
1784
- .edit-post-text-editor .editor-post-title {
1721
+ .edit-post-text-editor .editor-post-title:not(.is-raw-text),
1722
+ .edit-post-text-editor .editor-post-title.is-raw-text textarea {
1785
1723
  padding: 24px;
1786
1724
  }
1787
1725
  }
1788
- .edit-post-text-editor .editor-post-title:focus {
1726
+ .edit-post-text-editor .editor-post-title:not(.is-raw-text):focus,
1727
+ .edit-post-text-editor .editor-post-title.is-raw-text textarea:focus {
1789
1728
  border-color: var(--wp-admin-theme-color);
1790
1729
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
1791
1730
  }
@@ -1849,7 +1788,7 @@ h2.edit-post-template-summary__title {
1849
1788
  font-size: 13px;
1850
1789
  padding: 6px 12px;
1851
1790
  }
1852
- .edit-post-visual-editor .components-button.is-tertiary, .edit-post-visual-editor .components-button.has-icon {
1791
+ .edit-post-visual-editor .components-button.has-icon {
1853
1792
  padding: 6px;
1854
1793
  }
1855
1794
 
@@ -1871,99 +1810,6 @@ h2.edit-post-template-summary__title {
1871
1810
  flex-grow: 1;
1872
1811
  }
1873
1812
 
1874
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1875
- /* Set left position when auto-fold is not on the body element. */
1876
- left: 0;
1877
- }
1878
- @media (min-width: 783px) {
1879
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1880
- left: 160px;
1881
- }
1882
- }
1883
-
1884
- .auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1885
- /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
1886
- }
1887
- @media (min-width: 783px) {
1888
- .auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1889
- left: 36px;
1890
- }
1891
- }
1892
- @media (min-width: 961px) {
1893
- .auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1894
- left: 160px;
1895
- }
1896
- }
1897
-
1898
- /* Sidebar manually collapsed. */
1899
- .folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1900
- left: 0;
1901
- }
1902
- @media (min-width: 783px) {
1903
- .folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1904
- left: 36px;
1905
- }
1906
- }
1907
-
1908
- body.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1909
- left: 0 !important;
1910
- }
1911
-
1912
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1913
- position: sticky;
1914
- top: 0;
1915
- z-index: 31;
1916
- display: block;
1917
- width: 100%;
1918
- }
1919
- @media (min-width: 782px) {
1920
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1921
- margin-left: 180px;
1922
- position: fixed;
1923
- top: 32px;
1924
- min-height: initial;
1925
- border-bottom: none;
1926
- display: flex;
1927
- height: 60px;
1928
- align-items: center;
1929
- width: calc(100% - 180px);
1930
- }
1931
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
1932
- width: initial;
1933
- }
1934
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
1935
- width: initial;
1936
- }
1937
- .is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1938
- margin-left: 240px;
1939
- top: 0;
1940
- }
1941
- .is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
1942
- width: initial;
1943
- }
1944
- .is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
1945
- width: initial;
1946
- }
1947
- .show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1948
- width: calc(100% + 40px - 180px);
1949
- margin-left: 80px;
1950
- }
1951
- .is-fullscreen-mode .show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1952
- margin-left: 144px;
1953
- }
1954
- }
1955
- @media (min-width: 960px) {
1956
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1957
- width: auto;
1958
- }
1959
- .show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1960
- width: auto;
1961
- }
1962
- .is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
1963
- width: calc(100% - 280px - 256px);
1964
- }
1965
- }
1966
-
1967
1813
  .edit-post-welcome-guide,
1968
1814
  .edit-template-welcome-guide {
1969
1815
  width: 312px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "7.22.0",
3
+ "version": "7.24.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,36 +27,36 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.45.0",
31
- "@wordpress/api-fetch": "^6.42.0",
32
- "@wordpress/block-editor": "^12.13.0",
33
- "@wordpress/block-library": "^8.22.0",
34
- "@wordpress/blocks": "^12.22.0",
35
- "@wordpress/commands": "^0.16.0",
36
- "@wordpress/components": "^25.11.0",
37
- "@wordpress/compose": "^6.22.0",
38
- "@wordpress/core-commands": "^0.14.0",
39
- "@wordpress/core-data": "^6.22.0",
40
- "@wordpress/data": "^9.15.0",
41
- "@wordpress/deprecated": "^3.45.0",
42
- "@wordpress/dom": "^3.45.0",
43
- "@wordpress/editor": "^13.22.0",
44
- "@wordpress/element": "^5.22.0",
45
- "@wordpress/hooks": "^3.45.0",
46
- "@wordpress/i18n": "^4.45.0",
47
- "@wordpress/icons": "^9.36.0",
48
- "@wordpress/interface": "^5.22.0",
49
- "@wordpress/keyboard-shortcuts": "^4.22.0",
50
- "@wordpress/keycodes": "^3.45.0",
51
- "@wordpress/media-utils": "^4.36.0",
52
- "@wordpress/notices": "^4.13.0",
53
- "@wordpress/plugins": "^6.13.0",
54
- "@wordpress/preferences": "^3.22.0",
55
- "@wordpress/private-apis": "^0.27.0",
56
- "@wordpress/url": "^3.46.0",
57
- "@wordpress/viewport": "^5.22.0",
58
- "@wordpress/warning": "^2.45.0",
59
- "@wordpress/widgets": "^3.22.0",
30
+ "@wordpress/a11y": "^3.47.0",
31
+ "@wordpress/api-fetch": "^6.44.0",
32
+ "@wordpress/block-editor": "^12.15.0",
33
+ "@wordpress/block-library": "^8.24.0",
34
+ "@wordpress/blocks": "^12.24.0",
35
+ "@wordpress/commands": "^0.18.0",
36
+ "@wordpress/components": "^25.13.0",
37
+ "@wordpress/compose": "^6.24.0",
38
+ "@wordpress/core-commands": "^0.16.0",
39
+ "@wordpress/core-data": "^6.24.0",
40
+ "@wordpress/data": "^9.17.0",
41
+ "@wordpress/deprecated": "^3.47.0",
42
+ "@wordpress/dom": "^3.47.0",
43
+ "@wordpress/editor": "^13.24.0",
44
+ "@wordpress/element": "^5.24.0",
45
+ "@wordpress/hooks": "^3.47.0",
46
+ "@wordpress/i18n": "^4.47.0",
47
+ "@wordpress/icons": "^9.38.0",
48
+ "@wordpress/interface": "^5.24.0",
49
+ "@wordpress/keyboard-shortcuts": "^4.24.0",
50
+ "@wordpress/keycodes": "^3.47.0",
51
+ "@wordpress/media-utils": "^4.38.0",
52
+ "@wordpress/notices": "^4.15.0",
53
+ "@wordpress/plugins": "^6.15.0",
54
+ "@wordpress/preferences": "^3.24.0",
55
+ "@wordpress/private-apis": "^0.29.0",
56
+ "@wordpress/url": "^3.48.0",
57
+ "@wordpress/viewport": "^5.24.0",
58
+ "@wordpress/warning": "^2.47.0",
59
+ "@wordpress/widgets": "^3.24.0",
60
60
  "classnames": "^2.3.1",
61
61
  "memize": "^2.1.0",
62
62
  "rememo": "^4.0.2"
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "2a00e87b57b9c27ed2b9b0fd8d423ef3cada72c1"
71
+ "gitHead": "d98dff8ea96f29cfea045bf964269f46f040d539"
72
72
  }
@@ -15,22 +15,27 @@ import { store as coreStore } from '@wordpress/core-data';
15
15
  import { store as editPostStore } from '../../store';
16
16
 
17
17
  export default function DevicePreview() {
18
- const { hasActiveMetaboxes, isPostSaveable, isViewable, deviceType } =
19
- useSelect( ( select ) => {
20
- const { getEditedPostAttribute } = select( editorStore );
21
- const { getPostType } = select( coreStore );
22
- const postType = getPostType( getEditedPostAttribute( 'type' ) );
18
+ const {
19
+ hasActiveMetaboxes,
20
+ isPostSaveable,
21
+ isViewable,
22
+ deviceType,
23
+ showIconLabels,
24
+ } = useSelect( ( select ) => {
25
+ const { getEditedPostAttribute } = select( editorStore );
26
+ const { getPostType } = select( coreStore );
27
+ const postType = getPostType( getEditedPostAttribute( 'type' ) );
23
28
 
24
- return {
25
- hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
26
- isPostSaveable: select( editorStore ).isEditedPostSaveable(),
27
- isViewable: postType?.viewable ?? false,
28
- deviceType:
29
- select(
30
- editPostStore
31
- ).__experimentalGetPreviewDeviceType(),
32
- };
33
- }, [] );
29
+ return {
30
+ hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
31
+ isPostSaveable: select( editorStore ).isEditedPostSaveable(),
32
+ isViewable: postType?.viewable ?? false,
33
+ deviceType:
34
+ select( editPostStore ).__experimentalGetPreviewDeviceType(),
35
+ showIconLabels:
36
+ select( editPostStore ).isFeatureActive( 'showIconLabels' ),
37
+ };
38
+ }, [] );
34
39
  const { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =
35
40
  useDispatch( editPostStore );
36
41
 
@@ -41,6 +46,7 @@ export default function DevicePreview() {
41
46
  deviceType={ deviceType }
42
47
  setDeviceType={ setPreviewDeviceType }
43
48
  label={ __( 'Preview' ) }
49
+ showIconLabels={ showIconLabels }
44
50
  >
45
51
  { ( { onClose } ) =>
46
52
  isViewable && (
@@ -20,21 +20,18 @@ import { displayShortcut } from '@wordpress/keycodes';
20
20
  import { store as editPostStore } from '../../../store';
21
21
 
22
22
  function DocumentActions() {
23
- const { template, isEditing } = useSelect( ( select ) => {
24
- const { isEditingTemplate, getEditedPostTemplate } =
25
- select( editPostStore );
26
- const _isEditing = isEditingTemplate();
23
+ const { template } = useSelect( ( select ) => {
24
+ const { getEditedPostTemplate } = select( editPostStore );
27
25
 
28
26
  return {
29
- template: _isEditing ? getEditedPostTemplate() : null,
30
- isEditing: _isEditing,
27
+ template: getEditedPostTemplate(),
31
28
  };
32
29
  }, [] );
33
30
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
34
31
  const { setIsEditingTemplate } = useDispatch( editPostStore );
35
32
  const { open: openCommandCenter } = useDispatch( commandsStore );
36
33
 
37
- if ( ! isEditing || ! template ) {
34
+ if ( ! template ) {
38
35
  return null;
39
36
  }
40
37
 
@@ -19,7 +19,6 @@ import { Button, ToolbarItem } from '@wordpress/components';
19
19
  import { listView, plus } from '@wordpress/icons';
20
20
  import { useRef, useCallback } from '@wordpress/element';
21
21
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
22
- import { store as preferencesStore } from '@wordpress/preferences';
23
22
 
24
23
  /**
25
24
  * Internal dependencies
@@ -33,7 +32,7 @@ const preventDefault = ( event ) => {
33
32
  event.preventDefault();
34
33
  };
35
34
 
36
- function HeaderToolbar( { setListViewToggleElement } ) {
35
+ function HeaderToolbar( { hasFixedToolbar, setListViewToggleElement } ) {
37
36
  const inserterButton = useRef();
38
37
  const { setIsInserterOpened, setIsListViewOpened } =
39
38
  useDispatch( editPostStore );
@@ -44,7 +43,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
44
43
  showIconLabels,
45
44
  isListViewOpen,
46
45
  listViewShortcut,
47
- hasFixedToolbar,
48
46
  } = useSelect( ( select ) => {
49
47
  const { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =
50
48
  select( blockEditorStore );
@@ -52,7 +50,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
52
50
  const { getEditorMode, isFeatureActive, isListViewOpened } =
53
51
  select( editPostStore );
54
52
  const { getShortcutRepresentation } = select( keyboardShortcutsStore );
55
- const { get: getPreference } = select( preferencesStore );
56
53
 
57
54
  return {
58
55
  // This setting (richEditingEnabled) should not live in the block editor's setting.
@@ -69,7 +66,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
69
66
  listViewShortcut: getShortcutRepresentation(
70
67
  'core/edit-post/toggle-list-view'
71
68
  ),
72
- hasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),
73
69
  };
74
70
  }, [] );
75
71
 
@@ -1,11 +1,28 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
9
+ import {
10
+ privateApis as blockEditorPrivateApis,
11
+ store as blockEditorStore,
12
+ } from '@wordpress/block-editor';
4
13
  import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
14
+ import { useEffect, useRef, useState } from '@wordpress/element';
5
15
  import { useSelect } from '@wordpress/data';
16
+ import { __ } from '@wordpress/i18n';
17
+ import { next, previous } from '@wordpress/icons';
6
18
  import { PinnedItems } from '@wordpress/interface';
7
19
  import { useViewportMatch } from '@wordpress/compose';
8
- import { __unstableMotion as motion } from '@wordpress/components';
20
+ import {
21
+ Button,
22
+ __unstableMotion as motion,
23
+ Popover,
24
+ } from '@wordpress/components';
25
+ import { store as preferencesStore } from '@wordpress/preferences';
9
26
 
10
27
  /**
11
28
  * Internal dependencies
@@ -19,6 +36,9 @@ import ViewLink from '../view-link';
19
36
  import MainDashboardButton from './main-dashboard-button';
20
37
  import { store as editPostStore } from '../../store';
21
38
  import DocumentActions from './document-actions';
39
+ import { unlock } from '../../lock-unlock';
40
+
41
+ const { BlockContextualToolbar } = unlock( blockEditorPrivateApis );
22
42
 
23
43
  const slideY = {
24
44
  hidden: { y: '-50px' },
@@ -36,18 +56,43 @@ function Header( {
36
56
  setEntitiesSavedStatesCallback,
37
57
  setListViewToggleElement,
38
58
  } ) {
39
- const isLargeViewport = useViewportMatch( 'large' );
40
- const { hasActiveMetaboxes, isPublishSidebarOpened, showIconLabels } =
41
- useSelect(
42
- ( select ) => ( {
43
- hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
44
- isPublishSidebarOpened:
45
- select( editPostStore ).isPublishSidebarOpened(),
46
- showIconLabels:
47
- select( editPostStore ).isFeatureActive( 'showIconLabels' ),
48
- } ),
49
- []
50
- );
59
+ const isWideViewport = useViewportMatch( 'large' );
60
+ const isLargeViewport = useViewportMatch( 'medium' );
61
+ const blockToolbarRef = useRef();
62
+ const {
63
+ blockSelectionStart,
64
+ hasActiveMetaboxes,
65
+ hasFixedToolbar,
66
+ isEditingTemplate,
67
+ isPublishSidebarOpened,
68
+ showIconLabels,
69
+ } = useSelect( ( select ) => {
70
+ const { get: getPreference } = select( preferencesStore );
71
+
72
+ return {
73
+ blockSelectionStart:
74
+ select( blockEditorStore ).getBlockSelectionStart(),
75
+ hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
76
+ isEditingTemplate: select( editPostStore ).isEditingTemplate(),
77
+ isPublishSidebarOpened:
78
+ select( editPostStore ).isPublishSidebarOpened(),
79
+ hasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),
80
+ showIconLabels:
81
+ select( editPostStore ).isFeatureActive( 'showIconLabels' ),
82
+ };
83
+ }, [] );
84
+
85
+ const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
86
+ useState( true );
87
+
88
+ const hasBlockSelected = !! blockSelectionStart;
89
+
90
+ useEffect( () => {
91
+ // If we have a new block selection, show the block tools
92
+ if ( blockSelectionStart ) {
93
+ setIsBlockToolsCollapsed( false );
94
+ }
95
+ }, [ blockSelectionStart ] );
51
96
 
52
97
  return (
53
98
  <div className="edit-post-header">
@@ -65,10 +110,52 @@ function Header( {
65
110
  className="edit-post-header__toolbar"
66
111
  >
67
112
  <HeaderToolbar
113
+ hasFixedToolbar={ hasFixedToolbar }
68
114
  setListViewToggleElement={ setListViewToggleElement }
69
115
  />
70
- <div className="edit-post-header__center">
71
- <DocumentActions />
116
+ { hasFixedToolbar && isLargeViewport && (
117
+ <>
118
+ <div
119
+ className={ classnames(
120
+ 'selected-block-tools-wrapper',
121
+ {
122
+ 'is-collapsed': isBlockToolsCollapsed,
123
+ }
124
+ ) }
125
+ >
126
+ <BlockContextualToolbar isFixed />
127
+ </div>
128
+ <Popover.Slot
129
+ ref={ blockToolbarRef }
130
+ name="block-toolbar"
131
+ />
132
+ { isEditingTemplate && hasBlockSelected && (
133
+ <Button
134
+ className="edit-post-header__block-tools-toggle"
135
+ icon={ isBlockToolsCollapsed ? next : previous }
136
+ onClick={ () => {
137
+ setIsBlockToolsCollapsed(
138
+ ( collapsed ) => ! collapsed
139
+ );
140
+ } }
141
+ label={
142
+ isBlockToolsCollapsed
143
+ ? __( 'Show block tools' )
144
+ : __( 'Hide block tools' )
145
+ }
146
+ />
147
+ ) }
148
+ </>
149
+ ) }
150
+ <div
151
+ className={ classnames( 'edit-post-header__center', {
152
+ 'is-collapsed':
153
+ ! isBlockToolsCollapsed &&
154
+ isLargeViewport &&
155
+ isEditingTemplate,
156
+ } ) }
157
+ >
158
+ { isEditingTemplate && <DocumentActions /> }
72
159
  </div>
73
160
  </motion.div>
74
161
  <motion.div
@@ -96,13 +183,13 @@ function Header( {
96
183
  setEntitiesSavedStatesCallback
97
184
  }
98
185
  />
99
- { ( isLargeViewport || ! showIconLabels ) && (
186
+ { ( isWideViewport || ! showIconLabels ) && (
100
187
  <>
101
188
  <PinnedItems.Slot scope="core/edit-post" />
102
189
  <MoreMenu showIconLabels={ showIconLabels } />
103
190
  </>
104
191
  ) }
105
- { showIconLabels && ! isLargeViewport && (
192
+ { showIconLabels && ! isWideViewport && (
106
193
  <MoreMenu showIconLabels={ showIconLabels } />
107
194
  ) }
108
195
  </motion.div>