@wordpress/block-editor 12.5.0 → 12.7.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 +4 -0
- package/README.md +2 -6
- package/build/autocompleters/block.js +6 -2
- package/build/autocompleters/block.js.map +1 -1
- 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-editing-mode/index.js +1 -1
- package/build/components/block-editing-mode/index.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.js +4 -2
- package/build/components/block-list/block.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-list/index.js +2 -4
- package/build/components/block-list/index.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-parent-selector/index.js +6 -21
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -1
- package/build/components/block-preview/auto.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-settings-menu/block-settings-dropdown.js +3 -17
- package/build/components/block-settings-menu/block-settings-dropdown.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 -33
- 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/block-toolbar/utils.js +56 -51
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +10 -20
- package/build/components/block-variation-picker/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/editor-styles/index.js +2 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +11 -11
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/behaviors-panel.js +66 -0
- package/build/components/global-styles/behaviors-panel.js.map +1 -0
- 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 +131 -27
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +20 -0
- package/build/components/global-styles/index.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/typography-utils.js +4 -4
- package/build/components/global-styles/typography-utils.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 +7 -7
- 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/hooks/use-block-types-state.js +6 -2
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build/components/inserter/hooks/use-patterns-state.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/inserter/reusable-blocks-tab.js +3 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter-list-item/index.js +1 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/link-control/index.js +51 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +3 -3
- package/build/components/link-control/link-preview.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/list-view/use-list-view-drop-zone.js +6 -1
- package/build/components/list-view/use-list-view-drop-zone.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/media-replace-flow/index.native.js +15 -3
- package/build/components/media-replace-flow/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/format-edit.js +57 -28
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +111 -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 +2 -2
- 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/behaviors.js +5 -12
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/border.js +2 -1
- package/build/hooks/border.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/style.js +11 -2
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +3 -4
- 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 +23 -79
- 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/autocompleters/block.js +7 -3
- package/build-module/autocompleters/block.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-editing-mode/index.js +1 -1
- package/build-module/components/block-editing-mode/index.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.js +4 -2
- package/build-module/components/block-list/block.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-list/index.js +2 -3
- package/build-module/components/block-list/index.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-parent-selector/index.js +7 -22
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -1
- package/build-module/components/block-preview/auto.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-settings-menu/block-settings-dropdown.js +4 -18
- package/build-module/components/block-settings-menu/block-settings-dropdown.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 +6 -35
- 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/block-toolbar/utils.js +54 -49
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +13 -23
- package/build-module/components/block-variation-picker/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/editor-styles/index.js +2 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +11 -11
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/behaviors-panel.js +57 -0
- package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
- 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 +127 -27
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.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/typography-utils.js +4 -4
- package/build-module/components/global-styles/typography-utils.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 +6 -6
- 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/hooks/use-block-types-state.js +7 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build-module/components/inserter/hooks/use-patterns-state.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/inserter/reusable-blocks-tab.js +3 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -1
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/link-control/index.js +49 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +3 -3
- package/build-module/components/link-control/link-preview.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/list-view/use-list-view-drop-zone.js +6 -1
- package/build-module/components/list-view/use-list-view-drop-zone.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/media-replace-flow/index.native.js +15 -3
- package/build-module/components/media-replace-flow/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/format-edit.js +51 -26
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +100 -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 +2 -2
- 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/behaviors.js +5 -12
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/border.js +2 -1
- package/build-module/hooks/border.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/style.js +11 -2
- package/build-module/hooks/style.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 +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -5
- 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 +20 -75
- 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 +25 -6
- package/build-style/style.css +25 -6
- package/package.json +32 -32
- package/src/autocompleters/block.js +21 -6
- 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 +2 -57
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-editing-mode/index.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.js +6 -1
- 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/index.js +3 -6
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +40 -6
- package/src/components/block-parent-selector/index.js +30 -42
- package/src/components/block-preview/auto.js +8 -1
- package/src/components/block-preview/style.scss +2 -1
- 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-settings-menu/block-settings-dropdown.js +4 -13
- 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 +36 -64
- 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/block-toolbar/utils.js +57 -45
- package/src/components/block-tools/block-contextual-toolbar.js +43 -35
- package/src/components/block-tools/style.scss +17 -5
- package/src/components/block-variation-picker/index.native.js +52 -72
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/editor-styles/index.js +2 -2
- package/src/components/font-sizes/fluid-utils.js +17 -17
- package/src/components/font-sizes/test/fluid-utils.js +6 -6
- package/src/components/global-styles/behaviors-panel.js +71 -0
- 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 +134 -31
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/typography-utils.js +6 -6
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/typography-utils.js +4 -4
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +17 -7
- 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/hooks/use-block-types-state.js +15 -6
- package/src/components/inserter/hooks/use-debounced-input.js +8 -7
- package/src/components/inserter/hooks/use-patterns-state.js +2 -1
- 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/reusable-blocks-tab.js +4 -1
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/inserter-list-item/index.js +3 -1
- package/src/components/link-control/README.md +12 -3
- package/src/components/link-control/index.js +47 -7
- package/src/components/link-control/link-preview.js +6 -4
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +11 -3
- package/src/components/link-control/test/index.js +28 -1
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/list-view/use-list-view-drop-zone.js +5 -1
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/media-replace-flow/index.native.js +12 -3
- package/src/components/media-upload/test/index.native.js +1 -0
- 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/format-edit.js +62 -38
- package/src/components/rich-text/get-rich-text-values.js +99 -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/test/utils.js +9 -1
- package/src/components/spacing-sizes-control/utils.js +2 -2
- 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/behaviors.js +10 -16
- package/src/hooks/border.js +2 -1
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/style.js +7 -3
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +9 -1
- package/src/store/actions.js +23 -30
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +36 -85
- 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 +8 -7
- 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
|
@@ -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/behaviors.js
CHANGED
|
@@ -22,15 +22,13 @@ function BehaviorsControl( {
|
|
|
22
22
|
onChangeAnimation,
|
|
23
23
|
disabled = false,
|
|
24
24
|
} ) {
|
|
25
|
-
const { settings
|
|
25
|
+
const { settings } = useSelect(
|
|
26
26
|
( select ) => {
|
|
27
|
-
const {
|
|
28
|
-
|
|
27
|
+
const { getSettings } = select( blockEditorStore );
|
|
29
28
|
return {
|
|
30
29
|
settings:
|
|
31
30
|
getSettings()?.__experimentalFeatures?.blocks?.[ blockName ]
|
|
32
|
-
?.behaviors,
|
|
33
|
-
themeBehaviors: getBehaviors()?.blocks?.[ blockName ],
|
|
31
|
+
?.behaviors || {},
|
|
34
32
|
};
|
|
35
33
|
},
|
|
36
34
|
[ blockName ]
|
|
@@ -46,7 +44,6 @@ function BehaviorsControl( {
|
|
|
46
44
|
label: __( 'No behaviors' ),
|
|
47
45
|
},
|
|
48
46
|
};
|
|
49
|
-
|
|
50
47
|
const behaviorsOptions = Object.entries( settings )
|
|
51
48
|
.filter(
|
|
52
49
|
( [ behaviorName, behaviorValue ] ) =>
|
|
@@ -60,7 +57,6 @@ function BehaviorsControl( {
|
|
|
60
57
|
.slice( 1 )
|
|
61
58
|
.toLowerCase() }`,
|
|
62
59
|
} ) );
|
|
63
|
-
|
|
64
60
|
const options = [
|
|
65
61
|
...Object.values( defaultBehaviors ),
|
|
66
62
|
...behaviorsOptions,
|
|
@@ -68,7 +64,6 @@ function BehaviorsControl( {
|
|
|
68
64
|
|
|
69
65
|
const { behaviors, behaviorsValue } = useMemo( () => {
|
|
70
66
|
const mergedBehaviors = {
|
|
71
|
-
...themeBehaviors,
|
|
72
67
|
...( blockBehaviors || {} ),
|
|
73
68
|
};
|
|
74
69
|
|
|
@@ -83,7 +78,8 @@ function BehaviorsControl( {
|
|
|
83
78
|
behaviors: mergedBehaviors,
|
|
84
79
|
behaviorsValue: value,
|
|
85
80
|
};
|
|
86
|
-
}, [ blockBehaviors
|
|
81
|
+
}, [ blockBehaviors ] );
|
|
82
|
+
|
|
87
83
|
// If every behavior is disabled, do not show the behaviors inspector control.
|
|
88
84
|
if ( behaviorsOptions.length === 0 ) {
|
|
89
85
|
return null;
|
|
@@ -203,10 +199,8 @@ export const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {
|
|
|
203
199
|
};
|
|
204
200
|
}, 'withBehaviors' );
|
|
205
201
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
);
|
|
212
|
-
}
|
|
202
|
+
addFilter(
|
|
203
|
+
'editor.BlockEdit',
|
|
204
|
+
'core/behaviors/with-inspector-control',
|
|
205
|
+
withBehaviors
|
|
206
|
+
);
|
package/src/hooks/border.js
CHANGED
|
@@ -377,13 +377,14 @@ export const withBorderColorPaletteStyles = createHigherOrderComponent(
|
|
|
377
377
|
borderBottomColor: borderBottomColor || borderColorValue,
|
|
378
378
|
borderLeftColor: borderLeftColor || borderColorValue,
|
|
379
379
|
};
|
|
380
|
+
const cleanedExtraStyles = cleanEmptyObject( extraStyles ) || {};
|
|
380
381
|
|
|
381
382
|
let wrapperProps = props.wrapperProps;
|
|
382
383
|
wrapperProps = {
|
|
383
384
|
...props.wrapperProps,
|
|
384
385
|
style: {
|
|
385
386
|
...props.wrapperProps?.style,
|
|
386
|
-
...
|
|
387
|
+
...cleanedExtraStyles,
|
|
387
388
|
},
|
|
388
389
|
};
|
|
389
390
|
|
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/style.js
CHANGED
|
@@ -44,8 +44,8 @@ const styleSupportKeys = [
|
|
|
44
44
|
SPACING_SUPPORT_KEY,
|
|
45
45
|
];
|
|
46
46
|
|
|
47
|
-
const hasStyleSupport = (
|
|
48
|
-
styleSupportKeys.some( ( key ) => hasBlockSupport(
|
|
47
|
+
const hasStyleSupport = ( nameOrType ) =>
|
|
48
|
+
styleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Returns the inline styles to add depending on the style object
|
|
@@ -347,6 +347,10 @@ export function addEditProps( settings ) {
|
|
|
347
347
|
*/
|
|
348
348
|
export const withBlockControls = createHigherOrderComponent(
|
|
349
349
|
( BlockEdit ) => ( props ) => {
|
|
350
|
+
if ( ! hasStyleSupport( props.name ) ) {
|
|
351
|
+
return <BlockEdit key="edit" { ...props } />;
|
|
352
|
+
}
|
|
353
|
+
|
|
350
354
|
const shouldDisplayControls = useDisplayBlockControls();
|
|
351
355
|
const blockEditingMode = useBlockEditingMode();
|
|
352
356
|
|
|
@@ -360,7 +364,7 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
360
364
|
<DimensionsPanel { ...props } />
|
|
361
365
|
</>
|
|
362
366
|
) }
|
|
363
|
-
<BlockEdit { ...props } />
|
|
367
|
+
<BlockEdit key="edit" { ...props } />
|
|
364
368
|
</>
|
|
365
369
|
);
|
|
366
370
|
},
|
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,11 @@ 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';
|
|
26
|
+
import { usesContextKey } from './components/rich-text/format-edit';
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
29
|
* Private @wordpress/block-editor APIs.
|
|
@@ -43,4 +48,7 @@ lock( privateApis, {
|
|
|
43
48
|
useLayoutStyles,
|
|
44
49
|
DimensionsTool,
|
|
45
50
|
ResolutionTool,
|
|
51
|
+
ReusableBlocksRenameHint,
|
|
52
|
+
useReusableBlocksRenameHint,
|
|
53
|
+
usesContextKey,
|
|
46
54
|
} );
|
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
|
/**
|
|
@@ -949,36 +948,30 @@ export const __unstableSplitSelection =
|
|
|
949
948
|
valueA = remove( valueA, selectionA.offset, valueA.text.length );
|
|
950
949
|
valueB = remove( valueB, 0, selectionB.offset );
|
|
951
950
|
|
|
952
|
-
dispatch.replaceBlocks(
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
...blockA,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
...mapRichTextSettings( attributeDefinitionA ),
|
|
963
|
-
} ),
|
|
964
|
-
},
|
|
951
|
+
dispatch.replaceBlocks( select.getSelectedBlockClientIds(), [
|
|
952
|
+
{
|
|
953
|
+
// Preserve the original client ID.
|
|
954
|
+
...blockA,
|
|
955
|
+
attributes: {
|
|
956
|
+
...blockA.attributes,
|
|
957
|
+
[ selectionA.attributeKey ]: toHTMLString( {
|
|
958
|
+
value: valueA,
|
|
959
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
960
|
+
} ),
|
|
965
961
|
},
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
},
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
// Preserve the original client ID.
|
|
965
|
+
...blockB,
|
|
966
|
+
attributes: {
|
|
967
|
+
...blockB.attributes,
|
|
968
|
+
[ selectionB.attributeKey ]: toHTMLString( {
|
|
969
|
+
value: valueB,
|
|
970
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
971
|
+
} ),
|
|
977
972
|
},
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
select.getSelectedBlocksInitialCaretPosition()
|
|
981
|
-
);
|
|
973
|
+
},
|
|
974
|
+
] );
|
|
982
975
|
};
|
|
983
976
|
|
|
984
977
|
/**
|
|
@@ -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
|
@@ -1962,51 +1962,8 @@ const buildBlockTypeItem =
|
|
|
1962
1962
|
*/
|
|
1963
1963
|
export const getInserterItems = createSelector(
|
|
1964
1964
|
( state, rootClientId = null ) => {
|
|
1965
|
-
/*
|
|
1966
|
-
* Matches block comment delimiters amid serialized content.
|
|
1967
|
-
*
|
|
1968
|
-
* @see `tokenizer` in `@wordpress/block-serialization-default-parser`
|
|
1969
|
-
* package
|
|
1970
|
-
*
|
|
1971
|
-
* blockParserTokenizer differs from the original tokenizer in the
|
|
1972
|
-
* following ways:
|
|
1973
|
-
*
|
|
1974
|
-
* - removed global flag (/g)
|
|
1975
|
-
* - prepended ^\s*
|
|
1976
|
-
*
|
|
1977
|
-
*/
|
|
1978
|
-
const blockParserTokenizer =
|
|
1979
|
-
/^\s*<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/;
|
|
1980
|
-
|
|
1981
1965
|
const buildReusableBlockInserterItem = ( reusableBlock ) => {
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
/*
|
|
1985
|
-
* Instead of always displaying a generic "symbol" icon for every
|
|
1986
|
-
* reusable block, try to use an icon that represents the first
|
|
1987
|
-
* outermost block contained in the reusable block. This requires
|
|
1988
|
-
* scanning the serialized form of the reusable block to find its
|
|
1989
|
-
* first block delimiter, then looking up the corresponding block
|
|
1990
|
-
* type, if available.
|
|
1991
|
-
*/
|
|
1992
|
-
if ( Platform.OS === 'web' ) {
|
|
1993
|
-
const content =
|
|
1994
|
-
typeof reusableBlock.content.raw === 'string'
|
|
1995
|
-
? reusableBlock.content.raw
|
|
1996
|
-
: reusableBlock.content;
|
|
1997
|
-
const rawBlockMatch = content.match( blockParserTokenizer );
|
|
1998
|
-
if ( rawBlockMatch ) {
|
|
1999
|
-
const [ , , namespace = 'core/', blockName ] =
|
|
2000
|
-
rawBlockMatch;
|
|
2001
|
-
const referencedBlockType = getBlockType(
|
|
2002
|
-
namespace + blockName
|
|
2003
|
-
);
|
|
2004
|
-
if ( referencedBlockType ) {
|
|
2005
|
-
icon = referencedBlockType.icon;
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
|
|
1966
|
+
const icon = symbol;
|
|
2010
1967
|
const id = `core/block/${ reusableBlock.id }`;
|
|
2011
1968
|
const { time, count = 0 } = getInsertUsage( state, id ) || {};
|
|
2012
1969
|
const frecency = calculateFrecency( time, count );
|
|
@@ -2018,11 +1975,12 @@ export const getInserterItems = createSelector(
|
|
|
2018
1975
|
title: reusableBlock.title.raw,
|
|
2019
1976
|
icon,
|
|
2020
1977
|
category: 'reusable',
|
|
2021
|
-
keywords: [],
|
|
1978
|
+
keywords: [ 'reusable' ],
|
|
2022
1979
|
isDisabled: false,
|
|
2023
1980
|
utility: 1, // Deprecated.
|
|
2024
1981
|
frecency,
|
|
2025
1982
|
content: reusableBlock.content.raw,
|
|
1983
|
+
syncStatus: reusableBlock.wp_pattern_sync_status,
|
|
2026
1984
|
};
|
|
2027
1985
|
};
|
|
2028
1986
|
|
|
@@ -2031,18 +1989,7 @@ export const getInserterItems = createSelector(
|
|
|
2031
1989
|
'core/block',
|
|
2032
1990
|
rootClientId
|
|
2033
1991
|
)
|
|
2034
|
-
? getReusableBlocks( state )
|
|
2035
|
-
.filter(
|
|
2036
|
-
( reusableBlock ) =>
|
|
2037
|
-
// Reusable blocks that are fully synced should have no sync status set
|
|
2038
|
-
// for backwards compat between patterns and old reusable blocks, but
|
|
2039
|
-
// some in release 16.1 may have had sync status inadvertantly set to
|
|
2040
|
-
// 'fully' if created in the site editor.
|
|
2041
|
-
reusableBlock.wp_pattern_sync_status === 'fully' ||
|
|
2042
|
-
reusableBlock.wp_pattern_sync_status === '' ||
|
|
2043
|
-
! reusableBlock.wp_pattern_sync_status
|
|
2044
|
-
)
|
|
2045
|
-
.map( buildReusableBlockInserterItem )
|
|
1992
|
+
? getReusableBlocks( state ).map( buildReusableBlockInserterItem )
|
|
2046
1993
|
: [];
|
|
2047
1994
|
|
|
2048
1995
|
const buildBlockTypeInserterItem = buildBlockTypeItem( state, {
|
|
@@ -2214,15 +2161,24 @@ export const getAllowedBlocks = createSelector(
|
|
|
2214
2161
|
return;
|
|
2215
2162
|
}
|
|
2216
2163
|
|
|
2217
|
-
|
|
2164
|
+
const blockTypes = getBlockTypes().filter( ( blockType ) =>
|
|
2218
2165
|
canIncludeBlockTypeInInserter( state, blockType, rootClientId )
|
|
2219
2166
|
);
|
|
2167
|
+
const hasReusableBlock =
|
|
2168
|
+
canInsertBlockTypeUnmemoized( state, 'core/block', rootClientId ) &&
|
|
2169
|
+
getReusableBlocks( state ).length > 0;
|
|
2170
|
+
|
|
2171
|
+
return [
|
|
2172
|
+
...blockTypes,
|
|
2173
|
+
...( hasReusableBlock ? [ 'core/block' ] : [] ),
|
|
2174
|
+
];
|
|
2220
2175
|
},
|
|
2221
2176
|
( state, rootClientId ) => [
|
|
2222
2177
|
state.blockListSettings[ rootClientId ],
|
|
2223
2178
|
state.blocks.byClientId,
|
|
2224
2179
|
state.settings.allowedBlockTypes,
|
|
2225
2180
|
state.settings.templateLock,
|
|
2181
|
+
getReusableBlocks( state ),
|
|
2226
2182
|
getBlockTypes(),
|
|
2227
2183
|
]
|
|
2228
2184
|
);
|
|
@@ -2258,15 +2214,15 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
2258
2214
|
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
2259
2215
|
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
|
|
2260
2216
|
*/
|
|
2261
|
-
export const
|
|
2217
|
+
export const getDirectInsertBlock = createSelector(
|
|
2262
2218
|
( state, rootClientId = null ) => {
|
|
2263
2219
|
if ( ! rootClientId ) {
|
|
2264
2220
|
return;
|
|
2265
2221
|
}
|
|
2266
2222
|
const defaultBlock =
|
|
2267
|
-
state.blockListSettings[ rootClientId ]?.
|
|
2223
|
+
state.blockListSettings[ rootClientId ]?.defaultBlock;
|
|
2268
2224
|
const directInsert =
|
|
2269
|
-
state.blockListSettings[ rootClientId ]?.
|
|
2225
|
+
state.blockListSettings[ rootClientId ]?.directInsert;
|
|
2270
2226
|
if ( ! defaultBlock || ! directInsert ) {
|
|
2271
2227
|
return;
|
|
2272
2228
|
}
|
|
@@ -2283,6 +2239,25 @@ export const __experimentalGetDirectInsertBlock = createSelector(
|
|
|
2283
2239
|
]
|
|
2284
2240
|
);
|
|
2285
2241
|
|
|
2242
|
+
export const __experimentalGetDirectInsertBlock = createSelector(
|
|
2243
|
+
( state, rootClientId = null ) => {
|
|
2244
|
+
deprecated(
|
|
2245
|
+
'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',
|
|
2246
|
+
{
|
|
2247
|
+
alternative:
|
|
2248
|
+
'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
|
|
2249
|
+
since: '6.3',
|
|
2250
|
+
version: '6.4',
|
|
2251
|
+
}
|
|
2252
|
+
);
|
|
2253
|
+
return getDirectInsertBlock( state, rootClientId );
|
|
2254
|
+
},
|
|
2255
|
+
( state, rootClientId ) => [
|
|
2256
|
+
state.blockListSettings[ rootClientId ],
|
|
2257
|
+
state.blocks.tree.get( rootClientId ),
|
|
2258
|
+
]
|
|
2259
|
+
);
|
|
2260
|
+
|
|
2286
2261
|
const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
|
|
2287
2262
|
if ( typeof allowedBlockTypes === 'boolean' ) {
|
|
2288
2263
|
return allowedBlockTypes;
|
|
@@ -2549,30 +2524,6 @@ export function getSettings( state ) {
|
|
|
2549
2524
|
return state.settings;
|
|
2550
2525
|
}
|
|
2551
2526
|
|
|
2552
|
-
/**
|
|
2553
|
-
* Returns the behaviors registered with the editor.
|
|
2554
|
-
*
|
|
2555
|
-
* Behaviors are named, reusable pieces of functionality that can be
|
|
2556
|
-
* attached to blocks. They are registered with the editor using the
|
|
2557
|
-
* `theme.json` file.
|
|
2558
|
-
*
|
|
2559
|
-
* @example
|
|
2560
|
-
*
|
|
2561
|
-
* ```js
|
|
2562
|
-
* const behaviors = select( blockEditorStore ).getBehaviors();
|
|
2563
|
-
* if ( behaviors?.lightbox ) {
|
|
2564
|
-
* // Do something with the lightbox.
|
|
2565
|
-
* }
|
|
2566
|
-
*```
|
|
2567
|
-
*
|
|
2568
|
-
* @param {Object} state Editor state.
|
|
2569
|
-
*
|
|
2570
|
-
* @return {Object} The editor behaviors object.
|
|
2571
|
-
*/
|
|
2572
|
-
export function getBehaviors( state ) {
|
|
2573
|
-
return state.settings.behaviors;
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
2527
|
/**
|
|
2577
2528
|
* Returns true if the most recent block change is be considered persistent, or
|
|
2578
2529
|
* false otherwise. A persistent change is one committed by BlockEditorProvider
|
|
@@ -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: [],
|
|
@@ -3328,25 +3328,32 @@ describe( 'state', () => {
|
|
|
3328
3328
|
expect( state.clientIds ).toEqual( [ clientIdOne, clientIdTwo ] );
|
|
3329
3329
|
} );
|
|
3330
3330
|
|
|
3331
|
-
it( 'should return client ids of
|
|
3332
|
-
const
|
|
3333
|
-
|
|
3331
|
+
it( 'should return client ids of the original blocks when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => {
|
|
3332
|
+
const initialBlocks = deepFreeze( [
|
|
3333
|
+
'62bfef6e-d5e9-43ba-b7f9-c77cf354141f',
|
|
3334
|
+
'9db792c6-a25a-495d-adbd-97d56a4c4189',
|
|
3335
|
+
] );
|
|
3334
3336
|
|
|
3335
3337
|
const action = {
|
|
3336
3338
|
blocks: [
|
|
3337
3339
|
{
|
|
3338
|
-
clientId:
|
|
3340
|
+
clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1',
|
|
3339
3341
|
},
|
|
3340
3342
|
{
|
|
3341
|
-
clientId:
|
|
3343
|
+
clientId: '14501cc2-90a6-4f52-aa36-ab6e896135d1',
|
|
3342
3344
|
},
|
|
3343
3345
|
],
|
|
3344
3346
|
type: 'REPLACE_INNER_BLOCKS',
|
|
3345
3347
|
};
|
|
3346
3348
|
|
|
3347
|
-
const state = lastBlockInserted(
|
|
3349
|
+
const state = lastBlockInserted(
|
|
3350
|
+
{
|
|
3351
|
+
clientIds: initialBlocks,
|
|
3352
|
+
},
|
|
3353
|
+
action
|
|
3354
|
+
);
|
|
3348
3355
|
|
|
3349
|
-
expect( state.clientIds ).toEqual(
|
|
3356
|
+
expect( state.clientIds ).toEqual( initialBlocks );
|
|
3350
3357
|
} );
|
|
3351
3358
|
|
|
3352
3359
|
it( 'should return empty state if last block inserted is called with action RESET_BLOCKS', () => {
|