@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 +2 -0
- package/LICENSE.md +1 -1
- package/README.md +12 -10
- package/build/components/block-canvas/index.js +21 -7
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +257 -95
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +58 -23
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +49 -69
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +21 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +90 -29
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +84 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +6 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +3 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +43 -36
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +14 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -33
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +11 -16
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +6 -62
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +19 -37
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +22 -57
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +7 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +108 -17
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +9 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +21 -69
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +14 -30
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +198 -36
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +53 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +79 -90
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +13 -30
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +13 -14
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +23 -28
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +52 -120
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +27 -16
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +15 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +25 -104
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +52 -89
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +25 -10
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +200 -10
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -6
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +54 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +46 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -73
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +38 -99
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +22 -8
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +261 -99
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +60 -25
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +50 -70
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +22 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +6 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +89 -27
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +26 -23
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +8 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +3 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +45 -38
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +3 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -33
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +11 -16
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +21 -39
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +22 -56
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +7 -3
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +107 -18
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +9 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +20 -67
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +12 -27
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +197 -37
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +52 -79
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +78 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +12 -28
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +15 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +20 -25
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +50 -120
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +20 -16
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +10 -6
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +21 -100
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +52 -85
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +26 -11
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +194 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +52 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -65
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +37 -97
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +164 -301
- package/build-style/style.css +164 -301
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +29 -17
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +2 -7
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +6 -4
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +309 -104
- package/src/components/block-list/block.native.js +69 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +43 -86
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +23 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +9 -6
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +179 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +84 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +36 -26
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +6 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +5 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +60 -47
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +3 -2
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +26 -36
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +21 -21
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +15 -13
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/preview-options/index.js +6 -86
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +23 -52
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +22 -71
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +8 -3
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +181 -30
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +9 -24
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +3 -7
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/README.md +0 -4
- package/src/components/use-settings/index.js +15 -1
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +16 -81
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +14 -38
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +269 -32
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +62 -124
- package/src/hooks/color.js +111 -138
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +9 -45
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +14 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +14 -36
- package/src/hooks/font-size.js +67 -168
- package/src/hooks/index.js +58 -16
- package/src/hooks/index.native.js +22 -6
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +17 -103
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +118 -193
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +14 -16
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +261 -10
- package/src/private-apis.js +2 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +48 -0
- package/src/store/private-selectors.js +56 -0
- package/src/store/reducer.js +20 -1
- package/src/store/selectors.js +10 -82
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -2
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +34 -104
- package/src/utils/selection.js +9 -2
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -120
- package/build/hooks/custom-fields.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -118
- package/build-module/hooks/custom-fields.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/custom-fields.js +0 -142
- package/src/hooks/test/color.js +0 -112
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
__experimentalUseDropZone as useDropZone,
|
|
9
9
|
} from '@wordpress/compose';
|
|
10
10
|
import { isRTL } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
isUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,
|
|
13
|
+
store as blocksStore,
|
|
14
|
+
} from '@wordpress/blocks';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Internal dependencies
|
|
@@ -20,6 +23,10 @@ import {
|
|
|
20
23
|
} from '../../utils/math';
|
|
21
24
|
import { store as blockEditorStore } from '../../store';
|
|
22
25
|
|
|
26
|
+
const THRESHOLD_DISTANCE = 30;
|
|
27
|
+
const MINIMUM_HEIGHT_FOR_THRESHOLD = 120;
|
|
28
|
+
const MINIMUM_WIDTH_FOR_THRESHOLD = 120;
|
|
29
|
+
|
|
23
30
|
/** @typedef {import('../../utils/math').WPPoint} WPPoint */
|
|
24
31
|
/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */
|
|
25
32
|
|
|
@@ -48,24 +55,86 @@ import { store as blockEditorStore } from '../../store';
|
|
|
48
55
|
* @param {WPBlockData[]} blocksData The block data list.
|
|
49
56
|
* @param {WPPoint} position The position of the item being dragged.
|
|
50
57
|
* @param {WPBlockListOrientation} orientation The orientation of the block list.
|
|
58
|
+
* @param {Object} options Additional options.
|
|
51
59
|
* @return {[number, WPDropOperation]} The drop target position.
|
|
52
60
|
*/
|
|
53
61
|
export function getDropTargetPosition(
|
|
54
62
|
blocksData,
|
|
55
63
|
position,
|
|
56
|
-
orientation = 'vertical'
|
|
64
|
+
orientation = 'vertical',
|
|
65
|
+
options = {}
|
|
57
66
|
) {
|
|
58
67
|
const allowedEdges =
|
|
59
68
|
orientation === 'horizontal'
|
|
60
69
|
? [ 'left', 'right' ]
|
|
61
70
|
: [ 'top', 'bottom' ];
|
|
62
71
|
|
|
63
|
-
const isRightToLeft = isRTL();
|
|
64
|
-
|
|
65
72
|
let nearestIndex = 0;
|
|
66
73
|
let insertPosition = 'before';
|
|
67
74
|
let minDistance = Infinity;
|
|
68
75
|
|
|
76
|
+
const {
|
|
77
|
+
dropZoneElement,
|
|
78
|
+
parentBlockOrientation,
|
|
79
|
+
rootBlockIndex = 0,
|
|
80
|
+
} = options;
|
|
81
|
+
|
|
82
|
+
// Allow before/after when dragging over the top/bottom edges of the drop zone.
|
|
83
|
+
if ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {
|
|
84
|
+
const rect = dropZoneElement.getBoundingClientRect();
|
|
85
|
+
const [ distance, edge ] = getDistanceToNearestEdge( position, rect, [
|
|
86
|
+
'top',
|
|
87
|
+
'bottom',
|
|
88
|
+
] );
|
|
89
|
+
|
|
90
|
+
// If dragging over the top or bottom of the drop zone, insert the block
|
|
91
|
+
// before or after the parent block. This only applies to blocks that use
|
|
92
|
+
// a drop zone element, typically container blocks such as Group or Cover.
|
|
93
|
+
if (
|
|
94
|
+
rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&
|
|
95
|
+
distance < THRESHOLD_DISTANCE
|
|
96
|
+
) {
|
|
97
|
+
if ( edge === 'top' ) {
|
|
98
|
+
return [ rootBlockIndex, 'before' ];
|
|
99
|
+
}
|
|
100
|
+
if ( edge === 'bottom' ) {
|
|
101
|
+
return [ rootBlockIndex + 1, 'after' ];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const isRightToLeft = isRTL();
|
|
107
|
+
|
|
108
|
+
// Allow before/after when dragging over the left/right edges of the drop zone.
|
|
109
|
+
if ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {
|
|
110
|
+
const rect = dropZoneElement.getBoundingClientRect();
|
|
111
|
+
const [ distance, edge ] = getDistanceToNearestEdge( position, rect, [
|
|
112
|
+
'left',
|
|
113
|
+
'right',
|
|
114
|
+
] );
|
|
115
|
+
|
|
116
|
+
// If dragging over the left or right of the drop zone, insert the block
|
|
117
|
+
// before or after the parent block. This only applies to blocks that use
|
|
118
|
+
// a drop zone element, typically container blocks such as Group.
|
|
119
|
+
if (
|
|
120
|
+
rect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&
|
|
121
|
+
distance < THRESHOLD_DISTANCE
|
|
122
|
+
) {
|
|
123
|
+
if (
|
|
124
|
+
( isRightToLeft && edge === 'right' ) ||
|
|
125
|
+
( ! isRightToLeft && edge === 'left' )
|
|
126
|
+
) {
|
|
127
|
+
return [ rootBlockIndex, 'before' ];
|
|
128
|
+
}
|
|
129
|
+
if (
|
|
130
|
+
( isRightToLeft && edge === 'left' ) ||
|
|
131
|
+
( ! isRightToLeft && edge === 'right' )
|
|
132
|
+
) {
|
|
133
|
+
return [ rootBlockIndex + 1, 'after' ];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
69
138
|
blocksData.forEach(
|
|
70
139
|
( { isUnmodifiedDefaultBlock, getBoundingClientRect, blockIndex } ) => {
|
|
71
140
|
const rect = getBoundingClientRect();
|
|
@@ -125,6 +194,50 @@ export function getDropTargetPosition(
|
|
|
125
194
|
];
|
|
126
195
|
}
|
|
127
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Check if the dragged blocks can be dropped on the target.
|
|
199
|
+
* @param {Function} getBlockType
|
|
200
|
+
* @param {Object[]} allowedBlocks
|
|
201
|
+
* @param {string[]} draggedBlockNames
|
|
202
|
+
* @param {string} targetBlockName
|
|
203
|
+
* @return {boolean} Whether the dragged blocks can be dropped on the target.
|
|
204
|
+
*/
|
|
205
|
+
export function isDropTargetValid(
|
|
206
|
+
getBlockType,
|
|
207
|
+
allowedBlocks,
|
|
208
|
+
draggedBlockNames,
|
|
209
|
+
targetBlockName
|
|
210
|
+
) {
|
|
211
|
+
// At root level allowedBlocks is undefined and all blocks are allowed.
|
|
212
|
+
// Otherwise, check if all dragged blocks are allowed.
|
|
213
|
+
let areBlocksAllowed = true;
|
|
214
|
+
if ( allowedBlocks ) {
|
|
215
|
+
const allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );
|
|
216
|
+
|
|
217
|
+
areBlocksAllowed = draggedBlockNames.every( ( name ) =>
|
|
218
|
+
allowedBlockNames?.includes( name )
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Work out if dragged blocks have an allowed parent and if so
|
|
223
|
+
// check target block matches the allowed parent.
|
|
224
|
+
const draggedBlockTypes = draggedBlockNames.map( ( name ) =>
|
|
225
|
+
getBlockType( name )
|
|
226
|
+
);
|
|
227
|
+
const targetMatchesDraggedBlockParents = draggedBlockTypes.every(
|
|
228
|
+
( block ) => {
|
|
229
|
+
const [ allowedParentName ] = block?.parent || [];
|
|
230
|
+
if ( ! allowedParentName ) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return allowedParentName === targetBlockName;
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
return areBlocksAllowed && targetMatchesDraggedBlockParents;
|
|
239
|
+
}
|
|
240
|
+
|
|
128
241
|
/**
|
|
129
242
|
* @typedef {Object} WPBlockDropZoneConfig
|
|
130
243
|
* @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.
|
|
@@ -143,6 +256,8 @@ export default function useBlockDropZone( {
|
|
|
143
256
|
// values returned by the `getRootBlockClientId` selector, which also uses
|
|
144
257
|
// an empty string to represent top-level blocks.
|
|
145
258
|
rootClientId: targetRootClientId = '',
|
|
259
|
+
parentClientId: parentBlockClientId = '',
|
|
260
|
+
isDisabled = false,
|
|
146
261
|
} = {} ) {
|
|
147
262
|
const registry = useRegistry();
|
|
148
263
|
const [ dropTarget, setDropTarget ] = useState( {
|
|
@@ -150,34 +265,47 @@ export default function useBlockDropZone( {
|
|
|
150
265
|
operation: 'insert',
|
|
151
266
|
} );
|
|
152
267
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
blockEditingMode !== 'default' ||
|
|
163
|
-
__unstableHasActiveBlockOverlayActive( targetRootClientId ) ||
|
|
164
|
-
__unstableIsWithinBlockOverlay( targetRootClientId )
|
|
165
|
-
);
|
|
166
|
-
},
|
|
167
|
-
[ targetRootClientId ]
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const { getBlockListSettings, getBlocks, getBlockIndex } =
|
|
171
|
-
useSelect( blockEditorStore );
|
|
268
|
+
const { getBlockType } = useSelect( blocksStore );
|
|
269
|
+
const {
|
|
270
|
+
getBlockListSettings,
|
|
271
|
+
getBlocks,
|
|
272
|
+
getBlockIndex,
|
|
273
|
+
getDraggedBlockClientIds,
|
|
274
|
+
getBlockNamesByClientId,
|
|
275
|
+
getAllowedBlocks,
|
|
276
|
+
} = useSelect( blockEditorStore );
|
|
172
277
|
const { showInsertionPoint, hideInsertionPoint } =
|
|
173
278
|
useDispatch( blockEditorStore );
|
|
174
279
|
|
|
175
|
-
const onBlockDrop = useOnBlockDrop(
|
|
176
|
-
operation
|
|
177
|
-
|
|
280
|
+
const onBlockDrop = useOnBlockDrop(
|
|
281
|
+
dropTarget.operation === 'before' || dropTarget.operation === 'after'
|
|
282
|
+
? parentBlockClientId
|
|
283
|
+
: targetRootClientId,
|
|
284
|
+
dropTarget.index,
|
|
285
|
+
{
|
|
286
|
+
operation: dropTarget.operation,
|
|
287
|
+
}
|
|
288
|
+
);
|
|
178
289
|
const throttled = useThrottle(
|
|
179
290
|
useCallback(
|
|
180
291
|
( event, ownerDocument ) => {
|
|
292
|
+
const allowedBlocks = getAllowedBlocks( targetRootClientId );
|
|
293
|
+
const targetBlockName = getBlockNamesByClientId( [
|
|
294
|
+
targetRootClientId,
|
|
295
|
+
] )[ 0 ];
|
|
296
|
+
const draggedBlockNames = getBlockNamesByClientId(
|
|
297
|
+
getDraggedBlockClientIds()
|
|
298
|
+
);
|
|
299
|
+
const isBlockDroppingAllowed = isDropTargetValid(
|
|
300
|
+
getBlockType,
|
|
301
|
+
allowedBlocks,
|
|
302
|
+
draggedBlockNames,
|
|
303
|
+
targetBlockName
|
|
304
|
+
);
|
|
305
|
+
if ( ! isBlockDroppingAllowed ) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
181
309
|
const blocks = getBlocks( targetRootClientId );
|
|
182
310
|
|
|
183
311
|
// The block list is empty, don't show the insertion point but still allow dropping.
|
|
@@ -211,7 +339,16 @@ export default function useBlockDropZone( {
|
|
|
211
339
|
const [ targetIndex, operation ] = getDropTargetPosition(
|
|
212
340
|
blocksData,
|
|
213
341
|
{ x: event.clientX, y: event.clientY },
|
|
214
|
-
getBlockListSettings( targetRootClientId )?.orientation
|
|
342
|
+
getBlockListSettings( targetRootClientId )?.orientation,
|
|
343
|
+
{
|
|
344
|
+
dropZoneElement,
|
|
345
|
+
parentBlockClientId,
|
|
346
|
+
parentBlockOrientation: parentBlockClientId
|
|
347
|
+
? getBlockListSettings( parentBlockClientId )
|
|
348
|
+
?.orientation
|
|
349
|
+
: undefined,
|
|
350
|
+
rootBlockIndex: getBlockIndex( targetRootClientId ),
|
|
351
|
+
}
|
|
215
352
|
);
|
|
216
353
|
|
|
217
354
|
registry.batch( () => {
|
|
@@ -219,18 +356,32 @@ export default function useBlockDropZone( {
|
|
|
219
356
|
index: targetIndex,
|
|
220
357
|
operation,
|
|
221
358
|
} );
|
|
222
|
-
|
|
359
|
+
|
|
360
|
+
const insertionPointClientId = [
|
|
361
|
+
'before',
|
|
362
|
+
'after',
|
|
363
|
+
].includes( operation )
|
|
364
|
+
? parentBlockClientId
|
|
365
|
+
: targetRootClientId;
|
|
366
|
+
|
|
367
|
+
showInsertionPoint( insertionPointClientId, targetIndex, {
|
|
223
368
|
operation,
|
|
224
369
|
} );
|
|
225
370
|
} );
|
|
226
371
|
},
|
|
227
372
|
[
|
|
228
|
-
|
|
373
|
+
getAllowedBlocks,
|
|
229
374
|
targetRootClientId,
|
|
375
|
+
getBlockNamesByClientId,
|
|
376
|
+
getDraggedBlockClientIds,
|
|
377
|
+
getBlockType,
|
|
378
|
+
getBlocks,
|
|
230
379
|
getBlockListSettings,
|
|
380
|
+
dropZoneElement,
|
|
381
|
+
parentBlockClientId,
|
|
382
|
+
getBlockIndex,
|
|
231
383
|
registry,
|
|
232
384
|
showInsertionPoint,
|
|
233
|
-
getBlockIndex,
|
|
234
385
|
]
|
|
235
386
|
),
|
|
236
387
|
200
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Controller } from '@react-spring/web';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
useState,
|
|
11
|
-
useLayoutEffect,
|
|
12
|
-
useReducer,
|
|
13
|
-
useMemo,
|
|
14
|
-
useRef,
|
|
15
|
-
} from '@wordpress/element';
|
|
16
|
-
import { useReducedMotion } from '@wordpress/compose';
|
|
9
|
+
import { useLayoutEffect, useMemo, useRef } from '@wordpress/element';
|
|
17
10
|
import { getScrollContainer } from '@wordpress/dom';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
18
12
|
|
|
19
13
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param {number} state Previous counter value.
|
|
23
|
-
* @return {number} New state value.
|
|
14
|
+
* Internal dependencies
|
|
24
15
|
*/
|
|
25
|
-
|
|
16
|
+
import { store as blockEditorStore } from '../../store';
|
|
26
17
|
|
|
27
|
-
|
|
18
|
+
/**
|
|
19
|
+
* If the block count exceeds the threshold, we disable the reordering animation
|
|
20
|
+
* to avoid laginess.
|
|
21
|
+
*/
|
|
22
|
+
const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
23
|
+
|
|
24
|
+
function getAbsolutePosition( element ) {
|
|
28
25
|
return {
|
|
29
26
|
top: element.offsetTop,
|
|
30
27
|
left: element.offsetLeft,
|
|
31
28
|
};
|
|
32
|
-
}
|
|
29
|
+
}
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Hook used to compute the styles required to move a div into a new position.
|
|
@@ -42,114 +39,121 @@ const getAbsolutePosition = ( element ) => {
|
|
|
42
39
|
* - It uses the "resetAnimation" flag to reset the animation
|
|
43
40
|
* from the beginning in order to animate to the new destination point.
|
|
44
41
|
*
|
|
45
|
-
* @param {Object}
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {
|
|
48
|
-
* @param {boolean} $1.enableAnimation Enable/Disable animation.
|
|
49
|
-
* @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
|
|
42
|
+
* @param {Object} $1 Options
|
|
43
|
+
* @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
|
|
44
|
+
* @param {string} $1.clientId
|
|
50
45
|
*/
|
|
51
|
-
function useMovingAnimation( {
|
|
52
|
-
isSelected,
|
|
53
|
-
adjustScrolling,
|
|
54
|
-
enableAnimation,
|
|
55
|
-
triggerAnimationOnChange,
|
|
56
|
-
} ) {
|
|
46
|
+
function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
57
47
|
const ref = useRef();
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
const {
|
|
49
|
+
isTyping,
|
|
50
|
+
getGlobalBlockCount,
|
|
51
|
+
isBlockSelected,
|
|
52
|
+
isFirstMultiSelectedBlock,
|
|
53
|
+
isBlockMultiSelected,
|
|
54
|
+
isAncestorMultiSelected,
|
|
55
|
+
} = useSelect( blockEditorStore );
|
|
56
|
+
|
|
57
|
+
// Whenever the trigger changes, we need to take a snapshot of the current
|
|
58
|
+
// position of the block to use it as a destination point for the animation.
|
|
59
|
+
const { previous, prevRect } = useMemo(
|
|
60
|
+
() => ( {
|
|
61
|
+
previous: ref.current && getAbsolutePosition( ref.current ),
|
|
62
|
+
prevRect: ref.current && ref.current.getBoundingClientRect(),
|
|
63
|
+
} ),
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
65
|
[ triggerAnimationOnChange ]
|
|
68
66
|
);
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if ( ! adjustScrolling || ! ref.current ) {
|
|
74
|
-
return () => {};
|
|
68
|
+
useLayoutEffect( () => {
|
|
69
|
+
if ( ! previous || ! ref.current ) {
|
|
70
|
+
return;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
const scrollContainer = getScrollContainer( ref.current );
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
const isSelected = isBlockSelected( clientId );
|
|
75
|
+
const adjustScrolling =
|
|
76
|
+
isSelected || isFirstMultiSelectedBlock( clientId );
|
|
77
|
+
|
|
78
|
+
function preserveScrollPosition() {
|
|
79
|
+
if ( adjustScrolling && prevRect ) {
|
|
80
|
+
const blockRect = ref.current.getBoundingClientRect();
|
|
81
|
+
const diff = blockRect.top - prevRect.top;
|
|
82
|
+
|
|
83
|
+
if ( diff ) {
|
|
84
|
+
scrollContainer.scrollTop += diff;
|
|
85
|
+
}
|
|
90
86
|
}
|
|
91
|
-
};
|
|
92
|
-
}, [ triggerAnimationOnChange, adjustScrolling ] );
|
|
93
|
-
|
|
94
|
-
useLayoutEffect( () => {
|
|
95
|
-
if ( triggeredAnimation ) {
|
|
96
|
-
endAnimation();
|
|
97
|
-
}
|
|
98
|
-
}, [ triggeredAnimation ] );
|
|
99
|
-
useLayoutEffect( () => {
|
|
100
|
-
if ( ! previous ) {
|
|
101
|
-
return;
|
|
102
87
|
}
|
|
103
88
|
|
|
104
|
-
if
|
|
89
|
+
// We disable the animation if the user has a preference for reduced
|
|
90
|
+
// motion, if the user is typing (insertion by Enter), or if the block
|
|
91
|
+
// count exceeds the threshold (insertion caused all the blocks that
|
|
92
|
+
// follow to animate).
|
|
93
|
+
// To do: consider enableing the _moving_ animation even for large
|
|
94
|
+
// posts, while only disabling the _insertion_ animation?
|
|
95
|
+
const disableAnimation =
|
|
96
|
+
window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||
|
|
97
|
+
isTyping() ||
|
|
98
|
+
getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;
|
|
99
|
+
|
|
100
|
+
if ( disableAnimation ) {
|
|
105
101
|
// If the animation is disabled and the scroll needs to be adjusted,
|
|
106
102
|
// just move directly to the final scroll position.
|
|
107
103
|
preserveScrollPosition();
|
|
108
|
-
|
|
109
104
|
return;
|
|
110
105
|
}
|
|
111
106
|
|
|
107
|
+
const isPartOfSelection =
|
|
108
|
+
isSelected ||
|
|
109
|
+
isBlockMultiSelected( clientId ) ||
|
|
110
|
+
isAncestorMultiSelected( clientId );
|
|
111
|
+
// Make sure the other blocks move under the selected block(s).
|
|
112
|
+
const zIndex = isPartOfSelection ? '1' : '';
|
|
113
|
+
|
|
114
|
+
const controller = new Controller( {
|
|
115
|
+
x: 0,
|
|
116
|
+
y: 0,
|
|
117
|
+
config: { mass: 5, tension: 2000, friction: 200 },
|
|
118
|
+
onChange( { value } ) {
|
|
119
|
+
if ( ! ref.current ) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
let { x, y } = value;
|
|
123
|
+
x = Math.round( x );
|
|
124
|
+
y = Math.round( y );
|
|
125
|
+
const finishedMoving = x === 0 && y === 0;
|
|
126
|
+
ref.current.style.transformOrigin = 'center center';
|
|
127
|
+
ref.current.style.transform = finishedMoving
|
|
128
|
+
? null // Set to `null` to explicitly remove the transform.
|
|
129
|
+
: `translate3d(${ x }px,${ y }px,0)`;
|
|
130
|
+
ref.current.style.zIndex = zIndex;
|
|
131
|
+
preserveScrollPosition();
|
|
132
|
+
},
|
|
133
|
+
} );
|
|
134
|
+
|
|
112
135
|
ref.current.style.transform = undefined;
|
|
113
136
|
const destination = getAbsolutePosition( ref.current );
|
|
114
137
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
x: Math.round( previous.left - destination.left ),
|
|
118
|
-
y: Math.round( previous.top - destination.top ),
|
|
119
|
-
} );
|
|
120
|
-
}, [ triggerAnimationOnChange ] );
|
|
138
|
+
const x = Math.round( previous.left - destination.left );
|
|
139
|
+
const y = Math.round( previous.top - destination.top );
|
|
121
140
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
useSpring( {
|
|
140
|
-
from: {
|
|
141
|
-
x: transform.x,
|
|
142
|
-
y: transform.y,
|
|
143
|
-
},
|
|
144
|
-
to: {
|
|
145
|
-
x: 0,
|
|
146
|
-
y: 0,
|
|
147
|
-
},
|
|
148
|
-
reset: triggeredAnimation !== finishedAnimation,
|
|
149
|
-
config: { mass: 5, tension: 2000, friction: 200 },
|
|
150
|
-
immediate: prefersReducedMotion,
|
|
151
|
-
onChange,
|
|
152
|
-
} );
|
|
141
|
+
controller.start( { x: 0, y: 0, from: { x, y } } );
|
|
142
|
+
|
|
143
|
+
return () => {
|
|
144
|
+
controller.stop();
|
|
145
|
+
};
|
|
146
|
+
}, [
|
|
147
|
+
previous,
|
|
148
|
+
prevRect,
|
|
149
|
+
clientId,
|
|
150
|
+
isTyping,
|
|
151
|
+
getGlobalBlockCount,
|
|
152
|
+
isBlockSelected,
|
|
153
|
+
isFirstMultiSelectedBlock,
|
|
154
|
+
isBlockMultiSelected,
|
|
155
|
+
isAncestorMultiSelected,
|
|
156
|
+
] );
|
|
153
157
|
|
|
154
158
|
return ref;
|
|
155
159
|
}
|
|
@@ -133,8 +133,7 @@ export function onBlockDrop(
|
|
|
133
133
|
* A function that returns an event handler function for block-related file drop events.
|
|
134
134
|
*
|
|
135
135
|
* @param {string} targetRootClientId The root client id where the block(s) will be inserted.
|
|
136
|
-
* @param {
|
|
137
|
-
* @param {boolean} hasUploadPermissions Whether the user has upload permissions.
|
|
136
|
+
* @param {Function} getSettings A function that gets the block editor settings.
|
|
138
137
|
* @param {Function} updateBlockAttributes A function that updates a block's attributes.
|
|
139
138
|
* @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.
|
|
140
139
|
* @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.
|
|
@@ -143,14 +142,13 @@ export function onBlockDrop(
|
|
|
143
142
|
*/
|
|
144
143
|
export function onFilesDrop(
|
|
145
144
|
targetRootClientId,
|
|
146
|
-
|
|
147
|
-
hasUploadPermissions,
|
|
145
|
+
getSettings,
|
|
148
146
|
updateBlockAttributes,
|
|
149
147
|
canInsertBlockType,
|
|
150
148
|
insertOrReplaceBlocks
|
|
151
149
|
) {
|
|
152
150
|
return ( files ) => {
|
|
153
|
-
if ( !
|
|
151
|
+
if ( ! getSettings().mediaUpload ) {
|
|
154
152
|
return;
|
|
155
153
|
}
|
|
156
154
|
|
|
@@ -175,17 +173,11 @@ export function onFilesDrop(
|
|
|
175
173
|
/**
|
|
176
174
|
* A function that returns an event handler function for block-related HTML drop events.
|
|
177
175
|
*
|
|
178
|
-
* @param {string} targetRootClientId The root client id where the block(s) will be inserted.
|
|
179
|
-
* @param {number} targetBlockIndex The index where the block(s) will be inserted.
|
|
180
176
|
* @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.
|
|
181
177
|
*
|
|
182
178
|
* @return {Function} The event handler for a block-related HTML drop event.
|
|
183
179
|
*/
|
|
184
|
-
export function onHTMLDrop(
|
|
185
|
-
targetRootClientId,
|
|
186
|
-
targetBlockIndex,
|
|
187
|
-
insertOrReplaceBlocks
|
|
188
|
-
) {
|
|
180
|
+
export function onHTMLDrop( insertOrReplaceBlocks ) {
|
|
189
181
|
return ( HTML ) => {
|
|
190
182
|
const blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );
|
|
191
183
|
|
|
@@ -211,16 +203,13 @@ export default function useOnBlockDrop(
|
|
|
211
203
|
options = {}
|
|
212
204
|
) {
|
|
213
205
|
const { operation = 'insert' } = options;
|
|
214
|
-
const hasUploadPermissions = useSelect(
|
|
215
|
-
( select ) => select( blockEditorStore ).getSettings().mediaUpload,
|
|
216
|
-
[]
|
|
217
|
-
);
|
|
218
206
|
const {
|
|
219
207
|
canInsertBlockType,
|
|
220
208
|
getBlockIndex,
|
|
221
209
|
getClientIdsOfDescendants,
|
|
222
210
|
getBlockOrder,
|
|
223
211
|
getBlocksByClientId,
|
|
212
|
+
getSettings,
|
|
224
213
|
} = useSelect( blockEditorStore );
|
|
225
214
|
const {
|
|
226
215
|
insertBlocks,
|
|
@@ -292,9 +281,10 @@ export default function useOnBlockDrop(
|
|
|
292
281
|
operation,
|
|
293
282
|
getBlockOrder,
|
|
294
283
|
getBlocksByClientId,
|
|
295
|
-
insertBlocks,
|
|
296
284
|
moveBlocksToPosition,
|
|
285
|
+
registry,
|
|
297
286
|
removeBlocks,
|
|
287
|
+
replaceBlocks,
|
|
298
288
|
targetBlockIndex,
|
|
299
289
|
targetRootClientId,
|
|
300
290
|
]
|
|
@@ -311,17 +301,12 @@ export default function useOnBlockDrop(
|
|
|
311
301
|
);
|
|
312
302
|
const _onFilesDrop = onFilesDrop(
|
|
313
303
|
targetRootClientId,
|
|
314
|
-
|
|
315
|
-
hasUploadPermissions,
|
|
304
|
+
getSettings,
|
|
316
305
|
updateBlockAttributes,
|
|
317
306
|
canInsertBlockType,
|
|
318
307
|
insertOrReplaceBlocks
|
|
319
308
|
);
|
|
320
|
-
const _onHTMLDrop = onHTMLDrop(
|
|
321
|
-
targetRootClientId,
|
|
322
|
-
targetBlockIndex,
|
|
323
|
-
insertOrReplaceBlocks
|
|
324
|
-
);
|
|
309
|
+
const _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );
|
|
325
310
|
|
|
326
311
|
return ( event ) => {
|
|
327
312
|
const files = getFilesFromDataTransfer( event.dataTransfer );
|