@wordpress/block-editor 12.20.0 → 12.22.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-actions/index.js +47 -36
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
- package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build/components/block-edit/context.js +2 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +8 -3
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- 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 +7 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.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/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +41 -39
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.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 +24 -11
- 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 +108 -11
- 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/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/border-panel.js +21 -8
- 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 +8 -33
- 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/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +80 -23
- package/build/components/global-styles/shadow-panel-components.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 +16 -16
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -4
- 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 +66 -17
- 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/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +2 -2
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- 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 +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +4 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +0 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.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/list-view/use-clipboard-handler.js +2 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.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/index.js +46 -26
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +3 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/url-popover/index.js +3 -3
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +2 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/utils.js +23 -6
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/anchor.js +7 -8
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +39 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +34 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/border.js +6 -4
- package/build/hooks/border.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 +3 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +67 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +32 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +1 -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-bindings-attributes.js +171 -48
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +6 -2
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +42 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -55
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -8
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +34 -46
- 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-module/components/block-actions/index.js +47 -36
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -4
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- 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 +7 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.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/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +42 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.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 +24 -12
- 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 +109 -12
- 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/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +22 -10
- 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 +9 -34
- 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/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +82 -24
- package/build-module/components/global-styles/shadow-panel-components.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 +17 -17
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -4
- 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 +66 -17
- 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/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +2 -2
- package/build-module/components/inserter/mobile-tab-navigation.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/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- 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 +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +5 -2
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +0 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.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/list-view/use-clipboard-handler.js +3 -2
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.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/index.js +47 -28
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +3 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +22 -7
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/anchor.js +8 -9
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +38 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +34 -8
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/border.js +7 -5
- package/build-module/hooks/border.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 +3 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +67 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +32 -14
- 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 +1 -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-bindings-attributes.js +172 -49
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- 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 +6 -2
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +3 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +42 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -54
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -46
- 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-style/content-rtl.css +22 -2
- package/build-style/content.css +22 -2
- package/build-style/default-editor-styles-rtl.css +1 -0
- package/build-style/default-editor-styles.css +1 -0
- package/build-style/style-rtl.css +106 -27
- package/build-style/style.css +106 -27
- package/package.json +31 -31
- package/src/components/block-actions/index.js +59 -55
- package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
- package/src/components/block-bindings-toolbar-indicator/style.scss +16 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +5 -1
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-inspector/index.js +7 -5
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- 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 +14 -10
- package/src/components/block-list/content.scss +21 -1
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-list/use-block-props/index.js +12 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
- 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/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +53 -65
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- 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 +22 -16
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/test/index.native.js +1 -7
- 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 +148 -36
- 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/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/global-styles/border-panel.js +35 -24
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +92 -23
- package/src/components/global-styles/style.scss +33 -10
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/test/use-global-styles-output.js +31 -0
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +17 -17
- package/src/components/global-styles/utils.js +2 -26
- 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 +89 -26
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +2 -2
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/link-preview.js +9 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/style.scss +9 -5
- package/src/components/list-view/block-select-button.js +0 -2
- package/src/components/list-view/block.js +12 -21
- 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/list-view/style.scss +34 -16
- package/src/components/list-view/use-clipboard-handler.js +3 -2
- package/src/components/list-view/utils.js +4 -1
- 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/README.md +6 -0
- package/src/components/rich-text/index.js +76 -53
- package/src/components/rich-text/use-enter.js +4 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/url-popover/index.js +5 -5
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/components/writing-flow/use-clipboard-handler.js +3 -2
- package/src/components/writing-flow/utils.js +31 -16
- package/src/hooks/anchor.js +41 -61
- package/src/hooks/background.js +49 -4
- package/src/hooks/block-hooks.js +47 -9
- package/src/hooks/block-hooks.scss +6 -0
- package/src/hooks/border.js +16 -4
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +82 -8
- package/src/hooks/layout.js +34 -19
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/position.js +1 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/hooks/use-bindings-attributes.js +215 -65
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +8 -3
- package/src/private-apis.js +6 -2
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +56 -18
- package/src/store/private-actions.js +34 -79
- package/src/store/private-selectors.js +0 -8
- package/src/store/reducer.js +43 -64
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -4
- package/src/style.scss +3 -1
- package/tsconfig.json +1 -0
- 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/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/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -9,7 +9,7 @@ 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 { Children, cloneElement
|
|
12
|
+
import { Children, cloneElement } from '@wordpress/element';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import {
|
|
15
15
|
store as keyboardShortcutsStore,
|
|
@@ -33,8 +33,12 @@ const POPOVER_PROPS = {
|
|
|
33
33
|
placement: 'bottom-start',
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
function CopyMenuItem( {
|
|
37
|
-
const
|
|
36
|
+
function CopyMenuItem( { clientIds, onCopy, label } ) {
|
|
37
|
+
const { getBlocksByClientId } = useSelect( blockEditorStore );
|
|
38
|
+
const ref = useCopyToClipboard(
|
|
39
|
+
() => serialize( getBlocksByClientId( clientIds ) ),
|
|
40
|
+
onCopy
|
|
41
|
+
);
|
|
38
42
|
const copyMenuItemLabel = label ? label : __( 'Copy' );
|
|
39
43
|
return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
|
|
40
44
|
}
|
|
@@ -42,18 +46,14 @@ function CopyMenuItem( { blocks, onCopy, label } ) {
|
|
|
42
46
|
export function BlockSettingsDropdown( {
|
|
43
47
|
block,
|
|
44
48
|
clientIds,
|
|
45
|
-
__experimentalSelectBlock,
|
|
46
49
|
children,
|
|
47
|
-
|
|
50
|
+
__experimentalSelectBlock,
|
|
48
51
|
...props
|
|
49
52
|
} ) {
|
|
50
53
|
// Get the client id of the current block for this menu, if one is set.
|
|
51
54
|
const currentClientId = block?.clientId;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
: [ clientIds ];
|
|
55
|
-
const count = blockClientIds.length;
|
|
56
|
-
const firstBlockClientId = blockClientIds[ 0 ];
|
|
55
|
+
const count = clientIds.length;
|
|
56
|
+
const firstBlockClientId = clientIds[ 0 ];
|
|
57
57
|
const {
|
|
58
58
|
firstParentClientId,
|
|
59
59
|
onlyBlock,
|
|
@@ -123,41 +123,35 @@ export function BlockSettingsDropdown( {
|
|
|
123
123
|
const isMatch = __unstableUseShortcutEventMatch();
|
|
124
124
|
const hasSelectedBlocks = selectedBlockClientIds.length > 0;
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if ( ids && ids[ 0 ] ) {
|
|
131
|
-
__experimentalSelectBlock( ids[ 0 ], false );
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
[ __experimentalSelectBlock ]
|
|
136
|
-
);
|
|
126
|
+
async function updateSelectionAfterDuplicate( clientIdsPromise ) {
|
|
127
|
+
if ( ! __experimentalSelectBlock ) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
131
|
+
const ids = await clientIdsPromise;
|
|
132
|
+
if ( ids && ids[ 0 ] ) {
|
|
133
|
+
__experimentalSelectBlock( ids[ 0 ], false );
|
|
134
|
+
}
|
|
135
|
+
}
|
|
141
136
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
function updateSelectionAfterRemove() {
|
|
138
|
+
if ( ! __experimentalSelectBlock ) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
const shouldUpdateSelection =
|
|
149
|
-
hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
|
|
142
|
+
let blockToFocus = previousBlockClientId || firstParentClientId;
|
|
150
143
|
|
|
151
|
-
|
|
144
|
+
// Focus the first block if there's no previous block nor parent block.
|
|
145
|
+
if ( ! blockToFocus ) {
|
|
146
|
+
blockToFocus = getBlockOrder()[ 0 ];
|
|
152
147
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
] );
|
|
148
|
+
|
|
149
|
+
// Only update the selection if the original selection is removed.
|
|
150
|
+
const shouldUpdateSelection =
|
|
151
|
+
hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
|
|
152
|
+
|
|
153
|
+
__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );
|
|
154
|
+
}
|
|
161
155
|
|
|
162
156
|
// This can occur when the selected block (the parent)
|
|
163
157
|
// displays child blocks within a List View.
|
|
@@ -175,20 +169,17 @@ export function BlockSettingsDropdown( {
|
|
|
175
169
|
? undefined
|
|
176
170
|
: openedBlockSettingsMenu === currentClientId || false;
|
|
177
171
|
|
|
178
|
-
|
|
179
|
-
( localOpen )
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]
|
|
191
|
-
);
|
|
172
|
+
function onToggle( localOpen ) {
|
|
173
|
+
if ( localOpen && openedBlockSettingsMenu !== currentClientId ) {
|
|
174
|
+
setOpenedBlockSettingsMenu( currentClientId );
|
|
175
|
+
} else if (
|
|
176
|
+
! localOpen &&
|
|
177
|
+
openedBlockSettingsMenu &&
|
|
178
|
+
openedBlockSettingsMenu === currentClientId
|
|
179
|
+
) {
|
|
180
|
+
setOpenedBlockSettingsMenu( undefined );
|
|
181
|
+
}
|
|
182
|
+
}
|
|
192
183
|
|
|
193
184
|
return (
|
|
194
185
|
<BlockActions
|
|
@@ -198,7 +189,7 @@ export function BlockSettingsDropdown( {
|
|
|
198
189
|
{ ( {
|
|
199
190
|
canCopyStyles,
|
|
200
191
|
canDuplicate,
|
|
201
|
-
|
|
192
|
+
canInsertBlock,
|
|
202
193
|
canMove,
|
|
203
194
|
canRemove,
|
|
204
195
|
onDuplicate,
|
|
@@ -208,7 +199,6 @@ export function BlockSettingsDropdown( {
|
|
|
208
199
|
onCopy,
|
|
209
200
|
onPasteStyles,
|
|
210
201
|
onMoveTo,
|
|
211
|
-
blocks,
|
|
212
202
|
} ) => (
|
|
213
203
|
<DropdownMenu
|
|
214
204
|
icon={ moreVertical }
|
|
@@ -230,7 +220,8 @@ export function BlockSettingsDropdown( {
|
|
|
230
220
|
canRemove
|
|
231
221
|
) {
|
|
232
222
|
event.preventDefault();
|
|
233
|
-
|
|
223
|
+
onRemove();
|
|
224
|
+
updateSelectionAfterRemove();
|
|
234
225
|
} else if (
|
|
235
226
|
isMatch(
|
|
236
227
|
'core/block-editor/duplicate',
|
|
@@ -245,7 +236,7 @@ export function BlockSettingsDropdown( {
|
|
|
245
236
|
'core/block-editor/insert-after',
|
|
246
237
|
event
|
|
247
238
|
) &&
|
|
248
|
-
|
|
239
|
+
canInsertBlock
|
|
249
240
|
) {
|
|
250
241
|
event.preventDefault();
|
|
251
242
|
setOpenedBlockSettingsMenu( undefined );
|
|
@@ -255,7 +246,7 @@ export function BlockSettingsDropdown( {
|
|
|
255
246
|
'core/block-editor/insert-before',
|
|
256
247
|
event
|
|
257
248
|
) &&
|
|
258
|
-
|
|
249
|
+
canInsertBlock
|
|
259
250
|
) {
|
|
260
251
|
event.preventDefault();
|
|
261
252
|
setOpenedBlockSettingsMenu( undefined );
|
|
@@ -286,7 +277,7 @@ export function BlockSettingsDropdown( {
|
|
|
286
277
|
/>
|
|
287
278
|
) }
|
|
288
279
|
<CopyMenuItem
|
|
289
|
-
|
|
280
|
+
clientIds={ clientIds }
|
|
290
281
|
onCopy={ onCopy }
|
|
291
282
|
/>
|
|
292
283
|
{ canDuplicate && (
|
|
@@ -301,7 +292,7 @@ export function BlockSettingsDropdown( {
|
|
|
301
292
|
{ __( 'Duplicate' ) }
|
|
302
293
|
</MenuItem>
|
|
303
294
|
) }
|
|
304
|
-
{
|
|
295
|
+
{ canInsertBlock && (
|
|
305
296
|
<>
|
|
306
297
|
<MenuItem
|
|
307
298
|
onClick={ pipe(
|
|
@@ -327,7 +318,7 @@ export function BlockSettingsDropdown( {
|
|
|
327
318
|
{ canCopyStyles && (
|
|
328
319
|
<MenuGroup>
|
|
329
320
|
<CopyMenuItem
|
|
330
|
-
|
|
321
|
+
clientIds={ clientIds }
|
|
331
322
|
onCopy={ onCopy }
|
|
332
323
|
label={ __( 'Copy styles' ) }
|
|
333
324
|
/>
|
|
@@ -346,9 +337,6 @@ export function BlockSettingsDropdown( {
|
|
|
346
337
|
firstBlockClientId,
|
|
347
338
|
} }
|
|
348
339
|
clientIds={ clientIds }
|
|
349
|
-
__unstableDisplayLocation={
|
|
350
|
-
__unstableDisplayLocation
|
|
351
|
-
}
|
|
352
340
|
/>
|
|
353
341
|
{ typeof children === 'function'
|
|
354
342
|
? children( { onClose } )
|
|
@@ -16,12 +16,3 @@ function ReusableBlocksMenuItems() {
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
```
|
|
19
|
-
|
|
20
|
-
## Props
|
|
21
|
-
|
|
22
|
-
### `__unstableDisplayLocation`
|
|
23
|
-
|
|
24
|
-
- **Type:** `String`
|
|
25
|
-
- **Default:** `undefined`
|
|
26
|
-
|
|
27
|
-
A string representing the location where the component is being displayed within the UI. This can be used to conditionalize certain behaviors including the display of associated components. This behaviour will likely be refactored to a React.Context implementation.
|
|
@@ -26,11 +26,7 @@ import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
|
26
26
|
|
|
27
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
28
28
|
|
|
29
|
-
const BlockSettingsMenuControlsSlot = ( {
|
|
30
|
-
fillProps,
|
|
31
|
-
clientIds = null,
|
|
32
|
-
__unstableDisplayLocation,
|
|
33
|
-
} ) => {
|
|
29
|
+
const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
34
30
|
const { selectedBlocks, selectedClientIds } = useSelect(
|
|
35
31
|
( select ) => {
|
|
36
32
|
const { getBlockNamesByClientId, getSelectedBlockClientIds } =
|
|
@@ -61,7 +57,6 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
61
57
|
<Slot
|
|
62
58
|
fillProps={ {
|
|
63
59
|
...fillProps,
|
|
64
|
-
__unstableDisplayLocation,
|
|
65
60
|
selectedBlocks,
|
|
66
61
|
selectedClientIds,
|
|
67
62
|
} }
|
|
@@ -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,8 +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
|
|
38
|
-
|
|
37
|
+
import Shuffle from './shuffle';
|
|
38
|
+
import BlockBindingsIndicator from '../block-bindings-toolbar-indicator';
|
|
39
|
+
import { useHasBlockToolbar } from './use-has-block-toolbar';
|
|
40
|
+
import { canBindBlock } from '../../hooks/use-bindings-attributes';
|
|
39
41
|
/**
|
|
40
42
|
* Renders the block toolbar.
|
|
41
43
|
*
|
|
@@ -60,8 +62,11 @@ export function PrivateBlockToolbar( {
|
|
|
60
62
|
blockClientIds,
|
|
61
63
|
isDefaultEditingMode,
|
|
62
64
|
blockType,
|
|
65
|
+
blockName,
|
|
66
|
+
toolbarKey,
|
|
63
67
|
shouldShowVisualToolbar,
|
|
64
68
|
showParentSelector,
|
|
69
|
+
isUsingBindings,
|
|
65
70
|
} = useSelect( ( select ) => {
|
|
66
71
|
const {
|
|
67
72
|
getBlockName,
|
|
@@ -71,6 +76,7 @@ export function PrivateBlockToolbar( {
|
|
|
71
76
|
isBlockValid,
|
|
72
77
|
getBlockRootClientId,
|
|
73
78
|
getBlockEditingMode,
|
|
79
|
+
getBlockAttributes,
|
|
74
80
|
} = select( blockEditorStore );
|
|
75
81
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
76
82
|
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
@@ -81,22 +87,24 @@ export function PrivateBlockToolbar( {
|
|
|
81
87
|
const parentBlockType = getBlockType( parentBlockName );
|
|
82
88
|
const _isDefaultEditingMode =
|
|
83
89
|
getBlockEditingMode( selectedBlockClientId ) === 'default';
|
|
90
|
+
const _blockName = getBlockName( selectedBlockClientId );
|
|
84
91
|
const isValid = selectedBlockClientIds.every( ( id ) =>
|
|
85
92
|
isBlockValid( id )
|
|
86
93
|
);
|
|
87
94
|
const isVisual = selectedBlockClientIds.every(
|
|
88
95
|
( id ) => getBlockMode( id ) === 'visual'
|
|
89
96
|
);
|
|
97
|
+
const _isUsingBindings = !! getBlockAttributes( selectedBlockClientId )
|
|
98
|
+
?.metadata?.bindings;
|
|
90
99
|
return {
|
|
91
100
|
blockClientId: selectedBlockClientId,
|
|
92
101
|
blockClientIds: selectedBlockClientIds,
|
|
93
102
|
isDefaultEditingMode: _isDefaultEditingMode,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
getBlockType( getBlockName( selectedBlockClientId ) ),
|
|
97
|
-
|
|
103
|
+
blockName: _blockName,
|
|
104
|
+
blockType: selectedBlockClientId && getBlockType( _blockName ),
|
|
98
105
|
shouldShowVisualToolbar: isValid && isVisual,
|
|
99
106
|
rootClientId: blockRootClientId,
|
|
107
|
+
toolbarKey: `${ selectedBlockClientId }${ firstParentClientId }`,
|
|
100
108
|
showParentSelector:
|
|
101
109
|
parentBlockType &&
|
|
102
110
|
getBlockEditingMode( firstParentClientId ) === 'default' &&
|
|
@@ -107,6 +115,7 @@ export function PrivateBlockToolbar( {
|
|
|
107
115
|
) &&
|
|
108
116
|
selectedBlockClientIds.length === 1 &&
|
|
109
117
|
_isDefaultEditingMode,
|
|
118
|
+
isUsingBindings: _isUsingBindings,
|
|
110
119
|
};
|
|
111
120
|
}, [] );
|
|
112
121
|
|
|
@@ -121,15 +130,8 @@ export function PrivateBlockToolbar( {
|
|
|
121
130
|
|
|
122
131
|
const isLargeViewport = ! useViewportMatch( 'medium', '<' );
|
|
123
132
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
hasBlockSupport( blockType, '__experimentalToolbar', true );
|
|
127
|
-
const hasAnyBlockControls = useHasAnyBlockControls();
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
! isToolbarEnabled ||
|
|
131
|
-
( ! isDefaultEditingMode && ! hasAnyBlockControls )
|
|
132
|
-
) {
|
|
133
|
+
const hasBlockToolbar = useHasBlockToolbar();
|
|
134
|
+
if ( ! hasBlockToolbar ) {
|
|
133
135
|
return null;
|
|
134
136
|
}
|
|
135
137
|
|
|
@@ -159,12 +161,15 @@ export function PrivateBlockToolbar( {
|
|
|
159
161
|
__experimentalOnIndexChange={ __experimentalOnIndexChange }
|
|
160
162
|
// Resets the index whenever the active block changes so
|
|
161
163
|
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
162
|
-
key={
|
|
164
|
+
key={ toolbarKey }
|
|
163
165
|
>
|
|
164
166
|
<div ref={ toolbarWrapperRef } className={ innerClasses }>
|
|
165
167
|
{ ! isMultiToolbar &&
|
|
166
168
|
isLargeViewport &&
|
|
167
169
|
isDefaultEditingMode && <BlockParentSelector /> }
|
|
170
|
+
{ isUsingBindings && canBindBlock( blockName ) && (
|
|
171
|
+
<BlockBindingsIndicator />
|
|
172
|
+
) }
|
|
168
173
|
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
|
|
169
174
|
isDefaultEditingMode && (
|
|
170
175
|
<div
|
|
@@ -185,6 +190,7 @@ export function PrivateBlockToolbar( {
|
|
|
185
190
|
</ToolbarGroup>
|
|
186
191
|
</div>
|
|
187
192
|
) }
|
|
193
|
+
<Shuffle clientId={ blockClientId } />
|
|
188
194
|
{ shouldShowVisualToolbar && isMultiToolbar && (
|
|
189
195
|
<BlockGroupToolbar />
|
|
190
196
|
) }
|
|
@@ -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
|
+
}
|
|
@@ -15,13 +15,7 @@ describe( 'Block Toolbar', () => {
|
|
|
15
15
|
it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
|
|
16
16
|
// Arrange
|
|
17
17
|
const screen = await initializeEditor();
|
|
18
|
-
await addBlock( screen, '
|
|
19
|
-
|
|
20
|
-
// Act
|
|
21
|
-
fireEvent(
|
|
22
|
-
screen.getByTestId( 'media-options-picker' ),
|
|
23
|
-
'backdropPress'
|
|
24
|
-
);
|
|
18
|
+
await addBlock( screen, 'Shortcode' );
|
|
25
19
|
|
|
26
20
|
// Assert
|
|
27
21
|
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();
|
|
@@ -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
|
}
|