@wordpress/block-editor 12.16.0 → 12.17.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 +3 -6
- package/build/components/block-canvas/index.js +0 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.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-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/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 +245 -102
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +46 -20
- 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 +33 -96
- package/build/components/block-list/use-block-props/index.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 +15 -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 +4 -4
- package/build/components/block-patterns-list/index.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 +1 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +0 -2
- package/build/components/block-tools/block-toolbar-popover.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/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 +2 -1
- 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 +1 -4
- 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 +1 -1
- 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 +2 -1
- 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-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +6 -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/menu.js +14 -28
- package/build/components/inserter/menu.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-draggable-blocks/index.js +1 -1
- 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-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 +9 -14
- 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/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/index.js +17 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +16 -24
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +2 -2
- 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/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 +51 -22
- 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 +8 -11
- package/build/components/use-on-block-drop/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 +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- 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 +185 -20
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +5 -10
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +13 -11
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -1
- 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 +4 -9
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +7 -3
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +1 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +4 -3
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +5 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -9
- 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 +44 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- 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 +51 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +12 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -13
- 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 +1 -1
- package/build/store/utils.js.map +1 -1
- 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 +0 -38
- package/build/utils/object.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 +0 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.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-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/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 +249 -106
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +48 -22
- 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 +34 -97
- package/build-module/components/block-list/use-block-props/index.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 +16 -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 +5 -5
- package/build-module/components/block-patterns-list/index.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 +1 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
- package/build-module/components/block-tools/block-toolbar-popover.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/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 +3 -2
- 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 +2 -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 +1 -1
- 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 +3 -2
- 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-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 +2 -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/menu.js +14 -28
- package/build-module/components/inserter/menu.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-draggable-blocks/index.js +2 -2
- 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-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 +9 -14
- 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/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/index.js +17 -7
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +16 -23
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -2
- 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/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 +51 -23
- 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 +8 -11
- package/build-module/components/use-on-block-drop/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 +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- 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 +181 -19
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +2 -8
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +11 -9
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +1 -1
- 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 +1 -7
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +6 -2
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +5 -4
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +6 -4
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +1 -7
- 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 +43 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- 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 +49 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -12
- 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 +2 -2
- package/build-module/store/utils.js.map +1 -1
- 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 +0 -37
- package/build-module/utils/object.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 +51 -8
- package/build-style/style.css +51 -8
- 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 +0 -2
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +0 -5
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +1 -1
- 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-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +290 -119
- package/src/components/block-list/block.native.js +55 -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 +32 -128
- 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 +15 -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 +8 -5
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +1 -2
- package/src/components/block-tools/block-toolbar-popover.js +4 -10
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-variation-picker/README.md +0 -5
- 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/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- 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 +2 -1
- 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 +2 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +3 -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 +2 -1
- 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-size-control/index.js +5 -2
- package/src/components/index.native.js +2 -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/menu.js +13 -31
- package/src/components/inserter/style.scss +6 -4
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-draggable-blocks/index.js +2 -2
- 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-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/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/index.js +13 -11
- package/src/components/plain-text/index.native.js +6 -1
- 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/index.js +18 -6
- package/src/components/rich-text/native/index.native.js +16 -24
- 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 +2 -2
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- 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 +85 -34
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +7 -23
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +0 -4
- package/src/components/use-settings/README.md +0 -4
- 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 +1 -5
- package/src/hooks/anchor.js +1 -5
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +253 -21
- package/src/hooks/border.js +2 -13
- package/src/hooks/color.js +19 -14
- package/src/hooks/custom-class-name.js +1 -5
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +1 -7
- package/src/hooks/font-family.js +4 -7
- package/src/hooks/font-size.js +1 -6
- package/src/hooks/index.js +19 -3
- package/src/hooks/index.native.js +17 -4
- package/src/hooks/layout.js +5 -2
- package/src/hooks/style.js +1 -6
- 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 +1 -7
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +60 -2
- package/src/private-apis.js +2 -4
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +44 -4
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +16 -5
- package/src/store/selectors.js +5 -13
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +0 -35
- 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/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/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/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
|
@@ -6,11 +6,6 @@ The block breadcrumb trail displays the hierarchy of the current block selection
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
#### Props
|
|
@@ -4,11 +4,6 @@ The `BlockCaption` component renders block-level UI for adding and editing capti
|
|
|
4
4
|
|
|
5
5
|
`BlockCaption` is used in several native blocks, including `Video`, `Image`, `Audio`, etc.
|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
2. [Related components](#related-components)
|
|
11
|
-
|
|
12
7
|
## Development guidelines
|
|
13
8
|
|
|
14
9
|
### Usage
|
|
@@ -6,11 +6,6 @@ In the editor, this component is displayed in two different places: in the block
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
### Usage
|
|
@@ -10,7 +10,12 @@ import { dragHandle } from '@wordpress/icons';
|
|
|
10
10
|
*/
|
|
11
11
|
import BlockIcon from '../block-icon';
|
|
12
12
|
|
|
13
|
-
export default function BlockDraggableChip( {
|
|
13
|
+
export default function BlockDraggableChip( {
|
|
14
|
+
count,
|
|
15
|
+
icon,
|
|
16
|
+
isPattern,
|
|
17
|
+
fadeWhenDisabled,
|
|
18
|
+
} ) {
|
|
14
19
|
const patternLabel = isPattern && __( 'Pattern' );
|
|
15
20
|
return (
|
|
16
21
|
<div className="block-editor-block-draggable-chip-wrapper">
|
|
@@ -37,6 +42,11 @@ export default function BlockDraggableChip( { count, icon, isPattern } ) {
|
|
|
37
42
|
<FlexItem>
|
|
38
43
|
<BlockIcon icon={ dragHandle } />
|
|
39
44
|
</FlexItem>
|
|
45
|
+
{ fadeWhenDisabled && (
|
|
46
|
+
<FlexItem className="block-editor-block-draggable-chip__disabled">
|
|
47
|
+
<span className="block-editor-block-draggable-chip__disabled-icon"></span>
|
|
48
|
+
</FlexItem>
|
|
49
|
+
) }
|
|
40
50
|
</Flex>
|
|
41
51
|
</div>
|
|
42
52
|
</div>
|
|
@@ -5,6 +5,7 @@ import { store as blocksStore } from '@wordpress/blocks';
|
|
|
5
5
|
import { Draggable } from '@wordpress/components';
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { useEffect, useRef } from '@wordpress/element';
|
|
8
|
+
import { throttle } from '@wordpress/compose';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -12,6 +13,8 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
12
13
|
import BlockDraggableChip from './draggable-chip';
|
|
13
14
|
import useScrollWhenDragging from './use-scroll-when-dragging';
|
|
14
15
|
import { store as blockEditorStore } from '../../store';
|
|
16
|
+
import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
|
|
17
|
+
import { isDropTargetValid } from '../use-block-drop-zone';
|
|
15
18
|
|
|
16
19
|
const BlockDraggable = ( {
|
|
17
20
|
children,
|
|
@@ -19,16 +22,24 @@ const BlockDraggable = ( {
|
|
|
19
22
|
cloneClassname,
|
|
20
23
|
onDragStart,
|
|
21
24
|
onDragEnd,
|
|
25
|
+
fadeWhenDisabled = false,
|
|
22
26
|
} ) => {
|
|
23
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
srcRootClientId,
|
|
29
|
+
isDraggable,
|
|
30
|
+
icon,
|
|
31
|
+
visibleInserter,
|
|
32
|
+
getBlockType,
|
|
33
|
+
} = useSelect(
|
|
24
34
|
( select ) => {
|
|
25
35
|
const {
|
|
26
36
|
canMoveBlocks,
|
|
27
37
|
getBlockRootClientId,
|
|
28
38
|
getBlockName,
|
|
29
39
|
getBlockAttributes,
|
|
40
|
+
isBlockInsertionPointVisible,
|
|
30
41
|
} = select( blockEditorStore );
|
|
31
|
-
const { getBlockType, getActiveBlockVariation } =
|
|
42
|
+
const { getBlockType: _getBlockType, getActiveBlockVariation } =
|
|
32
43
|
select( blocksStore );
|
|
33
44
|
const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
|
|
34
45
|
const blockName = getBlockName( clientIds[ 0 ] );
|
|
@@ -40,15 +51,21 @@ const BlockDraggable = ( {
|
|
|
40
51
|
return {
|
|
41
52
|
srcRootClientId: rootClientId,
|
|
42
53
|
isDraggable: canMoveBlocks( clientIds, rootClientId ),
|
|
43
|
-
icon: variation?.icon ||
|
|
54
|
+
icon: variation?.icon || _getBlockType( blockName )?.icon,
|
|
55
|
+
visibleInserter: isBlockInsertionPointVisible(),
|
|
56
|
+
getBlockType: _getBlockType,
|
|
44
57
|
};
|
|
45
58
|
},
|
|
46
59
|
[ clientIds ]
|
|
47
60
|
);
|
|
61
|
+
|
|
48
62
|
const isDragging = useRef( false );
|
|
49
63
|
const [ startScrolling, scrollOnDragOver, stopScrolling ] =
|
|
50
64
|
useScrollWhenDragging();
|
|
51
65
|
|
|
66
|
+
const { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } =
|
|
67
|
+
useSelect( blockEditorStore );
|
|
68
|
+
|
|
52
69
|
const { startDraggingBlocks, stopDraggingBlocks } =
|
|
53
70
|
useDispatch( blockEditorStore );
|
|
54
71
|
|
|
@@ -61,6 +78,97 @@ const BlockDraggable = ( {
|
|
|
61
78
|
};
|
|
62
79
|
}, [] );
|
|
63
80
|
|
|
81
|
+
// Find the root of the editor iframe.
|
|
82
|
+
const blockRef = useBlockRef( clientIds[ 0 ] );
|
|
83
|
+
const editorRoot = blockRef.current?.closest( 'body' );
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Add a dragover event listener to the editor root to track the blocks being dragged over.
|
|
87
|
+
* The listener has to be inside the editor iframe otherwise the target isn't accessible.
|
|
88
|
+
*/
|
|
89
|
+
useEffect( () => {
|
|
90
|
+
if ( ! editorRoot || ! fadeWhenDisabled ) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const onDragOver = ( event ) => {
|
|
95
|
+
if ( ! event.target.closest( '[data-block]' ) ) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const draggedBlockNames = getBlockNamesByClientId( clientIds );
|
|
99
|
+
const targetClientId = event.target
|
|
100
|
+
.closest( '[data-block]' )
|
|
101
|
+
.getAttribute( 'data-block' );
|
|
102
|
+
|
|
103
|
+
const allowedBlocks = getAllowedBlocks( targetClientId );
|
|
104
|
+
const targetBlockName = getBlockNamesByClientId( [
|
|
105
|
+
targetClientId,
|
|
106
|
+
] )[ 0 ];
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Check if the target is valid to drop in.
|
|
110
|
+
* If the target's allowedBlocks is an empty array,
|
|
111
|
+
* it isn't a container block, in which case we check
|
|
112
|
+
* its parent's validity instead.
|
|
113
|
+
*/
|
|
114
|
+
let dropTargetValid;
|
|
115
|
+
if ( allowedBlocks?.length === 0 ) {
|
|
116
|
+
const targetRootClientId =
|
|
117
|
+
getBlockRootClientId( targetClientId );
|
|
118
|
+
const targetRootBlockName = getBlockNamesByClientId( [
|
|
119
|
+
targetRootClientId,
|
|
120
|
+
] )[ 0 ];
|
|
121
|
+
const rootAllowedBlocks =
|
|
122
|
+
getAllowedBlocks( targetRootClientId );
|
|
123
|
+
dropTargetValid = isDropTargetValid(
|
|
124
|
+
getBlockType,
|
|
125
|
+
rootAllowedBlocks,
|
|
126
|
+
draggedBlockNames,
|
|
127
|
+
targetRootBlockName
|
|
128
|
+
);
|
|
129
|
+
} else {
|
|
130
|
+
dropTargetValid = isDropTargetValid(
|
|
131
|
+
getBlockType,
|
|
132
|
+
allowedBlocks,
|
|
133
|
+
draggedBlockNames,
|
|
134
|
+
targetBlockName
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* Update the body class to reflect if drop target is valid.
|
|
140
|
+
* This has to be done on the document body because the draggable
|
|
141
|
+
* chip is rendered outside of the editor iframe.
|
|
142
|
+
*/
|
|
143
|
+
if ( ! dropTargetValid && ! visibleInserter ) {
|
|
144
|
+
window?.document?.body?.classList?.add(
|
|
145
|
+
'block-draggable-invalid-drag-token'
|
|
146
|
+
);
|
|
147
|
+
} else {
|
|
148
|
+
window?.document?.body?.classList?.remove(
|
|
149
|
+
'block-draggable-invalid-drag-token'
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const throttledOnDragOver = throttle( onDragOver, 200 );
|
|
155
|
+
|
|
156
|
+
editorRoot.addEventListener( 'dragover', throttledOnDragOver );
|
|
157
|
+
|
|
158
|
+
return () => {
|
|
159
|
+
editorRoot.removeEventListener( 'dragover', throttledOnDragOver );
|
|
160
|
+
};
|
|
161
|
+
}, [
|
|
162
|
+
clientIds,
|
|
163
|
+
editorRoot,
|
|
164
|
+
fadeWhenDisabled,
|
|
165
|
+
getAllowedBlocks,
|
|
166
|
+
getBlockNamesByClientId,
|
|
167
|
+
getBlockRootClientId,
|
|
168
|
+
getBlockType,
|
|
169
|
+
visibleInserter,
|
|
170
|
+
] );
|
|
171
|
+
|
|
64
172
|
if ( ! isDraggable ) {
|
|
65
173
|
return children( { draggable: false } );
|
|
66
174
|
}
|
|
@@ -102,7 +210,11 @@ const BlockDraggable = ( {
|
|
|
102
210
|
}
|
|
103
211
|
} }
|
|
104
212
|
__experimentalDragComponent={
|
|
105
|
-
<BlockDraggableChip
|
|
213
|
+
<BlockDraggableChip
|
|
214
|
+
count={ clientIds.length }
|
|
215
|
+
icon={ icon }
|
|
216
|
+
fadeWhenDisabled
|
|
217
|
+
/>
|
|
106
218
|
}
|
|
107
219
|
>
|
|
108
220
|
{ ( { onDraggableStart, onDraggableEnd } ) => {
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import Animated, {
|
|
10
10
|
runOnJS,
|
|
11
11
|
runOnUI,
|
|
12
|
-
useAnimatedRef,
|
|
13
12
|
useAnimatedStyle,
|
|
14
13
|
useSharedValue,
|
|
15
14
|
withDelay,
|
|
@@ -39,7 +38,6 @@ import RCTAztecView from '@wordpress/react-native-aztec';
|
|
|
39
38
|
import useScrollWhenDragging from './use-scroll-when-dragging';
|
|
40
39
|
import DraggableChip from './draggable-chip';
|
|
41
40
|
import { store as blockEditorStore } from '../../store';
|
|
42
|
-
import { useBlockListContext } from '../block-list/block-list-context';
|
|
43
41
|
import DroppingInsertionPoint from './dropping-insertion-point';
|
|
44
42
|
import useBlockDropZone from '../use-block-drop-zone';
|
|
45
43
|
import styles from './style.scss';
|
|
@@ -74,13 +72,10 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
|
74
72
|
const { selectBlock, startDraggingBlocks, stopDraggingBlocks } =
|
|
75
73
|
useDispatch( blockEditorStore );
|
|
76
74
|
|
|
77
|
-
const { scrollRef } = useBlockListContext();
|
|
78
|
-
const animatedScrollRef = useAnimatedRef();
|
|
79
75
|
const { left, right } = useSafeAreaInsets();
|
|
80
76
|
const { width } = useSafeAreaFrame();
|
|
81
77
|
const safeAreaOffset = left + right;
|
|
82
78
|
const contentWidth = width - safeAreaOffset;
|
|
83
|
-
animatedScrollRef( scrollRef );
|
|
84
79
|
|
|
85
80
|
const scroll = {
|
|
86
81
|
offsetY: useSharedValue( 0 ),
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
display: inline-flex;
|
|
15
15
|
height: $block-toolbar-height;
|
|
16
16
|
padding: 0 ( $grid-unit-15 + $border-width );
|
|
17
|
+
position: relative;
|
|
17
18
|
user-select: none;
|
|
18
19
|
width: max-content;
|
|
19
20
|
|
|
@@ -45,3 +46,37 @@
|
|
|
45
46
|
font-size: $default-font-size;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
49
|
+
|
|
50
|
+
// Specificity bump to override native component style.
|
|
51
|
+
.block-editor-block-draggable-chip__disabled.block-editor-block-draggable-chip__disabled {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
bottom: 0;
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
align-items: center;
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
transition: all 0.1s linear 0.1s;
|
|
63
|
+
|
|
64
|
+
.block-editor-block-draggable-chip__disabled-icon {
|
|
65
|
+
width: $grid-unit-50 * 0.5;
|
|
66
|
+
height: $grid-unit-50 * 0.5;
|
|
67
|
+
box-shadow: inset 0 0 0 1.5px $white;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
display: inline-block;
|
|
70
|
+
padding: 0;
|
|
71
|
+
background: transparent linear-gradient(-45deg, transparent 47.5%, $white 47.5%, $white 52.5%, transparent 52.5%);
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.block-draggable-invalid-drag-token {
|
|
77
|
+
.block-editor-block-draggable-chip__disabled.block-editor-block-draggable-chip__disabled {
|
|
78
|
+
background-color: $gray-700;
|
|
79
|
+
opacity: 1;
|
|
80
|
+
box-shadow: 0 4px 8px rgba($black, 0.2);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
act,
|
|
6
|
+
advanceAnimationByFrames,
|
|
6
7
|
fireEvent,
|
|
7
8
|
initializeEditor,
|
|
9
|
+
screen,
|
|
8
10
|
waitForStoreResolvers,
|
|
9
11
|
within,
|
|
10
|
-
advanceAnimationByFrames,
|
|
11
12
|
} from 'test/helpers';
|
|
12
13
|
import { fireGestureHandler } from 'react-native-gesture-handler/jest-utils';
|
|
13
14
|
import { State } from 'react-native-gesture-handler';
|
|
@@ -52,15 +53,15 @@ const DEFAULT_TOUCH_EVENTS = [
|
|
|
52
53
|
export const initializeWithBlocksLayouts = async ( blocks ) => {
|
|
53
54
|
const initialHtml = blocks.map( ( block ) => block.html ).join( '\n' );
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
const { getAllByLabelText } = screen;
|
|
56
|
+
await initializeEditor( { initialHtml } );
|
|
57
57
|
|
|
58
58
|
const waitPromises = [];
|
|
59
|
+
const blockListItems = screen.getAllByTestId( 'block-list-item-cell' );
|
|
60
|
+
// Check that rendered block list items match expected block count.
|
|
61
|
+
expect( blockListItems.length ).toBe( blocks.length );
|
|
62
|
+
|
|
59
63
|
blocks.forEach( ( block, index ) => {
|
|
60
|
-
const
|
|
61
|
-
`${ block.name } Block\\. Row ${ index + 1 }`
|
|
62
|
-
);
|
|
63
|
-
const [ element ] = getAllByLabelText( a11yLabel );
|
|
64
|
+
const element = blockListItems[ index ];
|
|
64
65
|
// "onLayout" event will populate the blocks layouts data.
|
|
65
66
|
fireEvent( element, 'layout', {
|
|
66
67
|
nativeEvent: { layout: block.layout },
|
|
@@ -34,7 +34,7 @@ const VELOCITY_MULTIPLIER = 5000;
|
|
|
34
34
|
export default function useScrollWhenDragging() {
|
|
35
35
|
const { scrollRef } = useBlockListContext();
|
|
36
36
|
const animatedScrollRef = useAnimatedRef();
|
|
37
|
-
animatedScrollRef( scrollRef );
|
|
37
|
+
animatedScrollRef( scrollRef?.scrollViewRef );
|
|
38
38
|
|
|
39
39
|
const { height: windowHeight } = useWindowDimensions();
|
|
40
40
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import {
|
|
5
|
+
import { useEffect } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { store as blockEditorStore } from '../../store';
|
|
11
|
-
import {
|
|
11
|
+
import { useBlockEditContext } from '../block-edit/context';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @typedef {'disabled'|'contentOnly'|'default'} BlockEditingMode
|
|
@@ -45,7 +45,7 @@ import { BlockListBlockContext } from '../block-list/block-list-block-context';
|
|
|
45
45
|
* @return {BlockEditingMode} The current editing mode.
|
|
46
46
|
*/
|
|
47
47
|
export function useBlockEditingMode( mode ) {
|
|
48
|
-
const { clientId = '' } =
|
|
48
|
+
const { clientId = '' } = useBlockEditContext();
|
|
49
49
|
const blockEditingMode = useSelect(
|
|
50
50
|
( select ) =>
|
|
51
51
|
select( blockEditorStore ).getBlockEditingMode( clientId ),
|
|
@@ -6,11 +6,6 @@ The rendered an [Icon](https://github.com/WordPress/gutenberg/tree/HEAD/packages
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
### Usage
|
|
@@ -4,11 +4,6 @@ The Block inspector is one of the panels that is displayed in the editor; it is
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
2. [Related components](#related-components)
|
|
11
|
-
|
|
12
7
|
## Development guidelines
|
|
13
8
|
|
|
14
9
|
### Usage
|
|
@@ -92,7 +92,9 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
92
92
|
blockType: _blockType,
|
|
93
93
|
topLevelLockedBlock:
|
|
94
94
|
__unstableGetContentLockingParent( _selectedBlockClientId ) ||
|
|
95
|
-
( getTemplateLock( _selectedBlockClientId ) === 'contentOnly'
|
|
95
|
+
( getTemplateLock( _selectedBlockClientId ) === 'contentOnly' ||
|
|
96
|
+
( _selectedBlockName === 'core/block' &&
|
|
97
|
+
window.__experimentalPatternPartialSyncing )
|
|
96
98
|
? _selectedBlockClientId
|
|
97
99
|
: undefined ),
|
|
98
100
|
};
|
|
@@ -52,7 +52,11 @@ function BlockListItemCell( { children, item: clientId, onLayout } ) {
|
|
|
52
52
|
[ clientId, rootClientId, updateBlocksLayouts, onLayout ]
|
|
53
53
|
);
|
|
54
54
|
|
|
55
|
-
return
|
|
55
|
+
return (
|
|
56
|
+
<View testID="block-list-item-cell" onLayout={ onCellLayout }>
|
|
57
|
+
{ children }
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
export default BlockListItemCell;
|