@wordpress/block-editor 12.5.0 → 12.6.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/README.md +0 -4
- package/build/components/block-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +2 -2
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +25 -13
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +14 -18
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block.native.js +21 -42
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +1 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +4 -3
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +62 -3
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/global-styles/color-panel.js +21 -15
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +13 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +4 -8
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +13 -23
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +18 -3
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +12 -18
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +6 -6
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +36 -48
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +5 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/index.js +1 -10
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +3 -1
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +21 -32
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +23 -3
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build/components/link-control/index.js +4 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +1 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -2
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +0 -36
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +118 -0
- package/build/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +49 -8
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-setting/index.js +5 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -6
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +19 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +38 -2
- package/build/utils/object.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +2 -2
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +27 -10
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +14 -18
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +24 -43
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -3
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -4
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +3 -3
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +4 -3
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +60 -4
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +21 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +13 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +4 -8
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +12 -22
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +18 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +13 -18
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +5 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +37 -49
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +5 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +3 -1
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +22 -33
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build-module/components/link-control/index.js +4 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +1 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +1 -36
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +105 -0
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +50 -8
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js +5 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/utils.js +2 -7
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +16 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +34 -2
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +2 -1
- package/build-style/content.css +2 -1
- package/build-style/style-rtl.css +7 -1
- package/build-style/style.css +7 -1
- package/package.json +32 -32
- package/src/components/block-controls/README.md +89 -0
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/block-draggable/index.native.js +7 -3
- package/src/components/block-draggable/test/index.native.js +0 -54
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.native.js +24 -38
- package/src/components/block-list/block.native.scss +18 -40
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
- package/src/components/block-removal-warning-modal/index.js +0 -3
- package/src/components/block-settings/button.native.js +12 -6
- package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
- package/src/components/block-toolbar/index.js +2 -3
- package/src/components/block-toolbar/index.native.js +86 -6
- package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
- package/src/components/block-toolbar/test/index.native.js +42 -0
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/global-styles/color-panel.js +23 -16
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +20 -26
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +15 -6
- package/src/components/iframe/index.js +30 -56
- package/src/components/iframe/use-compatibility-styles.js +5 -0
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/README.md +10 -0
- package/src/components/inner-blocks/index.js +4 -0
- package/src/components/inner-blocks/index.native.js +4 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/reusable-block-rename-hint.js +18 -1
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/link-control/index.js +4 -1
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +8 -1
- package/src/components/link-control/test/index.js +26 -0
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/rich-text/content.js +1 -46
- package/src/components/rich-text/get-rich-text-values.js +105 -0
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/text-transform-control/README.md +44 -0
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/components/use-block-drop-zone/index.native.js +65 -28
- package/src/components/use-setting/index.js +8 -8
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +7 -1
- package/src/store/actions.js +1 -2
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +33 -5
- package/src/store/test/actions.js +3 -0
- package/src/store/test/private-selectors.js +5 -5
- package/src/store/test/reducer.js +14 -7
- package/src/store/test/selectors.js +1 -1
- package/src/utils/object.js +32 -2
- package/src/utils/test/object.js +36 -0
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build/components/block-mobile-toolbar/index.native.js +0 -135
- package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
- package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.native.js +0 -127
- package/src/components/block-mobile-toolbar/style.native.scss +0 -16
- /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
LABELS,
|
|
7
|
+
ICONS,
|
|
8
|
+
getPresetValueFromCustomValue,
|
|
9
|
+
hasAxisSupport,
|
|
10
|
+
} from '../utils';
|
|
6
11
|
|
|
7
12
|
const groupedSides = [ 'vertical', 'horizontal' ];
|
|
8
13
|
|
|
@@ -20,7 +25,17 @@ export default function AxialInputControls( {
|
|
|
20
25
|
if ( ! onChange ) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
23
|
-
|
|
28
|
+
|
|
29
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
30
|
+
const nextValues = {
|
|
31
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
32
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
33
|
+
values[ key ],
|
|
34
|
+
spacingSizes
|
|
35
|
+
);
|
|
36
|
+
return acc;
|
|
37
|
+
}, {} ),
|
|
38
|
+
};
|
|
24
39
|
|
|
25
40
|
if ( side === 'vertical' ) {
|
|
26
41
|
nextValues.top = next;
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ALL_SIDES,
|
|
7
|
+
LABELS,
|
|
8
|
+
ICONS,
|
|
9
|
+
getPresetValueFromCustomValue,
|
|
10
|
+
} from '../utils';
|
|
6
11
|
|
|
7
12
|
export default function SeparatedInputControls( {
|
|
8
13
|
minimumCustomValue,
|
|
@@ -20,7 +25,17 @@ export default function SeparatedInputControls( {
|
|
|
20
25
|
: ALL_SIDES;
|
|
21
26
|
|
|
22
27
|
const createHandleOnChange = ( side ) => ( next ) => {
|
|
23
|
-
|
|
28
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
29
|
+
const nextValues = {
|
|
30
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
31
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
32
|
+
values[ key ],
|
|
33
|
+
spacingSizes
|
|
34
|
+
);
|
|
35
|
+
return acc;
|
|
36
|
+
}, {} ),
|
|
37
|
+
};
|
|
38
|
+
|
|
24
39
|
nextValues[ side ] = next;
|
|
25
40
|
|
|
26
41
|
onChange( nextValues );
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import { LABELS } from '../utils';
|
|
5
|
+
import { LABELS, getPresetValueFromCustomValue } from '../utils';
|
|
6
6
|
|
|
7
7
|
export default function SingleInputControl( {
|
|
8
8
|
minimumCustomValue,
|
|
@@ -16,7 +16,17 @@ export default function SingleInputControl( {
|
|
|
16
16
|
values,
|
|
17
17
|
} ) {
|
|
18
18
|
const createHandleOnChange = ( currentSide ) => ( next ) => {
|
|
19
|
-
|
|
19
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
20
|
+
const nextValues = {
|
|
21
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
22
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
23
|
+
values[ key ],
|
|
24
|
+
spacingSizes
|
|
25
|
+
);
|
|
26
|
+
return acc;
|
|
27
|
+
}, {} ),
|
|
28
|
+
};
|
|
29
|
+
|
|
20
30
|
nextValues[ currentSide ] = next;
|
|
21
31
|
|
|
22
32
|
onChange( nextValues );
|
|
@@ -102,7 +102,7 @@ export function getCustomValueFromPreset( value, spacingSizes ) {
|
|
|
102
102
|
*/
|
|
103
103
|
export function getPresetValueFromCustomValue( value, spacingSizes ) {
|
|
104
104
|
// Return value as-is if it is already a preset;
|
|
105
|
-
if ( isValueSpacingPreset( value ) ) {
|
|
105
|
+
if ( isValueSpacingPreset( value ) || value === '0' ) {
|
|
106
106
|
return value;
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# TextTransformControl
|
|
2
|
+
|
|
3
|
+
The `TextTransformControl` component is responsible for rendering a control element that allows users to select and apply text transformation options to blocks or elements in the Gutenberg editor. It provides an intuitive interface for changing the text appearance by applying different transformations such as `none`, `uppercase`, `lowercase`, `capitalize`.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
1. [Development guidelines](#development-guidelines)
|
|
10
|
+
|
|
11
|
+
## Development guidelines
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
Renders the Text Transform Component with `none`, `uppercase`, `lowercase`, `capitalize` options.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { TextTransformControl } from '@wordpress/block-editor';
|
|
19
|
+
|
|
20
|
+
const MyTextTransformControlComponent = () => (
|
|
21
|
+
<TextTransformControl
|
|
22
|
+
value={ textTransform }
|
|
23
|
+
onChange={ ( value ) => {
|
|
24
|
+
setAttributes( { textTransform: value } );
|
|
25
|
+
} }
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Props
|
|
31
|
+
|
|
32
|
+
### `value`
|
|
33
|
+
|
|
34
|
+
- **Type:** `String`
|
|
35
|
+
- **Default:** `none`
|
|
36
|
+
- **Options:** `none`, `uppercase`, `lowercase`, `capitalize`
|
|
37
|
+
|
|
38
|
+
The current value of the Text Transform setting. You may only choose from the `Options` listed above.
|
|
39
|
+
|
|
40
|
+
### `onChange`
|
|
41
|
+
|
|
42
|
+
- **Type:** `Function`
|
|
43
|
+
|
|
44
|
+
A callback function invoked when the Text Transform value is changed via an interaction with any of the buttons. Called with the Text Transform value (`none`, `uppercase`, `lowercase`, `capitalize`) as the only argument.
|
|
@@ -67,8 +67,11 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
67
67
|
return useSelect(
|
|
68
68
|
( select ) => {
|
|
69
69
|
if ( ! clientId ) return null;
|
|
70
|
-
const {
|
|
71
|
-
|
|
70
|
+
const {
|
|
71
|
+
getBlockName,
|
|
72
|
+
getBlockAttributes,
|
|
73
|
+
__experimentalGetReusableBlockTitle,
|
|
74
|
+
} = select( blockEditorStore );
|
|
72
75
|
const { getBlockType, getActiveBlockVariation } =
|
|
73
76
|
select( blocksStore );
|
|
74
77
|
const blockName = getBlockName( clientId );
|
|
@@ -76,12 +79,16 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
76
79
|
if ( ! blockType ) return null;
|
|
77
80
|
const attributes = getBlockAttributes( clientId );
|
|
78
81
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
79
|
-
const
|
|
80
|
-
|
|
82
|
+
const isReusable = isReusableBlock( blockType );
|
|
83
|
+
const resusableTitle = isReusable
|
|
84
|
+
? __experimentalGetReusableBlockTitle( attributes.ref )
|
|
85
|
+
: undefined;
|
|
86
|
+
const title = resusableTitle || blockType.title;
|
|
87
|
+
const isSynced = isReusable || isTemplatePart( blockType );
|
|
81
88
|
const positionLabel = getPositionTypeLabel( attributes );
|
|
82
89
|
const blockTypeInfo = {
|
|
83
90
|
isSynced,
|
|
84
|
-
title
|
|
91
|
+
title,
|
|
85
92
|
icon: blockType.icon,
|
|
86
93
|
description: blockType.description,
|
|
87
94
|
anchor: attributes?.anchor,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
runOnJS,
|
|
6
|
+
useDerivedValue,
|
|
7
|
+
useSharedValue,
|
|
8
|
+
} from 'react-native-reanimated';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* WordPress dependencies
|
|
8
12
|
*/
|
|
9
13
|
import { useSelect } from '@wordpress/data';
|
|
10
14
|
import { useCallback } from '@wordpress/element';
|
|
11
|
-
import { useThrottle } from '@wordpress/compose';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Internal dependencies
|
|
@@ -18,6 +21,8 @@ import { useBlockListContext } from '../block-list/block-list-context';
|
|
|
18
21
|
import { getDistanceToNearestEdge } from '../../utils/math';
|
|
19
22
|
import useOnBlockDrop from '../use-on-block-drop';
|
|
20
23
|
|
|
24
|
+
const UPDATE_TARGET_BLOCK_INDEX_THRESHOLD = 20; // In pixels
|
|
25
|
+
|
|
21
26
|
/** @typedef {import('../../utils/math').WPPoint} WPPoint */
|
|
22
27
|
|
|
23
28
|
/**
|
|
@@ -111,6 +116,14 @@ export default function useBlockDropZone( {
|
|
|
111
116
|
rootClientId: targetRootClientId = '',
|
|
112
117
|
} = {} ) {
|
|
113
118
|
const targetBlockIndex = useSharedValue( null );
|
|
119
|
+
const dragPosition = {
|
|
120
|
+
x: useSharedValue( 0 ),
|
|
121
|
+
y: useSharedValue( 0 ),
|
|
122
|
+
};
|
|
123
|
+
const prevDragPosition = {
|
|
124
|
+
x: useSharedValue( 0 ),
|
|
125
|
+
y: useSharedValue( 0 ),
|
|
126
|
+
};
|
|
114
127
|
|
|
115
128
|
const { getBlockListSettings, getSettings } = useSelect( blockEditorStore );
|
|
116
129
|
const { blocksLayouts, getBlockLayoutsOrderedByYCoord } =
|
|
@@ -118,43 +131,67 @@ export default function useBlockDropZone( {
|
|
|
118
131
|
|
|
119
132
|
const getSortedBlocksLayouts = useCallback( () => {
|
|
120
133
|
return getBlockLayoutsOrderedByYCoord( blocksLayouts.current );
|
|
134
|
+
// We use the value of `blocksLayouts` as the dependency.
|
|
135
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
121
136
|
}, [ blocksLayouts.current ] );
|
|
122
137
|
|
|
123
138
|
const isRTL = getSettings().isRTL;
|
|
124
139
|
|
|
125
140
|
const onBlockDrop = useOnBlockDrop();
|
|
126
141
|
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
),
|
|
149
|
-
200
|
|
142
|
+
const updateTargetBlockIndex = useCallback(
|
|
143
|
+
( event ) => {
|
|
144
|
+
const sortedBlockLayouts = getSortedBlocksLayouts();
|
|
145
|
+
|
|
146
|
+
const targetIndex = getNearestBlockIndex(
|
|
147
|
+
sortedBlockLayouts,
|
|
148
|
+
{ x: event.x, y: event.y },
|
|
149
|
+
getBlockListSettings( targetRootClientId )?.orientation,
|
|
150
|
+
isRTL
|
|
151
|
+
);
|
|
152
|
+
if ( targetIndex !== null ) {
|
|
153
|
+
targetBlockIndex.value = targetIndex ?? 0;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
[
|
|
157
|
+
getSortedBlocksLayouts,
|
|
158
|
+
getBlockListSettings,
|
|
159
|
+
targetRootClientId,
|
|
160
|
+
isRTL,
|
|
161
|
+
targetBlockIndex,
|
|
162
|
+
]
|
|
150
163
|
);
|
|
151
164
|
|
|
165
|
+
useDerivedValue( () => {
|
|
166
|
+
const x = dragPosition.x.value;
|
|
167
|
+
const y = dragPosition.y.value;
|
|
168
|
+
const prevX = prevDragPosition.x.value;
|
|
169
|
+
const prevY = prevDragPosition.y.value;
|
|
170
|
+
// `updateTargetBlockIndex` performs expensive calculations, so we throttle
|
|
171
|
+
// the call using a offset threshold based on the dragging position.
|
|
172
|
+
if (
|
|
173
|
+
Math.abs( x - prevX ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD ||
|
|
174
|
+
Math.abs( y - prevY ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD
|
|
175
|
+
) {
|
|
176
|
+
runOnJS( updateTargetBlockIndex )( { x, y } );
|
|
177
|
+
prevDragPosition.x.value = x;
|
|
178
|
+
prevDragPosition.y.value = y;
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
} );
|
|
183
|
+
|
|
152
184
|
return {
|
|
153
|
-
onBlockDragOver(
|
|
154
|
-
|
|
185
|
+
onBlockDragOver( { x, y } ) {
|
|
186
|
+
dragPosition.x.value = x;
|
|
187
|
+
dragPosition.y.value = y;
|
|
188
|
+
},
|
|
189
|
+
onBlockDragOverWorklet( { x, y } ) {
|
|
190
|
+
'worklet';
|
|
191
|
+
dragPosition.x.value = x;
|
|
192
|
+
dragPosition.y.value = y;
|
|
155
193
|
},
|
|
156
194
|
onBlockDragEnd() {
|
|
157
|
-
throttled.cancel();
|
|
158
195
|
targetBlockIndex.value = null;
|
|
159
196
|
},
|
|
160
197
|
onBlockDrop: ( event ) => {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -18,6 +13,7 @@ import { applyFilters } from '@wordpress/hooks';
|
|
|
18
13
|
*/
|
|
19
14
|
import { useBlockEditContext } from '../block-edit';
|
|
20
15
|
import { store as blockEditorStore } from '../../store';
|
|
16
|
+
import { getValueFromObjectPath } from '../../utils/object';
|
|
21
17
|
|
|
22
18
|
const blockedPaths = [
|
|
23
19
|
'color',
|
|
@@ -165,11 +161,14 @@ export default function useSetting( path ) {
|
|
|
165
161
|
candidateClientId
|
|
166
162
|
);
|
|
167
163
|
result =
|
|
168
|
-
|
|
164
|
+
getValueFromObjectPath(
|
|
169
165
|
candidateAtts,
|
|
170
166
|
`settings.blocks.${ blockName }.${ normalizedPath }`
|
|
171
167
|
) ??
|
|
172
|
-
|
|
168
|
+
getValueFromObjectPath(
|
|
169
|
+
candidateAtts,
|
|
170
|
+
`settings.${ normalizedPath }`
|
|
171
|
+
);
|
|
173
172
|
if ( result !== undefined ) {
|
|
174
173
|
// Stop the search for more distant ancestors and move on.
|
|
175
174
|
break;
|
|
@@ -183,7 +182,8 @@ export default function useSetting( path ) {
|
|
|
183
182
|
const defaultsPath = `__experimentalFeatures.${ normalizedPath }`;
|
|
184
183
|
const blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;
|
|
185
184
|
result =
|
|
186
|
-
|
|
185
|
+
getValueFromObjectPath( settings, blockPath ) ??
|
|
186
|
+
getValueFromObjectPath( settings, defaultsPath );
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// Return if the setting was found in either the block instance or the store.
|
package/src/hooks/margin.js
CHANGED
|
@@ -23,7 +23,10 @@ export function MarginVisualizer( { clientId, attributes, forceShow } ) {
|
|
|
23
23
|
const margin = attributes?.style?.spacing?.margin;
|
|
24
24
|
|
|
25
25
|
useEffect( () => {
|
|
26
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
! blockElement ||
|
|
28
|
+
null === blockElement.ownerDocument.defaultView
|
|
29
|
+
) {
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
32
|
|
package/src/hooks/padding.js
CHANGED
|
@@ -23,7 +23,10 @@ export function PaddingVisualizer( { clientId, attributes, forceShow } ) {
|
|
|
23
23
|
const padding = attributes?.style?.spacing?.padding;
|
|
24
24
|
|
|
25
25
|
useEffect( () => {
|
|
26
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
! blockElement ||
|
|
28
|
+
null === blockElement.ownerDocument.defaultView
|
|
29
|
+
) {
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
32
|
|
package/src/hooks/utils.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -14,7 +9,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
9
|
*/
|
|
15
10
|
import { useSetting } from '../components';
|
|
16
11
|
import { useSettingsForBlockElement } from '../components/global-styles/hooks';
|
|
17
|
-
import { setImmutably } from '../utils/object';
|
|
12
|
+
import { getValueFromObjectPath, setImmutably } from '../utils/object';
|
|
18
13
|
|
|
19
14
|
/**
|
|
20
15
|
* Removed falsy values from nested object.
|
|
@@ -79,7 +74,10 @@ export function transformStyles(
|
|
|
79
74
|
Object.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {
|
|
80
75
|
if ( isActive ) {
|
|
81
76
|
migrationPaths[ support ].forEach( ( path ) => {
|
|
82
|
-
const styleValue =
|
|
77
|
+
const styleValue = getValueFromObjectPath(
|
|
78
|
+
referenceBlockAttributes,
|
|
79
|
+
path
|
|
80
|
+
);
|
|
83
81
|
if ( styleValue ) {
|
|
84
82
|
returnBlock = {
|
|
85
83
|
...returnBlock,
|
package/src/private-apis.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as globalStyles from './components/global-styles';
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
|
-
import { getRichTextValues } from './components/rich-text/
|
|
7
|
+
import { getRichTextValues } from './components/rich-text/get-rich-text-values';
|
|
8
8
|
import { kebabCase } from './utils/object';
|
|
9
9
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
10
10
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
@@ -19,6 +19,10 @@ import { BlockRemovalWarningModal } from './components/block-removal-warning-mod
|
|
|
19
19
|
import { useLayoutClasses, useLayoutStyles } from './hooks';
|
|
20
20
|
import DimensionsTool from './components/dimensions-tool';
|
|
21
21
|
import ResolutionTool from './components/resolution-tool';
|
|
22
|
+
import {
|
|
23
|
+
default as ReusableBlocksRenameHint,
|
|
24
|
+
useReusableBlocksRenameHint,
|
|
25
|
+
} from './components/inserter/reusable-block-rename-hint';
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* Private @wordpress/block-editor APIs.
|
|
@@ -43,4 +47,6 @@ lock( privateApis, {
|
|
|
43
47
|
useLayoutStyles,
|
|
44
48
|
DimensionsTool,
|
|
45
49
|
ResolutionTool,
|
|
50
|
+
ReusableBlocksRenameHint,
|
|
51
|
+
useReusableBlocksRenameHint,
|
|
46
52
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
} from '../utils/selection';
|
|
29
29
|
import {
|
|
30
30
|
__experimentalUpdateSettings,
|
|
31
|
-
ensureDefaultBlock,
|
|
32
31
|
privateRemoveBlocks,
|
|
33
32
|
} from './private-actions';
|
|
34
33
|
|
|
@@ -403,7 +402,7 @@ export const replaceBlocks =
|
|
|
403
402
|
initialPosition,
|
|
404
403
|
meta,
|
|
405
404
|
} );
|
|
406
|
-
dispatch
|
|
405
|
+
dispatch.ensureDefaultBlock();
|
|
407
406
|
};
|
|
408
407
|
|
|
409
408
|
/**
|
|
@@ -136,21 +136,18 @@ export const isBlockSubtreeDisabled = createSelector(
|
|
|
136
136
|
*
|
|
137
137
|
* @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
|
|
138
138
|
*/
|
|
139
|
-
export const
|
|
139
|
+
export const getEnabledClientIdsTree = createSelector(
|
|
140
140
|
( state, rootClientId = '' ) => {
|
|
141
141
|
return getBlockOrder( state, rootClientId ).flatMap( ( clientId ) => {
|
|
142
142
|
if ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {
|
|
143
143
|
return [
|
|
144
144
|
{
|
|
145
145
|
clientId,
|
|
146
|
-
innerBlocks:
|
|
147
|
-
state,
|
|
148
|
-
clientId
|
|
149
|
-
),
|
|
146
|
+
innerBlocks: getEnabledClientIdsTree( state, clientId ),
|
|
150
147
|
},
|
|
151
148
|
];
|
|
152
149
|
}
|
|
153
|
-
return
|
|
150
|
+
return getEnabledClientIdsTree( state, clientId );
|
|
154
151
|
} );
|
|
155
152
|
},
|
|
156
153
|
( state ) => [
|
package/src/store/reducer.js
CHANGED
package/src/store/selectors.js
CHANGED
|
@@ -2018,7 +2018,7 @@ export const getInserterItems = createSelector(
|
|
|
2018
2018
|
title: reusableBlock.title.raw,
|
|
2019
2019
|
icon,
|
|
2020
2020
|
category: 'reusable',
|
|
2021
|
-
keywords: [],
|
|
2021
|
+
keywords: [ 'reusable' ],
|
|
2022
2022
|
isDisabled: false,
|
|
2023
2023
|
utility: 1, // Deprecated.
|
|
2024
2024
|
frecency,
|
|
@@ -2214,15 +2214,24 @@ export const getAllowedBlocks = createSelector(
|
|
|
2214
2214
|
return;
|
|
2215
2215
|
}
|
|
2216
2216
|
|
|
2217
|
-
|
|
2217
|
+
const blockTypes = getBlockTypes().filter( ( blockType ) =>
|
|
2218
2218
|
canIncludeBlockTypeInInserter( state, blockType, rootClientId )
|
|
2219
2219
|
);
|
|
2220
|
+
const hasReusableBlock =
|
|
2221
|
+
canInsertBlockTypeUnmemoized( state, 'core/block', rootClientId ) &&
|
|
2222
|
+
getReusableBlocks( state ).length > 0;
|
|
2223
|
+
|
|
2224
|
+
return [
|
|
2225
|
+
...blockTypes,
|
|
2226
|
+
...( hasReusableBlock ? [ 'core/block' ] : [] ),
|
|
2227
|
+
];
|
|
2220
2228
|
},
|
|
2221
2229
|
( state, rootClientId ) => [
|
|
2222
2230
|
state.blockListSettings[ rootClientId ],
|
|
2223
2231
|
state.blocks.byClientId,
|
|
2224
2232
|
state.settings.allowedBlockTypes,
|
|
2225
2233
|
state.settings.templateLock,
|
|
2234
|
+
getReusableBlocks( state ),
|
|
2226
2235
|
getBlockTypes(),
|
|
2227
2236
|
]
|
|
2228
2237
|
);
|
|
@@ -2258,15 +2267,15 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
2258
2267
|
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
2259
2268
|
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
|
|
2260
2269
|
*/
|
|
2261
|
-
export const
|
|
2270
|
+
export const getDirectInsertBlock = createSelector(
|
|
2262
2271
|
( state, rootClientId = null ) => {
|
|
2263
2272
|
if ( ! rootClientId ) {
|
|
2264
2273
|
return;
|
|
2265
2274
|
}
|
|
2266
2275
|
const defaultBlock =
|
|
2267
|
-
state.blockListSettings[ rootClientId ]?.
|
|
2276
|
+
state.blockListSettings[ rootClientId ]?.defaultBlock;
|
|
2268
2277
|
const directInsert =
|
|
2269
|
-
state.blockListSettings[ rootClientId ]?.
|
|
2278
|
+
state.blockListSettings[ rootClientId ]?.directInsert;
|
|
2270
2279
|
if ( ! defaultBlock || ! directInsert ) {
|
|
2271
2280
|
return;
|
|
2272
2281
|
}
|
|
@@ -2283,6 +2292,25 @@ export const __experimentalGetDirectInsertBlock = createSelector(
|
|
|
2283
2292
|
]
|
|
2284
2293
|
);
|
|
2285
2294
|
|
|
2295
|
+
export const __experimentalGetDirectInsertBlock = createSelector(
|
|
2296
|
+
( state, rootClientId = null ) => {
|
|
2297
|
+
deprecated(
|
|
2298
|
+
'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',
|
|
2299
|
+
{
|
|
2300
|
+
alternative:
|
|
2301
|
+
'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
|
|
2302
|
+
since: '6.3',
|
|
2303
|
+
version: '6.4',
|
|
2304
|
+
}
|
|
2305
|
+
);
|
|
2306
|
+
return getDirectInsertBlock( state, rootClientId );
|
|
2307
|
+
},
|
|
2308
|
+
( state, rootClientId ) => [
|
|
2309
|
+
state.blockListSettings[ rootClientId ],
|
|
2310
|
+
state.blocks.tree.get( rootClientId ),
|
|
2311
|
+
]
|
|
2312
|
+
);
|
|
2313
|
+
|
|
2286
2314
|
const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
|
|
2287
2315
|
if ( typeof allowedBlockTypes === 'boolean' ) {
|
|
2288
2316
|
return allowedBlockTypes;
|
|
@@ -216,6 +216,7 @@ describe( 'actions', () => {
|
|
|
216
216
|
getBlockCount: () => 1,
|
|
217
217
|
};
|
|
218
218
|
const dispatch = jest.fn();
|
|
219
|
+
dispatch.ensureDefaultBlock = jest.fn();
|
|
219
220
|
|
|
220
221
|
replaceBlock( 'chicken', block )( { select, dispatch } );
|
|
221
222
|
|
|
@@ -281,6 +282,7 @@ describe( 'actions', () => {
|
|
|
281
282
|
getBlockCount: () => 1,
|
|
282
283
|
};
|
|
283
284
|
const dispatch = jest.fn();
|
|
285
|
+
dispatch.ensureDefaultBlock = jest.fn();
|
|
284
286
|
|
|
285
287
|
replaceBlocks( [ 'chicken' ], blocks )( { select, dispatch } );
|
|
286
288
|
|
|
@@ -314,6 +316,7 @@ describe( 'actions', () => {
|
|
|
314
316
|
getBlockCount: () => 1,
|
|
315
317
|
};
|
|
316
318
|
const dispatch = jest.fn();
|
|
319
|
+
dispatch.ensureDefaultBlock = jest.fn();
|
|
317
320
|
|
|
318
321
|
replaceBlocks(
|
|
319
322
|
[ 'chicken' ],
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getLastInsertedBlocksClientIds,
|
|
12
12
|
getBlockEditingMode,
|
|
13
13
|
isBlockSubtreeDisabled,
|
|
14
|
-
|
|
14
|
+
getEnabledClientIdsTree,
|
|
15
15
|
getEnabledBlockParents,
|
|
16
16
|
} from '../private-selectors';
|
|
17
17
|
|
|
@@ -391,7 +391,7 @@ describe( 'private selectors', () => {
|
|
|
391
391
|
} );
|
|
392
392
|
} );
|
|
393
393
|
|
|
394
|
-
describe( '
|
|
394
|
+
describe( 'getEnabledClientIdsTree', () => {
|
|
395
395
|
const baseState = {
|
|
396
396
|
settings: {},
|
|
397
397
|
blocks: {
|
|
@@ -462,7 +462,7 @@ describe( 'private selectors', () => {
|
|
|
462
462
|
...baseState,
|
|
463
463
|
blockEditingModes: new Map( [] ),
|
|
464
464
|
};
|
|
465
|
-
expect(
|
|
465
|
+
expect( getEnabledClientIdsTree( state ) ).toEqual( [
|
|
466
466
|
{
|
|
467
467
|
clientId: '6cf70164-9097-4460-bcbf-200560546988',
|
|
468
468
|
innerBlocks: [],
|
|
@@ -500,7 +500,7 @@ describe( 'private selectors', () => {
|
|
|
500
500
|
blockEditingModes: new Map( [] ),
|
|
501
501
|
};
|
|
502
502
|
expect(
|
|
503
|
-
|
|
503
|
+
getEnabledClientIdsTree(
|
|
504
504
|
state,
|
|
505
505
|
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337'
|
|
506
506
|
)
|
|
@@ -534,7 +534,7 @@ describe( 'private selectors', () => {
|
|
|
534
534
|
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'contentOnly' ],
|
|
535
535
|
] ),
|
|
536
536
|
};
|
|
537
|
-
expect(
|
|
537
|
+
expect( getEnabledClientIdsTree( state ) ).toEqual( [
|
|
538
538
|
{
|
|
539
539
|
clientId: 'b26fc763-417d-4f01-b81c-2ec61e14a972',
|
|
540
540
|
innerBlocks: [],
|