@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
package/src/store/actions.js
CHANGED
|
@@ -924,10 +924,8 @@ export const __unstableExpandSelection =
|
|
|
924
924
|
export const mergeBlocks =
|
|
925
925
|
( firstBlockClientId, secondBlockClientId ) =>
|
|
926
926
|
( { registry, select, dispatch } ) => {
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
const [ clientIdA, clientIdB ] = blocks;
|
|
927
|
+
const clientIdA = firstBlockClientId;
|
|
928
|
+
const clientIdB = secondBlockClientId;
|
|
931
929
|
const blockA = select.getBlock( clientIdA );
|
|
932
930
|
const blockAType = getBlockType( blockA.name );
|
|
933
931
|
|
|
@@ -1539,7 +1537,7 @@ export const duplicateBlocks =
|
|
|
1539
1537
|
};
|
|
1540
1538
|
|
|
1541
1539
|
/**
|
|
1542
|
-
* Action that inserts
|
|
1540
|
+
* Action that inserts a default block before a given block.
|
|
1543
1541
|
*
|
|
1544
1542
|
* @param {string} clientId
|
|
1545
1543
|
*/
|
|
@@ -1555,16 +1553,34 @@ export const insertBeforeBlock =
|
|
|
1555
1553
|
return;
|
|
1556
1554
|
}
|
|
1557
1555
|
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
)
|
|
1556
|
+
const blockIndex = select.getBlockIndex( clientId );
|
|
1557
|
+
const directInsertBlock = rootClientId
|
|
1558
|
+
? select.getDirectInsertBlock( rootClientId )
|
|
1559
|
+
: null;
|
|
1560
|
+
|
|
1561
|
+
if ( ! directInsertBlock ) {
|
|
1562
|
+
return dispatch.insertDefaultBlock( {}, rootClientId, blockIndex );
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
const copiedAttributes = {};
|
|
1566
|
+
if ( directInsertBlock.attributesToCopy ) {
|
|
1567
|
+
const attributes = select.getBlockAttributes( clientId );
|
|
1568
|
+
directInsertBlock.attributesToCopy.forEach( ( key ) => {
|
|
1569
|
+
if ( attributes[ key ] ) {
|
|
1570
|
+
copiedAttributes[ key ] = attributes[ key ];
|
|
1571
|
+
}
|
|
1572
|
+
} );
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
const block = createBlock( directInsertBlock.name, {
|
|
1576
|
+
...directInsertBlock.attributes,
|
|
1577
|
+
...copiedAttributes,
|
|
1578
|
+
} );
|
|
1579
|
+
return dispatch.insertBlock( block, blockIndex, rootClientId );
|
|
1564
1580
|
};
|
|
1565
1581
|
|
|
1566
1582
|
/**
|
|
1567
|
-
* Action that inserts
|
|
1583
|
+
* Action that inserts a default block after a given block.
|
|
1568
1584
|
*
|
|
1569
1585
|
* @param {string} clientId
|
|
1570
1586
|
*/
|
|
@@ -1580,12 +1596,34 @@ export const insertAfterBlock =
|
|
|
1580
1596
|
return;
|
|
1581
1597
|
}
|
|
1582
1598
|
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
)
|
|
1599
|
+
const blockIndex = select.getBlockIndex( clientId );
|
|
1600
|
+
const directInsertBlock = rootClientId
|
|
1601
|
+
? select.getDirectInsertBlock( rootClientId )
|
|
1602
|
+
: null;
|
|
1603
|
+
|
|
1604
|
+
if ( ! directInsertBlock ) {
|
|
1605
|
+
return dispatch.insertDefaultBlock(
|
|
1606
|
+
{},
|
|
1607
|
+
rootClientId,
|
|
1608
|
+
blockIndex + 1
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
const copiedAttributes = {};
|
|
1613
|
+
if ( directInsertBlock.attributesToCopy ) {
|
|
1614
|
+
const attributes = select.getBlockAttributes( clientId );
|
|
1615
|
+
directInsertBlock.attributesToCopy.forEach( ( key ) => {
|
|
1616
|
+
if ( attributes[ key ] ) {
|
|
1617
|
+
copiedAttributes[ key ] = attributes[ key ];
|
|
1618
|
+
}
|
|
1619
|
+
} );
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
const block = createBlock( directInsertBlock.name, {
|
|
1623
|
+
...directInsertBlock.attributes,
|
|
1624
|
+
...copiedAttributes,
|
|
1625
|
+
} );
|
|
1626
|
+
return dispatch.insertBlock( block, blockIndex + 1, rootClientId );
|
|
1589
1627
|
};
|
|
1590
1628
|
|
|
1591
1629
|
/**
|
|
@@ -123,61 +123,36 @@ export const privateRemoveBlocks =
|
|
|
123
123
|
//
|
|
124
124
|
// @see https://github.com/WordPress/gutenberg/pull/51145
|
|
125
125
|
const rules = ! forceRemove && select.getBlockRemovalRules();
|
|
126
|
-
if ( rules ) {
|
|
127
|
-
const blockNamesForPrompt = new Set();
|
|
128
|
-
|
|
129
|
-
// Given a list of client IDs of blocks that the user intended to
|
|
130
|
-
// remove, perform a tree search (BFS) to find all block names
|
|
131
|
-
// corresponding to "important" blocks, i.e. blocks that require a
|
|
132
|
-
// removal prompt.
|
|
133
|
-
const queue = [ ...clientIds ];
|
|
134
|
-
let messageType = 'templates';
|
|
135
|
-
while ( queue.length ) {
|
|
136
|
-
const clientId = queue.shift();
|
|
137
|
-
const blockName = select.getBlockName( clientId );
|
|
138
|
-
if ( rules[ blockName ] ) {
|
|
139
|
-
blockNamesForPrompt.add( blockName );
|
|
140
|
-
}
|
|
141
126
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
const blockAttributes =
|
|
153
|
-
select.getBlockAttributes( clientId );
|
|
154
|
-
if (
|
|
155
|
-
blockAttributes?.metadata?.bindings &&
|
|
156
|
-
JSON.stringify(
|
|
157
|
-
blockAttributes.metadata.bindings
|
|
158
|
-
).includes( 'core/pattern-overrides' )
|
|
159
|
-
) {
|
|
160
|
-
blockNamesForPrompt.add( blockName );
|
|
161
|
-
messageType = 'patternOverrides';
|
|
162
|
-
}
|
|
127
|
+
if ( rules ) {
|
|
128
|
+
function flattenBlocks( blocks ) {
|
|
129
|
+
const result = [];
|
|
130
|
+
const stack = [ ...blocks ];
|
|
131
|
+
while ( stack.length ) {
|
|
132
|
+
const { innerBlocks, ...block } = stack.shift();
|
|
133
|
+
stack.push( ...innerBlocks );
|
|
134
|
+
result.push( block );
|
|
163
135
|
}
|
|
164
|
-
|
|
165
|
-
const innerBlocks = select.getBlockOrder( clientId );
|
|
166
|
-
queue.push( ...innerBlocks );
|
|
136
|
+
return result;
|
|
167
137
|
}
|
|
168
138
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
139
|
+
const blockList = clientIds.map( select.getBlock );
|
|
140
|
+
const flattenedBlocks = flattenBlocks( blockList );
|
|
141
|
+
|
|
142
|
+
// Find the first message and use it.
|
|
143
|
+
let message;
|
|
144
|
+
for ( const rule of rules ) {
|
|
145
|
+
message = rule.callback( flattenedBlocks );
|
|
146
|
+
if ( message ) {
|
|
147
|
+
dispatch(
|
|
148
|
+
displayBlockRemovalPrompt(
|
|
149
|
+
clientIds,
|
|
150
|
+
selectPrevious,
|
|
151
|
+
message
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
181
156
|
}
|
|
182
157
|
}
|
|
183
158
|
|
|
@@ -228,31 +203,21 @@ export const ensureDefaultBlock =
|
|
|
228
203
|
*
|
|
229
204
|
* Contrast with `setBlockRemovalRules`.
|
|
230
205
|
*
|
|
231
|
-
* @param {string|string[]} clientIds
|
|
232
|
-
* @param {boolean} selectPrevious
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* @param {string[]} blockNamesForPrompt Names of the blocks that
|
|
238
|
-
* triggered the need for
|
|
239
|
-
* confirmation before removal.
|
|
240
|
-
* @param {string} messageType The type of message to display.
|
|
206
|
+
* @param {string|string[]} clientIds Client IDs of blocks to remove.
|
|
207
|
+
* @param {boolean} selectPrevious True if the previous block or the
|
|
208
|
+
* immediate parent (if no previous
|
|
209
|
+
* block exists) should be selected
|
|
210
|
+
* when a block is removed.
|
|
211
|
+
* @param {string} message Message to display in the prompt.
|
|
241
212
|
*
|
|
242
213
|
* @return {Object} Action object.
|
|
243
214
|
*/
|
|
244
|
-
function displayBlockRemovalPrompt(
|
|
245
|
-
clientIds,
|
|
246
|
-
selectPrevious,
|
|
247
|
-
blockNamesForPrompt,
|
|
248
|
-
messageType
|
|
249
|
-
) {
|
|
215
|
+
function displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {
|
|
250
216
|
return {
|
|
251
217
|
type: 'DISPLAY_BLOCK_REMOVAL_PROMPT',
|
|
252
218
|
clientIds,
|
|
253
219
|
selectPrevious,
|
|
254
|
-
|
|
255
|
-
messageType,
|
|
220
|
+
message,
|
|
256
221
|
};
|
|
257
222
|
}
|
|
258
223
|
|
|
@@ -390,16 +355,6 @@ export function stopEditingAsBlocks( clientId ) {
|
|
|
390
355
|
};
|
|
391
356
|
}
|
|
392
357
|
|
|
393
|
-
export function registerBlockBindingsSource( source ) {
|
|
394
|
-
return {
|
|
395
|
-
type: 'REGISTER_BLOCK_BINDINGS_SOURCE',
|
|
396
|
-
sourceName: source.name,
|
|
397
|
-
sourceLabel: source.label,
|
|
398
|
-
useSource: source.useSource,
|
|
399
|
-
lockAttributesEditing: source.lockAttributesEditing,
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
358
|
/**
|
|
404
359
|
* Returns an action object used in signalling that the user has begun to drag.
|
|
405
360
|
*
|
|
@@ -341,14 +341,6 @@ export function getLastFocus( state ) {
|
|
|
341
341
|
return state.lastFocus;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
export function getAllBlockBindingsSources( state ) {
|
|
345
|
-
return state.blockBindingsSources;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export function getBlockBindingsSource( state, sourceName ) {
|
|
349
|
-
return state.blockBindingsSources[ sourceName ];
|
|
350
|
-
}
|
|
351
|
-
|
|
352
344
|
/**
|
|
353
345
|
* Returns true if the user is dragging anything, or false otherwise. It is possible for a
|
|
354
346
|
* user to be dragging data from outside of the editor, so this selector is separate from
|
package/src/store/reducer.js
CHANGED
|
@@ -329,16 +329,13 @@ const withBlockTree =
|
|
|
329
329
|
// If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
|
|
330
330
|
const parentsOfRemovedBlocks = [];
|
|
331
331
|
for ( const clientId of action.clientIds ) {
|
|
332
|
+
const parentId = state.parents.get( clientId );
|
|
332
333
|
if (
|
|
333
|
-
|
|
334
|
-
(
|
|
335
|
-
newState.byClientId.get(
|
|
336
|
-
state.parents.get( clientId )
|
|
337
|
-
) )
|
|
334
|
+
parentId !== undefined &&
|
|
335
|
+
( parentId === '' ||
|
|
336
|
+
newState.byClientId.get( parentId ) )
|
|
338
337
|
) {
|
|
339
|
-
parentsOfRemovedBlocks.push(
|
|
340
|
-
state.parents.get( clientId )
|
|
341
|
-
);
|
|
338
|
+
parentsOfRemovedBlocks.push( parentId );
|
|
342
339
|
}
|
|
343
340
|
}
|
|
344
341
|
updateParentInnerBlocksInTree(
|
|
@@ -351,16 +348,13 @@ const withBlockTree =
|
|
|
351
348
|
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
|
352
349
|
const parentsOfRemovedBlocks = [];
|
|
353
350
|
for ( const clientId of action.clientIds ) {
|
|
351
|
+
const parentId = state.parents.get( clientId );
|
|
354
352
|
if (
|
|
355
|
-
|
|
356
|
-
(
|
|
357
|
-
newState.byClientId.get(
|
|
358
|
-
state.parents.get( clientId )
|
|
359
|
-
) )
|
|
353
|
+
parentId !== undefined &&
|
|
354
|
+
( parentId === '' ||
|
|
355
|
+
newState.byClientId.get( parentId ) )
|
|
360
356
|
) {
|
|
361
|
-
parentsOfRemovedBlocks.push(
|
|
362
|
-
state.parents.get( clientId )
|
|
363
|
-
);
|
|
357
|
+
parentsOfRemovedBlocks.push( parentId );
|
|
364
358
|
}
|
|
365
359
|
}
|
|
366
360
|
newState.tree = new Map( newState.tree );
|
|
@@ -1521,17 +1515,11 @@ export function isSelectionEnabled( state = true, action ) {
|
|
|
1521
1515
|
function removalPromptData( state = false, action ) {
|
|
1522
1516
|
switch ( action.type ) {
|
|
1523
1517
|
case 'DISPLAY_BLOCK_REMOVAL_PROMPT':
|
|
1524
|
-
const {
|
|
1525
|
-
clientIds,
|
|
1526
|
-
selectPrevious,
|
|
1527
|
-
blockNamesForPrompt,
|
|
1528
|
-
messageType,
|
|
1529
|
-
} = action;
|
|
1518
|
+
const { clientIds, selectPrevious, message } = action;
|
|
1530
1519
|
return {
|
|
1531
1520
|
clientIds,
|
|
1532
1521
|
selectPrevious,
|
|
1533
|
-
|
|
1534
|
-
messageType,
|
|
1522
|
+
message,
|
|
1535
1523
|
};
|
|
1536
1524
|
case 'CLEAR_BLOCK_REMOVAL_PROMPT':
|
|
1537
1525
|
return false;
|
|
@@ -1709,36 +1697,42 @@ export function settings( state = SETTINGS_DEFAULTS, action ) {
|
|
|
1709
1697
|
export function preferences( state = PREFERENCES_DEFAULTS, action ) {
|
|
1710
1698
|
switch ( action.type ) {
|
|
1711
1699
|
case 'INSERT_BLOCKS':
|
|
1712
|
-
case 'REPLACE_BLOCKS':
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1700
|
+
case 'REPLACE_BLOCKS': {
|
|
1701
|
+
const nextInsertUsage = action.blocks.reduce(
|
|
1702
|
+
( prevUsage, block ) => {
|
|
1703
|
+
const { attributes, name: blockName } = block;
|
|
1704
|
+
let id = blockName;
|
|
1705
|
+
// If a block variation match is found change the name to be the same with the
|
|
1706
|
+
// one that is used for block variations in the Inserter (`getItemFromVariation`).
|
|
1707
|
+
const match = select( blocksStore ).getActiveBlockVariation(
|
|
1708
|
+
blockName,
|
|
1709
|
+
attributes
|
|
1710
|
+
);
|
|
1711
|
+
if ( match?.name ) {
|
|
1712
|
+
id += '/' + match.name;
|
|
1713
|
+
}
|
|
1714
|
+
if ( blockName === 'core/block' ) {
|
|
1715
|
+
id += '/' + attributes.ref;
|
|
1716
|
+
}
|
|
1728
1717
|
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
insertUsage: {
|
|
1732
|
-
...prevState.insertUsage,
|
|
1718
|
+
return {
|
|
1719
|
+
...prevUsage,
|
|
1733
1720
|
[ id ]: {
|
|
1734
1721
|
time: action.time,
|
|
1735
|
-
count:
|
|
1736
|
-
?
|
|
1722
|
+
count: prevUsage[ id ]
|
|
1723
|
+
? prevUsage[ id ].count + 1
|
|
1737
1724
|
: 1,
|
|
1738
1725
|
},
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1726
|
+
};
|
|
1727
|
+
},
|
|
1728
|
+
state.insertUsage
|
|
1729
|
+
);
|
|
1730
|
+
|
|
1731
|
+
return {
|
|
1732
|
+
...state,
|
|
1733
|
+
insertUsage: nextInsertUsage,
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1742
1736
|
}
|
|
1743
1737
|
|
|
1744
1738
|
return state;
|
|
@@ -2050,20 +2044,6 @@ export function lastFocus( state = false, action ) {
|
|
|
2050
2044
|
return state;
|
|
2051
2045
|
}
|
|
2052
2046
|
|
|
2053
|
-
function blockBindingsSources( state = {}, action ) {
|
|
2054
|
-
if ( action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE' ) {
|
|
2055
|
-
return {
|
|
2056
|
-
...state,
|
|
2057
|
-
[ action.sourceName ]: {
|
|
2058
|
-
label: action.sourceLabel,
|
|
2059
|
-
useSource: action.useSource,
|
|
2060
|
-
lockAttributesEditing: action.lockAttributesEditing ?? true,
|
|
2061
|
-
},
|
|
2062
|
-
};
|
|
2063
|
-
}
|
|
2064
|
-
return state;
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
2047
|
const combinedReducers = combineReducers( {
|
|
2068
2048
|
blocks,
|
|
2069
2049
|
isDragging,
|
|
@@ -2095,7 +2075,6 @@ const combinedReducers = combineReducers( {
|
|
|
2095
2075
|
blockRemovalRules,
|
|
2096
2076
|
openedBlockSettingsMenu,
|
|
2097
2077
|
registeredInserterMediaCategories,
|
|
2098
|
-
blockBindingsSources,
|
|
2099
2078
|
} );
|
|
2100
2079
|
|
|
2101
2080
|
function withAutomaticChangeReset( reducer ) {
|
package/src/store/selectors.js
CHANGED
|
@@ -2231,56 +2231,41 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
2231
2231
|
* @param {Object} state Editor state.
|
|
2232
2232
|
* @param {?string} rootClientId Optional root client ID of block list.
|
|
2233
2233
|
*
|
|
2234
|
-
* @return {
|
|
2234
|
+
* @return {WPDirectInsertBlock|undefined} The block type to be directly inserted.
|
|
2235
2235
|
*
|
|
2236
2236
|
* @typedef {Object} WPDirectInsertBlock
|
|
2237
2237
|
* @property {string} name The type of block.
|
|
2238
2238
|
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
2239
2239
|
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
|
|
2240
2240
|
*/
|
|
2241
|
-
export
|
|
2242
|
-
(
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
if ( ! defaultBlock || ! directInsert ) {
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
if ( typeof directInsert === 'function' ) {
|
|
2254
|
-
return directInsert( getBlock( state, rootClientId ) )
|
|
2255
|
-
? defaultBlock
|
|
2256
|
-
: null;
|
|
2257
|
-
}
|
|
2258
|
-
return defaultBlock;
|
|
2259
|
-
},
|
|
2260
|
-
( state, rootClientId ) => [
|
|
2261
|
-
state.blockListSettings[ rootClientId ],
|
|
2262
|
-
state.blocks.tree.get( rootClientId ),
|
|
2263
|
-
]
|
|
2264
|
-
);
|
|
2241
|
+
export function getDirectInsertBlock( state, rootClientId = null ) {
|
|
2242
|
+
if ( ! rootClientId ) {
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
const { defaultBlock, directInsert } =
|
|
2246
|
+
state.blockListSettings[ rootClientId ] ?? {};
|
|
2247
|
+
if ( ! defaultBlock || ! directInsert ) {
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2265
2250
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2251
|
+
return defaultBlock;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
export function __experimentalGetDirectInsertBlock(
|
|
2255
|
+
state,
|
|
2256
|
+
rootClientId = null
|
|
2257
|
+
) {
|
|
2258
|
+
deprecated(
|
|
2259
|
+
'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',
|
|
2260
|
+
{
|
|
2261
|
+
alternative:
|
|
2262
|
+
'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
|
|
2263
|
+
since: '6.3',
|
|
2264
|
+
version: '6.4',
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
return getDirectInsertBlock( state, rootClientId );
|
|
2268
|
+
}
|
|
2284
2269
|
|
|
2285
2270
|
export const __experimentalGetParsedPattern = createRegistrySelector(
|
|
2286
2271
|
( select ) =>
|
|
@@ -2293,11 +2278,21 @@ export const __experimentalGetParsedPattern = createRegistrySelector(
|
|
|
2293
2278
|
if ( ! pattern ) {
|
|
2294
2279
|
return null;
|
|
2295
2280
|
}
|
|
2281
|
+
const blocks = parse( pattern.content, {
|
|
2282
|
+
__unstableSkipMigrationLogs: true,
|
|
2283
|
+
} );
|
|
2284
|
+
if ( blocks.length === 1 ) {
|
|
2285
|
+
blocks[ 0 ].attributes = {
|
|
2286
|
+
...blocks[ 0 ].attributes,
|
|
2287
|
+
metadata: {
|
|
2288
|
+
...( blocks[ 0 ].attributes.metadata || {} ),
|
|
2289
|
+
categories: pattern.categories,
|
|
2290
|
+
},
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2296
2293
|
return {
|
|
2297
2294
|
...pattern,
|
|
2298
|
-
blocks
|
|
2299
|
-
__unstableSkipMigrationLogs: true,
|
|
2300
|
-
} ),
|
|
2295
|
+
blocks,
|
|
2301
2296
|
};
|
|
2302
2297
|
}, getAllPatternsDependants( select ) )
|
|
2303
2298
|
);
|
|
@@ -832,10 +832,6 @@ describe( 'actions', () => {
|
|
|
832
832
|
blockB.clientId
|
|
833
833
|
)( { select, dispatch } );
|
|
834
834
|
|
|
835
|
-
expect( dispatch ).toHaveBeenCalledWith( {
|
|
836
|
-
type: 'MERGE_BLOCKS',
|
|
837
|
-
blocks: [ blockA.clientId, blockB.clientId ],
|
|
838
|
-
} );
|
|
839
835
|
expect( dispatch.selectBlock ).toHaveBeenCalledWith( 'chicken' );
|
|
840
836
|
} );
|
|
841
837
|
|
package/src/style.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import "./autocompleters/style.scss";
|
|
2
2
|
@import "./components/block-alignment-control/style.scss";
|
|
3
|
+
@import "./components/block-bindings-toolbar-indicator/style.scss";
|
|
3
4
|
@import "./components/block-canvas/style.scss";
|
|
4
5
|
@import "./components/block-icon/style.scss";
|
|
5
6
|
@import "./components/block-inspector/style.scss";
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
@import "./components/duotone-control/style.scss";
|
|
28
29
|
@import "./components/font-appearance-control/style.scss";
|
|
29
30
|
@import "./components/global-styles/style.scss";
|
|
31
|
+
@import "./components/grid-visualizer/style.scss";
|
|
30
32
|
@import "./components/height-control/style.scss";
|
|
31
33
|
@import "./components/image-size-control/style.scss";
|
|
32
34
|
@import "./components/inserter-list-item/style.scss";
|
|
@@ -52,8 +54,8 @@
|
|
|
52
54
|
@import "./hooks/color.scss";
|
|
53
55
|
@import "./hooks/dimensions.scss";
|
|
54
56
|
@import "./hooks/layout.scss";
|
|
55
|
-
@import "./hooks/padding.scss";
|
|
56
57
|
@import "./hooks/position.scss";
|
|
58
|
+
@import "./hooks/spacing.scss";
|
|
57
59
|
@import "./hooks/typography.scss";
|
|
58
60
|
|
|
59
61
|
@import "./components/block-toolbar/style.scss";
|
package/tsconfig.json
CHANGED
package/build/hooks/margin.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.MarginVisualizer = MarginVisualizer;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _element = require("@wordpress/element");
|
|
10
|
-
var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
|
|
11
|
-
var _blockPopover = _interopRequireDefault(require("../components/block-popover"));
|
|
12
|
-
var _useBlockRefs = require("../components/block-list/use-block-props/use-block-refs");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function getComputedCSS(element, property) {
|
|
22
|
-
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
|
|
23
|
-
}
|
|
24
|
-
function MarginVisualizer({
|
|
25
|
-
clientId,
|
|
26
|
-
attributes,
|
|
27
|
-
forceShow
|
|
28
|
-
}) {
|
|
29
|
-
const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
30
|
-
const [style, setStyle] = (0, _element.useState)();
|
|
31
|
-
const margin = attributes?.style?.spacing?.margin;
|
|
32
|
-
(0, _element.useEffect)(() => {
|
|
33
|
-
if (!blockElement || null === blockElement.ownerDocument.defaultView) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const top = getComputedCSS(blockElement, 'margin-top');
|
|
37
|
-
const right = getComputedCSS(blockElement, 'margin-right');
|
|
38
|
-
const bottom = getComputedCSS(blockElement, 'margin-bottom');
|
|
39
|
-
const left = getComputedCSS(blockElement, 'margin-left');
|
|
40
|
-
setStyle({
|
|
41
|
-
borderTopWidth: top,
|
|
42
|
-
borderRightWidth: right,
|
|
43
|
-
borderBottomWidth: bottom,
|
|
44
|
-
borderLeftWidth: left,
|
|
45
|
-
top: top ? `-${top}` : 0,
|
|
46
|
-
right: right ? `-${right}` : 0,
|
|
47
|
-
bottom: bottom ? `-${bottom}` : 0,
|
|
48
|
-
left: left ? `-${left}` : 0
|
|
49
|
-
});
|
|
50
|
-
}, [blockElement, margin]);
|
|
51
|
-
const [isActive, setIsActive] = (0, _element.useState)(false);
|
|
52
|
-
const valueRef = (0, _element.useRef)(margin);
|
|
53
|
-
const timeoutRef = (0, _element.useRef)();
|
|
54
|
-
const clearTimer = () => {
|
|
55
|
-
if (timeoutRef.current) {
|
|
56
|
-
window.clearTimeout(timeoutRef.current);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
(0, _element.useEffect)(() => {
|
|
60
|
-
if (!(0, _isShallowEqual.default)(margin, valueRef.current) && !forceShow) {
|
|
61
|
-
setIsActive(true);
|
|
62
|
-
valueRef.current = margin;
|
|
63
|
-
timeoutRef.current = setTimeout(() => {
|
|
64
|
-
setIsActive(false);
|
|
65
|
-
}, 400);
|
|
66
|
-
}
|
|
67
|
-
return () => {
|
|
68
|
-
setIsActive(false);
|
|
69
|
-
clearTimer();
|
|
70
|
-
};
|
|
71
|
-
}, [margin, forceShow]);
|
|
72
|
-
if (!isActive && !forceShow) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return (0, _react.createElement)(_blockPopover.default, {
|
|
76
|
-
clientId: clientId,
|
|
77
|
-
__unstableCoverTarget: true,
|
|
78
|
-
__unstableRefreshSize: margin,
|
|
79
|
-
__unstablePopoverSlot: "block-toolbar",
|
|
80
|
-
shift: false
|
|
81
|
-
}, (0, _react.createElement)("div", {
|
|
82
|
-
className: "block-editor__padding-visualizer",
|
|
83
|
-
style: style
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=margin.js.map
|