@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
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
within,
|
|
10
10
|
getEditorHtml,
|
|
11
11
|
typeInRichText,
|
|
12
|
+
openBlockActionsMenu,
|
|
12
13
|
} from 'test/helpers';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -36,15 +37,14 @@ describe( 'Block Actions Menu', () => {
|
|
|
36
37
|
<p></p>
|
|
37
38
|
<!-- /wp:paragraph -->`,
|
|
38
39
|
} );
|
|
39
|
-
const {
|
|
40
|
+
const { getByRole } = screen;
|
|
40
41
|
|
|
41
42
|
// Get block
|
|
42
43
|
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
43
44
|
fireEvent.press( paragraphBlock );
|
|
44
45
|
|
|
45
46
|
// Open block actions menu
|
|
46
|
-
|
|
47
|
-
fireEvent.press( blockActionsButton );
|
|
47
|
+
await openBlockActionsMenu( screen );
|
|
48
48
|
|
|
49
49
|
// Get Picker title
|
|
50
50
|
const pickerHeader = getByRole( 'header' );
|
|
@@ -56,10 +56,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
56
56
|
|
|
57
57
|
describe( 'moving blocks', () => {
|
|
58
58
|
it( 'moves blocks up and down', async () => {
|
|
59
|
-
const screen = await initializeEditor(
|
|
60
|
-
|
|
61
|
-
} );
|
|
62
|
-
const { getByLabelText, getByTestId } = screen;
|
|
59
|
+
const screen = await initializeEditor();
|
|
60
|
+
const { getByLabelText } = screen;
|
|
63
61
|
|
|
64
62
|
// Add Paragraph block
|
|
65
63
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -85,16 +83,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
85
83
|
} );
|
|
86
84
|
fireEvent.press( spacerBlock );
|
|
87
85
|
|
|
88
|
-
// Open block actions menu
|
|
89
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
90
|
-
|
|
91
|
-
// Get block actions modal
|
|
92
|
-
let blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
93
|
-
|
|
94
86
|
// Tap on the Move Down button
|
|
95
|
-
fireEvent.press(
|
|
96
|
-
within( blockActionsMenu ).getByLabelText( 'Move block down' )
|
|
97
|
-
);
|
|
87
|
+
fireEvent.press( getByLabelText( /Move block down/ ) );
|
|
98
88
|
|
|
99
89
|
// Get Heading block
|
|
100
90
|
const headingBlock = await getBlock( screen, 'Heading', {
|
|
@@ -102,25 +92,15 @@ describe( 'Block Actions Menu', () => {
|
|
|
102
92
|
} );
|
|
103
93
|
fireEvent.press( headingBlock );
|
|
104
94
|
|
|
105
|
-
// Open block actions menu
|
|
106
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
107
|
-
|
|
108
|
-
// Get block actions modal
|
|
109
|
-
blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
110
|
-
|
|
111
95
|
// Tap on the Move Up button
|
|
112
|
-
fireEvent.press(
|
|
113
|
-
within( blockActionsMenu ).getByLabelText( 'Move block up' )
|
|
114
|
-
);
|
|
96
|
+
fireEvent.press( getByLabelText( /Move block up/ ) );
|
|
115
97
|
|
|
116
98
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
117
99
|
} );
|
|
118
100
|
|
|
119
101
|
it( 'disables the Move Up button for the first block', async () => {
|
|
120
|
-
const screen = await initializeEditor(
|
|
121
|
-
|
|
122
|
-
} );
|
|
123
|
-
const { getByLabelText, getByTestId } = screen;
|
|
102
|
+
const screen = await initializeEditor();
|
|
103
|
+
const { getByLabelText } = screen;
|
|
124
104
|
|
|
125
105
|
// Add Paragraph block
|
|
126
106
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -144,15 +124,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
144
124
|
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
145
125
|
fireEvent.press( paragraphBlock );
|
|
146
126
|
|
|
147
|
-
// Open block actions menu
|
|
148
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
149
|
-
|
|
150
|
-
// Get block actions modal
|
|
151
|
-
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
152
|
-
|
|
153
127
|
// Get the Move Up button
|
|
154
|
-
const upButton =
|
|
155
|
-
within( blockActionsMenu ).getByLabelText( 'Move block up' );
|
|
128
|
+
const upButton = getByLabelText( /Move block up/ );
|
|
156
129
|
const isUpButtonDisabled =
|
|
157
130
|
upButton.props.accessibilityState?.disabled;
|
|
158
131
|
expect( isUpButtonDisabled ).toBe( true );
|
|
@@ -167,7 +140,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
167
140
|
const screen = await initializeEditor( {
|
|
168
141
|
screenWidth: 100,
|
|
169
142
|
} );
|
|
170
|
-
const { getByLabelText
|
|
143
|
+
const { getByLabelText } = screen;
|
|
171
144
|
|
|
172
145
|
// Add Paragraph block
|
|
173
146
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -193,15 +166,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
193
166
|
} );
|
|
194
167
|
fireEvent.press( headingBlock );
|
|
195
168
|
|
|
196
|
-
// Open block actions menu
|
|
197
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
198
|
-
|
|
199
|
-
// Get block actions modal
|
|
200
|
-
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
201
|
-
|
|
202
169
|
// Get the Move Down button
|
|
203
|
-
const downButton =
|
|
204
|
-
within( blockActionsMenu ).getByLabelText( 'Move block down' );
|
|
170
|
+
const downButton = getByLabelText( /Move block down/ );
|
|
205
171
|
const isDownButtonDisabled =
|
|
206
172
|
downButton.props.accessibilityState?.disabled;
|
|
207
173
|
expect( isDownButtonDisabled ).toBe( true );
|
|
@@ -243,7 +209,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
243
209
|
fireEvent.press( headingBlock );
|
|
244
210
|
|
|
245
211
|
// Open block actions menu
|
|
246
|
-
|
|
212
|
+
await openBlockActionsMenu( screen );
|
|
247
213
|
|
|
248
214
|
// Tap on the Copy button
|
|
249
215
|
fireEvent.press( getByLabelText( /Copy/ ) );
|
|
@@ -253,7 +219,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
253
219
|
fireEvent.press( paragraphBlock );
|
|
254
220
|
|
|
255
221
|
// Open block actions menu
|
|
256
|
-
|
|
222
|
+
await openBlockActionsMenu( screen );
|
|
257
223
|
|
|
258
224
|
// Tap on the Paste block after button
|
|
259
225
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -290,7 +256,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
290
256
|
fireEvent.press( headingBlock );
|
|
291
257
|
|
|
292
258
|
// Open block actions menu
|
|
293
|
-
|
|
259
|
+
await openBlockActionsMenu( screen );
|
|
294
260
|
|
|
295
261
|
// Tap on the Copy button
|
|
296
262
|
fireEvent.press( getByLabelText( /Copy/ ) );
|
|
@@ -300,7 +266,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
300
266
|
fireEvent.press( paragraphBlock );
|
|
301
267
|
|
|
302
268
|
// Open block actions menu
|
|
303
|
-
|
|
269
|
+
await openBlockActionsMenu( screen );
|
|
304
270
|
|
|
305
271
|
// Tap on the Past block after button
|
|
306
272
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -335,7 +301,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
335
301
|
fireEvent.press( paragraphBlock );
|
|
336
302
|
|
|
337
303
|
// Open block actions menu
|
|
338
|
-
|
|
304
|
+
await openBlockActionsMenu( screen );
|
|
339
305
|
|
|
340
306
|
// Tap on the Cut button
|
|
341
307
|
fireEvent.press( getByLabelText( /Cut block/ ) );
|
|
@@ -346,7 +312,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
346
312
|
fireEvent.press( headingBlock );
|
|
347
313
|
|
|
348
314
|
// Open block actions menu
|
|
349
|
-
|
|
315
|
+
await openBlockActionsMenu( screen );
|
|
350
316
|
|
|
351
317
|
// Tap on the Cut button
|
|
352
318
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -383,7 +349,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
383
349
|
fireEvent.press( spacerBlock );
|
|
384
350
|
|
|
385
351
|
// Open block actions menu
|
|
386
|
-
|
|
352
|
+
await openBlockActionsMenu( screen );
|
|
387
353
|
|
|
388
354
|
// Tap on the Duplicate button
|
|
389
355
|
fireEvent.press( getByLabelText( /Duplicate block/ ) );
|
|
@@ -418,7 +384,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
418
384
|
fireEvent.press( paragraphBlock );
|
|
419
385
|
|
|
420
386
|
// Open block actions menu
|
|
421
|
-
|
|
387
|
+
await openBlockActionsMenu( screen );
|
|
422
388
|
|
|
423
389
|
// Tap on the Transform block button
|
|
424
390
|
fireEvent.press( getByLabelText( /Transform block…/ ) );
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
getBlock,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
setupCoreBlocks,
|
|
10
|
+
} from 'test/helpers';
|
|
11
|
+
|
|
12
|
+
setupCoreBlocks();
|
|
13
|
+
|
|
14
|
+
describe( 'Block Toolbar', () => {
|
|
15
|
+
it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const screen = await initializeEditor();
|
|
18
|
+
await addBlock( screen, 'Image' );
|
|
19
|
+
|
|
20
|
+
// Act
|
|
21
|
+
fireEvent(
|
|
22
|
+
screen.getByTestId( 'media-options-picker' ),
|
|
23
|
+
'backdropPress'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Assert
|
|
27
|
+
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
it( 'renders the block settings button for the current selected block', async () => {
|
|
31
|
+
// Arrange
|
|
32
|
+
const screen = await initializeEditor();
|
|
33
|
+
await addBlock( screen, 'Paragraph' );
|
|
34
|
+
|
|
35
|
+
// Act
|
|
36
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
37
|
+
fireEvent.press( paragraphBlock );
|
|
38
|
+
|
|
39
|
+
// Assert
|
|
40
|
+
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeVisible();
|
|
41
|
+
} );
|
|
42
|
+
} );
|
|
@@ -1,43 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
4
5
|
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../../store';
|
|
11
|
+
|
|
6
12
|
const { clearTimeout, setTimeout } = window;
|
|
7
|
-
const noop = () => {};
|
|
8
13
|
const DEBOUNCE_TIMEOUT = 200;
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
|
-
* Hook that creates
|
|
16
|
+
* Hook that creates debounced callbacks when the node is hovered or focused.
|
|
12
17
|
*
|
|
13
|
-
* @param {Object}
|
|
14
|
-
* @param {Object}
|
|
15
|
-
* @param {boolean}
|
|
16
|
-
* @param {number}
|
|
17
|
-
* @param {
|
|
18
|
+
* @param {Object} props Component props.
|
|
19
|
+
* @param {Object} props.ref Element reference.
|
|
20
|
+
* @param {boolean} props.isFocused Whether the component has current focus.
|
|
21
|
+
* @param {number} props.highlightParent Whether to highlight the parent block. It defaults in highlighting the selected block.
|
|
22
|
+
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
|
|
18
23
|
*/
|
|
19
|
-
|
|
24
|
+
function useDebouncedShowGestures( {
|
|
20
25
|
ref,
|
|
21
26
|
isFocused,
|
|
27
|
+
highlightParent,
|
|
22
28
|
debounceTimeout = DEBOUNCE_TIMEOUT,
|
|
23
|
-
onChange = noop,
|
|
24
29
|
} ) {
|
|
25
|
-
const
|
|
30
|
+
const { getSelectedBlockClientId, getBlockRootClientId } =
|
|
31
|
+
useSelect( blockEditorStore );
|
|
32
|
+
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
26
33
|
const timeoutRef = useRef();
|
|
27
|
-
|
|
34
|
+
const isDistractionFree = useSelect(
|
|
35
|
+
( select ) =>
|
|
36
|
+
select( blockEditorStore ).getSettings().isDistractionFree,
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
28
39
|
const handleOnChange = ( nextIsFocused ) => {
|
|
29
|
-
if (
|
|
30
|
-
|
|
40
|
+
if ( nextIsFocused && isDistractionFree ) {
|
|
41
|
+
return;
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
44
|
+
const clientId = highlightParent
|
|
45
|
+
? getBlockRootClientId( selectedBlockClientId )
|
|
46
|
+
: selectedBlockClientId;
|
|
47
|
+
toggleBlockHighlight( clientId, nextIsFocused );
|
|
34
48
|
};
|
|
35
49
|
|
|
36
50
|
const getIsHovered = () => {
|
|
37
51
|
return ref?.current && ref.current.matches( ':hover' );
|
|
38
52
|
};
|
|
39
53
|
|
|
40
|
-
const
|
|
54
|
+
const shouldHideGestures = () => {
|
|
41
55
|
const isHovered = getIsHovered();
|
|
42
56
|
return ! isFocused && ! isHovered;
|
|
43
57
|
};
|
|
@@ -50,19 +64,16 @@ export function useDebouncedShowMovers( {
|
|
|
50
64
|
}
|
|
51
65
|
};
|
|
52
66
|
|
|
53
|
-
const
|
|
67
|
+
const debouncedShowGestures = ( event ) => {
|
|
54
68
|
if ( event ) {
|
|
55
69
|
event.stopPropagation();
|
|
56
70
|
}
|
|
57
71
|
|
|
58
72
|
clearTimeoutRef();
|
|
59
|
-
|
|
60
|
-
if ( ! showMovers ) {
|
|
61
|
-
handleOnChange( true );
|
|
62
|
-
}
|
|
73
|
+
handleOnChange( true );
|
|
63
74
|
};
|
|
64
75
|
|
|
65
|
-
const
|
|
76
|
+
const debouncedHideGestures = ( event ) => {
|
|
66
77
|
if ( event ) {
|
|
67
78
|
event.stopPropagation();
|
|
68
79
|
}
|
|
@@ -70,7 +81,7 @@ export function useDebouncedShowMovers( {
|
|
|
70
81
|
clearTimeoutRef();
|
|
71
82
|
|
|
72
83
|
timeoutRef.current = setTimeout( () => {
|
|
73
|
-
if (
|
|
84
|
+
if ( shouldHideGestures() ) {
|
|
74
85
|
handleOnChange( false );
|
|
75
86
|
}
|
|
76
87
|
}, debounceTimeout );
|
|
@@ -90,29 +101,33 @@ export function useDebouncedShowMovers( {
|
|
|
90
101
|
);
|
|
91
102
|
|
|
92
103
|
return {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
debouncedHideMovers,
|
|
104
|
+
debouncedShowGestures,
|
|
105
|
+
debouncedHideGestures,
|
|
96
106
|
};
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
/**
|
|
100
|
-
* Hook that provides
|
|
101
|
-
* that interact with the
|
|
110
|
+
* Hook that provides gesture events for DOM elements
|
|
111
|
+
* that interact with the isFocused state.
|
|
102
112
|
*
|
|
103
|
-
* @param {Object}
|
|
104
|
-
* @param {Object}
|
|
105
|
-
* @param {number}
|
|
106
|
-
* @param {
|
|
113
|
+
* @param {Object} props Component props.
|
|
114
|
+
* @param {Object} props.ref Element reference.
|
|
115
|
+
* @param {number} [props.highlightParent=false] Whether to highlight the parent block. It defaults to highlighting the selected block.
|
|
116
|
+
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
|
|
107
117
|
*/
|
|
108
|
-
export function
|
|
118
|
+
export function useShowHoveredOrFocusedGestures( {
|
|
109
119
|
ref,
|
|
120
|
+
highlightParent = false,
|
|
110
121
|
debounceTimeout = DEBOUNCE_TIMEOUT,
|
|
111
|
-
onChange = noop,
|
|
112
122
|
} ) {
|
|
113
123
|
const [ isFocused, setIsFocused ] = useState( false );
|
|
114
|
-
const {
|
|
115
|
-
|
|
124
|
+
const { debouncedShowGestures, debouncedHideGestures } =
|
|
125
|
+
useDebouncedShowGestures( {
|
|
126
|
+
ref,
|
|
127
|
+
debounceTimeout,
|
|
128
|
+
isFocused,
|
|
129
|
+
highlightParent,
|
|
130
|
+
} );
|
|
116
131
|
|
|
117
132
|
const registerRef = useRef( false );
|
|
118
133
|
|
|
@@ -129,14 +144,14 @@ export function useShowMoversGestures( {
|
|
|
129
144
|
const handleOnFocus = () => {
|
|
130
145
|
if ( isFocusedWithin() ) {
|
|
131
146
|
setIsFocused( true );
|
|
132
|
-
|
|
147
|
+
debouncedShowGestures();
|
|
133
148
|
}
|
|
134
149
|
};
|
|
135
150
|
|
|
136
151
|
const handleOnBlur = () => {
|
|
137
152
|
if ( ! isFocusedWithin() ) {
|
|
138
153
|
setIsFocused( false );
|
|
139
|
-
|
|
154
|
+
debouncedHideGestures();
|
|
140
155
|
}
|
|
141
156
|
};
|
|
142
157
|
|
|
@@ -160,15 +175,12 @@ export function useShowMoversGestures( {
|
|
|
160
175
|
ref,
|
|
161
176
|
registerRef,
|
|
162
177
|
setIsFocused,
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
debouncedShowGestures,
|
|
179
|
+
debouncedHideGestures,
|
|
165
180
|
] );
|
|
166
181
|
|
|
167
182
|
return {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onMouseMove: debouncedShowMovers,
|
|
171
|
-
onMouseLeave: debouncedHideMovers,
|
|
172
|
-
},
|
|
183
|
+
onMouseMove: debouncedShowGestures,
|
|
184
|
+
onMouseLeave: debouncedHideGestures,
|
|
173
185
|
};
|
|
174
186
|
}
|
|
@@ -32,48 +32,56 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
32
32
|
const toolbarButtonRef = useRef();
|
|
33
33
|
|
|
34
34
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
const {
|
|
36
|
+
blockType,
|
|
37
|
+
hasParents,
|
|
38
|
+
showParentSelector,
|
|
39
|
+
selectedBlockClientId,
|
|
40
|
+
isContentOnly,
|
|
41
|
+
} = useSelect( ( select ) => {
|
|
42
|
+
const {
|
|
43
|
+
getBlockName,
|
|
44
|
+
getBlockParents,
|
|
45
|
+
getSelectedBlockClientIds,
|
|
46
|
+
getBlockEditingMode,
|
|
47
|
+
} = unlock( select( blockEditorStore ) );
|
|
48
|
+
const { getBlockType } = select( blocksStore );
|
|
49
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
50
|
+
const _selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
51
|
+
const parents = getBlockParents( _selectedBlockClientId );
|
|
52
|
+
const firstParentClientId = parents[ parents.length - 1 ];
|
|
53
|
+
const parentBlockName = getBlockName( firstParentClientId );
|
|
54
|
+
const parentBlockType = getBlockType( parentBlockName );
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
return {
|
|
57
|
+
selectedBlockClientId: _selectedBlockClientId,
|
|
58
|
+
blockType:
|
|
59
|
+
_selectedBlockClientId &&
|
|
60
|
+
getBlockType( getBlockName( _selectedBlockClientId ) ),
|
|
61
|
+
hasParents: parents.length,
|
|
62
|
+
isContentOnly:
|
|
63
|
+
getBlockEditingMode( _selectedBlockClientId ) === 'contentOnly',
|
|
64
|
+
showParentSelector:
|
|
65
|
+
parentBlockType &&
|
|
66
|
+
getBlockEditingMode( firstParentClientId ) === 'default' &&
|
|
67
|
+
hasBlockSupport(
|
|
68
|
+
parentBlockType,
|
|
69
|
+
'__experimentalParentSelector',
|
|
70
|
+
true
|
|
71
|
+
) &&
|
|
72
|
+
selectedBlockClientIds.length <= 1 &&
|
|
73
|
+
getBlockEditingMode( _selectedBlockClientId ) === 'default',
|
|
74
|
+
};
|
|
75
|
+
}, [] );
|
|
69
76
|
|
|
70
77
|
useEffect( () => {
|
|
71
78
|
setIsCollapsed( false );
|
|
72
79
|
}, [ selectedBlockClientId ] );
|
|
73
80
|
|
|
74
81
|
if (
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
isContentOnly ||
|
|
83
|
+
( blockType &&
|
|
84
|
+
! hasBlockSupport( blockType, '__experimentalToolbar', true ) )
|
|
77
85
|
) {
|
|
78
86
|
return null;
|
|
79
87
|
}
|
|
@@ -125,9 +125,18 @@
|
|
|
125
125
|
display: none;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// Add a scrim to the right of the collapsed button.
|
|
129
|
+
&.is-collapsed::after {
|
|
130
|
+
content: "";
|
|
131
|
+
position: absolute;
|
|
132
|
+
left: 100%;
|
|
133
|
+
width: $grid-unit-60;
|
|
134
|
+
height: 100%;
|
|
135
|
+
background: linear-gradient(to right, $white, transparent);
|
|
136
|
+
}
|
|
137
|
+
|
|
128
138
|
// on desktop and tablet viewports the toolbar is fixed
|
|
129
139
|
// on top of interface header
|
|
130
|
-
|
|
131
140
|
@include break-medium() {
|
|
132
141
|
&.is-fixed {
|
|
133
142
|
|
|
@@ -157,7 +166,7 @@
|
|
|
157
166
|
}
|
|
158
167
|
}
|
|
159
168
|
|
|
160
|
-
& > .block-editor-block-toolbar
|
|
169
|
+
& > .block-editor-block-toolbar {
|
|
161
170
|
flex-grow: initial;
|
|
162
171
|
width: initial;
|
|
163
172
|
|
|
@@ -308,7 +317,7 @@
|
|
|
308
317
|
}
|
|
309
318
|
}
|
|
310
319
|
|
|
311
|
-
// on tablet
|
|
320
|
+
// on tablet viewports the toolbar is fixed
|
|
312
321
|
// on top of interface header and covers the whole header
|
|
313
322
|
// except for the inserter on the left
|
|
314
323
|
@include break-medium() {
|
|
@@ -322,12 +331,15 @@
|
|
|
322
331
|
// for the block inserter the publish button
|
|
323
332
|
@include break-large() {
|
|
324
333
|
&.is-fixed {
|
|
334
|
+
width: auto;
|
|
335
|
+
}
|
|
336
|
+
.is-fullscreen-mode &.is-fixed {
|
|
337
|
+
// in full screen mode we need to account for
|
|
325
338
|
// the combined with of the tools at the right of the header and the margin left
|
|
326
339
|
// of the toolbar which includes four buttons
|
|
327
|
-
width: calc(100% -
|
|
340
|
+
width: calc(100% - 280px - #{4 * $grid-unit-80});
|
|
328
341
|
}
|
|
329
342
|
}
|
|
330
|
-
|
|
331
343
|
}
|
|
332
344
|
|
|
333
345
|
/**
|