@wordpress/block-editor 8.5.0 → 8.5.3

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 (123) hide show
  1. package/build/components/block-alignment-control/ui.js +1 -1
  2. package/build/components/block-alignment-control/ui.js.map +1 -1
  3. package/build/components/block-content-overlay/index.js +13 -4
  4. package/build/components/block-content-overlay/index.js.map +1 -1
  5. package/build/components/block-lock/index.js +8 -0
  6. package/build/components/block-lock/index.js.map +1 -1
  7. package/build/components/block-lock/menu-item.js +5 -20
  8. package/build/components/block-lock/menu-item.js.map +1 -1
  9. package/build/components/block-lock/modal.js +33 -12
  10. package/build/components/block-lock/modal.js.map +1 -1
  11. package/build/components/block-lock/toolbar.js +7 -20
  12. package/build/components/block-lock/toolbar.js.map +1 -1
  13. package/build/components/block-lock/use-block-lock.js +50 -0
  14. package/build/components/block-lock/use-block-lock.js.map +1 -0
  15. package/build/components/block-pattern-setup/index.js +37 -22
  16. package/build/components/block-pattern-setup/index.js.map +1 -1
  17. package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
  18. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  19. package/build/components/block-preview/auto.js +6 -3
  20. package/build/components/block-preview/auto.js.map +1 -1
  21. package/build/components/block-preview/index.js +4 -2
  22. package/build/components/block-preview/index.js.map +1 -1
  23. package/build/components/block-switcher/index.js +7 -2
  24. package/build/components/block-switcher/index.js.map +1 -1
  25. package/build/components/copy-handler/index.js +44 -9
  26. package/build/components/copy-handler/index.js.map +1 -1
  27. package/build/components/link-control/index.js +6 -7
  28. package/build/components/link-control/index.js.map +1 -1
  29. package/build/components/list-view/block-select-button.js +4 -10
  30. package/build/components/list-view/block-select-button.js.map +1 -1
  31. package/build/components/list-view/block.js +13 -2
  32. package/build/components/list-view/block.js.map +1 -1
  33. package/build/components/writing-flow/use-selection-observer.js +7 -1
  34. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  35. package/build/hooks/duotone.js +66 -16
  36. package/build/hooks/duotone.js.map +1 -1
  37. package/build/hooks/index.js +7 -1
  38. package/build/hooks/index.js.map +1 -1
  39. package/build/index.js +7 -0
  40. package/build/index.js.map +1 -1
  41. package/build/store/actions.js +22 -29
  42. package/build/store/actions.js.map +1 -1
  43. package/build/store/selectors.js +122 -3
  44. package/build/store/selectors.js.map +1 -1
  45. package/build/store/utils.js +27 -0
  46. package/build/store/utils.js.map +1 -0
  47. package/build-module/components/block-alignment-control/ui.js +2 -2
  48. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  49. package/build-module/components/block-content-overlay/index.js +13 -4
  50. package/build-module/components/block-content-overlay/index.js.map +1 -1
  51. package/build-module/components/block-lock/index.js +1 -0
  52. package/build-module/components/block-lock/index.js.map +1 -1
  53. package/build-module/components/block-lock/menu-item.js +4 -18
  54. package/build-module/components/block-lock/menu-item.js.map +1 -1
  55. package/build-module/components/block-lock/modal.js +31 -12
  56. package/build-module/components/block-lock/modal.js.map +1 -1
  57. package/build-module/components/block-lock/toolbar.js +6 -18
  58. package/build-module/components/block-lock/toolbar.js.map +1 -1
  59. package/build-module/components/block-lock/use-block-lock.js +41 -0
  60. package/build-module/components/block-lock/use-block-lock.js.map +1 -0
  61. package/build-module/components/block-pattern-setup/index.js +39 -24
  62. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  63. package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
  64. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  65. package/build-module/components/block-preview/auto.js +6 -3
  66. package/build-module/components/block-preview/auto.js.map +1 -1
  67. package/build-module/components/block-preview/index.js +4 -2
  68. package/build-module/components/block-preview/index.js.map +1 -1
  69. package/build-module/components/block-switcher/index.js +7 -2
  70. package/build-module/components/block-switcher/index.js.map +1 -1
  71. package/build-module/components/copy-handler/index.js +44 -9
  72. package/build-module/components/copy-handler/index.js.map +1 -1
  73. package/build-module/components/link-control/index.js +6 -7
  74. package/build-module/components/link-control/index.js.map +1 -1
  75. package/build-module/components/list-view/block-select-button.js +4 -9
  76. package/build-module/components/list-view/block-select-button.js.map +1 -1
  77. package/build-module/components/list-view/block.js +13 -2
  78. package/build-module/components/list-view/block.js.map +1 -1
  79. package/build-module/components/writing-flow/use-selection-observer.js +7 -1
  80. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  81. package/build-module/hooks/duotone.js +63 -16
  82. package/build-module/hooks/duotone.js.map +1 -1
  83. package/build-module/hooks/index.js +1 -0
  84. package/build-module/hooks/index.js.map +1 -1
  85. package/build-module/index.js +1 -1
  86. package/build-module/index.js.map +1 -1
  87. package/build-module/store/actions.js +5 -14
  88. package/build-module/store/actions.js.map +1 -1
  89. package/build-module/store/selectors.js +112 -2
  90. package/build-module/store/selectors.js.map +1 -1
  91. package/build-module/store/utils.js +20 -0
  92. package/build-module/store/utils.js.map +1 -0
  93. package/build-style/style-rtl.css +35 -28
  94. package/build-style/style.css +35 -28
  95. package/package.json +28 -28
  96. package/src/components/block-alignment-control/ui.js +2 -2
  97. package/src/components/block-content-overlay/index.js +19 -2
  98. package/src/components/block-content-overlay/style.scss +0 -1
  99. package/src/components/block-lock/index.js +1 -0
  100. package/src/components/block-lock/menu-item.js +3 -23
  101. package/src/components/block-lock/modal.js +37 -13
  102. package/src/components/block-lock/style.scss +1 -2
  103. package/src/components/block-lock/toolbar.js +4 -21
  104. package/src/components/block-lock/use-block-lock.js +45 -0
  105. package/src/components/block-pattern-setup/index.js +84 -59
  106. package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
  107. package/src/components/block-pattern-setup/style.scss +32 -26
  108. package/src/components/block-preview/auto.js +10 -1
  109. package/src/components/block-preview/index.js +2 -0
  110. package/src/components/block-switcher/index.js +13 -1
  111. package/src/components/block-switcher/style.scss +7 -3
  112. package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
  113. package/src/components/copy-handler/index.js +52 -10
  114. package/src/components/link-control/index.js +5 -5
  115. package/src/components/list-view/block-select-button.js +2 -10
  116. package/src/components/list-view/block.js +16 -7
  117. package/src/components/writing-flow/use-selection-observer.js +7 -0
  118. package/src/hooks/duotone.js +98 -62
  119. package/src/hooks/index.js +1 -0
  120. package/src/index.js +1 -0
  121. package/src/store/actions.js +5 -13
  122. package/src/store/selectors.js +148 -2
  123. package/src/store/utils.js +19 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Helper function that maps attribute definition properties to the
