@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
|
@@ -43,7 +43,19 @@ exports[`Block Mover Picker moving blocks moves blocks up and down 1`] = `
|
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
45
|
exports[`Block Mover Picker should render without crashing and match snapshot 1`] = `
|
|
46
|
-
|
|
46
|
+
<View
|
|
47
|
+
style={
|
|
48
|
+
[
|
|
49
|
+
{
|
|
50
|
+
"height": 44,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"borderLeftWidth": 0.5,
|
|
54
|
+
},
|
|
55
|
+
undefined,
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
>
|
|
47
59
|
<View>
|
|
48
60
|
<View
|
|
49
61
|
accessibilityHint="Double tap to move the block to the left"
|
|
@@ -51,7 +63,19 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
51
63
|
accessibilityRole="button"
|
|
52
64
|
accessibilityState={
|
|
53
65
|
{
|
|
66
|
+
"busy": undefined,
|
|
67
|
+
"checked": undefined,
|
|
54
68
|
"disabled": false,
|
|
69
|
+
"expanded": undefined,
|
|
70
|
+
"selected": undefined,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
accessibilityValue={
|
|
74
|
+
{
|
|
75
|
+
"max": undefined,
|
|
76
|
+
"min": undefined,
|
|
77
|
+
"now": undefined,
|
|
78
|
+
"text": undefined,
|
|
55
79
|
}
|
|
56
80
|
}
|
|
57
81
|
accessible={true}
|
|
@@ -99,7 +123,6 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
99
123
|
}
|
|
100
124
|
>
|
|
101
125
|
<Svg
|
|
102
|
-
colorScheme="light"
|
|
103
126
|
height={24}
|
|
104
127
|
style={{}}
|
|
105
128
|
viewBox="0 0 24 24"
|
|
@@ -111,7 +134,7 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
111
134
|
</View>
|
|
112
135
|
</View>
|
|
113
136
|
</View>
|
|
114
|
-
</View
|
|
137
|
+
</View>
|
|
115
138
|
<View>
|
|
116
139
|
<View
|
|
117
140
|
accessibilityHint="Double tap to move the block to the right"
|
|
@@ -119,7 +142,19 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
119
142
|
accessibilityRole="button"
|
|
120
143
|
accessibilityState={
|
|
121
144
|
{
|
|
145
|
+
"busy": undefined,
|
|
146
|
+
"checked": undefined,
|
|
122
147
|
"disabled": true,
|
|
148
|
+
"expanded": undefined,
|
|
149
|
+
"selected": undefined,
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
accessibilityValue={
|
|
153
|
+
{
|
|
154
|
+
"max": undefined,
|
|
155
|
+
"min": undefined,
|
|
156
|
+
"now": undefined,
|
|
157
|
+
"text": undefined,
|
|
123
158
|
}
|
|
124
159
|
}
|
|
125
160
|
accessible={true}
|
|
@@ -167,7 +202,6 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
167
202
|
}
|
|
168
203
|
>
|
|
169
204
|
<Svg
|
|
170
|
-
colorScheme="light"
|
|
171
205
|
height={24}
|
|
172
206
|
style={{}}
|
|
173
207
|
viewBox="0 0 24 24"
|
|
@@ -179,6 +213,6 @@ exports[`Block Mover Picker should render without crashing and match snapshot 1`
|
|
|
179
213
|
</View>
|
|
180
214
|
</View>
|
|
181
215
|
</View>
|
|
182
|
-
</View
|
|
183
|
-
|
|
216
|
+
</View>
|
|
217
|
+
</View>
|
|
184
218
|
`;
|
|
@@ -12,7 +12,7 @@ import { useRef } from '@wordpress/element';
|
|
|
12
12
|
*/
|
|
13
13
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
14
14
|
import BlockIcon from '../block-icon';
|
|
15
|
-
import {
|
|
15
|
+
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
16
16
|
import { store as blockEditorStore } from '../../store';
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
|
|
@@ -23,52 +23,40 @@ import { unlock } from '../../lock-unlock';
|
|
|
23
23
|
* @return {WPComponent} Parent block selector.
|
|
24
24
|
*/
|
|
25
25
|
export default function BlockParentSelector() {
|
|
26
|
-
const { selectBlock
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
true
|
|
53
|
-
),
|
|
54
|
-
isDistractionFree: settings.isDistractionFree,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
[]
|
|
58
|
-
);
|
|
26
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
27
|
+
const { firstParentClientId, isVisible } = useSelect( ( select ) => {
|
|
28
|
+
const {
|
|
29
|
+
getBlockName,
|
|
30
|
+
getBlockParents,
|
|
31
|
+
getSelectedBlockClientId,
|
|
32
|
+
getBlockEditingMode,
|
|
33
|
+
} = unlock( select( blockEditorStore ) );
|
|
34
|
+
const { hasBlockSupport } = select( blocksStore );
|
|
35
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
36
|
+
const parents = getBlockParents( selectedBlockClientId );
|
|
37
|
+
const _firstParentClientId = parents[ parents.length - 1 ];
|
|
38
|
+
const parentBlockName = getBlockName( _firstParentClientId );
|
|
39
|
+
const _parentBlockType = getBlockType( parentBlockName );
|
|
40
|
+
return {
|
|
41
|
+
firstParentClientId: _firstParentClientId,
|
|
42
|
+
isVisible:
|
|
43
|
+
_firstParentClientId &&
|
|
44
|
+
getBlockEditingMode( _firstParentClientId ) === 'default' &&
|
|
45
|
+
hasBlockSupport(
|
|
46
|
+
_parentBlockType,
|
|
47
|
+
'__experimentalParentSelector',
|
|
48
|
+
true
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
}, [] );
|
|
59
52
|
const blockInformation = useBlockDisplayInformation( firstParentClientId );
|
|
60
53
|
|
|
61
54
|
// Allows highlighting the parent block outline when focusing or hovering
|
|
62
55
|
// the parent block selector within the child.
|
|
63
56
|
const nodeRef = useRef();
|
|
64
|
-
const
|
|
57
|
+
const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {
|
|
65
58
|
ref: nodeRef,
|
|
66
|
-
|
|
67
|
-
if ( isFocused && isDistractionFree ) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
toggleBlockHighlight( firstParentClientId, isFocused );
|
|
71
|
-
},
|
|
59
|
+
highlightParent: true,
|
|
72
60
|
} );
|
|
73
61
|
|
|
74
62
|
if ( ! isVisible ) {
|
|
@@ -80,7 +68,7 @@ export default function BlockParentSelector() {
|
|
|
80
68
|
className="block-editor-block-parent-selector"
|
|
81
69
|
key={ firstParentClientId }
|
|
82
70
|
ref={ nodeRef }
|
|
83
|
-
{ ...
|
|
71
|
+
{ ...showHoveredOrFocusedGestures }
|
|
84
72
|
>
|
|
85
73
|
<ToolbarButton
|
|
86
74
|
className="block-editor-block-parent-selector__button"
|
|
@@ -58,12 +58,19 @@ function ScaledBlockPreview( {
|
|
|
58
58
|
MemoizedBlockList = MemoizedBlockList || pure( BlockList );
|
|
59
59
|
|
|
60
60
|
const scale = containerWidth / viewportWidth;
|
|
61
|
+
const aspectRatio = contentHeight
|
|
62
|
+
? containerWidth / ( contentHeight * scale )
|
|
63
|
+
: 0;
|
|
61
64
|
return (
|
|
62
65
|
<Disabled
|
|
63
66
|
className="block-editor-block-preview__content"
|
|
64
67
|
style={ {
|
|
65
68
|
transform: `scale(${ scale })`,
|
|
66
|
-
height
|
|
69
|
+
// Using width + aspect-ratio instead of height here triggers browsers' native
|
|
70
|
+
// handling of scrollbar's visibility. It prevents the flickering issue seen
|
|
71
|
+
// in https://github.com/WordPress/gutenberg/issues/52027.
|
|
72
|
+
// See https://github.com/WordPress/gutenberg/pull/52921 for more info.
|
|
73
|
+
aspectRatio,
|
|
67
74
|
maxHeight:
|
|
68
75
|
contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,
|
|
69
76
|
minHeight,
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
|
|
13
13
|
.block-editor-block-preview__content {
|
|
14
|
-
// This element receives inline styles for
|
|
14
|
+
// This element receives inline styles for transform-scale and aspect-ratio.
|
|
15
15
|
// Those inline styles are calculated to fit a perfect thumbnail.
|
|
16
|
+
width: 100%;
|
|
16
17
|
|
|
17
18
|
// Vertical alignment. It works with the transform: translate(-50%, -50%)`,
|
|
18
19
|
top: 0;
|
|
@@ -50,9 +50,6 @@ export function BlockRemovalWarningModal( { rules } ) {
|
|
|
50
50
|
<Modal
|
|
51
51
|
title={ __( 'Are you sure?' ) }
|
|
52
52
|
onRequestClose={ clearBlockRemovalPrompt }
|
|
53
|
-
style={ {
|
|
54
|
-
maxWidth: '40rem',
|
|
55
|
-
} }
|
|
56
53
|
>
|
|
57
54
|
{ blockNamesForPrompt.length === 1 ? (
|
|
58
55
|
<p>{ rules[ blockNamesForPrompt[ 0 ] ] }</p>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createSlotFill,
|
|
6
|
+
ToolbarButton,
|
|
7
|
+
ToolbarGroup,
|
|
8
|
+
} from '@wordpress/components';
|
|
5
9
|
import { __ } from '@wordpress/i18n';
|
|
6
10
|
import { withDispatch } from '@wordpress/data';
|
|
7
11
|
import { cog } from '@wordpress/icons';
|
|
@@ -9,11 +13,13 @@ import { cog } from '@wordpress/icons';
|
|
|
9
13
|
const { Fill, Slot } = createSlotFill( 'SettingsToolbarButton' );
|
|
10
14
|
|
|
11
15
|
const SettingsButton = ( { openGeneralSidebar } ) => (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
<ToolbarGroup>
|
|
17
|
+
<ToolbarButton
|
|
18
|
+
title={ __( 'Open Settings' ) }
|
|
19
|
+
icon={ cog }
|
|
20
|
+
onClick={ openGeneralSidebar }
|
|
21
|
+
/>
|
|
22
|
+
</ToolbarGroup>
|
|
17
23
|
);
|
|
18
24
|
|
|
19
25
|
const SettingsButtonFill = ( props ) => (
|
|
@@ -31,7 +31,7 @@ import BlockHTMLConvertButton from './block-html-convert-button';
|
|
|
31
31
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
32
32
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
33
33
|
import { store as blockEditorStore } from '../../store';
|
|
34
|
-
import {
|
|
34
|
+
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
35
35
|
|
|
36
36
|
const POPOVER_PROPS = {
|
|
37
37
|
className: 'block-editor-block-settings-menu__popover',
|
|
@@ -60,7 +60,6 @@ export function BlockSettingsDropdown( {
|
|
|
60
60
|
const firstBlockClientId = blockClientIds[ 0 ];
|
|
61
61
|
const {
|
|
62
62
|
firstParentClientId,
|
|
63
|
-
isDistractionFree,
|
|
64
63
|
onlyBlock,
|
|
65
64
|
parentBlockType,
|
|
66
65
|
previousBlockClientId,
|
|
@@ -73,7 +72,6 @@ export function BlockSettingsDropdown( {
|
|
|
73
72
|
getBlockRootClientId,
|
|
74
73
|
getPreviousBlockClientId,
|
|
75
74
|
getSelectedBlockClientIds,
|
|
76
|
-
getSettings,
|
|
77
75
|
getBlockAttributes,
|
|
78
76
|
} = select( blockEditorStore );
|
|
79
77
|
|
|
@@ -86,7 +84,6 @@ export function BlockSettingsDropdown( {
|
|
|
86
84
|
|
|
87
85
|
return {
|
|
88
86
|
firstParentClientId: _firstParentClientId,
|
|
89
|
-
isDistractionFree: getSettings().isDistractionFree,
|
|
90
87
|
onlyBlock: 1 === getBlockCount( _firstParentClientId ),
|
|
91
88
|
parentBlockType:
|
|
92
89
|
_firstParentClientId &&
|
|
@@ -122,8 +119,7 @@ export function BlockSettingsDropdown( {
|
|
|
122
119
|
}, [] );
|
|
123
120
|
const isMatch = __unstableUseShortcutEventMatch();
|
|
124
121
|
|
|
125
|
-
const { selectBlock
|
|
126
|
-
useDispatch( blockEditorStore );
|
|
122
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
127
123
|
const hasSelectedBlocks = selectedBlockClientIds.length > 0;
|
|
128
124
|
|
|
129
125
|
const updateSelectionAfterDuplicate = useCallback(
|
|
@@ -168,14 +164,9 @@ export function BlockSettingsDropdown( {
|
|
|
168
164
|
// Allows highlighting the parent block outline when focusing or hovering
|
|
169
165
|
// the parent block selector within the child.
|
|
170
166
|
const selectParentButtonRef = useRef();
|
|
171
|
-
const
|
|
167
|
+
const showParentOutlineGestures = useShowHoveredOrFocusedGestures( {
|
|
172
168
|
ref: selectParentButtonRef,
|
|
173
|
-
|
|
174
|
-
if ( isFocused && isDistractionFree ) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
toggleBlockHighlight( firstParentClientId, isFocused );
|
|
178
|
-
},
|
|
169
|
+
highlightParent: true,
|
|
179
170
|
} );
|
|
180
171
|
|
|
181
172
|
// This can occur when the selected block (the parent)
|
|
@@ -9,6 +9,7 @@ import { Platform, findNodeHandle } from 'react-native';
|
|
|
9
9
|
import {
|
|
10
10
|
getClipboard,
|
|
11
11
|
setClipboard,
|
|
12
|
+
ToolbarGroup,
|
|
12
13
|
ToolbarButton,
|
|
13
14
|
Picker,
|
|
14
15
|
} from '@wordpress/components';
|
|
@@ -99,9 +100,11 @@ const BlockActionsMenu = ( {
|
|
|
99
100
|
} = getMoversSetup( isStackedHorizontally, moversOptions );
|
|
100
101
|
|
|
101
102
|
// Check if selected block is Groupable and/or Ungroupable.
|
|
102
|
-
const convertToGroupButtonProps = useConvertToGroupButtonProps(
|
|
103
|
-
selectedBlockClientId
|
|
104
|
-
|
|
103
|
+
const convertToGroupButtonProps = useConvertToGroupButtonProps(
|
|
104
|
+
// `selectedBlockClientId` can be undefined in some cases where this
|
|
105
|
+
// component gets re-rendered right after the block is removed.
|
|
106
|
+
selectedBlockClientId ? [ selectedBlockClientId ] : []
|
|
107
|
+
);
|
|
105
108
|
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
106
109
|
const showConvertToGroupButton =
|
|
107
110
|
( isGroupable || isUngroupable ) && canRemove;
|
|
@@ -254,11 +257,13 @@ const BlockActionsMenu = ( {
|
|
|
254
257
|
// End early if there are no options to show.
|
|
255
258
|
if ( ! options.length ) {
|
|
256
259
|
return (
|
|
257
|
-
<
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
<ToolbarGroup>
|
|
261
|
+
<ToolbarButton
|
|
262
|
+
title={ __( 'Open Block Actions Menu' ) }
|
|
263
|
+
icon={ moreHorizontalMobile }
|
|
264
|
+
disabled={ true }
|
|
265
|
+
/>
|
|
266
|
+
</ToolbarGroup>
|
|
262
267
|
);
|
|
263
268
|
}
|
|
264
269
|
|
|
@@ -294,7 +299,7 @@ const BlockActionsMenu = ( {
|
|
|
294
299
|
anchorNodeRef ? findNodeHandle( anchorNodeRef ) : undefined;
|
|
295
300
|
|
|
296
301
|
return (
|
|
297
|
-
|
|
302
|
+
<ToolbarGroup>
|
|
298
303
|
<ToolbarButton
|
|
299
304
|
title={ __( 'Open Block Actions Menu' ) }
|
|
300
305
|
onClick={ onPickerPresent }
|
|
@@ -324,7 +329,7 @@ const BlockActionsMenu = ( {
|
|
|
324
329
|
selectedBlock={ getBlocksByClientId( selectedBlockClientId ) }
|
|
325
330
|
selectedBlockClientId={ selectedBlockClientId }
|
|
326
331
|
/>
|
|
327
|
-
|
|
332
|
+
</ToolbarGroup>
|
|
328
333
|
);
|
|
329
334
|
};
|
|
330
335
|
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useSelect
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import { useRef } from '@wordpress/element';
|
|
11
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
12
|
import {
|
|
@@ -29,77 +29,52 @@ import BlockSettingsMenu from '../block-settings-menu';
|
|
|
29
29
|
import { BlockLockToolbar } from '../block-lock';
|
|
30
30
|
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
31
31
|
import BlockEditVisuallyButton from '../block-edit-visually-button';
|
|
32
|
-
import {
|
|
32
|
+
import { useShowHoveredOrFocusedGestures } from './utils';
|
|
33
33
|
import { store as blockEditorStore } from '../../store';
|
|
34
34
|
import __unstableBlockNameContext from './block-name-context';
|
|
35
35
|
import { unlock } from '../../lock-unlock';
|
|
36
36
|
|
|
37
37
|
const BlockToolbar = ( { hideDragHandle } ) => {
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
hasFixedToolbar: settings.hasFixedToolbar,
|
|
69
|
-
isDistractionFree: settings.isDistractionFree,
|
|
70
|
-
rootClientId: blockRootClientId,
|
|
71
|
-
isValid: selectedBlockClientIds.every( ( id ) =>
|
|
72
|
-
isBlockValid( id )
|
|
73
|
-
),
|
|
74
|
-
isVisual: selectedBlockClientIds.every(
|
|
75
|
-
( id ) => getBlockMode( id ) === 'visual'
|
|
76
|
-
),
|
|
77
|
-
blockEditingMode: getBlockEditingMode( selectedBlockClientId ),
|
|
78
|
-
};
|
|
79
|
-
}, [] );
|
|
38
|
+
const { blockClientIds, blockType, isValid, isVisual, blockEditingMode } =
|
|
39
|
+
useSelect( ( select ) => {
|
|
40
|
+
const {
|
|
41
|
+
getBlockName,
|
|
42
|
+
getBlockMode,
|
|
43
|
+
getSelectedBlockClientIds,
|
|
44
|
+
isBlockValid,
|
|
45
|
+
getBlockRootClientId,
|
|
46
|
+
getBlockEditingMode,
|
|
47
|
+
} = unlock( select( blockEditorStore ) );
|
|
48
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
49
|
+
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
50
|
+
const blockRootClientId = getBlockRootClientId(
|
|
51
|
+
selectedBlockClientId
|
|
52
|
+
);
|
|
53
|
+
return {
|
|
54
|
+
blockClientIds: selectedBlockClientIds,
|
|
55
|
+
blockType:
|
|
56
|
+
selectedBlockClientId &&
|
|
57
|
+
getBlockType( getBlockName( selectedBlockClientId ) ),
|
|
58
|
+
rootClientId: blockRootClientId,
|
|
59
|
+
isValid: selectedBlockClientIds.every( ( id ) =>
|
|
60
|
+
isBlockValid( id )
|
|
61
|
+
),
|
|
62
|
+
isVisual: selectedBlockClientIds.every(
|
|
63
|
+
( id ) => getBlockMode( id ) === 'visual'
|
|
64
|
+
),
|
|
65
|
+
blockEditingMode: getBlockEditingMode( selectedBlockClientId ),
|
|
66
|
+
};
|
|
67
|
+
}, [] );
|
|
80
68
|
|
|
81
69
|
const toolbarWrapperRef = useRef( null );
|
|
82
70
|
|
|
83
71
|
// Handles highlighting the current block outline on hover or focus of the
|
|
84
72
|
// block type toolbar area.
|
|
85
|
-
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
86
73
|
const nodeRef = useRef();
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onChange( isFocused ) {
|
|
91
|
-
if ( isFocused && isDistractionFree ) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
toggleBlockHighlight( blockClientId, isFocused );
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
);
|
|
74
|
+
const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {
|
|
75
|
+
ref: nodeRef,
|
|
76
|
+
} );
|
|
98
77
|
|
|
99
|
-
// Account for the cases where the block toolbar is rendered within the
|
|
100
|
-
// header area and not contextually to the block.
|
|
101
|
-
const displayHeaderToolbar =
|
|
102
|
-
useViewportMatch( 'medium', '<' ) || hasFixedToolbar;
|
|
103
78
|
const isLargeViewport = ! useViewportMatch( 'medium', '<' );
|
|
104
79
|
|
|
105
80
|
if ( blockType ) {
|
|
@@ -108,8 +83,6 @@ const BlockToolbar = ( { hideDragHandle } ) => {
|
|
|
108
83
|
}
|
|
109
84
|
}
|
|
110
85
|
|
|
111
|
-
const shouldShowMovers = displayHeaderToolbar || showMovers;
|
|
112
|
-
|
|
113
86
|
if ( blockClientIds.length === 0 ) {
|
|
114
87
|
return null;
|
|
115
88
|
}
|
|
@@ -120,7 +93,6 @@ const BlockToolbar = ( { hideDragHandle } ) => {
|
|
|
120
93
|
isReusableBlock( blockType ) || isTemplatePart( blockType );
|
|
121
94
|
|
|
122
95
|
const classes = classnames( 'block-editor-block-toolbar', {
|
|
123
|
-
'is-showing-movers': shouldShowMovers,
|
|
124
96
|
'is-synced': isSynced,
|
|
125
97
|
} );
|
|
126
98
|
|
|
@@ -131,7 +103,7 @@ const BlockToolbar = ( { hideDragHandle } ) => {
|
|
|
131
103
|
blockEditingMode === 'default' && <BlockParentSelector /> }
|
|
132
104
|
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
|
|
133
105
|
blockEditingMode === 'default' && (
|
|
134
|
-
<div ref={ nodeRef } { ...
|
|
106
|
+
<div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>
|
|
135
107
|
<ToolbarGroup className="block-editor-block-toolbar__block-controls">
|
|
136
108
|
<BlockSwitcher clientIds={ blockClientIds } />
|
|
137
109
|
{ ! isMultiToolbar && (
|
|
@@ -1,23 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useCallback } from '@wordpress/element';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
10
|
+
import BlockActionsMenu from './block-toolbar-menu';
|
|
9
11
|
import BlockControls from '../block-controls';
|
|
12
|
+
import BlockMover from '../block-mover';
|
|
10
13
|
import UngroupButton from '../ungroup-button';
|
|
14
|
+
import { BlockSettingsButton } from '../block-settings';
|
|
11
15
|
import { store as blockEditorStore } from '../../store';
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const REMOVE_EMPY_PARENT_BLOCKS = [
|
|
18
|
+
'core/buttons',
|
|
19
|
+
'core/columns',
|
|
20
|
+
'core/social-links',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export default function BlockToolbar( { anchorNodeRef } ) {
|
|
24
|
+
const {
|
|
25
|
+
rootClientId,
|
|
26
|
+
blockClientId,
|
|
27
|
+
isSelected,
|
|
28
|
+
isValidAndVisual,
|
|
29
|
+
isStackedHorizontally,
|
|
30
|
+
parentBlockName,
|
|
31
|
+
parentNumberOfInnerBlocks,
|
|
32
|
+
} = useSelect( ( select ) => {
|
|
33
|
+
const {
|
|
34
|
+
getBlockListSettings,
|
|
35
|
+
getBlockMode,
|
|
36
|
+
getBlockName,
|
|
37
|
+
getBlockCount,
|
|
38
|
+
getBlockRootClientId,
|
|
39
|
+
getSelectedBlockClientIds,
|
|
40
|
+
isBlockValid,
|
|
41
|
+
} = select( blockEditorStore );
|
|
17
42
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
43
|
+
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
44
|
+
const blockRootClientId = getBlockRootClientId( selectedBlockClientId );
|
|
45
|
+
const blockListSettings = getBlockListSettings( blockRootClientId );
|
|
46
|
+
const orientation = blockListSettings?.orientation;
|
|
47
|
+
const isBlockStackedHorizontally = orientation === 'horizontal';
|
|
48
|
+
const parentName = getBlockName( blockRootClientId );
|
|
49
|
+
const numberOfInnerBlocks = getBlockCount( blockRootClientId );
|
|
18
50
|
|
|
19
51
|
return {
|
|
52
|
+
rootClientId: blockRootClientId,
|
|
53
|
+
blockClientId: selectedBlockClientId,
|
|
20
54
|
isSelected: selectedBlockClientIds.length > 0,
|
|
55
|
+
isStackedHorizontally: isBlockStackedHorizontally,
|
|
56
|
+
parentBlockName: parentName,
|
|
57
|
+
parentNumberOfInnerBlocks: numberOfInnerBlocks,
|
|
21
58
|
isValidAndVisual:
|
|
22
59
|
selectedBlockClientIds.length === 1
|
|
23
60
|
? isBlockValid( selectedBlockClientIds[ 0 ] ) &&
|
|
@@ -26,6 +63,28 @@ export default function BlockToolbar() {
|
|
|
26
63
|
};
|
|
27
64
|
}, [] );
|
|
28
65
|
|
|
66
|
+
const { removeBlock } = useDispatch( blockEditorStore );
|
|
67
|
+
const onRemove = useCallback( () => {
|
|
68
|
+
// Temp: remove parent block for specific cases where they don't
|
|
69
|
+
// have inner blocks, ideally we should match the behavior as in
|
|
70
|
+
// the Web editor and show a placeholder instead of removing the parent.
|
|
71
|
+
if (
|
|
72
|
+
REMOVE_EMPY_PARENT_BLOCKS.includes( parentBlockName ) &&
|
|
73
|
+
parentNumberOfInnerBlocks === 1
|
|
74
|
+
) {
|
|
75
|
+
removeBlock( rootClientId );
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
removeBlock( blockClientId );
|
|
80
|
+
}, [
|
|
81
|
+
blockClientId,
|
|
82
|
+
parentBlockName,
|
|
83
|
+
parentNumberOfInnerBlocks,
|
|
84
|
+
removeBlock,
|
|
85
|
+
rootClientId,
|
|
86
|
+
] );
|
|
87
|
+
|
|
29
88
|
if ( ! isSelected ) {
|
|
30
89
|
return null;
|
|
31
90
|
}
|
|
@@ -34,11 +93,32 @@ export default function BlockToolbar() {
|
|
|
34
93
|
<>
|
|
35
94
|
{ isValidAndVisual && (
|
|
36
95
|
<>
|
|
37
|
-
<
|
|
96
|
+
<BlockSettingsButton.Slot>
|
|
97
|
+
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
98
|
+
{ ( fills = [ null ] ) => {
|
|
99
|
+
if ( ! fills?.length > 0 ) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return fills[ 0 ];
|
|
103
|
+
} }
|
|
104
|
+
</BlockSettingsButton.Slot>
|
|
38
105
|
<BlockControls.Slot group="block" />
|
|
39
106
|
<BlockControls.Slot />
|
|
40
107
|
<BlockControls.Slot group="inline" />
|
|
41
108
|
<BlockControls.Slot group="other" />
|
|
109
|
+
<UngroupButton />
|
|
110
|
+
|
|
111
|
+
<BlockMover
|
|
112
|
+
clientIds={ [ blockClientId ] }
|
|
113
|
+
isStackedHorizontally={ isStackedHorizontally }
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<BlockActionsMenu
|
|
117
|
+
clientId={ blockClientId }
|
|
118
|
+
isStackedHorizontally={ isStackedHorizontally }
|
|
119
|
+
onDelete={ onRemove }
|
|
120
|
+
anchorNodeRef={ anchorNodeRef }
|
|
121
|
+
/>
|
|
42
122
|
</>
|
|
43
123
|
) }
|
|
44
124
|
</>
|