@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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.undoIgnoreBlocks = void 0;
|
|
7
|
+
// Keep track of the blocks that should not be pushing an additional
|
|
8
|
+
// undo stack when editing the entity.
|
|
9
|
+
// See the implementation of `syncDerivedUpdates` and `useBlockSync`.
|
|
10
|
+
const undoIgnoreBlocks = new WeakSet();
|
|
11
|
+
exports.undoIgnoreBlocks = undoIgnoreBlocks;
|
|
12
|
+
//# sourceMappingURL=undo-ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["undoIgnoreBlocks","WeakSet","exports"],"sources":["@wordpress/block-editor/src/store/undo-ignore.js"],"sourcesContent":["// Keep track of the blocks that should not be pushing an additional\n// undo stack when editing the entity.\n// See the implementation of `syncDerivedUpdates` and `useBlockSync`.\nexport const undoIgnoreBlocks = new WeakSet();\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAACC,OAAA,CAAAF,gBAAA,GAAAA,gBAAA"}
|
package/build/store/utils.js
CHANGED
|
@@ -21,7 +21,7 @@ function getUserPatterns(state) {
|
|
|
21
21
|
return {
|
|
22
22
|
name: `core/block/${userPattern.id}`,
|
|
23
23
|
id: userPattern.id,
|
|
24
|
-
type: _utils.
|
|
24
|
+
type: _utils.INSERTER_PATTERN_TYPES.user,
|
|
25
25
|
title: userPattern.title.raw,
|
|
26
26
|
categories: userPattern.wp_pattern_category.map(catId => categories && categories.get(catId) ? categories.get(catId).slug : catId),
|
|
27
27
|
content: userPattern.content.raw,
|
package/build/store/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","EMPTY_ARRAY","getUserPatterns","state","_state$settings$__exp","_state$settings$__exp2","userPatterns","settings","__experimentalReusableBlocks","userPatternCategories","__experimentalUserPatternCategories","categories","Map","forEach","userCategory","set","id","map","userPattern","name","type","
|
|
1
|
+
{"version":3,"names":["_utils","require","EMPTY_ARRAY","getUserPatterns","state","_state$settings$__exp","_state$settings$__exp2","userPatterns","settings","__experimentalReusableBlocks","userPatternCategories","__experimentalUserPatternCategories","categories","Map","forEach","userCategory","set","id","map","userPattern","name","type","INSERTER_PATTERN_TYPES","user","title","raw","wp_pattern_category","catId","get","slug","content","syncStatus","wp_pattern_sync_status","checkAllowList","list","item","defaultResult","Array","isArray","includes","exports","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","blockName","innerBlocks","innerBlock","push"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\n\nconst EMPTY_ARRAY = [];\n\nexport function getUserPatterns( state ) {\n\tconst userPatterns =\n\t\tstate?.settings?.__experimentalReusableBlocks ?? EMPTY_ARRAY;\n\tconst userPatternCategories =\n\t\tstate?.settings?.__experimentalUserPatternCategories ?? [];\n\tconst categories = new Map();\n\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\tcategories.set( userCategory.id, userCategory )\n\t);\n\treturn userPatterns.map( ( userPattern ) => {\n\t\treturn {\n\t\t\tname: `core/block/${ userPattern.id }`,\n\t\t\tid: userPattern.id,\n\t\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\t\ttitle: userPattern.title.raw,\n\t\t\tcategories: userPattern.wp_pattern_category.map( ( catId ) =>\n\t\t\t\tcategories && categories.get( catId )\n\t\t\t\t\t? categories.get( catId ).slug\n\t\t\t\t\t: catId\n\t\t\t),\n\t\t\tcontent: userPattern.content.raw,\n\t\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t\t};\n\t} );\n}\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,WAAW,GAAG,EAAE;AAEf,SAASC,eAAeA,CAAEC,KAAK,EAAG;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EACxC,MAAMC,YAAY,IAAAF,qBAAA,GACjBD,KAAK,EAAEI,QAAQ,EAAEC,4BAA4B,cAAAJ,qBAAA,cAAAA,qBAAA,GAAIH,WAAW;EAC7D,MAAMQ,qBAAqB,IAAAJ,sBAAA,GAC1BF,KAAK,EAAEI,QAAQ,EAAEG,mCAAmC,cAAAL,sBAAA,cAAAA,sBAAA,GAAI,EAAE;EAC3D,MAAMM,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC5BH,qBAAqB,CAACI,OAAO,CAAIC,YAAY,IAC5CH,UAAU,CAACI,G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C,WAAW,GAAG,CAAE,GAAGF,MAAM,CAAE;EACjC,OAAQE,WAAW,CAACC,MAAM,GAAG,CAAC,EAAG;IAChC,MAAMC,KAAK,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC;IAEjC,MAAMC,SAAS,GAAGf,cAAc,CAC/BU,iBAAiB,EACjBG,KAAK,CAAC1B,IAAI,IAAI0B,KAAK,CAACG,SAAS,EAC7B,IACD,CAAC;IACD,IAAK,CAAED,SAAS,EAAG;MAClB,OAAO,KAAK;IACb;IAEAF,KAAK,CAACI,WAAW,EAAEpC,OAAO,CAAIqC,UAAU,IAAM;MAC7CP,WAAW,CAACQ,IAAI,CAAED,UAAW,CAAC;IAC/B,CAAE,CAAC;EACJ;EAEA,OAAO,IAAI;AACZ,CAAC;AAACX,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This function was accidentially exposed for mobile/native usage.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated
|
|
11
|
+
*
|
|
12
|
+
* @return {string} Empty string.
|
|
13
|
+
*/
|
|
14
|
+
var _default = () => '';
|
|
15
|
+
exports.default = _default;
|
|
16
|
+
//# sourceMappingURL=get-px-from-css-unit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_default","exports","default"],"sources":["@wordpress/block-editor/src/utils/get-px-from-css-unit.js"],"sourcesContent":["/**\n * This function was accidentially exposed for mobile/native usage.\n *\n * @deprecated\n *\n * @return {string} Empty string.\n */\nexport default () => '';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAAA,QAAA,GAOeA,CAAA,KAAM,EAAE;AAAAC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/build/utils/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var _exportNames = {
|
|
|
11
11
|
Object.defineProperty(exports, "getPxFromCssUnit", {
|
|
12
12
|
enumerable: true,
|
|
13
13
|
get: function () {
|
|
14
|
-
return
|
|
14
|
+
return _getPxFromCssUnit.default;
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "transformStyles", {
|
|
@@ -33,5 +33,5 @@ Object.keys(_blockVariationTransforms).forEach(function (key) {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
-
var
|
|
36
|
+
var _getPxFromCssUnit = _interopRequireDefault(require("./get-px-from-css-unit"));
|
|
37
37
|
//# sourceMappingURL=index.js.map
|
package/build/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_transformStyles","_interopRequireDefault","require","_blockVariationTransforms","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","
|
|
1
|
+
{"version":3,"names":["_transformStyles","_interopRequireDefault","require","_blockVariationTransforms","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getPxFromCssUnit"],"sources":["@wordpress/block-editor/src/utils/index.js"],"sourcesContent":["export { default as transformStyles } from './transform-styles';\nexport * from './block-variation-transforms';\nexport { default as getPxFromCssUnit } from './get-px-from-css-unit';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,yBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,yBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,yBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAf,sBAAA,CAAAC,OAAA"}
|
package/build/utils/object.js
CHANGED
|
@@ -4,45 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getValueFromObjectPath = void 0;
|
|
7
|
-
exports.kebabCase = kebabCase;
|
|
8
7
|
exports.setImmutably = setImmutably;
|
|
9
|
-
var _changeCase = require("change-case");
|
|
10
|
-
/**
|
|
11
|
-
* External dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Converts any string to kebab case.
|
|
16
|
-
* Backwards compatible with Lodash's `_.kebabCase()`.
|
|
17
|
-
* Backwards compatible with `_wp_to_kebab_case()`.
|
|
18
|
-
*
|
|
19
|
-
* @see https://lodash.com/docs/4.17.15#kebabCase
|
|
20
|
-
* @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/
|
|
21
|
-
*
|
|
22
|
-
* @param {string} str String to convert.
|
|
23
|
-
* @return {string} Kebab-cased string
|
|
24
|
-
*/
|
|
25
|
-
function kebabCase(str) {
|
|
26
|
-
let input = str;
|
|
27
|
-
if (typeof str !== 'string') {
|
|
28
|
-
var _str$toString;
|
|
29
|
-
input = (_str$toString = str?.toString?.()) !== null && _str$toString !== void 0 ? _str$toString : '';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970
|
|
33
|
-
input = input.replace(/['\u2019]/, '');
|
|
34
|
-
return (0, _changeCase.paramCase)(input, {
|
|
35
|
-
splitRegexp: [/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g,
|
|
36
|
-
// fooBar => foo-bar, 3Bar => 3-bar
|
|
37
|
-
/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g,
|
|
38
|
-
// 3bar => 3-bar
|
|
39
|
-
/([A-Za-z])([0-9])/g,
|
|
40
|
-
// Foo3 => foo-3, foo3 => foo-3
|
|
41
|
-
/([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
8
|
/**
|
|
47
9
|
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
|
|
48
10
|
* new object. Treats nullish initial values as empty objects. Clones any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["setImmutably","object","path","value","Array","isArray","leaf","pop","prev","key","lvl","getValueFromObjectPath","defaultValue","_value","arrayPath","split","forEach","fieldName","exports"],"sources":["@wordpress/block-editor/src/utils/object.js"],"sourcesContent":["/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects. Supports arrays, too.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\t// Normalize path\n\tpath = Array.isArray( path ) ? [ ...path ] : [ path ];\n\n\t// Shallowly clone the base of the object\n\tobject = Array.isArray( object ) ? [ ...object ] : { ...object };\n\n\tconst leaf = path.pop();\n\n\t// Traverse object from root to leaf, shallowly cloning at each level\n\tlet prev = object;\n\tfor ( const key of path ) {\n\t\tconst lvl = prev[ key ];\n\t\tprev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl };\n\t}\n\n\tprev[ leaf ] = value;\n\n\treturn object;\n}\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param {Object} object Input object.\n * @param {string|Array} path Path to the object property.\n * @param {*} defaultValue Default value if the value at the specified path is nullish.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path, defaultValue ) => {\n\tconst arrayPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value = object;\n\tarrayPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAYA,CAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAG;EACnD;EACAD,IAAI,GAAGE,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAG,CAAE,GAAGA,IAAI,CAAE,GAAG,CAAEA,IAAI,CAAE;;EAErD;EACAD,MAAM,GAAGG,KAAK,CAACC,OAAO,CAAEJ,MAAO,CAAC,GAAG,CAAE,GAAGA,MAAM,CAAE,GAAG;IAAE,GAAGA;EAAO,CAAC;EAEhE,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAG,CAAC,CAAC;;EAEvB;EACA,IAAIC,IAAI,GAAGP,MAAM;EACjB,KAAM,MAAMQ,GAAG,IAAIP,IAAI,EAAG;IACzB,MAAMQ,GAAG,GAAGF,IAAI,CAAEC,GAAG,CAAE;IACvBD,IAAI,GAAGA,IAAI,CAAEC,GAAG,CAAE,GAAGL,KAAK,CAACC,OAAO,CAAEK,GAAI,CAAC,GAAG,CAAE,GAAGA,GAAG,CAAE,GAAG;MAAE,GAAGA;IAAI,CAAC;EACpE;EAEAF,IAAI,CAAEF,IAAI,CAAE,GAAGH,KAAK;EAEpB,OAAOF,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMU,sBAAsB,GAAGA,CAAEV,MAAM,EAAEC,IAAI,EAAEU,YAAY,KAAM;EAAA,IAAAC,MAAA;EACvE,MAAMC,SAAS,GAAGV,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAGA,IAAI,GAAGA,IAAI,CAACa,KAAK,CAAE,GAAI,CAAC;EAClE,IAAIZ,KAAK,GAAGF,MAAM;EAClBa,SAAS,CAACE,OAAO,CAAIC,SAAS,IAAM;IACnCd,KAAK,GAAGA,KAAK,GAAIc,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,QAAAJ,MAAA,GAAOV,KAAK,cAAAU,MAAA,cAAAA,MAAA,GAAID,YAAY;AAC7B,CAAC;AAACM,OAAA,CAAAP,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCanBlockToolbarBeFocused = useCanBlockToolbarBeFocused;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _blocks = require("@wordpress/blocks");
|
|
9
|
+
var _store = require("../store");
|
|
10
|
+
var _lockUnlock = require("../lock-unlock");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns true if the block toolbar should be able to receive focus.
|
|
21
|
+
*
|
|
22
|
+
* @return {boolean} Whether the block toolbar should be able to receive focus
|
|
23
|
+
*/
|
|
24
|
+
function useCanBlockToolbarBeFocused() {
|
|
25
|
+
return (0, _data.useSelect)(select => {
|
|
26
|
+
const {
|
|
27
|
+
__unstableGetEditorMode,
|
|
28
|
+
getBlock,
|
|
29
|
+
getSettings,
|
|
30
|
+
getSelectedBlockClientId,
|
|
31
|
+
getFirstMultiSelectedBlockClientId
|
|
32
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
33
|
+
const selectedBlockId = getFirstMultiSelectedBlockClientId() || getSelectedBlockClientId();
|
|
34
|
+
const isEmptyDefaultBlock = (0, _blocks.isUnmodifiedDefaultBlock)(getBlock(selectedBlockId) || {});
|
|
35
|
+
|
|
36
|
+
// Fixed Toolbar can be focused when:
|
|
37
|
+
// - a block is selected
|
|
38
|
+
// - fixed toolbar is on
|
|
39
|
+
// Block Toolbar Popover can be focused when:
|
|
40
|
+
// - a block is selected
|
|
41
|
+
// - we are in edit mode
|
|
42
|
+
// - it is not an empty default block
|
|
43
|
+
return !!selectedBlockId && (getSettings().hasFixedToolbar || __unstableGetEditorMode() === 'edit' && !isEmptyDefaultBlock);
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=use-can-block-toolbar-be-focused.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","_lockUnlock","useCanBlockToolbarBeFocused","useSelect","select","__unstableGetEditorMode","getBlock","getSettings","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","unlock","blockEditorStore","selectedBlockId","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","hasFixedToolbar"],"sources":["@wordpress/block-editor/src/utils/use-can-block-toolbar-be-focused.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Returns true if the block toolbar should be able to receive focus.\n *\n * @return {boolean} Whether the block toolbar should be able to receive focus\n */\nexport function useCanBlockToolbarBeFocused() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetBlock,\n\t\t\tgetSettings,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst selectedBlockId =\n\t\t\tgetFirstMultiSelectedBlockClientId() || getSelectedBlockClientId();\n\t\tconst isEmptyDefaultBlock = isUnmodifiedDefaultBlock(\n\t\t\tgetBlock( selectedBlockId ) || {}\n\t\t);\n\n\t\t// Fixed Toolbar can be focused when:\n\t\t// - a block is selected\n\t\t// - fixed toolbar is on\n\t\t// Block Toolbar Popover can be focused when:\n\t\t// - a block is selected\n\t\t// - we are in edit mode\n\t\t// - it is not an empty default block\n\t\treturn (\n\t\t\t!! selectedBlockId &&\n\t\t\t( getSettings().hasFixedToolbar ||\n\t\t\t\t( __unstableGetEditorMode() === 'edit' &&\n\t\t\t\t\t! isEmptyDefaultBlock ) )\n\t\t);\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,2BAA2BA,CAAA,EAAG;EAC7C,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MACLC,uBAAuB;MACvBC,QAAQ;MACRC,WAAW;MACXC,wBAAwB;MACxBC;IACD,CAAC,GAAG,IAAAC,kBAAM,EAAEN,MAAM,CAAEO,YAAiB,CAAE,CAAC;IAExC,MAAMC,eAAe,GACpBH,kCAAkC,CAAC,CAAC,IAAID,wBAAwB,CAAC,CAAC;IACnE,MAAMK,mBAAmB,GAAG,IAAAC,gCAAwB,EACnDR,QAAQ,CAAEM,eAAgB,CAAC,IAAI,CAAC,CACjC,CAAC;;IAED;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OACC,CAAC,CAAEA,eAAe,KAChBL,WAAW,CAAC,CAAC,CAACQ,eAAe,IAC5BV,uBAAuB,CAAC,CAAC,KAAK,MAAM,IACrC,CAAEQ,mBAAqB,CAAE;EAE7B,CAAC,EAAE,EAAG,CAAC;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMergeRefs","useRef","BlockList","BlockTools","EditorStyles","Iframe","WritingFlow","useMouseMoveTypingReset","useBlockSelectionClearer","ExperimentalBlockCanvas","shouldIframe","height","children","createElement","styles","contentRef","contentRefProp","iframeProps","resetTypingRef","clearerRef","localRef","__unstableContentRef","style","display","scope","ref","className","tabIndex","width","name","BlockCanvas"],"sources":["@wordpress/block-editor/src/components/block-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockTools from '../block-tools';\nimport EditorStyles from '../editor-styles';\nimport Iframe from '../iframe';\nimport WritingFlow from '../writing-flow';\nimport { useMouseMoveTypingReset } from '../observe-typing';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\n\nexport function ExperimentalBlockCanvas( {\n\tshouldIframe = true,\n\theight = '300px',\n\tchildren = <BlockList />,\n\tstyles,\n\tcontentRef: contentRefProp,\n\tiframeProps,\n} ) {\n\tconst resetTypingRef = useMouseMoveTypingReset();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst localRef = useRef();\n\tconst contentRef = useMergeRefs( [ contentRefProp, clearerRef, localRef ] );\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<BlockTools\n\t\t\t\t__unstableContentRef={ localRef }\n\t\t\t\tstyle={ { height, display: 'flex' } }\n\t\t\t>\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</BlockTools>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ localRef }\n\t\t\tstyle={ { height, display: 'flex' } }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\t{ ...iframeProps }\n\t\t\t\tref={ resetTypingRef }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\tstyle={ {\n\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["useMergeRefs","useRef","BlockList","BlockTools","EditorStyles","Iframe","WritingFlow","useMouseMoveTypingReset","useBlockSelectionClearer","ExperimentalBlockCanvas","shouldIframe","height","children","createElement","styles","contentRef","contentRefProp","iframeProps","resetTypingRef","clearerRef","localRef","__unstableContentRef","style","display","scope","ref","className","tabIndex","width","name","BlockCanvas"],"sources":["@wordpress/block-editor/src/components/block-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockTools from '../block-tools';\nimport EditorStyles from '../editor-styles';\nimport Iframe from '../iframe';\nimport WritingFlow from '../writing-flow';\nimport { useMouseMoveTypingReset } from '../observe-typing';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\n\nexport function ExperimentalBlockCanvas( {\n\tshouldIframe = true,\n\theight = '300px',\n\tchildren = <BlockList />,\n\tstyles,\n\tcontentRef: contentRefProp,\n\tiframeProps,\n} ) {\n\tconst resetTypingRef = useMouseMoveTypingReset();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst localRef = useRef();\n\tconst contentRef = useMergeRefs( [ contentRefProp, clearerRef, localRef ] );\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<BlockTools\n\t\t\t\t__unstableContentRef={ localRef }\n\t\t\t\tstyle={ { height, display: 'flex' } }\n\t\t\t>\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</BlockTools>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ localRef }\n\t\t\tstyle={ { height, display: 'flex' } }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\t{ ...iframeProps }\n\t\t\t\tref={ resetTypingRef }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t} }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t{ children }\n\t\t\t</Iframe>\n\t\t</BlockTools>\n\t);\n}\n\n/**\n * BlockCanvas component is a component used to display the canvas of the block editor.\n * What we call the canvas is an iframe containing the block list that you can manipulate.\n * The component is also responsible of wiring up all the necessary hooks to enable\n * the keyboard navigation across blocks in the editor and inject content styles into the iframe.\n *\n * @example\n *\n * ```jsx\n * function MyBlockEditor() {\n * const [ blocks, updateBlocks ] = useState([]);\n * return (\n * <BlockEditorProvider\n * value={ blocks }\n * onInput={ updateBlocks }\n * onChange={ persistBlocks }\n * >\n * <BlockCanvas height=\"400px\" />\n * </BlockEditorProvider>\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.height Canvas height, defaults to 300px.\n * @param {Array} props.styles Content styles to inject into the iframe.\n * @param {Element} props.children Content of the canvas, defaults to the BlockList component.\n * @return {Element} Block Breadcrumb.\n */\nfunction BlockCanvas( { children, height, styles } ) {\n\treturn (\n\t\t<ExperimentalBlockCanvas height={ height } styles={ styles }>\n\t\t\t{ children }\n\t\t</ExperimentalBlockCanvas>\n\t);\n}\n\nexport default BlockCanvas;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,wBAAwB,QAAQ,4BAA4B;AAErE,OAAO,SAASC,uBAAuBA,CAAE;EACxCC,YAAY,GAAG,IAAI;EACnBC,MAAM,GAAG,OAAO;EAChBC,QAAQ,GAAGC,aAAA,CAACX,SAAS,MAAE,CAAC;EACxBY,MAAM;EACNC,UAAU,EAAEC,cAAc;EAC1BC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGX,uBAAuB,CAAC,CAAC;EAChD,MAAMY,UAAU,GAAGX,wBAAwB,CAAC,CAAC;EAC7C,MAAMY,QAAQ,GAAGnB,MAAM,CAAC,CAAC;EACzB,MAAMc,UAAU,GAAGf,YAAY,CAAE,CAAEgB,cAAc,EAAEG,UAAU,EAAEC,QAAQ,CAAG,CAAC;EAE3E,IAAK,CAAEV,YAAY,EAAG;IACrB,OACCG,aAAA,CAACV,UAAU;MACVkB,oBAAoB,EAAGD,QAAU;MACjCE,KAAK,EAAG;QAAEX,MAAM;QAAEY,OAAO,EAAE;MAAO;IAAG,GAErCV,aAAA,CAACT,YAAY;MACZU,MAAM,EAAGA,MAAQ;MACjBU,KAAK,EAAC;IAAwB,CAC9B,CAAC,EACFX,aAAA,CAACP,WAAW;MACXmB,GAAG,EAAGV,UAAY;MAClBW,SAAS,EAAC,uBAAuB;MACjCC,QAAQ,EAAG,CAAC,CAAG;MACfL,KAAK,EAAG;QACPX,MAAM,EAAE,MAAM;QACdiB,KAAK,EAAE;MACR;IAAG,GAEDhB,QACU,CACF,CAAC;EAEf;EAEA,OACCC,aAAA,CAACV,UAAU;IACVkB,oBAAoB,EAAGD,QAAU;IACjCE,KAAK,EAAG;MAAEX,MAAM;MAAEY,OAAO,EAAE;IAAO;EAAG,GAErCV,aAAA,CAACR,MAAM;IAAA,GACDY,WAAW;IAChBQ,GAAG,EAAGP,cAAgB;IACtBH,UAAU,EAAGA,UAAY;IACzBO,KAAK,EAAG;MACP,GAAGL,WAAW,EAAEK;IACjB,CAAG;IACHO,IAAI,EAAC;EAAe,GAEpBhB,aAAA,CAACT,YAAY;IAACU,MAAM,EAAGA;EAAQ,CAAE,CAAC,EAChCF,QACK,CACG,CAAC;AAEf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASkB,WAAWA,CAAE;EAAElB,QAAQ;EAAED,MAAM;EAAEG;AAAO,CAAC,EAAG;EACpD,OACCD,aAAA,CAACJ,uBAAuB;IAACE,MAAM,EAAGA,MAAQ;IAACG,MAAM,EAAGA;EAAQ,GACzDF,QACsB,CAAC;AAE5B;AAEA,eAAekB,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","deprecated","Button","chevronLeft","chevronRight","__","isRTL","useSelect","useDispatch","BlockIcon","store","blockEditorStore","BlockCard","title","icon","description","blockType","className","since","alternative","parentNavBlockClientId","select","getSelectedBlockClientId","getBlockParentsByBlockName","_selectedBlockClientId","selectBlock","createElement","onClick","label","style","minWidth","padding","
|
|
1
|
+
{"version":3,"names":["classnames","deprecated","Button","chevronLeft","chevronRight","__","isRTL","useSelect","useDispatch","BlockIcon","store","blockEditorStore","BlockCard","title","icon","description","blockType","className","since","alternative","parentNavBlockClientId","select","getSelectedBlockClientId","getBlockParentsByBlockName","_selectedBlockClientId","selectBlock","createElement","onClick","label","style","minWidth","padding","size","showColors"],"sources":["@wordpress/block-editor/src/components/block-card/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { Button } from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockCard( { title, icon, description, blockType, className } ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentNavBlockClientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\n\t\treturn {\n\t\t\tparentNavBlockClientId: getBlockParentsByBlockName(\n\t\t\t\t_selectedBlockClientId,\n\t\t\t\t'core/navigation',\n\t\t\t\ttrue\n\t\t\t)[ 0 ],\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<div className={ classnames( 'block-editor-block-card', className ) }>\n\t\t\t{ parentNavBlockClientId && ( // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => selectBlock( parentNavBlockClientId ) }\n\t\t\t\t\tlabel={ __( 'Go to parent Navigation block' ) }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t}\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t<div className=\"block-editor-block-card__content\">\n\t\t\t\t<h2 className=\"block-editor-block-card__title\">{ title }</h2>\n\t\t\t\t{ description && (\n\t\t\t\t\t<span className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AAC5D,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,SAASA,CAAE;EAAEC,KAAK;EAAEC,IAAI;EAAEC,WAAW;EAAEC,SAAS;EAAEC;AAAU,CAAC,EAAG;EACxE,IAAKD,SAAS,EAAG;IAChBf,UAAU,CAAE,+CAA+C,EAAE;MAC5DiB,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE;IACd,CAAE,CAAC;IACH,CAAE;MAAEN,KAAK;MAAEC,IAAI;MAAEC;IAAY,C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ip({
|
|
14
14
|
count,
|
|
15
15
|
icon,
|
|
16
|
-
isPattern
|
|
16
|
+
isPattern,
|
|
17
|
+
fadeWhenDisabled
|
|
17
18
|
}) {
|
|
18
19
|
const patternLabel = isPattern && __('Pattern');
|
|
19
20
|
return createElement("div", {
|
|
@@ -29,6 +30,10 @@ export default function BlockDraggableChip({
|
|
|
29
30
|
}) : patternLabel || sprintf( /* translators: %d: Number of blocks. */
|
|
30
31
|
_n('%d block', '%d blocks', count), count)), createElement(FlexItem, null, createElement(BlockIcon, {
|
|
31
32
|
icon: dragHandle
|
|
33
|
+
})), fadeWhenDisabled && createElement(FlexItem, {
|
|
34
|
+
className: "block-editor-block-draggable-chip__disabled"
|
|
35
|
+
}, createElement("span", {
|
|
36
|
+
className: "block-editor-block-draggable-chip__disabled-icon"
|
|
32
37
|
})))));
|
|
33
38
|
}
|
|
34
39
|
//# sourceMappingURL=draggable-chip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_n","sprintf","Flex","FlexItem","dragHandle","BlockIcon","BlockDraggableChip","count","icon","isPattern","patternLabel","createElement","className","justify"],"sources":["@wordpress/block-editor/src/components/block-draggable/draggable-chip.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { Flex, FlexItem } from '@wordpress/components';\nimport { dragHandle } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\n\nexport default function BlockDraggableChip( {
|
|
1
|
+
{"version":3,"names":["__","_n","sprintf","Flex","FlexItem","dragHandle","BlockIcon","BlockDraggableChip","count","icon","isPattern","fadeWhenDisabled","patternLabel","createElement","className","justify"],"sources":["@wordpress/block-editor/src/components/block-draggable/draggable-chip.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { Flex, FlexItem } from '@wordpress/components';\nimport { dragHandle } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\n\nexport default function BlockDraggableChip( {\n\tcount,\n\ticon,\n\tisPattern,\n\tfadeWhenDisabled,\n} ) {\n\tconst patternLabel = isPattern && __( 'Pattern' );\n\treturn (\n\t\t<div className=\"block-editor-block-draggable-chip-wrapper\">\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-block-draggable-chip\"\n\t\t\t\tdata-testid=\"block-draggable-chip\"\n\t\t\t>\n\t\t\t\t<Flex\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"block-editor-block-draggable-chip__content\"\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t{ icon ? (\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tpatternLabel ||\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %d: Number of blocks. */\n\t\t\t\t\t\t\t\t_n( '%d block', '%d blocks', count ),\n\t\t\t\t\t\t\t\tcount\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<BlockIcon icon={ dragHandle } />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t{ fadeWhenDisabled && (\n\t\t\t\t\t\t<FlexItem className=\"block-editor-block-draggable-chip__disabled\">\n\t\t\t\t\t\t\t<span className=\"block-editor-block-draggable-chip__disabled-icon\"></span>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,IAAI,EAAEC,QAAQ,QAAQ,uBAAuB;AACtD,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AAErC,eAAe,SAASC,kBAAkBA,CAAE;EAC3CC,KAAK;EACLC,IAAI;EACJC,SAAS;EACTC;AACD,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGF,SAAS,IAAIV,EAAE,CAAE,SAAU,CAAC;EACjD,OACCa,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACzDD,aAAA;IACCC,SAAS,EAAC,mCAAmC;IAC7C,eAAY;EAAsB,GAElCD,aAAA,CAACV,IAAI;IACJY,OAAO,EAAC,QAAQ;IAChBD,SAAS,EAAC;EAA4C,GAEtDD,aAAA,CAACT,QAAQ,QACNK,IAAI,GACLI,aAAA,CAACP,SAAS;IAACG,IAAI,EAAGA;EAAM,CAAE,CAAC,GAE3BG,YAAY,IACZV,OAAO,EACN;EACAD,EAAE,CAAE,UAAU,EAAE,WAAW,EAAEO,KAAM,CAAC,EACpCA,KACD,CAEQ,CAAC,EACXK,aAAA,CAACT,QAAQ,QACRS,aAAA,CAACP,SAAS;IAACG,IAAI,EAAGJ;EAAY,CAAE,CACvB,CAAC,EACTM,gBAAgB,IACjBE,aAAA,CAACT,QAAQ;IAACU,SAAS,EAAC;EAA6C,GAChED,aAAA;IAAMC,SAAS,EAAC;EAAkD,CAAO,CAChE,CAEN,CACF,CACD,CAAC;AAER"}
|
|
@@ -6,6 +6,7 @@ import { store as blocksStore } from '@wordpress/blocks';
|
|
|
6
6
|
import { Draggable } from '@wordpress/components';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { useEffect, useRef } from '@wordpress/element';
|
|
9
|
+
import { throttle } from '@wordpress/compose';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -13,26 +14,32 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
13
14
|
import BlockDraggableChip from './draggable-chip';
|
|
14
15
|
import useScrollWhenDragging from './use-scroll-when-dragging';
|
|
15
16
|
import { store as blockEditorStore } from '../../store';
|
|
17
|
+
import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
|
|
18
|
+
import { isDropTargetValid } from '../use-block-drop-zone';
|
|
16
19
|
const BlockDraggable = ({
|
|
17
20
|
children,
|
|
18
21
|
clientIds,
|
|
19
22
|
cloneClassname,
|
|
20
23
|
onDragStart,
|
|
21
|
-
onDragEnd
|
|
24
|
+
onDragEnd,
|
|
25
|
+
fadeWhenDisabled = false
|
|
22
26
|
}) => {
|
|
23
27
|
const {
|
|
24
28
|
srcRootClientId,
|
|
25
29
|
isDraggable,
|
|
26
|
-
icon
|
|
30
|
+
icon,
|
|
31
|
+
visibleInserter,
|
|
32
|
+
getBlockType
|
|
27
33
|
} = useSelect(select => {
|
|
28
34
|
const {
|
|
29
35
|
canMoveBlocks,
|
|
30
36
|
getBlockRootClientId,
|
|
31
37
|
getBlockName,
|
|
32
|
-
getBlockAttributes
|
|
38
|
+
getBlockAttributes,
|
|
39
|
+
isBlockInsertionPointVisible
|
|
33
40
|
} = select(blockEditorStore);
|
|
34
41
|
const {
|
|
35
|
-
getBlockType,
|
|
42
|
+
getBlockType: _getBlockType,
|
|
36
43
|
getActiveBlockVariation
|
|
37
44
|
} = select(blocksStore);
|
|
38
45
|
const rootClientId = getBlockRootClientId(clientIds[0]);
|
|
@@ -41,11 +48,18 @@ const BlockDraggable = ({
|
|
|
41
48
|
return {
|
|
42
49
|
srcRootClientId: rootClientId,
|
|
43
50
|
isDraggable: canMoveBlocks(clientIds, rootClientId),
|
|
44
|
-
icon: variation?.icon ||
|
|
51
|
+
icon: variation?.icon || _getBlockType(blockName)?.icon,
|
|
52
|
+
visibleInserter: isBlockInsertionPointVisible(),
|
|
53
|
+
getBlockType: _getBlockType
|
|
45
54
|
};
|
|
46
55
|
}, [clientIds]);
|
|
47
56
|
const isDragging = useRef(false);
|
|
48
57
|
const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging();
|
|
58
|
+
const {
|
|
59
|
+
getAllowedBlocks,
|
|
60
|
+
getBlockNamesByClientId,
|
|
61
|
+
getBlockRootClientId
|
|
62
|
+
} = useSelect(blockEditorStore);
|
|
49
63
|
const {
|
|
50
64
|
startDraggingBlocks,
|
|
51
65
|
stopDraggingBlocks
|
|
@@ -59,6 +73,61 @@ const BlockDraggable = ({
|
|
|
59
73
|
}
|
|
60
74
|
};
|
|
61
75
|
}, []);
|
|
76
|
+
|
|
77
|
+
// Find the root of the editor iframe.
|
|
78
|
+
const blockRef = useBlockRef(clientIds[0]);
|
|
79
|
+
const editorRoot = blockRef.current?.closest('body');
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* Add a dragover event listener to the editor root to track the blocks being dragged over.
|
|
83
|
+
* The listener has to be inside the editor iframe otherwise the target isn't accessible.
|
|
84
|
+
*/
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!editorRoot || !fadeWhenDisabled) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const onDragOver = event => {
|
|
90
|
+
if (!event.target.closest('[data-block]')) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const draggedBlockNames = getBlockNamesByClientId(clientIds);
|
|
94
|
+
const targetClientId = event.target.closest('[data-block]').getAttribute('data-block');
|
|
95
|
+
const allowedBlocks = getAllowedBlocks(targetClientId);
|
|
96
|
+
const targetBlockName = getBlockNamesByClientId([targetClientId])[0];
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* Check if the target is valid to drop in.
|
|
100
|
+
* If the target's allowedBlocks is an empty array,
|
|
101
|
+
* it isn't a container block, in which case we check
|
|
102
|
+
* its parent's validity instead.
|
|
103
|
+
*/
|
|
104
|
+
let dropTargetValid;
|
|
105
|
+
if (allowedBlocks?.length === 0) {
|
|
106
|
+
const targetRootClientId = getBlockRootClientId(targetClientId);
|
|
107
|
+
const targetRootBlockName = getBlockNamesByClientId([targetRootClientId])[0];
|
|
108
|
+
const rootAllowedBlocks = getAllowedBlocks(targetRootClientId);
|
|
109
|
+
dropTargetValid = isDropTargetValid(getBlockType, rootAllowedBlocks, draggedBlockNames, targetRootBlockName);
|
|
110
|
+
} else {
|
|
111
|
+
dropTargetValid = isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
* Update the body class to reflect if drop target is valid.
|
|
116
|
+
* This has to be done on the document body because the draggable
|
|
117
|
+
* chip is rendered outside of the editor iframe.
|
|
118
|
+
*/
|
|
119
|
+
if (!dropTargetValid && !visibleInserter) {
|
|
120
|
+
window?.document?.body?.classList?.add('block-draggable-invalid-drag-token');
|
|
121
|
+
} else {
|
|
122
|
+
window?.document?.body?.classList?.remove('block-draggable-invalid-drag-token');
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const throttledOnDragOver = throttle(onDragOver, 200);
|
|
126
|
+
editorRoot.addEventListener('dragover', throttledOnDragOver);
|
|
127
|
+
return () => {
|
|
128
|
+
editorRoot.removeEventListener('dragover', throttledOnDragOver);
|
|
129
|
+
};
|
|
130
|
+
}, [clientIds, editorRoot, fadeWhenDisabled, getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId, getBlockType, visibleInserter]);
|
|
62
131
|
if (!isDraggable) {
|
|
63
132
|
return children({
|
|
64
133
|
draggable: false
|
|
@@ -96,7 +165,8 @@ const BlockDraggable = ({
|
|
|
96
165
|
},
|
|
97
166
|
__experimentalDragComponent: createElement(BlockDraggableChip, {
|
|
98
167
|
count: clientIds.length,
|
|
99
|
-
icon: icon
|
|
168
|
+
icon: icon,
|
|
169
|
+
fadeWhenDisabled: true
|
|
100
170
|
})
|
|
101
171
|
}, ({
|
|
102
172
|
onDraggableStart,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","blocksStore","Draggable","useSelect","useDispatch","useEffect","useRef","BlockDraggableChip","useScrollWhenDragging","blockEditorStore","BlockDraggable","children","clientIds","cloneClassname","onDragStart","onDragEnd","srcRootClientId","isDraggable","icon","select","canMoveBlocks","getBlockRootClientId","getBlockName","getBlockAttributes","getBlockType","getActiveBlockVariation","rootClientId","blockName","variation","isDragging","startScrolling","scrollOnDragOver","stopScrolling","startDraggingBlocks","stopDraggingBlocks","current","draggable","transferData","type","srcClientIds","createElement","__experimentalTransferDataType","event","window","requestAnimationFrame","onDragOver","__experimentalDragComponent","count","length","onDraggableStart","onDraggableEnd"],"sources":["@wordpress/block-editor/src/components/block-draggable/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Draggable } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from './draggable-chip';\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport { store as blockEditorStore } from '../../store';\n\nconst BlockDraggable = ( {\n\tchildren,\n\tclientIds,\n\tcloneClassname,\n\tonDragStart,\n\tonDragEnd,\n} ) => {\n\tconst { srcRootClientId, isDraggable, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst blockName = getBlockName( clientIds[ 0 ] );\n\t\t\tconst variation = getActiveBlockVariation(\n\t\t\t\tblockName,\n\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tsrcRootClientId: rootClientId,\n\t\t\t\tisDraggable: canMoveBlocks( clientIds, rootClientId ),\n\t\t\t\ticon: variation?.icon || getBlockType( blockName )?.icon,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst isDragging = useRef( false );\n\tconst [ startScrolling, scrollOnDragOver, stopScrolling ] =\n\t\tuseScrollWhenDragging();\n\n\tconst { startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.current ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { draggable: false } );\n\t}\n\n\tconst transferData = {\n\t\ttype: 'block',\n\t\tsrcClientIds: clientIds,\n\t\tsrcRootClientId,\n\t};\n\n\treturn (\n\t\t<Draggable\n\t\t\tcloneClassname={ cloneClassname }\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t// Defer hiding the dragged source element to the next\n\t\t\t\t// frame to enable dragging.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tstartDraggingBlocks( clientIds );\n\t\t\t\t\tisDragging.current = true;\n\n\t\t\t\t\tstartScrolling( event );\n\n\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\tonDragStart();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonDragOver={ scrollOnDragOver }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t\tisDragging.current = false;\n\n\t\t\t\tstopScrolling();\n\n\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\tonDragEnd();\n\t\t\t\t}\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip count={ clientIds.length } icon={ icon } />\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragE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C,CAAC;MACZ;IACD,CAAG;IACH+B,2BAA2B,EAC1BN,aAAA,CAACjC,kBAAkB;MAACwC,KAAK,EAAGnC,SAAS,CAACoC,MAAQ;MAAC9B,IAAI,EAAGA;IAAM,CAAE;EAC9D,GAEC,CAAE;IAAE+B,gBAAgB;IAAEC;EAAe,CAAC,KAAM;IAC7C,OAAOvC,QAAQ,CAAE;MAChByB,SAAS,EAAE,IAAI;MACftB,WAAW,EAAEmC,gBAAgB;MAC7BlC,SAAS,EAAEmC;IACZ,CAAE,CAAC;EACJ,CACU,CAAC;AAEd,CAAC;AAED,eAAexC,cAAc"}
|
|
1
|
+
{"version":3,"names":["store","blocksStore","Draggable","useSelect","useDispatch","useEffect","useRef","throttle","BlockDraggableChip","useScrollWhenDragging","blockEditorStore","__unstableUseBlockRef","useBlockRef","isDropTargetValid","BlockDraggable","children","clientIds","cloneClassname","onDragStart","onDragEnd","fadeWhenDisabled","srcRootClientId","isDraggable","icon","visibleInserter","getBlockType","select","canMoveBlocks","getBlockRootClientId","getBlockName","getBlockAttributes","isBlockInsertionPointVisible","_getBlockType","getActiveBlockVariation","rootClientId","blockName","variation","isDragging","startScrolling","scrollOnDragOver","stopScrolling","getAllowedBlocks","getBlockNamesByClientId","startDraggingBlocks","stopDraggingBlocks","current","blockRef","editorRoot","closest","onDragOver","event","target","draggedBlockNames","targetClientId","getAttribute","allowedBlocks","targetBlockName","dropTargetValid","length","targetRootClientId","targetRootBlockName","rootAllowedBlocks","window","document","body","classList","add","remove","throttledOnDragOver","addEventListener","removeEventListener","draggable","transferData","type","srcClientIds","createElement","__experimentalTransferDataType","requestAnimationFrame","__experimentalDragComponent","count","onDraggableStart","onDraggableEnd"],"sources":["@wordpress/block-editor/src/components/block-draggable/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Draggable } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { throttle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from './draggable-chip';\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';\nimport { isDropTargetValid } from '../use-block-drop-zone';\n\nconst BlockDraggable = ( {\n\tchildren,\n\tclientIds,\n\tcloneClassname,\n\tonDragStart,\n\tonDragEnd,\n\tfadeWhenDisabled = false,\n} ) => {\n\tconst {\n\t\tsrcRootClientId,\n\t\tisDraggable,\n\t\ticon,\n\t\tvisibleInserter,\n\t\tgetBlockType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType: _getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst blockName = getBlockName( clientIds[ 0 ] );\n\t\t\tconst variation = getActiveBlockVariation(\n\t\t\t\tblockName,\n\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tsrcRootClientId: rootClientId,\n\t\t\t\tisDraggable: canMoveBlocks( clientIds, rootClientId ),\n\t\t\t\ticon: variation?.icon || _getBlockType( blockName )?.icon,\n\t\t\t\tvisibleInserter: isBlockInsertionPointVisible(),\n\t\t\t\tgetBlockType: _getBlockType,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst isDragging = useRef( false );\n\tconst [ startScrolling, scrollOnDragOver, stopScrolling ] =\n\t\tuseScrollWhenDragging();\n\n\tconst { getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.current ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\t// Find the root of the editor iframe.\n\tconst blockRef = useBlockRef( clientIds[ 0 ] );\n\tconst editorRoot = blockRef.current?.closest( 'body' );\n\n\t/*\n\t * Add a dragover event listener to the editor root to track the blocks being dragged over.\n\t * The listener has to be inside the editor iframe otherwise the target isn't accessible.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! editorRoot || ! fadeWhenDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst onDragOver = ( event ) => {\n\t\t\tif ( ! event.target.closest( '[data-block]' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst draggedBlockNames = getBlockNamesByClientId( clientIds );\n\t\t\tconst targetClientId = event.target\n\t\t\t\t.closest( '[data-block]' )\n\t\t\t\t.getAttribute( 'data-block' );\n\n\t\t\tconst allowedBlocks = getAllowedBlocks( targetClientId );\n\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\ttargetClientId,\n\t\t\t] )[ 0 ];\n\n\t\t\t/*\n\t\t\t * Check if the target is valid to drop in.\n\t\t\t * If the target's allowedBlocks is an empty array,\n\t\t\t * it isn't a container block, in which case we check\n\t\t\t * its parent's validity instead.\n\t\t\t */\n\t\t\tlet dropTargetValid;\n\t\t\tif ( allowedBlocks?.length === 0 ) {\n\t\t\t\tconst targetRootClientId =\n\t\t\t\t\tgetBlockRootClientId( targetClientId );\n\t\t\t\tconst targetRootBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\t\t\t\tconst rootAllowedBlocks =\n\t\t\t\t\tgetAllowedBlocks( targetRootClientId );\n\t\t\t\tdropTargetValid = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\trootAllowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetRootBlockName\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdropTargetValid = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Update the body class to reflect if drop target is valid.\n\t\t\t * This has to be done on the document body because the draggable\n\t\t\t * chip is rendered outside of the editor iframe.\n\t\t\t */\n\t\t\tif ( ! dropTargetValid && ! visibleInserter ) {\n\t\t\t\twindow?.document?.body?.classList?.add(\n\t\t\t\t\t'block-draggable-invalid-drag-token'\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\twindow?.document?.body?.classList?.remove(\n\t\t\t\t\t'block-draggable-invalid-drag-token'\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst throttledOnDragOver = throttle( onDragOver, 200 );\n\n\t\teditorRoot.addEventListener( 'dragover', throttledOnDragOver );\n\n\t\treturn () => {\n\t\t\teditorRoot.removeEventListener( 'dragover', throttledOnDragOver );\n\t\t};\n\t}, [\n\t\tclientIds,\n\t\teditorRoot,\n\t\tfadeWhenDisabled,\n\t\tgetAllowedBlocks,\n\t\tgetBlockNamesByClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockType,\n\t\tvisibleInserter,\n\t] );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { draggable: false } );\n\t}\n\n\tconst transferData = {\n\t\ttype: 'block',\n\t\tsrcClientIds: clientIds,\n\t\tsrcRootClientId,\n\t};\n\n\treturn (\n\t\t<Draggable\n\t\t\tcloneClassname={ cloneClassname }\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t// Defer hiding the dragged source element to the next\n\t\t\t\t// frame to enable dragging.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tstartDraggingBlocks( clientIds );\n\t\t\t\t\tisDragging.current = true;\n\n\t\t\t\t\tstartScrolling( event );\n\n\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\tonDragStart();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonDragOver={ scrollOnDragOver }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t\tisDragging.current = false;\n\n\t\t\t\tstopScrolling();\n\n\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\tonDragEnd();\n\t\t\t\t}\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ clientIds.length }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tfadeWhenDisabled\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default BlockDraggable;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,kBAAkB;AACjD,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAAST,KAAK,IAAIU,gBAAgB,QAAQ,aAAa;AACvD,SAASC,qBAAqB,IAAIC,WAAW,QA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C,WAAW;IAC1CJ,YAAY,EAAGA,YAAc;IAC7BtD,WAAW,EAAKgC,KAAK,IAAM;MAC1B;MACA;MACAY,MAAM,CAACe,qBAAqB,CAAE,MAAM;QACnClC,mBAAmB,CAAE3B,SAAU,CAAC;QAChCqB,UAAU,CAACQ,OAAO,GAAG,IAAI;QAEzBP,cAAc,CAAEY,KAAM,CAAC;QAEvB,IAAKhC,WAAW,EAAG;UAClBA,WAAW,CAAC,CAAC;QACd;MACD,CAAE,CAAC;IACJ,CAAG;IACH+B,UAAU,EAAGV,gBAAkB;IAC/BpB,SAAS,EAAGA,CAAA,KAAM;MACjByB,kBAAkB,CAAC,CAAC;MACpBP,UAAU,CAACQ,OAAO,GAAG,KAAK;MAE1BL,aAAa,CAAC,CAAC;MAEf,IAAKrB,SAAS,EAAG;QAChBA,SAAS,CAAC,CAAC;MACZ;IACD,CAAG;IACH2D,2BAA2B,EAC1BH,aAAA,CAACnE,kBAAkB;MAClBuE,KAAK,EAAG/D,SAAS,CAAC0C,MAAQ;MAC1BnC,IAAI,EAAGA,IAAM;MACbH,gBAAgB;IAAA,CAChB;EACD,GAEC,CAAE;IAAE4D,gBAAgB;IAAEC;EAAe,CAAC,KAAM;IAC7C,OAAOlE,QAAQ,CAAE;MAChBwD,SAAS,EAAE,IAAI;MACfrD,WAAW,EAAE8D,gBAAgB;MAC7B7D,SAAS,EAAE8D;IACZ,CAAE,CAAC;EACJ,CACU,CAAC;AAEd,CAAC;AAED,eAAenE,cAAc"}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { AccessibilityInfo } from 'react-native';
|
|
6
6
|
import { useSafeAreaInsets, useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
7
|
-
import Animated, { runOnJS, runOnUI,
|
|
7
|
+
import Animated, { runOnJS, runOnUI, useAnimatedStyle, useSharedValue, withDelay, withTiming, ZoomInEasyDown } from 'react-native-reanimated';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* WordPress dependencies
|
|
@@ -22,7 +22,6 @@ import RCTAztecView from '@wordpress/react-native-aztec';
|
|
|
22
22
|
import useScrollWhenDragging from './use-scroll-when-dragging';
|
|
23
23
|
import DraggableChip from './draggable-chip';
|
|
24
24
|
import { store as blockEditorStore } from '../../store';
|
|
25
|
-
import { useBlockListContext } from '../block-list/block-list-context';
|
|
26
25
|
import DroppingInsertionPoint from './dropping-insertion-point';
|
|
27
26
|
import useBlockDropZone from '../use-block-drop-zone';
|
|
28
27
|
import styles from './style.scss';
|
|
@@ -61,10 +60,6 @@ const BlockDraggableWrapper = ({
|
|
|
61
60
|
startDraggingBlocks,
|
|
62
61
|
stopDraggingBlocks
|
|
63
62
|
} = useDispatch(blockEditorStore);
|
|
64
|
-
const {
|
|
65
|
-
scrollRef
|
|
66
|
-
} = useBlockListContext();
|
|
67
|
-
const animatedScrollRef = useAnimatedRef();
|
|
68
63
|
const {
|
|
69
64
|
left,
|
|
70
65
|
right
|
|
@@ -74,7 +69,6 @@ const BlockDraggableWrapper = ({
|
|
|
74
69
|
} = useSafeAreaFrame();
|
|
75
70
|
const safeAreaOffset = left + right;
|
|
76
71
|
const contentWidth = width - safeAreaOffset;
|
|
77
|
-
animatedScrollRef(scrollRef);
|
|
78
72
|
const scroll = {
|
|
79
73
|
offsetY: useSharedValue(0)
|
|
80
74
|
};
|