3
+ * ones used by RichText utils like `create, toHTMLString, etc..`.
4
+ *
5
+ * @param {Object} attributeDefinition A block's attribute definition object.
6
+ * @return {Object} The mapped object.
7
+ */
8
+ export function mapRichTextSettings(attributeDefinition) {
9
+ const {
10
+ multiline: multilineTag,
11
+ __unstableMultilineWrapperTags: multilineWrapperTags,
12
+ __unstablePreserveWhiteSpace: preserveWhiteSpace
13
+ } = attributeDefinition;
14
+ return {
15
+ multilineTag,
16
+ multilineWrapperTags,
17
+ preserveWhiteSpace
18
+ };
19
+ }
20
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/store/utils.js"],"names":["mapRichTextSettings","attributeDefinition","multiline","multilineTag","__unstableMultilineWrapperTags","multilineWrapperTags","__unstablePreserveWhiteSpace","preserveWhiteSpace"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAT,CAA8BC,mBAA9B,EAAoD;AAC1D,QAAM;AACLC,IAAAA,SAAS,EAAEC,YADN;AAELC,IAAAA,8BAA8B,EAAEC,oBAF3B;AAGLC,IAAAA,4BAA4B,EAAEC;AAHzB,MAIFN,mBAJJ;AAKA,SAAO;AACNE,IAAAA,YADM;AAENE,IAAAA,oBAFM;AAGNE,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Helper function that maps attribute definition properties to the\n * ones used by RichText utils like `create, toHTMLString, etc..`.\n *\n * @param {Object} attributeDefinition A block's attribute definition object.\n * @return {Object} The mapped object.\n */\nexport function mapRichTextSettings( attributeDefinition ) {\n\tconst {\n\t\tmultiline: multilineTag,\n\t\t__unstableMultilineWrapperTags: multilineWrapperTags,\n\t\t__unstablePreserveWhiteSpace: preserveWhiteSpace,\n\t} = attributeDefinition;\n\treturn {\n\t\tmultilineTag,\n\t\tmultilineWrapperTags,\n\t\tpreserveWhiteSpace,\n\t};\n}\n"]}
@@ -855,8 +855,7 @@
855
855
  padding-right: 0 !important;
