@wordpress/block-editor 8.6.0 → 9.0.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 +7 -0
- package/README.md +4 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/index.js +20 -5
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.js +21 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/url-input/index.js +7 -3
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +1 -3
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +49 -8
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/selectors.js +14 -12
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/index.js +21 -5
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.js +21 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/url-input/index.js +7 -3
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +1 -3
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +49 -8
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/dimensions.js +5 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/selectors.js +14 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +17 -31
- package/build-style/style.css +17 -31
- package/package.json +28 -28
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-content-overlay/style.scss +0 -1
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/index.js +20 -3
- package/src/components/block-popover/style.scss +3 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +0 -1
- package/src/components/inserter/index.js +20 -0
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/quick-inserter.js +3 -11
- package/src/components/inserter/style.native.scss +1 -0
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/index.js +11 -41
- package/src/components/url-input/index.js +6 -3
- package/src/components/use-setting/index.js +57 -21
- package/src/components/writing-flow/use-click-selection.js +1 -4
- package/src/components/writing-flow/use-selection-observer.js +55 -10
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +1 -0
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/test/settings.js +48 -0
- package/src/store/defaults.js +0 -1
- package/src/store/selectors.js +14 -12
- package/src/store/test/selectors.js +17 -0
- package/src/style.scss +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
|
@@ -358,6 +358,9 @@
|
|
|
358
358
|
border-radius: 1px;
|
|
359
359
|
}
|
|
360
360
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected {
|
|
361
|
+
cursor: default;
|
|
362
|
+
}
|
|
363
|
+
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected.rich-text {
|
|
361
364
|
cursor: unset;
|
|
362
365
|
}
|
|
363
366
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected::after {
|
|
@@ -386,21 +389,6 @@
|
|
|
386
389
|
opacity: 1;
|
|
387
390
|
}
|
|
388
391
|
|
|
389
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
390
|
-
opacity: 0.5;
|
|
391
|
-
transition: opacity 0.1s linear;
|
|
392
|
-
}
|
|
393
|
-
@media (prefers-reduced-motion: reduce) {
|
|
394
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
395
|
-
transition-duration: 0s;
|
|
396
|
-
transition-delay: 0s;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block,
|
|
400
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block {
|
|
401
|
-
opacity: 1;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
392
|
.wp-block[data-align=left] > *,
|
|
405
393
|
.wp-block[data-align=right] > *,
|
|
406
394
|
.wp-block.alignleft,
|
|
@@ -912,7 +900,6 @@
|
|
|
912
900
|
border: none;
|
|
913
901
|
border-radius: 2px;
|
|
914
902
|
z-index: 10;
|
|
915
|
-
pointer-events: none;
|
|
916
903
|
}
|
|
917
904
|
.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before {
|
|
918
905
|
background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
|
|
@@ -1099,6 +1086,7 @@
|
|
|
1099
1086
|
.components-popover.block-editor-block-popover {
|
|
1100
1087
|
z-index: 31;
|
|
1101
1088
|
position: absolute;
|
|
1089
|
+
margin: 0 !important;
|
|
1102
1090
|
}
|
|
1103
1091
|
.components-popover.block-editor-block-popover .components-popover__content {
|
|
1104
1092
|
margin: 0 !important;
|
|
@@ -1679,21 +1667,6 @@
|
|
|
1679
1667
|
margin-left: 0;
|
|
1680
1668
|
}
|
|
1681
1669
|
|
|
1682
|
-
.components-border-style-control legend {
|
|
1683
|
-
line-height: 1.4;
|
|
1684
|
-
margin-bottom: 8px;
|
|
1685
|
-
padding: 0;
|
|
1686
|
-
}
|
|
1687
|
-
.components-border-style-control .components-border-style-control__buttons {
|
|
1688
|
-
display: inline-flex;
|
|
1689
|
-
}
|
|
1690
|
-
.components-border-style-control .components-border-style-control__buttons .components-button.has-icon {
|
|
1691
|
-
min-width: 30px;
|
|
1692
|
-
height: 30px;
|
|
1693
|
-
padding: 3px;
|
|
1694
|
-
margin-left: 4px;
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
1670
|
.block-editor-button-block-appender {
|
|
1698
1671
|
display: flex;
|
|
1699
1672
|
flex-direction: column;
|
|
@@ -3725,6 +3698,19 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3725
3698
|
border-radius: inherit;
|
|
3726
3699
|
}
|
|
3727
3700
|
|
|
3701
|
+
.block-editor__padding-visualizer {
|
|
3702
|
+
position: absolute;
|
|
3703
|
+
top: 0;
|
|
3704
|
+
bottom: 0;
|
|
3705
|
+
right: 0;
|
|
3706
|
+
left: 0;
|
|
3707
|
+
opacity: 0.5;
|
|
3708
|
+
border-color: var(--wp-admin-theme-color);
|
|
3709
|
+
border-style: solid;
|
|
3710
|
+
pointer-events: none;
|
|
3711
|
+
box-sizing: border-box;
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3728
3714
|
/**
|
|
3729
3715
|
* Block Toolbar
|
|
3730
3716
|
*/
|
package/build-style/style.css
CHANGED
|
@@ -358,6 +358,9 @@
|
|
|
358
358
|
border-radius: 1px;
|
|
359
359
|
}
|
|
360
360
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected {
|
|
361
|
+
cursor: default;
|
|
362
|
+
}
|
|
363
|
+
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected.rich-text {
|
|
361
364
|
cursor: unset;
|
|
362
365
|
}
|
|
363
366
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline).is-selected::after {
|
|
@@ -386,21 +389,6 @@
|
|
|
386
389
|
opacity: 1;
|
|
387
390
|
}
|
|
388
391
|
|
|
389
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
390
|
-
opacity: 0.5;
|
|
391
|
-
transition: opacity 0.1s linear;
|
|
392
|
-
}
|
|
393
|
-
@media (prefers-reduced-motion: reduce) {
|
|
394
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
395
|
-
transition-duration: 0s;
|
|
396
|
-
transition-delay: 0s;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.has-child-selected, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity:not(.has-child-selected) .block-editor-block-list__block, .is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity.is-active-entity .block-editor-block-list__block,
|
|
400
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity .is-active-entity .block-editor-block-list__block {
|
|
401
|
-
opacity: 1;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
392
|
.wp-block[data-align=left] > *,
|
|
405
393
|
.wp-block[data-align=right] > *,
|
|
406
394
|
.wp-block.alignleft,
|
|
@@ -912,7 +900,6 @@
|
|
|
912
900
|
border: none;
|
|
913
901
|
border-radius: 2px;
|
|
914
902
|
z-index: 10;
|
|
915
|
-
pointer-events: none;
|
|
916
903
|
}
|
|
917
904
|
.block-editor-block-content-overlay:hover:not(.is-dragging-blocks).overlay-active::before, .block-editor-block-content-overlay.parent-highlighted.overlay-active::before {
|
|
918
905
|
background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
|
|
@@ -1099,6 +1086,7 @@
|
|
|
1099
1086
|
.components-popover.block-editor-block-popover {
|
|
1100
1087
|
z-index: 31;
|
|
1101
1088
|
position: absolute;
|
|
1089
|
+
margin: 0 !important;
|
|
1102
1090
|
}
|
|
1103
1091
|
.components-popover.block-editor-block-popover .components-popover__content {
|
|
1104
1092
|
margin: 0 !important;
|
|
@@ -1679,21 +1667,6 @@
|
|
|
1679
1667
|
margin-right: 0;
|
|
1680
1668
|
}
|
|
1681
1669
|
|
|
1682
|
-
.components-border-style-control legend {
|
|
1683
|
-
line-height: 1.4;
|
|
1684
|
-
margin-bottom: 8px;
|
|
1685
|
-
padding: 0;
|
|
1686
|
-
}
|
|
1687
|
-
.components-border-style-control .components-border-style-control__buttons {
|
|
1688
|
-
display: inline-flex;
|
|
1689
|
-
}
|
|
1690
|
-
.components-border-style-control .components-border-style-control__buttons .components-button.has-icon {
|
|
1691
|
-
min-width: 30px;
|
|
1692
|
-
height: 30px;
|
|
1693
|
-
padding: 3px;
|
|
1694
|
-
margin-right: 4px;
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
1670
|
.block-editor-button-block-appender {
|
|
1698
1671
|
display: flex;
|
|
1699
1672
|
flex-direction: column;
|
|
@@ -3725,6 +3698,19 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
3725
3698
|
border-radius: inherit;
|
|
3726
3699
|
}
|
|
3727
3700
|
|
|
3701
|
+
.block-editor__padding-visualizer {
|
|
3702
|
+
position: absolute;
|
|
3703
|
+
top: 0;
|
|
3704
|
+
bottom: 0;
|
|
3705
|
+
left: 0;
|
|
3706
|
+
right: 0;
|
|
3707
|
+
opacity: 0.5;
|
|
3708
|
+
border-color: var(--wp-admin-theme-color);
|
|
3709
|
+
border-style: solid;
|
|
3710
|
+
pointer-events: none;
|
|
3711
|
+
box-sizing: border-box;
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3728
3714
|
/**
|
|
3729
3715
|
* Block Toolbar
|
|
3730
3716
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
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.
|
|
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": "^8.
|
|
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.
|
|
36
|
+
"@wordpress/a11y": "^3.8.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.5.0",
|
|
38
|
+
"@wordpress/blob": "^3.8.0",
|
|
39
|
+
"@wordpress/blocks": "^11.7.0",
|
|
40
|
+
"@wordpress/components": "^19.10.0",
|
|
41
|
+
"@wordpress/compose": "^5.6.0",
|
|
42
|
+
"@wordpress/data": "^6.8.0",
|
|
43
|
+
"@wordpress/date": "^4.8.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.8.0",
|
|
45
|
+
"@wordpress/dom": "^3.8.0",
|
|
46
|
+
"@wordpress/element": "^4.6.0",
|
|
47
|
+
"@wordpress/hooks": "^3.8.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.8.0",
|
|
49
|
+
"@wordpress/i18n": "^4.8.0",
|
|
50
|
+
"@wordpress/icons": "^8.4.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.8.0",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.6.0",
|
|
53
|
+
"@wordpress/keycodes": "^3.8.0",
|
|
54
|
+
"@wordpress/notices": "^3.8.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.6.0",
|
|
56
|
+
"@wordpress/shortcode": "^3.8.0",
|
|
57
|
+
"@wordpress/style-engine": "^0.7.0",
|
|
58
|
+
"@wordpress/token-list": "^2.8.0",
|
|
59
|
+
"@wordpress/url": "^3.9.0",
|
|
60
|
+
"@wordpress/warning": "^2.8.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.8.0",
|
|
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": "
|
|
80
|
+
"gitHead": "4631d515033397fcfeda77e5755960253caef9bf"
|
|
81
81
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
alignNone,
|
|
7
|
+
positionCenter,
|
|
8
|
+
positionLeft,
|
|
9
|
+
positionRight,
|
|
10
|
+
stretchFullWidth,
|
|
11
|
+
stretchWide,
|
|
12
|
+
} from '@wordpress/icons';
|
|
13
|
+
|
|
14
|
+
export const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
15
|
+
none: {
|
|
16
|
+
icon: alignNone,
|
|
17
|
+
title: _x( 'None', 'Alignment option' ),
|
|
18
|
+
},
|
|
19
|
+
left: {
|
|
20
|
+
icon: positionLeft,
|
|
21
|
+
title: __( 'Align left' ),
|
|
22
|
+
},
|
|
23
|
+
center: {
|
|
24
|
+
icon: positionCenter,
|
|
25
|
+
title: __( 'Align center' ),
|
|
26
|
+
},
|
|
27
|
+
right: {
|
|
28
|
+
icon: positionRight,
|
|
29
|
+
title: __( 'Align right' ),
|
|
30
|
+
},
|
|
31
|
+
wide: {
|
|
32
|
+
icon: stretchWide,
|
|
33
|
+
title: __( 'Wide width' ),
|
|
34
|
+
},
|
|
35
|
+
full: {
|
|
36
|
+
icon: stretchFullWidth,
|
|
37
|
+
title: __( 'Full width' ),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const DEFAULT_CONTROL = 'none';
|
|
42
|
+
|
|
43
|
+
export const POPOVER_PROPS = {
|
|
44
|
+
isAlternate: true,
|
|
45
|
+
};
|
|
@@ -6,60 +6,23 @@ import classNames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import {
|
|
11
11
|
ToolbarDropdownMenu,
|
|
12
12
|
ToolbarGroup,
|
|
13
13
|
MenuGroup,
|
|
14
14
|
MenuItem,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
|
-
import {
|
|
17
|
-
alignNone,
|
|
18
|
-
positionCenter,
|
|
19
|
-
positionLeft,
|
|
20
|
-
positionRight,
|
|
21
|
-
stretchFullWidth,
|
|
22
|
-
stretchWide,
|
|
23
|
-
} from '@wordpress/icons';
|
|
24
|
-
import { Platform } from '@wordpress/element';
|
|
25
16
|
|
|
26
17
|
/**
|
|
27
18
|
* Internal dependencies
|
|
28
19
|
*/
|
|
29
20
|
import useAvailableAlignments from './use-available-alignments';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
left: {
|
|
37
|
-
icon: positionLeft,
|
|
38
|
-
title: __( 'Align left' ),
|
|
39
|
-
},
|
|
40
|
-
center: {
|
|
41
|
-
icon: positionCenter,
|
|
42
|
-
title: __( 'Align center' ),
|
|
43
|
-
},
|
|
44
|
-
right: {
|
|
45
|
-
icon: positionRight,
|
|
46
|
-
title: __( 'Align right' ),
|
|
47
|
-
},
|
|
48
|
-
wide: {
|
|
49
|
-
icon: stretchWide,
|
|
50
|
-
title: __( 'Wide width' ),
|
|
51
|
-
},
|
|
52
|
-
full: {
|
|
53
|
-
icon: stretchFullWidth,
|
|
54
|
-
title: __( 'Full width' ),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const DEFAULT_CONTROL = 'none';
|
|
59
|
-
|
|
60
|
-
const POPOVER_PROPS = {
|
|
61
|
-
isAlternate: true,
|
|
62
|
-
};
|
|
21
|
+
import {
|
|
22
|
+
BLOCK_ALIGNMENTS_CONTROLS,
|
|
23
|
+
DEFAULT_CONTROL,
|
|
24
|
+
POPOVER_PROPS,
|
|
25
|
+
} from './constants';
|
|
63
26
|
|
|
64
27
|
function BlockAlignmentUI( {
|
|
65
28
|
value,
|
|
@@ -92,72 +55,69 @@ function BlockAlignmentUI( {
|
|
|
92
55
|
label: __( 'Align' ),
|
|
93
56
|
toggleProps: { describedBy: __( 'Change alignment' ) },
|
|
94
57
|
};
|
|
95
|
-
const extraProps =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
159
|
-
},
|
|
160
|
-
};
|
|
58
|
+
const extraProps = isToolbar
|
|
59
|
+
? {
|
|
60
|
+
isCollapsed,
|
|
61
|
+
controls: enabledControls.map( ( { name: controlName } ) => {
|
|
62
|
+
return {
|
|
63
|
+
...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],
|
|
64
|
+
isActive:
|
|
65
|
+
value === controlName ||
|
|
66
|
+
( ! value && controlName === 'none' ),
|
|
67
|
+
role: isCollapsed ? 'menuitemradio' : undefined,
|
|
68
|
+
onClick: () => onChangeAlignment( controlName ),
|
|
69
|
+
};
|
|
70
|
+
} ),
|
|
71
|
+
}
|
|
72
|
+
: {
|
|
73
|
+
children: ( { onClose } ) => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<MenuGroup className="block-editor-block-alignment-control__menu-group">
|
|
77
|
+
{ enabledControls.map(
|
|
78
|
+
( { name: controlName, info } ) => {
|
|
79
|
+
const {
|
|
80
|
+
icon,
|
|
81
|
+
title,
|
|
82
|
+
} = BLOCK_ALIGNMENTS_CONTROLS[
|
|
83
|
+
controlName
|
|
84
|
+
];
|
|
85
|
+
// If no value is provided, mark as selected the `none` option.
|
|
86
|
+
const isSelected =
|
|
87
|
+
controlName === value ||
|
|
88
|
+
( ! value &&
|
|
89
|
+
controlName === 'none' );
|
|
90
|
+
return (
|
|
91
|
+
<MenuItem
|
|
92
|
+
key={ controlName }
|
|
93
|
+
icon={ icon }
|
|
94
|
+
iconPosition="left"
|
|
95
|
+
className={ classNames(
|
|
96
|
+
'components-dropdown-menu__menu-item',
|
|
97
|
+
{
|
|
98
|
+
'is-active': isSelected,
|
|
99
|
+
}
|
|
100
|
+
) }
|
|
101
|
+
isSelected={ isSelected }
|
|
102
|
+
onClick={ () => {
|
|
103
|
+
onChangeAlignment(
|
|
104
|
+
controlName
|
|
105
|
+
);
|
|
106
|
+
onClose();
|
|
107
|
+
} }
|
|
108
|
+
role="menuitemradio"
|
|
109
|
+
info={ info }
|
|
110
|
+
>
|
|
111
|
+
{ title }
|
|
112
|
+
</MenuItem>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
) }
|
|
116
|
+
</MenuGroup>
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
161
121
|
|
|
162
122
|
return <UIComponent { ...commonProps } { ...extraProps } />;
|
|
163
123
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
ToolbarDropdownMenu,
|
|
7
|
+
ToolbarGroup,
|
|
8
|
+
BottomSheetSelectControl,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import useAvailableAlignments from './use-available-alignments';
|
|
15
|
+
import {
|
|
16
|
+
BLOCK_ALIGNMENTS_CONTROLS,
|
|
17
|
+
DEFAULT_CONTROL,
|
|
18
|
+
POPOVER_PROPS,
|
|
19
|
+
} from './constants';
|
|
20
|
+
|
|
21
|
+
function BlockAlignmentUI( {
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
controls,
|
|
25
|
+
isToolbar,
|
|
26
|
+
isCollapsed = true,
|
|
27
|
+
isBottomSheetControl = false,
|
|
28
|
+
} ) {
|
|
29
|
+
const enabledControls = useAvailableAlignments( controls );
|
|
30
|
+
const hasEnabledControls = !! enabledControls.length;
|
|
31
|
+
|
|
32
|
+
if ( ! hasEnabledControls ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function onChangeAlignment( align ) {
|
|
37
|
+
onChange( [ value, 'none' ].includes( align ) ? undefined : align );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];
|
|
41
|
+
const defaultAlignmentControl =
|
|
42
|
+
BLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];
|
|
43
|
+
|
|
44
|
+
const toolbarUIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;
|
|
45
|
+
const UIComponent = isBottomSheetControl
|
|
46
|
+
? BottomSheetSelectControl
|
|
47
|
+
: toolbarUIComponent;
|
|
48
|
+
|
|
49
|
+
const commonProps = {
|
|
50
|
+
label: __( 'Align' ),
|
|
51
|
+
};
|
|
52
|
+
const extraProps = isBottomSheetControl
|
|
53
|
+
? {
|
|
54
|
+
options: enabledControls.map( ( { name: controlName } ) => {
|
|
55
|
+
const control = BLOCK_ALIGNMENTS_CONTROLS[ controlName ];
|
|
56
|
+
return {
|
|
57
|
+
value: controlName,
|
|
58
|
+
label: control.title,
|
|
59
|
+
icon: control.icon,
|
|
60
|
+
};
|
|
61
|
+
} ),
|
|
62
|
+
value: activeAlignmentControl ? value : 'none',
|
|
63
|
+
onChange: ( align ) => onChangeAlignment( align ),
|
|
64
|
+
}
|
|
65
|
+
: {
|
|
66
|
+
icon: activeAlignmentControl
|
|
67
|
+
? activeAlignmentControl.icon
|
|
68
|
+
: defaultAlignmentControl.icon,
|
|
69
|
+
isCollapsed: isToolbar ? isCollapsed : undefined,
|
|
70
|
+
controls: enabledControls.map( ( { name: controlName } ) => {
|
|
71
|
+
return {
|
|
72
|
+
...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],
|
|
73
|
+
isActive:
|
|
74
|
+
value === controlName ||
|
|
75
|
+
( ! value && controlName === 'none' ),
|
|
76
|
+
onClick: () => onChangeAlignment( controlName ),
|
|
77
|
+
};
|
|
78
|
+
} ),
|
|
79
|
+
popoverProps: POPOVER_PROPS,
|
|
80
|
+
toggleProps: { describedBy: __( 'Change alignment' ) },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return <UIComponent { ...commonProps } { ...extraProps } />;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default BlockAlignmentUI;
|
|
@@ -262,12 +262,17 @@
|
|
|
262
262
|
right: $border-width;
|
|
263
263
|
bottom: $border-width;
|
|
264
264
|
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
265
|
-
|
|
265
|
+
// Border is outset, so subtract the width to achieve correct radius.
|
|
266
|
+
border-radius: $radius-block-ui - $border-width;
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
&.is-selected {
|
|
270
|
-
cursor:
|
|
271
|
+
cursor: default;
|
|
272
|
+
|
|
273
|
+
&.rich-text {
|
|
274
|
+
cursor: unset;
|
|
275
|
+
}
|
|
271
276
|
|
|
272
277
|
&::after {
|
|
273
278
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); // Selected not focussed.
|
|
@@ -303,22 +308,6 @@
|
|
|
303
308
|
}
|
|
304
309
|
}
|
|
305
310
|
|
|
306
|
-
// Active entity spotlight.
|
|
307
|
-
// Disable if focus mode is active.
|
|
308
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
309
|
-
opacity: 0.5;
|
|
310
|
-
transition: opacity 0.1s linear;
|
|
311
|
-
@include reduce-motion("transition");
|
|
312
|
-
|
|
313
|
-
&.is-active-entity,
|
|
314
|
-
&.has-child-selected,
|
|
315
|
-
&:not(.has-child-selected) .block-editor-block-list__block,
|
|
316
|
-
&.is-active-entity .block-editor-block-list__block,
|
|
317
|
-
.is-active-entity .block-editor-block-list__block {
|
|
318
|
-
opacity: 1;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
311
|
.wp-block[data-align="left"] > *,
|
|
323
312
|
.wp-block[data-align="right"] > *,
|
|
324
313
|
.wp-block.alignleft,
|
|
@@ -33,12 +33,8 @@ export function useBlockClassNames( clientId ) {
|
|
|
33
33
|
getSettings,
|
|
34
34
|
hasSelectedInnerBlock,
|
|
35
35
|
isTyping,
|
|
36
|
-
__experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames,
|
|
37
36
|
} = select( blockEditorStore );
|
|
38
|
-
const {
|
|
39
|
-
__experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
|
|
40
|
-
outlineMode,
|
|
41
|
-
} = getSettings();
|
|
37
|
+
const { outlineMode } = getSettings();
|
|
42
38
|
const isDragging = isBlockBeingDragged( clientId );
|
|
43
39
|
const isSelected = isBlockSelected( clientId );
|
|
44
40
|
const name = getBlockName( clientId );
|
|
@@ -48,9 +44,6 @@ export function useBlockClassNames( clientId ) {
|
|
|
48
44
|
clientId,
|
|
49
45
|
checkDeep
|
|
50
46
|
);
|
|
51
|
-
const activeEntityBlockId = getActiveBlockIdByBlockNames(
|
|
52
|
-
spotlightEntityBlocks
|
|
53
|
-
);
|
|
54
47
|
return classnames( {
|
|
55
48
|
'is-selected': isSelected,
|
|
56
49
|
'is-highlighted': isBlockHighlighted( clientId ),
|
|
@@ -58,9 +51,6 @@ export function useBlockClassNames( clientId ) {
|
|
|
58
51
|
'is-reusable': isReusableBlock( getBlockType( name ) ),
|
|
59
52
|
'is-dragging': isDragging,
|
|
60
53
|
'has-child-selected': isAncestorOfSelectedBlock,
|
|
61
|
-
'has-active-entity': activeEntityBlockId,
|
|
62
|
-
// Determine if there is an active entity area to spotlight.
|
|
63
|
-
'is-active-entity': activeEntityBlockId === clientId,
|
|
64
54
|
'remove-outline': isSelected && outlineMode && isTyping(),
|
|
65
55
|
} );
|
|
66
56
|
},
|