@wordpress/block-editor 9.1.0 → 9.2.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-draggable/draggable-chip.native.js +2 -1
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build/components/block-draggable/index.native.js +7 -3
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -1
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +2 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +9 -6
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +70 -94
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +55 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/elements/index.js +9 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +14 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +5 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +14 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +17 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +29 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +2 -1
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +7 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +2 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +9 -6
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +72 -96
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +42 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/elements/index.js +2 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +14 -4
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +4 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +37 -34
- package/build-style/style.css +37 -34
- package/package.json +30 -30
- package/src/components/block-draggable/draggable-chip.native.js +1 -1
- package/src/components/block-draggable/index.native.js +4 -0
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +496 -0
- package/src/components/block-list/block.native.js +1 -0
- package/src/components/block-list/index.js +44 -44
- package/src/components/block-mobile-toolbar/index.native.js +1 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +4 -0
- package/src/components/block-popover/inbetween.js +12 -7
- package/src/components/block-popover/index.js +1 -0
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-variation-transforms/index.js +6 -2
- package/src/components/colors-gradients/dropdown.js +35 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +11 -37
- package/src/components/convert-to-group-buttons/toolbar.js +30 -13
- package/src/components/index.js +1 -0
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/plain-text/index.native.js +64 -8
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +50 -0
- package/src/components/publish-date-time-picker/style.scss +20 -0
- package/src/components/rich-text/index.js +2 -0
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/elements/index.js +1 -0
- package/src/hooks/color.js +5 -74
- package/src/hooks/color.scss +9 -0
- package/src/hooks/dimensions.js +11 -3
- package/src/index.js +1 -0
- package/src/layouts/flex.js +11 -3
- package/src/store/actions.js +12 -0
- package/src/store/reducer.js +14 -1
- package/src/store/selectors.js +28 -0
- package/src/store/test/reducer.js +5 -0
- package/src/style.scss +1 -0
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.js.map +0 -1
- package/build-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.js.map +0 -1
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
|
@@ -1654,21 +1654,10 @@
|
|
|
1654
1654
|
min-width: 0;
|
|
1655
1655
|
}
|
|
1656
1656
|
|
|
1657
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-
|
|
1658
|
-
display:
|
|
1659
|
-
gap: 8px;
|
|
1660
|
-
}
|
|
1661
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator {
|
|
1662
|
-
width: 12px;
|
|
1663
|
-
height: 12px;
|
|
1664
|
-
align-self: center;
|
|
1665
|
-
}
|
|
1666
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child {
|
|
1667
|
-
margin-right: 12px;
|
|
1668
|
-
}
|
|
1669
|
-
.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator {
|
|
1670
|
-
display: none;
|
|
1657
|
+
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings, .block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings > div:not(:first-of-type) {
|
|
1658
|
+
display: block;
|
|
1671
1659
|
}
|
|
1660
|
+
|
|
1672
1661
|
@media screen and (min-width: 782px) {
|
|
1673
1662
|
.block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches {
|
|
1674
1663
|
display: grid;
|
|
@@ -1679,31 +1668,11 @@
|
|
|
1679
1668
|
.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control {
|
|
1680
1669
|
margin-bottom: inherit;
|
|
1681
1670
|
}
|
|
1682
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown {
|
|
1683
|
-
display: block;
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1687
|
-
width: 100%;
|
|
1688
|
-
}
|
|
1689
1671
|
|
|
1690
1672
|
.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content {
|
|
1691
1673
|
width: 280px;
|
|
1692
1674
|
}
|
|
1693
1675
|
|
|
1694
|
-
.block-editor-panel-color-gradient-settings__dropdown:last-child > div {
|
|
1695
|
-
border-bottom-width: 0;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
.block-editor-panel-color-gradient-settings__item {
|
|
1699
|
-
padding-top: 12px !important;
|
|
1700
|
-
padding-bottom: 12px !important;
|
|
1701
|
-
}
|
|
1702
|
-
.block-editor-panel-color-gradient-settings__item.is-open {
|
|
1703
|
-
background: #f0f0f0;
|
|
1704
|
-
color: var(--wp-admin-theme-color);
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
1676
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
1708
1677
|
background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1709
1678
|
}
|
|
@@ -1722,6 +1691,7 @@
|
|
|
1722
1691
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
1723
1692
|
}
|
|
1724
1693
|
.block-editor-tools-panel-color-gradient-settings__item.first {
|
|
1694
|
+
margin-top: 24px;
|
|
1725
1695
|
border-top-right-radius: 2px;
|
|
1726
1696
|
border-top-left-radius: 2px;
|
|
1727
1697
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -1747,6 +1717,10 @@
|
|
|
1747
1717
|
color: var(--wp-admin-theme-color);
|
|
1748
1718
|
}
|
|
1749
1719
|
|
|
1720
|
+
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1721
|
+
width: 100%;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1750
1724
|
.block-editor-contrast-checker > .components-notice {
|
|
1751
1725
|
margin: 0;
|
|
1752
1726
|
}
|
|
@@ -3022,6 +2996,27 @@
|
|
|
3022
2996
|
width: 100%;
|
|
3023
2997
|
}
|
|
3024
2998
|
|
|
2999
|
+
.block-editor-publish-date-time-picker__header {
|
|
3000
|
+
margin-bottom: 1em;
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
.block-editor-publish-date-time-picker__heading {
|
|
3004
|
+
font-size: 13px;
|
|
3005
|
+
margin: 0;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
.block-editor-publish-date-time-picker__reset {
|
|
3009
|
+
height: 24px;
|
|
3010
|
+
margin: 0;
|
|
3011
|
+
text-decoration: underline;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
[class].block-editor-publish-date-time-picker__close {
|
|
3015
|
+
height: 24px;
|
|
3016
|
+
min-width: 24px;
|
|
3017
|
+
padding: 0;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3025
3020
|
.block-editor-responsive-block-control {
|
|
3026
3021
|
margin-bottom: 28px;
|
|
3027
3022
|
border-bottom: 1px solid #ccc;
|
|
@@ -3568,6 +3563,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3568
3563
|
|
|
3569
3564
|
.color-block-support-panel {
|
|
3570
3565
|
/* Increased specificity required to remove the slot wrapper's row gap */
|
|
3566
|
+
/**
|
|
3567
|
+
* After converting PanelColorGradientSettings to render as a ToolsPanel
|
|
3568
|
+
* we need to remove the top margin when wrapping inner content due to
|
|
3569
|
+
* rendering via SlotFills.
|
|
3570
|
+
*/
|
|
3571
3571
|
}
|
|
3572
3572
|
.color-block-support-panel .block-editor-contrast-checker {
|
|
3573
3573
|
/**
|
|
@@ -3585,6 +3585,9 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3585
3585
|
.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper {
|
|
3586
3586
|
row-gap: 0;
|
|
3587
3587
|
}
|
|
3588
|
+
.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first {
|
|
3589
|
+
margin-top: 0;
|
|
3590
|
+
}
|
|
3588
3591
|
|
|
3589
3592
|
.block-editor__padding-visualizer {
|
|
3590
3593
|
position: absolute;
|
package/build-style/style.css
CHANGED
|
@@ -1654,21 +1654,10 @@
|
|
|
1654
1654
|
min-width: 0;
|
|
1655
1655
|
}
|
|
1656
1656
|
|
|
1657
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-
|
|
1658
|
-
display:
|
|
1659
|
-
gap: 8px;
|
|
1660
|
-
}
|
|
1661
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator {
|
|
1662
|
-
width: 12px;
|
|
1663
|
-
height: 12px;
|
|
1664
|
-
align-self: center;
|
|
1665
|
-
}
|
|
1666
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator:first-child {
|
|
1667
|
-
margin-left: 12px;
|
|
1668
|
-
}
|
|
1669
|
-
.block-editor-panel-color-gradient-settings.is-opened .block-editor-panel-color-gradient-settings__panel-title .component-color-indicator {
|
|
1670
|
-
display: none;
|
|
1657
|
+
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings, .block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings > div:not(:first-of-type) {
|
|
1658
|
+
display: block;
|
|
1671
1659
|
}
|
|
1660
|
+
|
|
1672
1661
|
@media screen and (min-width: 782px) {
|
|
1673
1662
|
.block-editor-panel-color-gradient-settings .components-circular-option-picker__swatches {
|
|
1674
1663
|
display: grid;
|
|
@@ -1679,31 +1668,11 @@
|
|
|
1679
1668
|
.block-editor-block-inspector .block-editor-panel-color-gradient-settings .components-base-control {
|
|
1680
1669
|
margin-bottom: inherit;
|
|
1681
1670
|
}
|
|
1682
|
-
.block-editor-panel-color-gradient-settings .block-editor-panel-color-gradient-settings__dropdown {
|
|
1683
|
-
display: block;
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1687
|
-
width: 100%;
|
|
1688
|
-
}
|
|
1689
1671
|
|
|
1690
1672
|
.block-editor-panel-color-gradient-settings__dropdown-content .components-popover__content {
|
|
1691
1673
|
width: 280px;
|
|
1692
1674
|
}
|
|
1693
1675
|
|
|
1694
|
-
.block-editor-panel-color-gradient-settings__dropdown:last-child > div {
|
|
1695
|
-
border-bottom-width: 0;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
.block-editor-panel-color-gradient-settings__item {
|
|
1699
|
-
padding-top: 12px !important;
|
|
1700
|
-
padding-bottom: 12px !important;
|
|
1701
|
-
}
|
|
1702
|
-
.block-editor-panel-color-gradient-settings__item.is-open {
|
|
1703
|
-
background: #f0f0f0;
|
|
1704
|
-
color: var(--wp-admin-theme-color);
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
1676
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
1708
1677
|
background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1709
1678
|
}
|
|
@@ -1722,6 +1691,7 @@
|
|
|
1722
1691
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
1723
1692
|
}
|
|
1724
1693
|
.block-editor-tools-panel-color-gradient-settings__item.first {
|
|
1694
|
+
margin-top: 24px;
|
|
1725
1695
|
border-top-left-radius: 2px;
|
|
1726
1696
|
border-top-right-radius: 2px;
|
|
1727
1697
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -1747,6 +1717,10 @@
|
|
|
1747
1717
|
color: var(--wp-admin-theme-color);
|
|
1748
1718
|
}
|
|
1749
1719
|
|
|
1720
|
+
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1721
|
+
width: 100%;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1750
1724
|
.block-editor-contrast-checker > .components-notice {
|
|
1751
1725
|
margin: 0;
|
|
1752
1726
|
}
|
|
@@ -3022,6 +2996,27 @@
|
|
|
3022
2996
|
width: 100%;
|
|
3023
2997
|
}
|
|
3024
2998
|
|
|
2999
|
+
.block-editor-publish-date-time-picker__header {
|
|
3000
|
+
margin-bottom: 1em;
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
.block-editor-publish-date-time-picker__heading {
|
|
3004
|
+
font-size: 13px;
|
|
3005
|
+
margin: 0;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
.block-editor-publish-date-time-picker__reset {
|
|
3009
|
+
height: 24px;
|
|
3010
|
+
margin: 0;
|
|
3011
|
+
text-decoration: underline;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
[class].block-editor-publish-date-time-picker__close {
|
|
3015
|
+
height: 24px;
|
|
3016
|
+
min-width: 24px;
|
|
3017
|
+
padding: 0;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3025
3020
|
.block-editor-responsive-block-control {
|
|
3026
3021
|
margin-bottom: 28px;
|
|
3027
3022
|
border-bottom: 1px solid #ccc;
|
|
@@ -3568,6 +3563,11 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3568
3563
|
|
|
3569
3564
|
.color-block-support-panel {
|
|
3570
3565
|
/* Increased specificity required to remove the slot wrapper's row gap */
|
|
3566
|
+
/**
|
|
3567
|
+
* After converting PanelColorGradientSettings to render as a ToolsPanel
|
|
3568
|
+
* we need to remove the top margin when wrapping inner content due to
|
|
3569
|
+
* rendering via SlotFills.
|
|
3570
|
+
*/
|
|
3571
3571
|
}
|
|
3572
3572
|
.color-block-support-panel .block-editor-contrast-checker {
|
|
3573
3573
|
/**
|
|
@@ -3585,6 +3585,9 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3585
3585
|
.color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper {
|
|
3586
3586
|
row-gap: 0;
|
|
3587
3587
|
}
|
|
3588
|
+
.color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first {
|
|
3589
|
+
margin-top: 0;
|
|
3590
|
+
}
|
|
3588
3591
|
|
|
3589
3592
|
.block-editor__padding-visualizer {
|
|
3590
3593
|
position: absolute;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,33 +32,33 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@react-spring/web": "^9.
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^11.
|
|
40
|
-
"@wordpress/components": "^19.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/data": "^6.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
53
|
-
"@wordpress/keycodes": "^3.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/rich-text": "^5.
|
|
56
|
-
"@wordpress/shortcode": "^3.
|
|
57
|
-
"@wordpress/style-engine": "^0.
|
|
58
|
-
"@wordpress/token-list": "^2.
|
|
59
|
-
"@wordpress/url": "^3.
|
|
60
|
-
"@wordpress/warning": "^2.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
35
|
+
"@react-spring/web": "^9.4.5",
|
|
36
|
+
"@wordpress/a11y": "^3.10.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.7.0",
|
|
38
|
+
"@wordpress/blob": "^3.10.0",
|
|
39
|
+
"@wordpress/blocks": "^11.9.0",
|
|
40
|
+
"@wordpress/components": "^19.12.0",
|
|
41
|
+
"@wordpress/compose": "^5.8.0",
|
|
42
|
+
"@wordpress/data": "^6.10.0",
|
|
43
|
+
"@wordpress/date": "^4.10.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.10.0",
|
|
45
|
+
"@wordpress/dom": "^3.10.0",
|
|
46
|
+
"@wordpress/element": "^4.8.0",
|
|
47
|
+
"@wordpress/hooks": "^3.10.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.10.0",
|
|
49
|
+
"@wordpress/i18n": "^4.10.0",
|
|
50
|
+
"@wordpress/icons": "^9.1.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.10.0",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.8.0",
|
|
53
|
+
"@wordpress/keycodes": "^3.10.0",
|
|
54
|
+
"@wordpress/notices": "^3.10.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.8.0",
|
|
56
|
+
"@wordpress/shortcode": "^3.10.0",
|
|
57
|
+
"@wordpress/style-engine": "^0.9.0",
|
|
58
|
+
"@wordpress/token-list": "^2.10.0",
|
|
59
|
+
"@wordpress/url": "^3.11.0",
|
|
60
|
+
"@wordpress/warning": "^2.10.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.10.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"colord": "^2.7.0",
|
|
64
64
|
"diff": "^4.0.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"lodash": "^4.17.21",
|
|
68
68
|
"react-autosize-textarea": "^7.1.0",
|
|
69
69
|
"react-easy-crop": "^3.0.0",
|
|
70
|
-
"rememo": "^
|
|
70
|
+
"rememo": "^4.0.0",
|
|
71
71
|
"traverse": "^0.6.6"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "a3e0b62091e8a8bdf5e2518e42d60d7098af48cc"
|
|
81
81
|
}
|
|
@@ -41,7 +41,7 @@ export default function BlockDraggableChip( { icon } ) {
|
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<View style={ [ containerStyle, shadowStyle ] }>
|
|
44
|
+
<View style={ [ containerStyle, shadowStyle ] } testID="draggable-chip">
|
|
45
45
|
<BlockIcon icon={ dragHandle } />
|
|
46
46
|
{ icon && <BlockIcon icon={ icon } /> }
|
|
47
47
|
</View>
|
|
@@ -270,6 +270,7 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
|
270
270
|
onDragStart={ startDragging }
|
|
271
271
|
onDragOver={ updateDragging }
|
|
272
272
|
onDragEnd={ stopDragging }
|
|
273
|
+
testID="block-draggable-wrapper"
|
|
273
274
|
>
|
|
274
275
|
{ children( { onScroll: scrollHandler } ) }
|
|
275
276
|
</Draggable>
|
|
@@ -302,6 +303,7 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
|
302
303
|
* @param {string} props.clientId Client id of the block.
|
|
303
304
|
* @param {string} [props.draggingClientId] Client id to use for dragging. If not defined, the value from `clientId` will be used.
|
|
304
305
|
* @param {boolean} [props.enabled] Enables the draggable trigger.
|
|
306
|
+
* @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.
|
|
305
307
|
*
|
|
306
308
|
* @return {Function} Render function which includes the parameter `isDraggable` to determine if the block can be dragged.
|
|
307
309
|
*/
|
|
@@ -310,6 +312,7 @@ const BlockDraggable = ( {
|
|
|
310
312
|
children,
|
|
311
313
|
draggingClientId,
|
|
312
314
|
enabled = true,
|
|
315
|
+
testID,
|
|
313
316
|
} ) => {
|
|
314
317
|
const wasBeingDragged = useRef( false );
|
|
315
318
|
const [ isEditingText, setIsEditingText ] = useState( false );
|
|
@@ -446,6 +449,7 @@ const BlockDraggable = ( {
|
|
|
446
449
|
android: DEFAULT_LONG_PRESS_MIN_DURATION,
|
|
447
450
|
} ) }
|
|
448
451
|
onLongPress={ onLongPressDraggable }
|
|
452
|
+
testID={ testID }
|
|
449
453
|
>
|
|
450
454
|
<Animated.View style={ wrapperStyles }>
|
|
451
455
|
{ children( { isDraggable: true } ) }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`BlockDraggable moves blocks: Initial order 1`] = `
|
|
4
|
+
"<!-- wp:paragraph -->
|
|
5
|
+
<p>This is a paragraph.</p>
|
|
6
|
+
<!-- /wp:paragraph -->
|
|
7
|
+
|
|
8
|
+
<!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
|
|
9
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
10
|
+
<!-- /wp:image -->
|
|
11
|
+
|
|
12
|
+
<!-- wp:spacer -->
|
|
13
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
14
|
+
<!-- /wp:spacer -->
|
|
15
|
+
|
|
16
|
+
<!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
|
|
17
|
+
<figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
18
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
19
|
+
<!-- /wp:image -->
|
|
20
|
+
|
|
21
|
+
<!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
22
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
23
|
+
<!-- /wp:image --></figure>
|
|
24
|
+
<!-- /wp:gallery -->"
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`BlockDraggable moves blocks: Paragraph block moved from first to second position 1`] = `
|
|
28
|
+
"<!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
|
|
29
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
30
|
+
<!-- /wp:image -->
|
|
31
|
+
|
|
32
|
+
<!-- wp:paragraph -->
|
|
33
|
+
<p>This is a paragraph.</p>
|
|
34
|
+
<!-- /wp:paragraph -->
|
|
35
|
+
|
|
36
|
+
<!-- wp:spacer -->
|
|
37
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
38
|
+
<!-- /wp:spacer -->
|
|
39
|
+
|
|
40
|
+
<!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
|
|
41
|
+
<figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
42
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
43
|
+
<!-- /wp:image -->
|
|
44
|
+
|
|
45
|
+
<!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
46
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
47
|
+
<!-- /wp:image --></figure>
|
|
48
|
+
<!-- /wp:gallery -->"
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`BlockDraggable moves blocks: Spacer block moved from third to first position 1`] = `
|
|
52
|
+
"<!-- wp:spacer -->
|
|
53
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
54
|
+
<!-- /wp:spacer -->
|
|
55
|
+
|
|
56
|
+
<!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
|
|
57
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
58
|
+
<!-- /wp:image -->
|
|
59
|
+
|
|
60
|
+
<!-- wp:paragraph -->
|
|
61
|
+
<p>This is a paragraph.</p>
|
|
62
|
+
<!-- /wp:paragraph -->
|
|
63
|
+
|
|
64
|
+
<!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
|
|
65
|
+
<figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
66
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
67
|
+
<!-- /wp:image -->
|
|
68
|
+
|
|
69
|
+
<!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
70
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
|
|
71
|
+
<!-- /wp:image --></figure>
|
|
72
|
+
<!-- /wp:gallery -->"
|
|
73
|
+
`;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
act,
|
|
6
|
+
fireEvent,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
waitForStoreResolvers,
|
|
9
|
+
within,
|
|
10
|
+
advanceAnimationByFrame,
|
|
11
|
+
} from 'test/helpers';
|
|
12
|
+
import { fireGestureHandler } from 'react-native-gesture-handler/jest-utils';
|
|
13
|
+
import { State } from 'react-native-gesture-handler';
|
|
14
|
+
|
|
15
|
+
// Touch event type constants have been extracted from original source code, as they are not exported in the package.
|
|
16
|
+
// Reference: https://github.com/software-mansion/react-native-gesture-handler/blob/90895e5f38616a6be256fceec6c6a391cd9ad7c7/src/TouchEventType.ts
|
|
17
|
+
export const TouchEventType = {
|
|
18
|
+
UNDETERMINED: 0,
|
|
19
|
+
TOUCHES_DOWN: 1,
|
|
20
|
+
TOUCHES_MOVE: 2,
|
|
21
|
+
TOUCHES_UP: 3,
|
|
22
|
+
TOUCHES_CANCELLED: 4,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const DEFAULT_TOUCH_EVENTS = [
|
|
26
|
+
{
|
|
27
|
+
id: 1,
|
|
28
|
+
eventType: TouchEventType.TOUCHES_DOWN,
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} WPBlockWithLayout
|
|
36
|
+
* @property {string} name Name of the block (e.g. Paragraph).
|
|
37
|
+
* @property {string} html HTML content.
|
|
38
|
+
* @property {Object} layout Layout data.
|
|
39
|
+
* @property {Object} layout.x X position.
|
|
40
|
+
* @property {Object} layout.y Y position.
|
|
41
|
+
* @property {Object} layout.width Width.
|
|
42
|
+
* @property {Object} layout.height Height.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Initialize the editor with an array of blocks that include their HTML and layout.
|
|
47
|
+
*
|
|
48
|
+
* @param {WPBlockWithLayout[]} blocks Initial blocks.
|
|
49
|
+
*
|
|
50
|
+
* @return {import('@testing-library/react-native').RenderAPI} The Testing Library screen.
|
|
51
|
+
*/
|
|
52
|
+
export const initializeWithBlocksLayouts = async ( blocks ) => {
|
|
53
|
+
const initialHtml = blocks.map( ( block ) => block.html ).join( '\n' );
|
|
54
|
+
|
|
55
|
+
const screen = await initializeEditor( { initialHtml } );
|
|
56
|
+
const { getByA11yLabel } = screen;
|
|
57
|
+
|
|
58
|
+
const waitPromises = [];
|
|
59
|
+
blocks.forEach( ( block, index ) => {
|
|
60
|
+
const a11yLabel = new RegExp(
|
|
61
|
+
`${ block.name } Block\\. Row ${ index + 1 }`
|
|
62
|
+
);
|
|
63
|
+
const element = getByA11yLabel( a11yLabel );
|
|
64
|
+
// "onLayout" event will populate the blocks layouts data.
|
|
65
|
+
fireEvent( element, 'layout', {
|
|
66
|
+
nativeEvent: { layout: block.layout },
|
|
67
|
+
} );
|
|
68
|
+
if ( block.nestedBlocks ) {
|
|
69
|
+
// Nested blocks are rendered via the FlatList of the inner block list.
|
|
70
|
+
// In order to render the items of a FlatList, it's required to trigger the
|
|
71
|
+
// "onLayout" event. Additionally, the call is wrapped over "waitForStoreResolvers"
|
|
72
|
+
// because the nested blocks might make API requests (e.g. the Gallery block).
|
|
73
|
+
waitPromises.push(
|
|
74
|
+
waitForStoreResolvers( () =>
|
|
75
|
+
fireEvent(
|
|
76
|
+
within( element ).getByTestId( 'block-list-wrapper' ),
|
|
77
|
+
'layout',
|
|
78
|
+
{
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
layout: {
|
|
81
|
+
width: block.layout.width,
|
|
82
|
+
height: block.layout.height,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
block.nestedBlocks.forEach( ( nestedBlock, nestedIndex ) => {
|
|
91
|
+
const nestedA11yLabel = new RegExp(
|
|
92
|
+
`${ nestedBlock.name } Block\\. Row ${ nestedIndex + 1 }`
|
|
93
|
+
);
|
|
94
|
+
fireEvent(
|
|
95
|
+
within( element ).getByA11yLabel( nestedA11yLabel ),
|
|
96
|
+
'layout',
|
|
97
|
+
{
|
|
98
|
+
nativeEvent: { layout: nestedBlock.layout },
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
} );
|
|
102
|
+
}
|
|
103
|
+
} );
|
|
104
|
+
await Promise.all( waitPromises );
|
|
105
|
+
|
|
106
|
+
return screen;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Fires long-press gesture event on a block.
|
|
111
|
+
*
|
|
112
|
+
* @param {import('react-test-renderer').ReactTestInstance} block Block test instance.
|
|
113
|
+
* @param {string} testID Id for querying the draggable trigger element.
|
|
114
|
+
* @param {Object} [options] Configuration options for the gesture event.
|
|
115
|
+
* @param {boolean} [options.failed] Determines if the gesture should fail.
|
|
116
|
+
* @param {number} [options.triggerIndex] In case there are multiple draggable triggers, this specifies the index to use.
|
|
117
|
+
*/
|
|
118
|
+
export const fireLongPress = (
|
|
119
|
+
block,
|
|
120
|
+
testID,
|
|
121
|
+
{ failed = false, triggerIndex } = {}
|
|
122
|
+
) => {
|
|
123
|
+
const draggableTrigger =
|
|
124
|
+
typeof triggerIndex !== 'undefined'
|
|
125
|
+
? within( block ).getAllByTestId( testID )[ triggerIndex ]
|
|
126
|
+
: within( block ).getByTestId( testID );
|
|
127
|
+
if ( failed ) {
|
|
128
|
+
fireGestureHandler( draggableTrigger, [ { state: State.FAILED } ] );
|
|
129
|
+
} else {
|
|
130
|
+
fireGestureHandler( draggableTrigger, [
|
|
131
|
+
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
132
|
+
{ state: State.ACTIVE },
|
|
133
|
+
{ state: State.END },
|
|
134
|
+
] );
|
|
135
|
+
}
|
|
136
|
+
// Advance timers one frame to ensure that shared values
|
|
137
|
+
// are updated and trigger animation reactions.
|
|
138
|
+
act( () => advanceAnimationByFrame( 1 ) );
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Fires pan gesture event on a BlockDraggable component.
|
|
143
|
+
*
|
|
144
|
+
* @param {import('react-test-renderer').ReactTestInstance} blockDraggable BlockDraggable test instance.
|
|
145
|
+
* @param {Object} [touchEvents] Array of touch events to dispatch on the pan gesture.
|
|
146
|
+
*/
|
|
147
|
+
export const firePanGesture = (
|
|
148
|
+
blockDraggable,
|
|
149
|
+
touchEvents = DEFAULT_TOUCH_EVENTS
|
|
150
|
+
) => {
|
|
151
|
+
const gestureTouchEvents = touchEvents.map(
|
|
152
|
+
( { eventType, ...touchEvent } ) => ( {
|
|
153
|
+
allTouches: [ touchEvent ],
|
|
154
|
+
eventType,
|
|
155
|
+
} )
|
|
156
|
+
);
|
|
157
|
+
fireGestureHandler( blockDraggable, [
|
|
158
|
+
// TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
|
|
159
|
+
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
160
|
+
...gestureTouchEvents,
|
|
161
|
+
{ state: State.END },
|
|
162
|
+
] );
|
|
163
|
+
// Advance timers one frame to ensure that shared values
|
|
164
|
+
// are updated and trigger animation reactions.
|
|
165
|
+
act( () => advanceAnimationByFrame( 1 ) );
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Gets the draggable chip element.
|
|
170
|
+
*
|
|
171
|
+
* @param {import('@testing-library/react-native').RenderAPI} screen The Testing Library screen.
|
|
172
|
+
*
|
|
173
|
+
* @return {import('react-test-renderer').ReactTestInstance} Draggable chip test instance.
|
|
174
|
+
*/
|
|
175
|
+
export const getDraggableChip = ( { getByTestId } ) => {
|
|
176
|
+
let draggableChip;
|
|
177
|
+
try {
|
|
178
|
+
draggableChip = getByTestId( 'draggable-chip' );
|
|
179
|
+
} catch ( e ) {
|
|
180
|
+
// NOOP.
|
|
181
|
+
}
|
|
182
|
+
return draggableChip;
|
|
183
|
+
};
|