856
856
  }
857
857
  .block-editor-block-lock-toolbar .components-button.has-icon:focus::before {
858
- right: 0 !important;
859
- left: 12px !important;
858
+ left: 8px !important;
860
859
  }
861
860
 
862
861
  .block-editor-block-breadcrumb {
@@ -1019,7 +1018,6 @@
1019
1018
  border: none;
1020
1019
  border-radius: 2px;
1021
1020
  z-index: 10;
1022
- pointer-events: none;
1023
1021
  }
1024
1022
  .block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before {
1025
1023
  background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
@@ -1423,11 +1421,13 @@
1423
1421
  }
1424
1422
 
1425
1423
  .components-button.block-editor-block-switcher__no-switcher-icon {
1426
- width: 48px;
1424
+ display: flex;
1425
+ padding: 6px 12px !important;
1427
1426
  }
1428
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-blocks-icon {
1427
+ .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1429
1428
  margin-left: auto;
1430
1429
  margin-right: auto;
1430
+ min-width: 24px !important;
1431
1431
  }
1432
1432
 
1433
1433
  .components-button.block-editor-block-switcher__no-switcher-icon:disabled {
@@ -1525,7 +1525,7 @@
1525
1525
  }
1526
1526
 
1527
1527
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
1528
- width: 48px;
1528
+ min-width: 36px;
1529
1529
  }
1530
1530
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,
1531
1531
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle {
@@ -1652,39 +1652,41 @@
1652
1652
  align-items: flex-start;
1653
1653
  width: 100%;
1654
1654
  border-radius: 2px;
1655
- box-shadow: inset 0 0 0 1px #1e1e1e;
1656
- outline: 1px solid transparent;
1657
1655
  }
1658
1656
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar {
1659
1657
  justify-content: center;
1660
1658
  }
1661
1659
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container {
1662
- display: grid;
1663
- grid-template-columns: 1fr 1fr;
1664
- grid-gap: 16px;
1665
- padding: 16px;
1666
- max-height: 550px;
1667
- overflow: auto;
1668
- margin: 0 1px 1px 1px;
1669
- width: calc(100% - 2px);
1670
- background: #fff;
1660
+ column-gap: 24px;
1661
+ display: block;
1662
+ width: 100%;
1663
+ padding: 32px;
1664
+ column-count: 2;
1665
+ }
1666
+ @media (min-width: 1440px) {
1667
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container {
1668
+ column-count: 3;
1669
+ }
1671
1670
  }
1672
1671
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container,
1673
1672
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button] {
1674
1673
  cursor: pointer;
1675
1674
  }
