@wordpress/block-editor 12.19.5 → 12.21.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/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +7 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +89 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +111 -14
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +2 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +4 -36
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -45
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -6
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +89 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +113 -16
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -36
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -45
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +55 -25
- package/build-style/style.css +55 -25
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +5 -11
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/border-panel.js +2 -2
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +1 -2
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -5
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +1 -1
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +91 -1
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/position.js +0 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +137 -53
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +4 -42
- package/src/store/private-actions.js +34 -69
- package/src/store/reducer.js +2 -8
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -105
- package/src/style.scss +2 -2
- package/src/utils/calculate-scale.js +20 -0
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { MenuItem } from '@wordpress/components';
|
|
6
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import BlockIcon from '../block-icon';
|
|
14
|
+
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
15
|
+
import { store as blockEditorStore } from '../../store';
|
|
16
|
+
|
|
17
|
+
export default function BlockParentSelectorMenuItem( {
|
|
18
|
+
parentClientId,
|
|
19
|
+
parentBlockType,
|
|
20
|
+
} ) {
|
|
21
|
+
const isSmallViewport = useViewportMatch( 'medium', '<' );
|
|
22
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
23
|
+
|
|
24
|
+
// Allows highlighting the parent block outline when focusing or hovering
|
|
25
|
+
// the parent block selector within the child.
|
|
26
|
+
const menuItemRef = useRef();
|
|
27
|
+
const gesturesProps = useShowHoveredOrFocusedGestures( {
|
|
28
|
+
ref: menuItemRef,
|
|
29
|
+
highlightParent: true,
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
if ( ! isSmallViewport ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<MenuItem
|
|
38
|
+
{ ...gesturesProps }
|
|
39
|
+
ref={ menuItemRef }
|
|
40
|
+
icon={ <BlockIcon icon={ parentBlockType.icon } /> }
|
|
41
|
+
onClick={ () => selectBlock( parentClientId ) }
|
|
42
|
+
>
|
|
43
|
+
{ sprintf(
|
|
44
|
+
/* translators: %s: Name of the block's parent. */
|
|
45
|
+
__( 'Select parent block (%s)' ),
|
|
46
|
+
parentBlockType.title
|
|
47
|
+
) }
|
|
48
|
+
</MenuItem>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -9,30 +9,24 @@ import {
|
|
|
9
9
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
11
|
import { moreVertical } from '@wordpress/icons';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
cloneElement,
|
|
15
|
-
useCallback,
|
|
16
|
-
useRef,
|
|
17
|
-
} from '@wordpress/element';
|
|
18
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { Children, cloneElement, useCallback } from '@wordpress/element';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
19
14
|
import {
|
|
20
15
|
store as keyboardShortcutsStore,
|
|
21
16
|
__unstableUseShortcutEventMatch,
|
|
22
17
|
} from '@wordpress/keyboard-shortcuts';
|
|
23
|
-
import { pipe, useCopyToClipboard
|
|
18
|
+
import { pipe, useCopyToClipboard } from '@wordpress/compose';
|
|
24
19
|
|
|
25
20
|
/**
|
|
26
21
|
* Internal dependencies
|
|
27
22
|
*/
|
|
28
23
|
import BlockActions from '../block-actions';
|
|
29
|
-
import BlockIcon from '../block-icon';
|
|
30
24
|
import BlockHTMLConvertButton from './block-html-convert-button';
|
|
31
25
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
32
26
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
27
|
+
import BlockParentSelectorMenuItem from './block-parent-selector-menu-item';
|
|
33
28
|
import { store as blockEditorStore } from '../../store';
|
|
34
29
|
import { unlock } from '../../lock-unlock';
|
|
35
|
-
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
36
30
|
|
|
37
31
|
const POPOVER_PROPS = {
|
|
38
32
|
className: 'block-editor-block-settings-menu__popover',
|
|
@@ -49,38 +43,6 @@ function CopyMenuItem( { clientIds, onCopy, label } ) {
|
|
|
49
43
|
return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
function ParentSelectorMenuItem( { parentClientId, parentBlockType } ) {
|
|
53
|
-
const isSmallViewport = useViewportMatch( 'medium', '<' );
|
|
54
|
-
const { selectBlock } = useDispatch( blockEditorStore );
|
|
55
|
-
|
|
56
|
-
// Allows highlighting the parent block outline when focusing or hovering
|
|
57
|
-
// the parent block selector within the child.
|
|
58
|
-
const menuItemRef = useRef();
|
|
59
|
-
const gesturesProps = useShowHoveredOrFocusedGestures( {
|
|
60
|
-
ref: menuItemRef,
|
|
61
|
-
highlightParent: true,
|
|
62
|
-
} );
|
|
63
|
-
|
|
64
|
-
if ( ! isSmallViewport ) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<MenuItem
|
|
70
|
-
{ ...gesturesProps }
|
|
71
|
-
ref={ menuItemRef }
|
|
72
|
-
icon={ <BlockIcon icon={ parentBlockType.icon } /> }
|
|
73
|
-
onClick={ () => selectBlock( parentClientId ) }
|
|
74
|
-
>
|
|
75
|
-
{ sprintf(
|
|
76
|
-
/* translators: %s: Name of the block's parent. */
|
|
77
|
-
__( 'Select parent block (%s)' ),
|
|
78
|
-
parentBlockType.title
|
|
79
|
-
) }
|
|
80
|
-
</MenuItem>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
46
|
export function BlockSettingsDropdown( {
|
|
85
47
|
block,
|
|
86
48
|
clientIds,
|
|
@@ -102,6 +64,7 @@ export function BlockSettingsDropdown( {
|
|
|
102
64
|
parentBlockType,
|
|
103
65
|
previousBlockClientId,
|
|
104
66
|
selectedBlockClientIds,
|
|
67
|
+
openedBlockSettingsMenu,
|
|
105
68
|
} = useSelect(
|
|
106
69
|
( select ) => {
|
|
107
70
|
const {
|
|
@@ -111,7 +74,8 @@ export function BlockSettingsDropdown( {
|
|
|
111
74
|
getPreviousBlockClientId,
|
|
112
75
|
getSelectedBlockClientIds,
|
|
113
76
|
getBlockAttributes,
|
|
114
|
-
|
|
77
|
+
getOpenedBlockSettingsMenu,
|
|
78
|
+
} = unlock( select( blockEditorStore ) );
|
|
115
79
|
|
|
116
80
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
117
81
|
|
|
@@ -133,6 +97,7 @@ export function BlockSettingsDropdown( {
|
|
|
133
97
|
previousBlockClientId:
|
|
134
98
|
getPreviousBlockClientId( firstBlockClientId ),
|
|
135
99
|
selectedBlockClientIds: getSelectedBlockClientIds(),
|
|
100
|
+
openedBlockSettingsMenu: getOpenedBlockSettingsMenu(),
|
|
136
101
|
};
|
|
137
102
|
},
|
|
138
103
|
[ firstBlockClientId ]
|
|
@@ -140,12 +105,6 @@ export function BlockSettingsDropdown( {
|
|
|
140
105
|
const { getBlockOrder, getSelectedBlockClientIds } =
|
|
141
106
|
useSelect( blockEditorStore );
|
|
142
107
|
|
|
143
|
-
const openedBlockSettingsMenu = useSelect(
|
|
144
|
-
( select ) =>
|
|
145
|
-
unlock( select( blockEditorStore ) ).getOpenedBlockSettingsMenu(),
|
|
146
|
-
[]
|
|
147
|
-
);
|
|
148
|
-
|
|
149
108
|
const { setOpenedBlockSettingsMenu } = unlock(
|
|
150
109
|
useDispatch( blockEditorStore )
|
|
151
110
|
);
|
|
@@ -317,7 +276,7 @@ export function BlockSettingsDropdown( {
|
|
|
317
276
|
/>
|
|
318
277
|
{ ! parentBlockIsSelected &&
|
|
319
278
|
!! firstParentClientId && (
|
|
320
|
-
<
|
|
279
|
+
<BlockParentSelectorMenuItem
|
|
321
280
|
parentClientId={
|
|
322
281
|
firstParentClientId
|
|
323
282
|
}
|
|
@@ -80,7 +80,7 @@ const BlockTransformationsMenu = ( {
|
|
|
80
80
|
options={ pickerOptions() }
|
|
81
81
|
onChange={ onPickerSelect }
|
|
82
82
|
hideCancelButton={ Platform.OS !== 'ios' }
|
|
83
|
-
leftAlign
|
|
83
|
+
leftAlign
|
|
84
84
|
getAnchor={ getAnchor }
|
|
85
85
|
// translators: %s: block title e.g: "Paragraph".
|
|
86
86
|
title={ sprintf( __( 'Transform %s to' ), blockTitle ) }
|
|
@@ -256,7 +256,7 @@ const BlockActionsMenu = ( {
|
|
|
256
256
|
<ToolbarButton
|
|
257
257
|
title={ __( 'Open Block Actions Menu' ) }
|
|
258
258
|
icon={ moreHorizontalMobile }
|
|
259
|
-
disabled
|
|
259
|
+
disabled
|
|
260
260
|
/>
|
|
261
261
|
</ToolbarGroup>
|
|
262
262
|
);
|
|
@@ -311,7 +311,7 @@ const BlockActionsMenu = ( {
|
|
|
311
311
|
destructiveButtonIndex={ options.length }
|
|
312
312
|
disabledButtonIndices={ disabledButtonIndices }
|
|
313
313
|
hideCancelButton={ Platform.OS !== 'ios' }
|
|
314
|
-
leftAlign
|
|
314
|
+
leftAlign
|
|
315
315
|
getAnchor={ getAnchor }
|
|
316
316
|
// translators: %s: block title e.g: "Paragraph".
|
|
317
317
|
title={ sprintf( __( '%s block options' ), blockTitle ) }
|
|
@@ -34,10 +34,10 @@ import { useShowHoveredOrFocusedGestures } from './utils';
|
|
|
34
34
|
import { store as blockEditorStore } from '../../store';
|
|
35
35
|
import __unstableBlockNameContext from './block-name-context';
|
|
36
36
|
import NavigableToolbar from '../navigable-toolbar';
|
|
37
|
-
import
|
|
37
|
+
import Shuffle from './shuffle';
|
|
38
38
|
import BlockBindingsIndicator from '../block-bindings-toolbar-indicator';
|
|
39
|
+
import { useHasBlockToolbar } from './use-has-block-toolbar';
|
|
39
40
|
import { canBindBlock } from '../../hooks/use-bindings-attributes';
|
|
40
|
-
|
|
41
41
|
/**
|
|
42
42
|
* Renders the block toolbar.
|
|
43
43
|
*
|
|
@@ -128,15 +128,8 @@ export function PrivateBlockToolbar( {
|
|
|
128
128
|
|
|
129
129
|
const isLargeViewport = ! useViewportMatch( 'medium', '<' );
|
|
130
130
|
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
hasBlockSupport( blockType, '__experimentalToolbar', true );
|
|
134
|
-
const hasAnyBlockControls = useHasAnyBlockControls();
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
! isToolbarEnabled ||
|
|
138
|
-
( ! isDefaultEditingMode && ! hasAnyBlockControls )
|
|
139
|
-
) {
|
|
131
|
+
const hasBlockToolbar = useHasBlockToolbar();
|
|
132
|
+
if ( ! hasBlockToolbar ) {
|
|
140
133
|
return null;
|
|
141
134
|
}
|
|
142
135
|
|
|
@@ -195,6 +188,7 @@ export function PrivateBlockToolbar( {
|
|
|
195
188
|
</ToolbarGroup>
|
|
196
189
|
</div>
|
|
197
190
|
) }
|
|
191
|
+
<Shuffle clientId={ blockClientId } />
|
|
198
192
|
{ shouldShowVisualToolbar && isMultiToolbar && (
|
|
199
193
|
<BlockGroupToolbar />
|
|
200
194
|
) }
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { shuffle } from '@wordpress/icons';
|
|
5
|
+
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useMemo } from '@wordpress/element';
|
|
8
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { store as blockEditorStore } from '../../store';
|
|
14
|
+
|
|
15
|
+
const EMPTY_ARRAY = [];
|
|
16
|
+
|
|
17
|
+
function Container( props ) {
|
|
18
|
+
return (
|
|
19
|
+
<ToolbarGroup>
|
|
20
|
+
<ToolbarButton { ...props } />
|
|
21
|
+
</ToolbarGroup>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function Shuffle( { clientId, as = Container } ) {
|
|
26
|
+
const { categories, patterns } = useSelect(
|
|
27
|
+
( select ) => {
|
|
28
|
+
const {
|
|
29
|
+
getBlockAttributes,
|
|
30
|
+
getBlockRootClientId,
|
|
31
|
+
__experimentalGetAllowedPatterns,
|
|
32
|
+
} = select( blockEditorStore );
|
|
33
|
+
const attributes = getBlockAttributes( clientId );
|
|
34
|
+
const _categories = attributes?.metadata?.categories || EMPTY_ARRAY;
|
|
35
|
+
const rootBlock = getBlockRootClientId( clientId );
|
|
36
|
+
const _patterns = __experimentalGetAllowedPatterns( rootBlock );
|
|
37
|
+
return {
|
|
38
|
+
categories: _categories,
|
|
39
|
+
patterns: _patterns,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
[ clientId ]
|
|
43
|
+
);
|
|
44
|
+
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
45
|
+
const sameCategoryPatternsWithSingleWrapper = useMemo( () => {
|
|
46
|
+
if (
|
|
47
|
+
! categories ||
|
|
48
|
+
categories.length === 0 ||
|
|
49
|
+
! patterns ||
|
|
50
|
+
patterns.length === 0
|
|
51
|
+
) {
|
|
52
|
+
return EMPTY_ARRAY;
|
|
53
|
+
}
|
|
54
|
+
return patterns.filter( ( pattern ) => {
|
|
55
|
+
return (
|
|
56
|
+
// Check if the pattern has only one top level block,
|
|
57
|
+
// otherwise we may shuffle to pattern that will not allow to continue shuffling.
|
|
58
|
+
pattern.blocks.length === 1 &&
|
|
59
|
+
pattern.categories.some( ( category ) => {
|
|
60
|
+
return categories.includes( category );
|
|
61
|
+
} )
|
|
62
|
+
);
|
|
63
|
+
} );
|
|
64
|
+
}, [ categories, patterns ] );
|
|
65
|
+
if ( sameCategoryPatternsWithSingleWrapper.length === 0 ) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const ComponentToUse = as;
|
|
69
|
+
return (
|
|
70
|
+
<ComponentToUse
|
|
71
|
+
label={ __( 'Shuffle' ) }
|
|
72
|
+
icon={ shuffle }
|
|
73
|
+
onClick={ () => {
|
|
74
|
+
const randomPattern =
|
|
75
|
+
sameCategoryPatternsWithSingleWrapper[
|
|
76
|
+
Math.floor(
|
|
77
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
78
|
+
Math.random() *
|
|
79
|
+
sameCategoryPatternsWithSingleWrapper.length
|
|
80
|
+
)
|
|
81
|
+
];
|
|
82
|
+
randomPattern.blocks[ 0 ].attributes = {
|
|
83
|
+
...randomPattern.blocks[ 0 ].attributes,
|
|
84
|
+
metadata: {
|
|
85
|
+
...randomPattern.blocks[ 0 ].attributes.metadata,
|
|
86
|
+
categories,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
replaceBlocks( clientId, randomPattern.blocks );
|
|
90
|
+
} }
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { store as blockEditorStore } from '../../store';
|
|
10
|
+
import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if the block toolbar should be shown.
|
|
14
|
+
*
|
|
15
|
+
* @return {boolean} Whether the block toolbar component will be rendered.
|
|
16
|
+
*/
|
|
17
|
+
export function useHasBlockToolbar() {
|
|
18
|
+
const hasAnyBlockControls = useHasAnyBlockControls();
|
|
19
|
+
return useSelect(
|
|
20
|
+
( select ) => {
|
|
21
|
+
const {
|
|
22
|
+
getBlockEditingMode,
|
|
23
|
+
getBlockName,
|
|
24
|
+
getSelectedBlockClientIds,
|
|
25
|
+
} = select( blockEditorStore );
|
|
26
|
+
|
|
27
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
28
|
+
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
29
|
+
const isDefaultEditingMode =
|
|
30
|
+
getBlockEditingMode( selectedBlockClientId ) === 'default';
|
|
31
|
+
const blockType =
|
|
32
|
+
selectedBlockClientId &&
|
|
33
|
+
getBlockType( getBlockName( selectedBlockClientId ) );
|
|
34
|
+
const isToolbarEnabled =
|
|
35
|
+
blockType &&
|
|
36
|
+
hasBlockSupport( blockType, '__experimentalToolbar', true );
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
! isToolbarEnabled ||
|
|
40
|
+
( ! isDefaultEditingMode && ! hasAnyBlockControls )
|
|
41
|
+
) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
},
|
|
47
|
+
[ hasAnyBlockControls ]
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -39,6 +39,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
39
39
|
import BlockDraggable from '../block-draggable';
|
|
40
40
|
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
41
41
|
import BlockMover from '../block-mover';
|
|
42
|
+
import Shuffle from '../block-toolbar/shuffle';
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Block selection button component, displaying the label of the block. If the block
|
|
@@ -271,6 +272,9 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
271
272
|
</BlockDraggable>
|
|
272
273
|
) }
|
|
273
274
|
</FlexItem>
|
|
275
|
+
{ editorMode === 'zoom-out' && (
|
|
276
|
+
<Shuffle clientId={ clientId } as={ Button } />
|
|
277
|
+
) }
|
|
274
278
|
<FlexItem>
|
|
275
279
|
<Button
|
|
276
280
|
ref={ ref }
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
9
|
+
import BlockPopoverCover from '../block-popover/cover';
|
|
10
10
|
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
11
11
|
import Inserter from '../inserter';
|
|
12
12
|
import useSelectedBlockToolProps from './use-selected-block-tool-props';
|
|
@@ -28,9 +28,8 @@ export default function EmptyBlockInserter( {
|
|
|
28
28
|
} );
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<BlockPopoverCover
|
|
32
32
|
clientId={ capturingClientId || clientId }
|
|
33
|
-
__unstableCoverTarget
|
|
34
33
|
bottomClientId={ lastClientId }
|
|
35
34
|
className={ classnames(
|
|
36
35
|
'block-editor-block-list__block-side-inserter-popover',
|
|
@@ -39,8 +38,6 @@ export default function EmptyBlockInserter( {
|
|
|
39
38
|
}
|
|
40
39
|
) }
|
|
41
40
|
__unstableContentRef={ __unstableContentRef }
|
|
42
|
-
resize={ false }
|
|
43
|
-
shift={ false }
|
|
44
41
|
{ ...popoverProps }
|
|
45
42
|
>
|
|
46
43
|
<div className="block-editor-block-list__empty-block-inserter">
|
|
@@ -51,6 +48,6 @@ export default function EmptyBlockInserter( {
|
|
|
51
48
|
__experimentalIsQuick
|
|
52
49
|
/>
|
|
53
50
|
</div>
|
|
54
|
-
</
|
|
51
|
+
</BlockPopoverCover>
|
|
55
52
|
);
|
|
56
53
|
}
|
|
@@ -5,7 +5,6 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import { Popover } from '@wordpress/components';
|
|
6
6
|
import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';
|
|
7
7
|
import { useRef } from '@wordpress/element';
|
|
8
|
-
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -20,14 +19,13 @@ import BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';
|
|
|
20
19
|
import { store as blockEditorStore } from '../../store';
|
|
21
20
|
import usePopoverScroll from '../block-popover/use-popover-scroll';
|
|
22
21
|
import ZoomOutModeInserters from './zoom-out-mode-inserters';
|
|
22
|
+
import { useShowBlockTools } from './use-show-block-tools';
|
|
23
23
|
|
|
24
24
|
function selector( select ) {
|
|
25
25
|
const {
|
|
26
26
|
getSelectedBlockClientId,
|
|
27
27
|
getFirstMultiSelectedBlockClientId,
|
|
28
|
-
getBlock,
|
|
29
28
|
getSettings,
|
|
30
|
-
hasMultiSelection,
|
|
31
29
|
__unstableGetEditorMode,
|
|
32
30
|
isTyping,
|
|
33
31
|
} = select( blockEditorStore );
|
|
@@ -35,36 +33,13 @@ function selector( select ) {
|
|
|
35
33
|
const clientId =
|
|
36
34
|
getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
37
35
|
|
|
38
|
-
const { name = '', attributes = {} } = getBlock( clientId ) || {};
|
|
39
36
|
const editorMode = __unstableGetEditorMode();
|
|
40
|
-
const hasSelectedBlock = clientId && name;
|
|
41
|
-
const isEmptyDefaultBlock = isUnmodifiedDefaultBlock( {
|
|
42
|
-
name,
|
|
43
|
-
attributes,
|
|
44
|
-
} );
|
|
45
|
-
const _showEmptyBlockSideInserter =
|
|
46
|
-
clientId &&
|
|
47
|
-
! isTyping() &&
|
|
48
|
-
editorMode === 'edit' &&
|
|
49
|
-
isUnmodifiedDefaultBlock( { name, attributes } );
|
|
50
|
-
const maybeShowBreadcrumb =
|
|
51
|
-
hasSelectedBlock &&
|
|
52
|
-
! hasMultiSelection() &&
|
|
53
|
-
( editorMode === 'navigation' || editorMode === 'zoom-out' );
|
|
54
37
|
|
|
55
38
|
return {
|
|
56
39
|
clientId,
|
|
57
40
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
58
41
|
isTyping: isTyping(),
|
|
59
42
|
isZoomOutMode: editorMode === 'zoom-out',
|
|
60
|
-
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
61
|
-
showBreadcrumb: ! _showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
62
|
-
showBlockToolbar:
|
|
63
|
-
! getSettings().hasFixedToolbar &&
|
|
64
|
-
! _showEmptyBlockSideInserter &&
|
|
65
|
-
hasSelectedBlock &&
|
|
66
|
-
! isEmptyDefaultBlock &&
|
|
67
|
-
! maybeShowBreadcrumb,
|
|
68
43
|
};
|
|
69
44
|
}
|
|
70
45
|
|
|
@@ -82,18 +57,20 @@ export default function BlockTools( {
|
|
|
82
57
|
__unstableContentRef,
|
|
83
58
|
...props
|
|
84
59
|
} ) {
|
|
85
|
-
const {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
isZoomOutMode,
|
|
90
|
-
showEmptyBlockSideInserter,
|
|
91
|
-
showBreadcrumb,
|
|
92
|
-
showBlockToolbar,
|
|
93
|
-
} = useSelect( selector, [] );
|
|
60
|
+
const { clientId, hasFixedToolbar, isTyping, isZoomOutMode } = useSelect(
|
|
61
|
+
selector,
|
|
62
|
+
[]
|
|
63
|
+
);
|
|
94
64
|
const isMatch = useShortcutEventMatch();
|
|
95
65
|
const { getSelectedBlockClientIds, getBlockRootClientId } =
|
|
96
66
|
useSelect( blockEditorStore );
|
|
67
|
+
|
|
68
|
+
const {
|
|
69
|
+
showEmptyBlockSideInserter,
|
|
70
|
+
showBreadcrumb,
|
|
71
|
+
showBlockToolbarPopover,
|
|
72
|
+
} = useShowBlockTools();
|
|
73
|
+
|
|
97
74
|
const {
|
|
98
75
|
duplicateBlocks,
|
|
99
76
|
removeBlocks,
|
|
@@ -186,7 +163,7 @@ export default function BlockTools( {
|
|
|
186
163
|
/>
|
|
187
164
|
) }
|
|
188
165
|
|
|
189
|
-
{
|
|
166
|
+
{ showBlockToolbarPopover && (
|
|
190
167
|
<BlockToolbarPopover
|
|
191
168
|
__unstableContentRef={ __unstableContentRef }
|
|
192
169
|
clientId={ clientId }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../../store';
|
|
11
|
+
import { useHasBlockToolbar } from '../block-toolbar/use-has-block-toolbar';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Source of truth for which block tools are showing in the block editor.
|
|
15
|
+
*
|
|
16
|
+
* @return {Object} Object of which block tools will be shown.
|
|
17
|
+
*/
|
|
18
|
+
export function useShowBlockTools() {
|
|
19
|
+
const hasBlockToolbar = useHasBlockToolbar();
|
|
20
|
+
|
|
21
|
+
return useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const {
|
|
24
|
+
getSelectedBlockClientId,
|
|
25
|
+
getFirstMultiSelectedBlockClientId,
|
|
26
|
+
getBlock,
|
|
27
|
+
getSettings,
|
|
28
|
+
hasMultiSelection,
|
|
29
|
+
__unstableGetEditorMode,
|
|
30
|
+
isTyping,
|
|
31
|
+
} = select( blockEditorStore );
|
|
32
|
+
|
|
33
|
+
const clientId =
|
|
34
|
+
getSelectedBlockClientId() ||
|
|
35
|
+
getFirstMultiSelectedBlockClientId();
|
|
36
|
+
|
|
37
|
+
const { name = '', attributes = {} } = getBlock( clientId ) || {};
|
|
38
|
+
const editorMode = __unstableGetEditorMode();
|
|
39
|
+
const hasSelectedBlock = clientId && name;
|
|
40
|
+
const isEmptyDefaultBlock = isUnmodifiedDefaultBlock( {
|
|
41
|
+
name,
|
|
42
|
+
attributes,
|
|
43
|
+
} );
|
|
44
|
+
const _showEmptyBlockSideInserter =
|
|
45
|
+
clientId &&
|
|
46
|
+
! isTyping() &&
|
|
47
|
+
editorMode === 'edit' &&
|
|
48
|
+
isUnmodifiedDefaultBlock( { name, attributes } );
|
|
49
|
+
const maybeShowBreadcrumb =
|
|
50
|
+
hasSelectedBlock &&
|
|
51
|
+
! hasMultiSelection() &&
|
|
52
|
+
( editorMode === 'navigation' || editorMode === 'zoom-out' );
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
56
|
+
showBreadcrumb:
|
|
57
|
+
! _showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
58
|
+
showBlockToolbarPopover:
|
|
59
|
+
hasBlockToolbar &&
|
|
60
|
+
! getSettings().hasFixedToolbar &&
|
|
61
|
+
! _showEmptyBlockSideInserter &&
|
|
62
|
+
hasSelectedBlock &&
|
|
63
|
+
! isEmptyDefaultBlock &&
|
|
64
|
+
! maybeShowBreadcrumb,
|
|
65
|
+
showFixedToolbar:
|
|
66
|
+
editorMode !== 'zoom-out' &&
|
|
67
|
+
hasBlockToolbar &&
|
|
68
|
+
getSettings().hasFixedToolbar,
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
[ hasBlockToolbar ]
|
|
72
|
+
);
|
|
73
|
+
}
|