1676
- .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__item-title {
1677
- padding: 4px;
1678
- font-size: 12px;
1679
- text-align: center;
1675
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item {
1676
+ break-inside: avoid-column;
1677
+ margin-bottom: 24px;
1680
1678
  }
1681
- .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container {
1679
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container {
1680
+ min-height: 100px;
1682
1681
  border-radius: 2px;
1683
1682
  border: 1px solid #ddd;
1684
1683
  }
1684
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content {
1685
+ width: 100%;
1686
+ }
1685
1687
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar {
1688
+ height: 60px;
1686
1689
  box-sizing: border-box;
1687
- position: relative;
1688
1690
  padding: 16px;
1689
1691
  width: 100%;
1690
1692
  text-align: right;
@@ -1692,12 +1694,12 @@
1692
1694
  color: #1e1e1e;
1693
1695
  border-radius: 2px 2px 0 0;
1694
1696
  background-color: #fff;
1695
- box-shadow: inset 0 0 0 1px #1e1e1e;
1696
- outline: 1px solid transparent;
1697
1697
  display: flex;
1698
1698
  flex-direction: row;
1699
1699
  align-items: center;
1700
1700
  justify-content: space-between;
1701
+ border-top: 1px solid #ddd;
1702
+ align-self: flex-end;
1701
1703
  }
1702
1704
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls {
1703
1705
  display: flex;
@@ -1728,13 +1730,12 @@
1728
1730
  box-sizing: border-box;
1729
1731
  }
1730
1732
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide {
1731
- opacity: 0;
1732
1733
  position: absolute;
1733
1734
  top: 0;
1734
1735
  width: 100%;
1735
1736
  margin: auto;
1736
- padding: 16px;
1737
- transition: transform 0.5s, opacity 0.5s, z-index 0.5s;
1737
+ padding: 0;
1738
+ transition: transform 0.5s, z-index 0.5s;
1738
1739
  z-index: 100;
1739
1740
  }
1740
1741
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide {
@@ -1754,6 +1755,12 @@
1754
1755
  display: none;
1755
1756
  }
1756
1757
 
1758
+ .block-editor-block-pattern-setup__carousel,
1759
+ .block-editor-block-pattern-setup__grid {
1760
+ width: 100%;
1761
+ overflow-y: auto;
1762
+ }
1763
+
1757
1764
  .block-editor-block-variation-transforms {
1758
1765
  padding: 0 52px 16px 16px;
1759
1766
  width: 100%;
@@ -855,8 +855,7 @@
855
855
  padding-left: 0 !important;
856
856
  }
857
857
  .block-editor-block-lock-toolbar .components-button.has-icon:focus::before {
858
- left: 0 !important;
859
- right: 12px !important;
858
+ right: 8px !important;
860
859
  }
861
860
 
862
861
  .block-editor-block-breadcrumb {
@@ -1019,7 +1018,6 @@
1019
1018
  border: none;
1020
1019
  border-radius: 2px;
1021
1020
  z-index: 10;
1022
- pointer-events: none;
1023
1021
  }
1024
1022
  .block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before {
1025
1023
  background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
@@ -1423,11 +1421,13 @@
1423
1421
  }
1424
1422
 
1425
1423
  .components-button.block-editor-block-switcher__no-switcher-icon {
1426
- width: 48px;
1424
+ display: flex;
1425
+ padding: 6px 12px !important;
1427
1426
  }
1428
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-blocks-icon {
1427
+ .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1429
1428
  margin-right: auto;
1430
1429
  margin-left: auto;
1430
+ min-width: 24px !important;
1431
1431
  }
1432
1432
 
1433
1433
  .components-button.block-editor-block-switcher__no-switcher-icon:disabled {
@@ -1525,7 +1525,7 @@
1525
1525
  }
1526
1526
 
1527
1527
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
1528
- width: 48px;
1528
+ min-width: 36px;
1529
1529
  }
1530
1530
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,
1531
1531
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle {
@@ -1652,39 +1652,41 @@
1652
1652
  align-items: flex-start;
1653
1653
  width: 100%;
1654
1654
  border-radius: 2px;
1655
- box-shadow: inset 0 0 0 1px #1e1e1e;
1656
- outline: 1px solid transparent;
1657
1655
  }
1658
1656
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__toolbar {
1659
1657
  justify-content: center;
1660
1658
  }
1661
1659
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container {
1662
- display: grid;
1663
- grid-template-columns: 1fr 1fr;
1664
- grid-gap: 16px;
1665
- padding: 16px;
1666
- max-height: 550px;
1667
- overflow: auto;
1668
- margin: 0 1px 1px 1px;
1669
- width: calc(100% - 2px);
1670
- background: #fff;
1660
+ column-gap: 24px;
1661
+ display: block;
1662
+ width: 100%;
1663
+ padding: 32px;
1664
+ column-count: 2;
1665
+ }
1666
+ @media (min-width: 1440px) {
1667
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container {
1668
+ column-count: 3;
1669
+ }
1671
1670
  }
1672
1671
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container,
1673
1672
  .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container div[role=button] {
1674
1673
  cursor: pointer;
1675
1674
  }
1676
- .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__item-title {
1677
- padding: 4px;
1678
- font-size: 12px;
1679
- text-align: center;
1675
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item {
1676
+ break-inside: avoid-column;
1677
+ margin-bottom: 24px;
1680
1678
  }
1681
- .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-preview__container {
1679
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__container {
1680
+ min-height: 100px;
1682
1681
  border-radius: 2px;
1683
1682
  border: 1px solid #ddd;
1684
1683
  }
1684
+ .block-editor-block-pattern-setup.view-mode-grid .block-editor-block-pattern-setup__container .block-editor-block-pattern-setup-list__list-item .block-editor-block-preview__content {
1685
+ width: 100%;
1686
+ }
1685
1687
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar {
1688
+ height: 60px;
1686
1689
  box-sizing: border-box;
1687
- position: relative;
1688
1690
  padding: 16px;
1689
1691
  width: 100%;
1690
1692
  text-align: left;
@@ -1692,12 +1694,12 @@
1692
1694
  color: #1e1e1e;
1693
1695
  border-radius: 2px 2px 0 0;
1694
1696
  background-color: #fff;
1695
- box-shadow: inset 0 0 0 1px #1e1e1e;
1696
- outline: 1px solid transparent;
1697
1697
  display: flex;
1698
1698
  flex-direction: row;
1699
1699
  align-items: center;
1700
1700
  justify-content: space-between;
1701
+ border-top: 1px solid #ddd;
1702
+ align-self: flex-end;
1701
1703
  }
1702
1704
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__toolbar .block-editor-block-pattern-setup__display-controls {
1703
1705
  display: flex;
@@ -1728,13 +1730,12 @@
1728
1730
  box-sizing: border-box;
1729
1731
  }
1730
1732
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide {
1731
- opacity: 0;
1732
1733
  position: absolute;
1733
1734
  top: 0;
1734
1735
  width: 100%;
1735
1736
  margin: auto;
1736
- padding: 16px;
1737
- transition: transform 0.5s, opacity 0.5s, z-index 0.5s;
1737
+ padding: 0;
1738
+ transition: transform 0.5s, z-index 0.5s;
1738
1739
  z-index: 100;
1739
1740
  }
1740
1741
  .block-editor-block-pattern-setup .block-editor-block-pattern-setup__container .carousel-container .pattern-slide.active-slide {
@@ -1754,6 +1755,12 @@
1754
1755
  display: none;
1755
1756
  }
1756
1757
 
1758
+ .block-editor-block-pattern-setup__carousel,
1759
+ .block-editor-block-pattern-setup__grid {
1760
+ width: 100%;
1761
+ overflow-y: auto;
1762
+ }
1763
+
1757
1764
  .block-editor-block-variation-transforms {
1758
1765
  padding: 0 16px 16px 52px;
1759
1766
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "8.5.0",
3
+ "version": "8.5.3",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -33,32 +33,32 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.16.0",
35
35
  "@react-spring/web": "^9.2.4",
36
- "@wordpress/a11y": "^3.6.0",
37
- "@wordpress/api-fetch": "^6.3.0",
38
- "@wordpress/blob": "^3.6.0",
39
- "@wordpress/blocks": "^11.5.0",
40
- "@wordpress/components": "^19.8.0",
41
- "@wordpress/compose": "^5.4.0",
42
- "@wordpress/data": "^6.6.0",
43
- "@wordpress/date": "^4.6.0",
44
- "@wordpress/deprecated": "^3.6.0",
45
- "@wordpress/dom": "^3.6.0",
46
- "@wordpress/element": "^4.4.0",
47
- "@wordpress/hooks": "^3.6.0",
48
- "@wordpress/html-entities": "^3.6.0",
49
- "@wordpress/i18n": "^4.6.0",
50
- "@wordpress/icons": "^8.2.0",
51
- "@wordpress/is-shallow-equal": "^4.6.0",
52
- "@wordpress/keyboard-shortcuts": "^3.4.0",
53
- "@wordpress/keycodes": "^3.6.0",
54
- "@wordpress/notices": "^3.6.0",
55
- "@wordpress/rich-text": "^5.4.0",
56
- "@wordpress/shortcode": "^3.6.0",
57
- "@wordpress/style-engine": "^0.5.0",
58
- "@wordpress/token-list": "^2.6.0",
59
- "@wordpress/url": "^3.7.0",
60
- "@wordpress/warning": "^2.6.0",
61
- "@wordpress/wordcount": "^3.6.0",
36
+ "@wordpress/a11y": "^3.6.1",
37
+ "@wordpress/api-fetch": "^6.3.1",
38
+ "@wordpress/blob": "^3.6.1",
39
+ "@wordpress/blocks": "^11.5.3",
40
+ "@wordpress/components": "^19.8.2",
41
+ "@wordpress/compose": "^5.4.1",
42
+ "@wordpress/data": "^6.6.1",
43
+ "@wordpress/date": "^4.6.1",
44
+ "@wordpress/deprecated": "^3.6.1",
45
+ "@wordpress/dom": "^3.6.1",
46
+ "@wordpress/element": "^4.4.1",
47
+ "@wordpress/hooks": "^3.6.1",
48
+ "@wordpress/html-entities": "^3.6.1",
49
+ "@wordpress/i18n": "^4.6.1",
50
+ "@wordpress/icons": "^8.2.2",
51
+ "@wordpress/is-shallow-equal": "^4.6.1",
52
+ "@wordpress/keyboard-shortcuts": "^3.4.1",
53
+ "@wordpress/keycodes": "^3.6.1",
54
+ "@wordpress/notices": "^3.6.1",
55
+ "@wordpress/rich-text": "^5.4.1",
56
+ "@wordpress/shortcode": "^3.6.1",
57
+ "@wordpress/style-engine": "^0.5.1",
58
+ "@wordpress/token-list": "^2.6.1",
59
+ "@wordpress/url": "^3.7.1",
60
+ "@wordpress/warning": "^2.6.1",
61
+ "@wordpress/wordcount": "^3.6.1",
62
62
  "classnames": "^2.3.1",
63
63
  "colord": "^2.7.0",
64
64
  "diff": "^4.0.2",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "11eb1241e63c9240018323551c6753f8a5fa96f9"
80
+ "gitHead": "37e930b93fbba88fa024a91eb527a90f855c97f3"
81
81
  }
@@ -6,7 +6,7 @@ import classNames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __ } from '@wordpress/i18n';
9
+ import { __, _x } from '@wordpress/i18n';
10
10
  import {
11
11
  ToolbarDropdownMenu,
12
12
  ToolbarGroup,
@@ -31,7 +31,7 @@ import useAvailableAlignments from './use-available-alignments';
31
31
  const BLOCK_ALIGNMENTS_CONTROLS = {
32
32
  none: {
33
33
  icon: alignNone,
34
- title: __( 'None' ),
34
+ title: _x( 'None', 'Alignment option' ),
35
35
  },
36
36
  left: {
37
37
  icon: positionLeft,
@@ -25,6 +25,7 @@ export default function BlockContentOverlay( {
25
25
  const [ isHovered, setIsHovered ] = useState( false );
26
26
 
27
27
  const {
28
+ canEdit,
28
29
  isParentSelected,
29
30
  hasChildSelected,
30
31
  isDraggingBlocks,
@@ -36,8 +37,10 @@ export default function BlockContentOverlay( {
36
37
  hasSelectedInnerBlock,
37
38
  isDraggingBlocks: _isDraggingBlocks,
38
39
  isBlockHighlighted,
40
+ canEditBlock,
39
41
  } = select( blockEditorStore );
40
42
  return {
43
+ canEdit: canEditBlock( clientId ),
41
44
  isParentSelected: isBlockSelected( clientId ),
42
45
  hasChildSelected: hasSelectedInnerBlock( clientId, true ),
43
46
  isDraggingBlocks: _isDraggingBlocks(),
@@ -59,6 +62,12 @@ export default function BlockContentOverlay( {
59
62
  );
60
63
 
61
64
  useEffect( () => {
65
+ // The overlay is always active when editing is locked.
66
+ if ( ! canEdit ) {
67
+ setIsOverlayActive( true );
68
+ return;
69
+ }
70
+
62
71
  // Reenable when blocks are not in use.
63
72
  if ( ! isParentSelected && ! hasChildSelected && ! isOverlayActive ) {
64
73
  setIsOverlayActive( true );
@@ -75,7 +84,13 @@ export default function BlockContentOverlay( {
75
84
  if ( hasChildSelected && isOverlayActive ) {
76
85
  setIsOverlayActive( false );
77
86
  }
78
- }, [ isParentSelected, hasChildSelected, isOverlayActive, isHovered ] );
87
+ }, [
88
+ isParentSelected,
89
+ hasChildSelected,
90
+ isOverlayActive,
91
+ isHovered,
92
+ canEdit,
93
+ ] );
79
94
 
80
95
  // Disabled because the overlay div doesn't actually have a role or functionality
81
96
  // as far as the a11y is concerned. We're just catching the first click so that
@@ -88,7 +103,9 @@ export default function BlockContentOverlay( {
88
103
  onMouseEnter={ () => setIsHovered( true ) }
89
104
  onMouseLeave={ () => setIsHovered( false ) }
90
105
  onMouseUp={
91
- isOverlayActive ? () => setIsOverlayActive( false ) : undefined
106
+ isOverlayActive && canEdit
107
+ ? () => setIsOverlayActive( false )
108
+ : undefined
92
109
  }
93
110
  >
94
111
  { wrapperProps?.children }
@@ -10,7 +10,6 @@
10
10
  border: none;
11
11
  border-radius: $radius-block-ui;
12
12
  z-index: z-index(".block-editor-block-content-overlay__overlay");
13
- pointer-events: none;
14
13
  }
15
14
 
16
15
  &:hover:not(.is-dragging-blocks).overlay-active::before,
@@ -1,3 +1,4 @@
1
1
  export { default as BlockLockMenuItem } from './menu-item';
2
2
  export { default as BlockLockModal } from './modal';
3
3
  export { default as BlockLockToolbar } from './toolbar';
4
+ export { default as useBlockLock } from './use-block-lock';
@@ -4,43 +4,23 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { useReducer } from '@wordpress/element';
6
6
  import { MenuItem } from '@wordpress/components';
7
- import { useSelect } from '@wordpress/data';
8
7
  import { lock, unlock } from '@wordpress/icons';
9
8
 
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
12
+ import useBlockLock from './use-block-lock';
13
13
  import BlockLockModal from './modal';
14
- import { store as blockEditorStore } from '../../store';
15
14
 
16
15
  export default function BlockLockMenuItem( { clientId } ) {
17
- const { canLockBlock, isLocked } = useSelect(
18
- ( select ) => {
19
- const {
20
- canMoveBlock,
21
- canRemoveBlock,
22
- canLockBlockType,
23
- getBlockName,
24
- getBlockRootClientId,
25
- } = select( blockEditorStore );
26
- const rootClientId = getBlockRootClientId( clientId );
27
-
28
- return {
29
- canLockBlock: canLockBlockType( getBlockName( clientId ) ),
30
- isLocked:
31
- ! canMoveBlock( clientId, rootClientId ) ||
32
- ! canRemoveBlock( clientId, rootClientId ),
33
- };
34
- },
35
- [ clientId ]
36
- );
16
+ const { canLock, isLocked } = useBlockLock( clientId );
37
17
 
38
18
  const [ isModalOpen, toggleModal ] = useReducer(
39
19
  ( isActive ) => ! isActive,
40
20
  false
41
21
  );
42
22
 
43
- if ( ! canLockBlock ) {
23
+ if ( ! canLock ) {
44
24
  return null;
45
25
  }
46
26
 
@@ -14,27 +14,25 @@ import {
14
14
  import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';
15
15
  import { useInstanceId } from '@wordpress/compose';
16
16
  import { useDispatch, useSelect } from '@wordpress/data';
17
+ import { isReusableBlock, getBlockType } from '@wordpress/blocks';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
20
21
  */
22
+ import useBlockLock from './use-block-lock';
21
23
  import useBlockDisplayInformation from '../use-block-display-information';
22
24
  import { store as blockEditorStore } from '../../store';
23
25
 
24
26
  export default function BlockLockModal( { clientId, onClose } ) {
25
27
  const [ lock, setLock ] = useState( { move: false, remove: false } );
26
- const { canMove, canRemove } = useSelect(
28
+ const { canEdit, canMove, canRemove } = useBlockLock( clientId );
29
+ const { isReusable } = useSelect(
27
30
  ( select ) => {
28
- const {
29
- canMoveBlock,
30
- canRemoveBlock,
31
- getBlockRootClientId,
32
- } = select( blockEditorStore );
33
- const rootClientId = getBlockRootClientId( clientId );
31
+ const { getBlockName } = select( blockEditorStore );
32
+ const blockName = getBlockName( clientId );
34
33
 
35
34
  return {
36
- canMove: canMoveBlock( clientId, rootClientId ),
37
- canRemove: canRemoveBlock( clientId, rootClientId ),
35
+ isReusable: isReusableBlock( getBlockType( blockName ) ),
38
36
  };
39
37
  },
40
38
  [ clientId ]
@@ -50,12 +48,12 @@ export default function BlockLockModal( { clientId, onClose } ) {
50
48
  setLock( {
51
49
  move: ! canMove,
52
50
  remove: ! canRemove,
51
+ ...( isReusable ? { edit: ! canEdit } : {} ),
53
52
  } );
54
- }, [ canMove, canRemove ] );
53
+ }, [ canEdit, canMove, canRemove, isReusable ] );
55
54
 
56
55
  const isAllChecked = Object.values( lock ).every( Boolean );
57
- const isIndeterminate =
58
- Object.values( lock ).some( Boolean ) && ! isAllChecked;
56
+ const isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;
59
57
 
60
58
  return (
61
59
  <Modal
@@ -91,15 +89,41 @@ export default function BlockLockModal( { clientId, onClose } ) {
91
89
  <span id={ instanceId }>{ __( 'Lock all' ) }</span>
92
90
  }
93
91
  checked={ isAllChecked }
94
- indeterminate={ isIndeterminate }
92
+ indeterminate={ isMixed }
95
93
  onChange={ ( newValue ) =>
96
94
  setLock( {
97
95
  move: newValue,
98
96
  remove: newValue,
97
+ ...( isReusable ? { edit: newValue } : {} ),
99
98
  } )
100
99
  }
101
100
  />
102
101
  <ul className="block-editor-block-lock-modal__checklist">
102
+ { isReusable && (
103
+ <li className="block-editor-block-lock-modal__checklist-item">
104
+ <CheckboxControl
105
+ label={
106
+ <>
107
+ { __( 'Restrict editing' ) }
108
+ <Icon
109
+ icon={
110
+ lock.edit
111
+ ? lockIcon
112
+ : unlockIcon
113
+ }
114
+ />
115
+ </>
116
+ }
117
+ checked={ !! lock.edit }
118
+ onChange={ ( edit ) =>
119
+ setLock( ( prevLock ) => ( {
120
+ ...prevLock,
121
+ edit,
122
+ } ) )
123
+ }
124
+ />
125
+ </li>
126
+ ) }
103
127
  <li className="block-editor-block-lock-modal__checklist-item">
104
128
  <CheckboxControl
105
129
  label={
@@ -63,8 +63,7 @@
63
63
  padding-left: 0 !important;
64
64
 
65
65
  &:focus::before {
66
- left: 0 !important;
67
- right: $grid-unit-15 !important;
66
+ right: $grid-unit-10 !important;
68
67
  }
69
68
  }
70
69
  }