@wordpress/block-editor 9.7.1-next.d6164808d3.0 → 10.0.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 +8 -0
- package/README.md +13 -1
- package/build/components/alignment-control/ui.js +6 -5
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-actions/index.js +5 -9
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +5 -5
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-content-overlay/index.js +2 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +2 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-inspector/index.js +125 -17
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-compact.native.js +73 -0
- package/build/components/block-list/block-list-compact.native.js.map +1 -0
- package/build/components/block-list/block.js +40 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +4 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +14 -11
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +3 -2
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -10
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +1 -2
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -12
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +20 -21
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +1 -7
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +3 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +20 -10
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -6
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +4 -6
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +24 -8
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +58 -16
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +14 -9
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +4 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +3 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +3 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +7 -1
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +114 -25
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -8
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +3 -2
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +13 -5
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +33 -15
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -9
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +19 -10
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +131 -0
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +71 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
- package/build/components/block-vertical-alignment-control/ui.js +5 -2
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -0
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +1 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/iframe/index.js +31 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +1 -7
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +6 -2
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -5
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +14 -3
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +21 -8
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/tabs.js +11 -4
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +6 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +36 -5
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/block.js +23 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +19 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +8 -4
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +0 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -7
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +1 -1
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/rich-text/index.js +37 -19
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +11 -20
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +6 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +32 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/text-decoration-control/index.js +28 -17
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +21 -14
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +6 -11
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-popover/index.js +1 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +7 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +9 -28
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -0
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +7 -16
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/hooks/align.js +17 -3
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +3 -7
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/color-panel.js +2 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/content-lock-ui.js +145 -0
- package/build/hooks/content-lock-ui.js.map +1 -0
- package/build/hooks/dimensions.js +6 -6
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +8 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +2 -1
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +3 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +23 -6
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +14 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +14 -10
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/letter-spacing.js +2 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +2 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +3 -7
- package/build/hooks/lock.js.map +1 -1
- package/build/hooks/metadata-name.js +55 -0
- package/build/hooks/metadata-name.js.map +1 -0
- package/build/hooks/metadata.js +65 -0
- package/build/hooks/metadata.js.map +1 -0
- package/build/hooks/text-decoration.js +2 -1
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +2 -1
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/use-typography-props.js +51 -0
- package/build/hooks/use-typography-props.js.map +1 -0
- package/build/hooks/utils.js +3 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +71 -22
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flow.js +30 -2
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +65 -21
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +39 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +95 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +6 -5
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-actions/index.js +5 -8
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +5 -5
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +2 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-inspector/index.js +127 -19
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-compact.native.js +58 -0
- package/build-module/components/block-list/block-list-compact.native.js.map +1 -0
- package/build-module/components/block-list/block.js +41 -9
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +4 -4
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +13 -11
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +3 -2
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -9
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +1 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +7 -12
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +20 -20
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +1 -6
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +3 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +20 -9
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -5
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +24 -7
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +59 -17
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +12 -9
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +4 -2
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +3 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +3 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +6 -1
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +115 -27
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +9 -8
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +3 -2
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +12 -5
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +30 -15
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -9
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +17 -10
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +119 -0
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +59 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
- package/build-module/components/block-vertical-alignment-control/ui.js +5 -2
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -0
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/iframe/index.js +32 -5
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +1 -6
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -2
- 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 -5
- 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 +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +14 -3
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +20 -8
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/tabs.js +11 -4
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +6 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +37 -6
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/block.js +23 -11
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +19 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +8 -4
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +0 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -6
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +1 -1
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +37 -18
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -2
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +30 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +25 -18
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +19 -15
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +6 -11
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -1
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +7 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +9 -28
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -0
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +7 -15
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/hooks/align.js +16 -4
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +3 -6
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/color-panel.js +2 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +128 -0
- package/build-module/hooks/content-lock-ui.js.map +1 -0
- package/build-module/hooks/dimensions.js +6 -6
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +6 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +2 -1
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +3 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +22 -6
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +4 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +15 -11
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +2 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +2 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +3 -6
- package/build-module/hooks/lock.js.map +1 -1
- package/build-module/hooks/metadata-name.js +45 -0
- package/build-module/hooks/metadata-name.js.map +1 -0
- package/build-module/hooks/metadata.js +50 -0
- package/build-module/hooks/metadata.js.map +1 -0
- package/build-module/hooks/text-decoration.js +2 -1
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +2 -1
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +38 -0
- package/build-module/hooks/use-typography-props.js.map +1 -0
- package/build-module/hooks/utils.js +4 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +74 -25
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flow.js +31 -3
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +58 -20
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +37 -18
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +80 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +137 -86
- package/build-style/style.css +137 -86
- package/package.json +28 -28
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +137 -108
- package/src/components/alignment-control/test/index.js +124 -33
- package/src/components/alignment-control/ui.js +8 -3
- package/src/components/block-actions/index.js +9 -8
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +108 -65
- package/src/components/block-alignment-control/test/index.js +95 -31
- package/src/components/block-alignment-control/ui.js +2 -2
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +28 -26
- package/src/components/block-compare/test/block-view.js +3 -3
- package/src/components/block-content-overlay/index.js +2 -6
- package/src/components/block-content-overlay/style.scss +24 -3
- package/src/components/block-draggable/draggable-chip.js +4 -1
- package/src/components/block-edit/edit.js +5 -1
- package/src/components/block-edit/test/edit.js +23 -21
- package/src/components/block-icon/test/__snapshots__/index.js.snap +22 -0
- package/src/components/block-icon/test/index.js +31 -16
- package/src/components/block-inspector/index.js +126 -12
- package/src/components/block-inspector/style.scss +7 -1
- package/src/components/block-list/block-list-compact.native.js +62 -0
- package/src/components/block-list/block.js +53 -13
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/style.scss +68 -18
- package/src/components/block-list/test/block-list-context.native.js +11 -13
- package/src/components/block-list/use-block-props/index.js +10 -10
- package/src/components/block-list/use-block-props/use-block-class-names.js +4 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +4 -9
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -2
- package/src/components/block-list/use-in-between-inserter.js +11 -13
- package/src/components/block-list-appender/index.js +27 -18
- package/src/components/block-list-appender/index.native.js +3 -6
- package/src/components/block-lock/use-block-lock.js +2 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +15 -9
- package/src/components/block-mover/button.js +6 -5
- package/src/components/block-mover/index.js +8 -7
- package/src/components/block-mover/index.native.js +20 -13
- package/src/components/block-popover/inbetween.js +85 -21
- package/src/components/block-popover/index.js +25 -17
- package/src/components/block-popover/style.scss +3 -4
- package/src/components/block-preview/auto.js +4 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu-controls/README.md +9 -0
- package/src/components/block-settings-menu-controls/index.js +13 -2
- package/src/components/block-styles/preview-panel.js +3 -0
- package/src/components/block-switcher/block-transformations-menu.js +127 -33
- package/src/components/block-switcher/style.scss +4 -2
- package/src/components/block-switcher/test/index.js +1 -2
- package/src/components/block-title/test/index.js +28 -25
- package/src/components/block-toolbar/index.js +27 -17
- package/src/components/block-tools/block-contextual-toolbar.js +10 -3
- package/src/components/block-tools/block-selection-button.js +35 -16
- package/src/components/block-tools/index.js +40 -24
- package/src/components/block-tools/insertion-point.js +3 -7
- package/src/components/block-tools/selected-block-popover.js +16 -7
- package/src/components/block-tools/style.scss +5 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +136 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +57 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +91 -51
- package/src/components/block-vertical-alignment-control/test/index.js +92 -23
- package/src/components/block-vertical-alignment-control/ui.js +3 -2
- package/src/components/button-block-appender/style.scss +23 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -12
- package/src/components/colors/test/with-colors.js +37 -12
- package/src/components/colors-gradients/control.js +1 -0
- package/src/components/colors-gradients/dropdown.js +1 -1
- package/src/components/contrast-checker/test/index.js +135 -116
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +39 -57
- package/src/components/default-block-appender/test/index.js +32 -18
- package/src/components/font-sizes/README.MD +9 -0
- package/src/components/iframe/index.js +64 -5
- package/src/components/inner-blocks/README.md +2 -1
- package/src/components/inner-blocks/default-block-appender.js +1 -6
- package/src/components/inner-blocks/index.js +3 -2
- package/src/components/inner-blocks/index.native.js +5 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +9 -5
- package/src/components/inner-blocks/use-nested-settings-update.js +3 -1
- package/src/components/inserter/index.js +2 -8
- package/src/components/inserter/library.js +11 -5
- package/src/components/inserter/menu.js +42 -29
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/stories/fixtures.js +44 -0
- package/src/components/inserter/stories/index.js +90 -0
- package/src/components/inserter/style.scss +21 -27
- package/src/components/inserter/tabs.js +8 -4
- package/src/components/link-control/link-preview.js +5 -3
- package/src/components/link-control/search-input.js +2 -2
- package/src/components/link-control/search-item.js +39 -7
- package/src/components/list-view/block.js +29 -10
- package/src/components/list-view/branch.js +27 -4
- package/src/components/list-view/index.js +8 -3
- package/src/components/list-view/use-block-selection.js +0 -1
- package/src/components/media-placeholder/test/index.js +2 -2
- package/src/components/media-replace-flow/README.md +1 -1
- package/src/components/provider/use-block-sync.js +3 -6
- package/src/components/publish-date-time-picker/index.js +1 -1
- package/src/components/rich-text/index.js +33 -35
- package/src/components/rich-text/index.native.js +8 -21
- package/src/components/spacing-sizes-control/spacing-input-control.js +5 -0
- package/src/components/spacing-sizes-control/test/utils.js +26 -0
- package/src/components/spacing-sizes-control/utils.js +36 -9
- package/src/components/text-decoration-control/index.js +41 -30
- package/src/components/text-decoration-control/stories/index.js +37 -0
- package/src/components/text-transform-control/index.js +27 -27
- package/src/components/text-transform-control/stories/index.js +37 -0
- package/src/components/tool-selector/index.js +9 -11
- package/src/components/url-input/test/button.js +145 -71
- package/src/components/url-popover/index.js +1 -1
- package/src/components/url-popover/test/__snapshots__/index.js.snap +108 -80
- package/src/components/url-popover/test/index.js +14 -12
- package/src/components/use-block-drop-zone/index.js +15 -4
- package/src/components/use-moving-animation/index.js +9 -24
- package/src/components/warning/test/__snapshots__/index.js.snap +11 -14
- package/src/components/warning/test/index.js +32 -29
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-select-all.js +13 -18
- package/src/hooks/align.js +24 -15
- package/src/hooks/anchor.js +1 -6
- package/src/hooks/color-panel.js +2 -1
- package/src/hooks/content-lock-ui.js +161 -0
- package/src/hooks/dimensions.js +7 -8
- package/src/hooks/duotone.js +13 -1
- package/src/hooks/font-appearance.js +1 -0
- package/src/hooks/font-family.js +2 -0
- package/src/hooks/font-size.js +2 -0
- package/src/hooks/gap.js +43 -25
- package/src/hooks/index.js +4 -0
- package/src/hooks/layout.js +27 -21
- package/src/hooks/layout.scss +7 -1
- package/src/hooks/letter-spacing.js +1 -0
- package/src/hooks/line-height.js +1 -0
- package/src/hooks/lock.js +1 -6
- package/src/hooks/metadata-name.js +48 -0
- package/src/hooks/metadata.js +64 -0
- package/src/hooks/test/gap.js +16 -22
- package/src/hooks/test/use-typography-props.js +28 -0
- package/src/hooks/text-decoration.js +1 -0
- package/src/hooks/text-transform.js +1 -0
- package/src/hooks/typography.scss +0 -6
- package/src/hooks/use-typography-props.js +41 -0
- package/src/hooks/utils.js +2 -11
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +85 -33
- package/src/layouts/flow.js +21 -10
- package/src/store/actions.js +45 -4
- package/src/store/reducer.js +33 -21
- package/src/store/selectors.js +98 -19
- package/src/store/test/reducer.js +8 -5
- package/src/style.scss +0 -2
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/components/colors/test/__snapshots__/with-colors.js.snap +0 -23
- package/src/components/text-decoration-control/style.scss +0 -18
- package/src/components/text-transform-control/style.scss +0 -18
|
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
15
|
|
|
18
16
|
var _icons = require("@wordpress/icons");
|
|
@@ -61,13 +59,13 @@ function BlockMover(_ref) {
|
|
|
61
59
|
getBlockOrder,
|
|
62
60
|
getBlockRootClientId
|
|
63
61
|
} = select(_store.store);
|
|
64
|
-
const normalizedClientIds =
|
|
65
|
-
const firstClientId =
|
|
62
|
+
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
|
|
63
|
+
const firstClientId = normalizedClientIds[0];
|
|
66
64
|
|
|
67
|
-
const _rootClientId = getBlockRootClientId(
|
|
65
|
+
const _rootClientId = getBlockRootClientId(firstClientId);
|
|
68
66
|
|
|
69
67
|
const firstIndex = getBlockIndex(firstClientId);
|
|
70
|
-
const lastIndex = getBlockIndex(
|
|
68
|
+
const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
|
|
71
69
|
const blockOrder = getBlockOrder(_rootClientId);
|
|
72
70
|
return {
|
|
73
71
|
canMove: canMoveBlocks(clientIds, _rootClientId),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"names":["BlockMover","clientIds","hideDragHandle","canMove","rootClientId","isFirst","isLast","orientation","select","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","blockEditorStore","normalizedClientIds","firstClientId","_rootClientId","firstIndex","lastIndex","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"names":["BlockMover","clientIds","hideDragHandle","canMove","rootClientId","isFirst","isLast","orientation","select","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","blockEditorStore","normalizedClientIds","Array","isArray","firstClientId","_rootClientId","firstIndex","lastIndex","length","blockOrder","dragHandleLabel","draggableProps","dragHandle","itemProps"],"mappings":";;;;;;;;;;;;;AAGA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAKA,SAASA,UAAT,OAAqD;AAAA,MAAhC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAgC;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CAAxB;AAEA,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAG,yBAAY,0BAAZ,EAAwC;AACnD,uBAAiBjB,WAAW,KAAK;AADkB,KAAxC;AADb,KAKG,CAAEL,cAAF,IACD,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGD;AAA5B,KACKwB,cAAF,IACD,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGC,iBADR;AAEC,IAAA,SAAS,EAAC,uCAFX;AAGC,mBAAY,MAHb;AAIC,IAAA,KAAK,EAAGF,eAJT,CAKC;AACA;AAND;AAOC,IAAA,QAAQ,EAAC;AAPV,KAQMC,cARN,EAFF,CANF,EAqBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD,QACKE,SAAF,IACD,4BAAC,0BAAD;AACC,IAAA,SAAS,EAAG1B;AADb,KAEM0B,SAFN,EAFF,CADD,EASC,4BAAC,uBAAD,QACKA,SAAF,IACD,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAG1B;AADb,KAEM0B,SAFN,EAFF,CATD,CArBD,CADD;AA0CA;AAED;AACA;AACA;;;eACe3B,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n\nimport { dragHandle } from '@wordpress/icons';\nimport { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggable from '../block-draggable';\nimport { BlockMoverUpButton, BlockMoverDownButton } from './button';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockMover( { clientIds, hideDragHandle } ) {\n\tconst { canMove, rootClientId, isFirst, isLast, orientation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t\t? clientIds\n\t\t\t\t: [ clientIds ];\n\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\tconst _rootClientId = getBlockRootClientId( firstClientId );\n\t\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\t\tconst lastIndex = getBlockIndex(\n\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t);\n\t\t\tconst blockOrder = getBlockOrder( _rootClientId );\n\n\t\t\treturn {\n\t\t\t\tcanMove: canMoveBlocks( clientIds, _rootClientId ),\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisFirst: firstIndex === 0,\n\t\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\t\torientation: getBlockListSettings( _rootClientId )?.orientation,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\tconst dragHandleLabel = __( 'Drag' );\n\n\treturn (\n\t\t<ToolbarGroup\n\t\t\tclassName={ classnames( 'block-editor-block-mover', {\n\t\t\t\t'is-horizontal': orientation === 'horizontal',\n\t\t\t} ) }\n\t\t>\n\t\t\t{ ! hideDragHandle && (\n\t\t\t\t<BlockDraggable clientIds={ clientIds }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-mover__drag-handle\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ dragHandleLabel }\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t<div className=\"block-editor-block-mover__move-button-container\">\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t\t<ToolbarItem>\n\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarItem>\n\t\t\t</div>\n\t\t</ToolbarGroup>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md\n */\nexport default BlockMover;\n"]}
|
|
@@ -7,8 +7,6 @@ exports.default = exports.BlockMover = exports.BLOCK_MOVER_DIRECTION_TOP = expor
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
10
|
var _reactNative = require("react-native");
|
|
13
11
|
|
|
14
12
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -161,12 +159,12 @@ var _default = (0, _compose.compose)((0, _data.withSelect)((select, _ref2) => {
|
|
|
161
159
|
getBlockRootClientId,
|
|
162
160
|
getBlockOrder
|
|
163
161
|
} = select(_store.store);
|
|
164
|
-
const normalizedClientIds =
|
|
165
|
-
const firstClientId =
|
|
162
|
+
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
|
|
163
|
+
const firstClientId = normalizedClientIds[0];
|
|
166
164
|
const rootClientId = getBlockRootClientId(firstClientId);
|
|
167
165
|
const blockOrder = getBlockOrder(rootClientId);
|
|
168
166
|
const firstIndex = getBlockIndex(firstClientId);
|
|
169
|
-
const lastIndex = getBlockIndex(
|
|
167
|
+
const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
|
|
170
168
|
return {
|
|
171
169
|
firstIndex,
|
|
172
170
|
numberOfBlocks: blockOrder.length - 1,
|
|
@@ -186,9 +184,27 @@ var _default = (0, _compose.compose)((0, _data.withSelect)((select, _ref2) => {
|
|
|
186
184
|
moveBlocksToPosition
|
|
187
185
|
} = dispatch(_store.store);
|
|
188
186
|
return {
|
|
189
|
-
onMoveDown: (
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
onMoveDown: function () {
|
|
188
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
189
|
+
args[_key] = arguments[_key];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return moveBlocksDown(clientIds, rootClientId, ...args);
|
|
193
|
+
},
|
|
194
|
+
onMoveUp: function () {
|
|
195
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
196
|
+
args[_key2] = arguments[_key2];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return moveBlocksUp(clientIds, rootClientId, ...args);
|
|
200
|
+
},
|
|
201
|
+
onLongMove: targetIndex => function () {
|
|
202
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
203
|
+
args[_key3] = arguments[_key3];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return moveBlocksToPosition(clientIds, rootClientId, targetIndex, ...args);
|
|
207
|
+
}
|
|
192
208
|
};
|
|
193
209
|
}), _compose.withInstanceId)(BlockMover);
|
|
194
210
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.native.js"],"names":["BLOCK_MOVER_DIRECTION_TOP","BLOCK_MOVER_DIRECTION_BOTTOM","BlockMover","isFirst","isLast","canMove","onMoveDown","onMoveUp","onLongMove","firstIndex","numberOfBlocks","rootClientId","isStackedHorizontally","pickerRef","shouldPresentPicker","setShouldPresentPicker","blockPageMoverState","setBlockPageMoverState","undefined","showBlockPageMover","direction","current","presentPicker","description","backwardButtonHint","forwardButtonHint","firstBlockTitle","lastBlockTitle","icon","backward","backwardButtonIcon","forward","forwardButtonIcon","title","backwardButtonTitle","forwardButtonTitle","blockPageMoverOptions","label","value","onSelect","filter","el","onPickerSelect","option","find","onLongPressMoveUp","onLongPressMoveDown","hint","Platform","OS","select","clientIds","getBlockIndex","canMoveBlocks","getBlockRootClientId","getBlockOrder","blockEditorStore","normalizedClientIds","firstClientId","blockOrder","lastIndex","length","dispatch","moveBlocksDown","moveBlocksUp","moveBlocksToPosition","targetIndex","withInstanceId"],"mappings":";;;;;;;AAaA;;AAVA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,yBAAyB,GAAG,iCAAlC;;AACA,MAAMC,4BAA4B,GACxC,oCADM;;;AAGA,MAAMC,UAAU,GAAG,QAWnB;AAAA,MAXqB;AAC3BC,IAAAA,OAD2B;AAE3BC,IAAAA,MAF2B;AAG3BC,IAAAA,OAH2B;AAI3BC,IAAAA,UAJ2B;AAK3BC,IAAAA,QAL2B;AAM3BC,IAAAA,UAN2B;AAO3BC,IAAAA,UAP2B;AAQ3BC,IAAAA,cAR2B;AAS3BC,IAAAA,YAT2B;AAU3BC,IAAAA;AAV2B,GAWrB;AACN,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAM,CAAEC,mBAAF,EAAuBC,sBAAvB,IAAkD,uBAAU,KAAV,CAAxD;AACA,QAAM,CAAEC,mBAAF,EAAuBC,sBAAvB,IACL,uBAAUC,SAAV,CADD;;AAEA,QAAMC,kBAAkB,GAAKC,SAAF,IAAiB,MAAM;AACjD,QAAK,CAAEP,SAAS,CAACQ,OAAjB,EAA2B;AAC1BJ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CAAEN,YAAF,CADT;AAEA,SAAO;AACNlD,IAAAA,UAAU,EAAE,qBAASyD,cAAT,EAAyBZ,SAAzB,EAAoCxC,YAApC,CADN;AAENJ,IAAAA,QAAQ,EAAE,qBAASyD,YAAT,EAAuBb,SAAvB,EAAkCxC,YAAlC,CAFJ;AAGNH,IAAAA,UAAU,EAAI0D,WAAF,IACX,qBACCD,oBADD,EAECd,SAFD,EAGCxC,YAHD,EAICuD,WAJD;AAJK,GAAP;AAWA,CAdD,CAxBc,EAuCdC,uBAvCc,EAwCZjE,UAxCY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last, partial, castArray } from 'lodash';\nimport { Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Picker, ToolbarButton } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getMoversSetup } from './mover-description';\nimport { store as blockEditorStore } from '../../store';\n\nexport const BLOCK_MOVER_DIRECTION_TOP = 'blockPageMoverOptions-moveToTop';\nexport const BLOCK_MOVER_DIRECTION_BOTTOM =\n\t'blockPageMoverOptions-moveToBottom';\n\nexport const BlockMover = ( {\n\tisFirst,\n\tisLast,\n\tcanMove,\n\tonMoveDown,\n\tonMoveUp,\n\tonLongMove,\n\tfirstIndex,\n\tnumberOfBlocks,\n\trootClientId,\n\tisStackedHorizontally,\n} ) => {\n\tconst pickerRef = useRef();\n\tconst [ shouldPresentPicker, setShouldPresentPicker ] = useState( false );\n\tconst [ blockPageMoverState, setBlockPageMoverState ] =\n\t\tuseState( undefined );\n\tconst showBlockPageMover = ( direction ) => () => {\n\t\tif ( ! pickerRef.current ) {\n\t\t\tsetBlockPageMoverState( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tsetBlockPageMoverState( direction );\n\t\tsetShouldPresentPicker( true );\n\t};\n\n\t// Ensure that the picker is only presented after state updates.\n\tuseEffect( () => {\n\t\tif ( shouldPresentPicker ) {\n\t\t\tpickerRef.current?.presentPicker();\n\t\t\tsetShouldPresentPicker( false );\n\t\t}\n\t}, [ shouldPresentPicker ] );\n\n\tconst {\n\t\tdescription: {\n\t\t\tbackwardButtonHint,\n\t\t\tforwardButtonHint,\n\t\t\tfirstBlockTitle,\n\t\t\tlastBlockTitle,\n\t\t},\n\t\ticon: { backward: backwardButtonIcon, forward: forwardButtonIcon },\n\t\ttitle: { backward: backwardButtonTitle, forward: forwardButtonTitle },\n\t} = getMoversSetup( isStackedHorizontally, { firstIndex } );\n\n\tconst blockPageMoverOptions = [\n\t\t{\n\t\t\ticon: backwardButtonIcon,\n\t\t\tlabel: __( 'Move to top' ),\n\t\t\tvalue: BLOCK_MOVER_DIRECTION_TOP,\n\t\t\tonSelect: () => {\n\t\t\t\tonLongMove()( 0 );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ticon: forwardButtonIcon,\n\t\t\tlabel: __( 'Move to bottom' ),\n\t\t\tvalue: BLOCK_MOVER_DIRECTION_BOTTOM,\n\t\t\tonSelect: () => {\n\t\t\t\tonLongMove()( numberOfBlocks );\n\t\t\t},\n\t\t},\n\t].filter( ( el ) => el.value === blockPageMoverState );\n\n\tconst onPickerSelect = ( value ) => {\n\t\tconst option = blockPageMoverOptions.find(\n\t\t\t( el ) => el.value === value\n\t\t);\n\t\tif ( option && option.onSelect ) option.onSelect();\n\t};\n\n\tconst onLongPressMoveUp = useCallback(\n\t\tshowBlockPageMover( BLOCK_MOVER_DIRECTION_TOP ),\n\t\t[]\n\t);\n\tconst onLongPressMoveDown = useCallback(\n\t\tshowBlockPageMover( BLOCK_MOVER_DIRECTION_BOTTOM ),\n\t\t[]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ ! isFirst ? backwardButtonTitle : firstBlockTitle }\n\t\t\t\tisDisabled={ isFirst }\n\t\t\t\tonClick={ onMoveUp }\n\t\t\t\tonLongPress={ onLongPressMoveUp }\n\t\t\t\ticon={ backwardButtonIcon }\n\t\t\t\textraProps={ { hint: backwardButtonHint } }\n\t\t\t/>\n\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ ! isLast ? forwardButtonTitle : lastBlockTitle }\n\t\t\t\tisDisabled={ isLast }\n\t\t\t\tonClick={ onMoveDown }\n\t\t\t\tonLongPress={ onLongPressMoveDown }\n\t\t\t\ticon={ forwardButtonIcon }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: forwardButtonHint,\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t<Picker\n\t\t\t\tref={ pickerRef }\n\t\t\t\toptions={ blockPageMoverOptions }\n\t\t\t\tonChange={ onPickerSelect }\n\t\t\t\ttitle={ __( 'Change block position' ) }\n\t\t\t\tleftAlign={ true }\n\t\t\t\thideCancelButton={ Platform.OS !== 'ios' }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default compose(\n\twithSelect( ( select, { clientIds } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tcanMoveBlocks,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockOrder,\n\t\t} = select( blockEditorStore );\n\t\tconst normalizedClientIds = castArray( clientIds );\n\t\tconst firstClientId = first( normalizedClientIds );\n\t\tconst rootClientId = getBlockRootClientId( firstClientId );\n\t\tconst blockOrder = getBlockOrder( rootClientId );\n\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\tconst lastIndex = getBlockIndex( last( normalizedClientIds ) );\n\n\t\treturn {\n\t\t\tfirstIndex,\n\t\t\tnumberOfBlocks: blockOrder.length - 1,\n\t\t\tisFirst: firstIndex === 0,\n\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\tcanMove: canMoveBlocks( clientIds, rootClientId ),\n\t\t\trootClientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientIds, rootClientId } ) => {\n\t\tconst { moveBlocksDown, moveBlocksUp, moveBlocksToPosition } =\n\t\t\tdispatch( blockEditorStore );\n\t\treturn {\n\t\t\tonMoveDown: partial( moveBlocksDown, clientIds, rootClientId ),\n\t\t\tonMoveUp: partial( moveBlocksUp, clientIds, rootClientId ),\n\t\t\tonLongMove: ( targetIndex ) =>\n\t\t\t\tpartial(\n\t\t\t\t\tmoveBlocksToPosition,\n\t\t\t\t\tclientIds,\n\t\t\t\t\trootClientId,\n\t\t\t\t\ttargetIndex\n\t\t\t\t),\n\t\t};\n\t} ),\n\twithInstanceId\n)( BlockMover );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.native.js"],"names":["BLOCK_MOVER_DIRECTION_TOP","BLOCK_MOVER_DIRECTION_BOTTOM","BlockMover","isFirst","isLast","canMove","onMoveDown","onMoveUp","onLongMove","firstIndex","numberOfBlocks","rootClientId","isStackedHorizontally","pickerRef","shouldPresentPicker","setShouldPresentPicker","blockPageMoverState","setBlockPageMoverState","undefined","showBlockPageMover","direction","current","presentPicker","description","backwardButtonHint","forwardButtonHint","firstBlockTitle","lastBlockTitle","icon","backward","backwardButtonIcon","forward","forwardButtonIcon","title","backwardButtonTitle","forwardButtonTitle","blockPageMoverOptions","label","value","onSelect","filter","el","onPickerSelect","option","find","onLongPressMoveUp","onLongPressMoveDown","hint","Platform","OS","select","clientIds","getBlockIndex","canMoveBlocks","getBlockRootClientId","getBlockOrder","blockEditorStore","normalizedClientIds","Array","isArray","firstClientId","blockOrder","lastIndex","length","dispatch","moveBlocksDown","moveBlocksUp","moveBlocksToPosition","args","targetIndex","withInstanceId"],"mappings":";;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,yBAAyB,GAAG,iCAAlC;;AACA,MAAMC,4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A,CAlBD,CA5Bc,EA+CdE,uBA/Cc,EAgDZpE,UAhDY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Picker, ToolbarButton } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getMoversSetup } from './mover-description';\nimport { store as blockEditorStore } from '../../store';\n\nexport const BLOCK_MOVER_DIRECTION_TOP = 'blockPageMoverOptions-moveToTop';\nexport const BLOCK_MOVER_DIRECTION_BOTTOM =\n\t'blockPageMoverOptions-moveToBottom';\n\nexport const BlockMover = ( {\n\tisFirst,\n\tisLast,\n\tcanMove,\n\tonMoveDown,\n\tonMoveUp,\n\tonLongMove,\n\tfirstIndex,\n\tnumberOfBlocks,\n\trootClientId,\n\tisStackedHorizontally,\n} ) => {\n\tconst pickerRef = useRef();\n\tconst [ shouldPresentPicker, setShouldPresentPicker ] = useState( false );\n\tconst [ blockPageMoverState, setBlockPageMoverState ] =\n\t\tuseState( undefined );\n\tconst showBlockPageMover = ( direction ) => () => {\n\t\tif ( ! pickerRef.current ) {\n\t\t\tsetBlockPageMoverState( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tsetBlockPageMoverState( direction );\n\t\tsetShouldPresentPicker( true );\n\t};\n\n\t// Ensure that the picker is only presented after state updates.\n\tuseEffect( () => {\n\t\tif ( shouldPresentPicker ) {\n\t\t\tpickerRef.current?.presentPicker();\n\t\t\tsetShouldPresentPicker( false );\n\t\t}\n\t}, [ shouldPresentPicker ] );\n\n\tconst {\n\t\tdescription: {\n\t\t\tbackwardButtonHint,\n\t\t\tforwardButtonHint,\n\t\t\tfirstBlockTitle,\n\t\t\tlastBlockTitle,\n\t\t},\n\t\ticon: { backward: backwardButtonIcon, forward: forwardButtonIcon },\n\t\ttitle: { backward: backwardButtonTitle, forward: forwardButtonTitle },\n\t} = getMoversSetup( isStackedHorizontally, { firstIndex } );\n\n\tconst blockPageMoverOptions = [\n\t\t{\n\t\t\ticon: backwardButtonIcon,\n\t\t\tlabel: __( 'Move to top' ),\n\t\t\tvalue: BLOCK_MOVER_DIRECTION_TOP,\n\t\t\tonSelect: () => {\n\t\t\t\tonLongMove()( 0 );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ticon: forwardButtonIcon,\n\t\t\tlabel: __( 'Move to bottom' ),\n\t\t\tvalue: BLOCK_MOVER_DIRECTION_BOTTOM,\n\t\t\tonSelect: () => {\n\t\t\t\tonLongMove()( numberOfBlocks );\n\t\t\t},\n\t\t},\n\t].filter( ( el ) => el.value === blockPageMoverState );\n\n\tconst onPickerSelect = ( value ) => {\n\t\tconst option = blockPageMoverOptions.find(\n\t\t\t( el ) => el.value === value\n\t\t);\n\t\tif ( option && option.onSelect ) option.onSelect();\n\t};\n\n\tconst onLongPressMoveUp = useCallback(\n\t\tshowBlockPageMover( BLOCK_MOVER_DIRECTION_TOP ),\n\t\t[]\n\t);\n\tconst onLongPressMoveDown = useCallback(\n\t\tshowBlockPageMover( BLOCK_MOVER_DIRECTION_BOTTOM ),\n\t\t[]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ ! isFirst ? backwardButtonTitle : firstBlockTitle }\n\t\t\t\tisDisabled={ isFirst }\n\t\t\t\tonClick={ onMoveUp }\n\t\t\t\tonLongPress={ onLongPressMoveUp }\n\t\t\t\ticon={ backwardButtonIcon }\n\t\t\t\textraProps={ { hint: backwardButtonHint } }\n\t\t\t/>\n\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ ! isLast ? forwardButtonTitle : lastBlockTitle }\n\t\t\t\tisDisabled={ isLast }\n\t\t\t\tonClick={ onMoveDown }\n\t\t\t\tonLongPress={ onLongPressMoveDown }\n\t\t\t\ticon={ forwardButtonIcon }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: forwardButtonHint,\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t<Picker\n\t\t\t\tref={ pickerRef }\n\t\t\t\toptions={ blockPageMoverOptions }\n\t\t\t\tonChange={ onPickerSelect }\n\t\t\t\ttitle={ __( 'Change block position' ) }\n\t\t\t\tleftAlign={ true }\n\t\t\t\thideCancelButton={ Platform.OS !== 'ios' }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default compose(\n\twithSelect( ( select, { clientIds } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tcanMoveBlocks,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockOrder,\n\t\t} = select( blockEditorStore );\n\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t? clientIds\n\t\t\t: [ clientIds ];\n\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\tconst rootClientId = getBlockRootClientId( firstClientId );\n\t\tconst blockOrder = getBlockOrder( rootClientId );\n\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\tconst lastIndex = getBlockIndex(\n\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t);\n\n\t\treturn {\n\t\t\tfirstIndex,\n\t\t\tnumberOfBlocks: blockOrder.length - 1,\n\t\t\tisFirst: firstIndex === 0,\n\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\tcanMove: canMoveBlocks( clientIds, rootClientId ),\n\t\t\trootClientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientIds, rootClientId } ) => {\n\t\tconst { moveBlocksDown, moveBlocksUp, moveBlocksToPosition } =\n\t\t\tdispatch( blockEditorStore );\n\t\treturn {\n\t\t\tonMoveDown: ( ...args ) =>\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId, ...args ),\n\t\t\tonMoveUp: ( ...args ) =>\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId, ...args ),\n\t\t\tonLongMove:\n\t\t\t\t( targetIndex ) =>\n\t\t\t\t( ...args ) =>\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\ttargetIndex,\n\t\t\t\t\t\t...args\n\t\t\t\t\t),\n\t\t};\n\t} ),\n\twithInstanceId\n)( BlockMover );\n"]}
|
|
@@ -48,6 +48,8 @@ function BlockPopoverInbetween(_ref) {
|
|
|
48
48
|
__unstableContentRef,
|
|
49
49
|
...props
|
|
50
50
|
} = _ref;
|
|
51
|
+
// This is a temporary hack to get the inbetween inserter to recompute properly.
|
|
52
|
+
const [positionRecompute, forceRecompute] = (0, _element.useReducer)(s => s + 1, 0);
|
|
51
53
|
const {
|
|
52
54
|
orientation,
|
|
53
55
|
rootClientId,
|
|
@@ -61,14 +63,14 @@ function BlockPopoverInbetween(_ref) {
|
|
|
61
63
|
isBlockVisible
|
|
62
64
|
} = select(_store.store);
|
|
63
65
|
|
|
64
|
-
const _rootClientId = getBlockRootClientId(previousClientId);
|
|
66
|
+
const _rootClientId = getBlockRootClientId(previousClientId !== null && previousClientId !== void 0 ? previousClientId : nextClientId);
|
|
65
67
|
|
|
66
68
|
return {
|
|
67
69
|
orientation: ((_getBlockListSettings = getBlockListSettings(_rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
|
|
68
70
|
rootClientId: _rootClientId,
|
|
69
71
|
isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId)
|
|
70
72
|
};
|
|
71
|
-
}, [previousClientId]);
|
|
73
|
+
}, [previousClientId, nextClientId]);
|
|
72
74
|
const previousElement = (0, _useBlockRefs.__unstableUseBlockElement)(previousClientId);
|
|
73
75
|
const nextElement = (0, _useBlockRefs.__unstableUseBlockElement)(nextClientId);
|
|
74
76
|
const isVertical = orientation === 'vertical';
|
|
@@ -82,7 +84,7 @@ function BlockPopoverInbetween(_ref) {
|
|
|
82
84
|
|
|
83
85
|
if (isVertical) {
|
|
84
86
|
return {
|
|
85
|
-
width:
|
|
87
|
+
width: previousRect ? previousRect.width : nextRect.width,
|
|
86
88
|
height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
|
|
87
89
|
};
|
|
88
90
|
}
|
|
@@ -95,9 +97,9 @@ function BlockPopoverInbetween(_ref) {
|
|
|
95
97
|
|
|
96
98
|
return {
|
|
97
99
|
width,
|
|
98
|
-
height:
|
|
100
|
+
height: previousRect ? previousRect.height : nextRect.height
|
|
99
101
|
};
|
|
100
|
-
}, [previousElement, nextElement, isVertical]);
|
|
102
|
+
}, [previousElement, nextElement, isVertical, positionRecompute, isVisible]);
|
|
101
103
|
const getAnchorRect = (0, _element.useCallback)(() => {
|
|
102
104
|
if (!previousElement && !nextElement || !isVisible) {
|
|
103
105
|
return {};
|
|
@@ -114,8 +116,8 @@ function BlockPopoverInbetween(_ref) {
|
|
|
114
116
|
return {
|
|
115
117
|
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
116
118
|
left: previousRect ? previousRect.right : nextRect.right,
|
|
117
|
-
right: previousRect ? previousRect.
|
|
118
|
-
bottom:
|
|
119
|
+
right: previousRect ? previousRect.right : nextRect.right,
|
|
120
|
+
bottom: previousRect ? previousRect.bottom : nextRect.top,
|
|
119
121
|
height: 0,
|
|
120
122
|
width: 0,
|
|
121
123
|
ownerDocument
|
|
@@ -125,8 +127,8 @@ function BlockPopoverInbetween(_ref) {
|
|
|
125
127
|
return {
|
|
126
128
|
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
127
129
|
left: previousRect ? previousRect.left : nextRect.left,
|
|
128
|
-
right: previousRect ? previousRect.
|
|
129
|
-
bottom:
|
|
130
|
+
right: previousRect ? previousRect.left : nextRect.left,
|
|
131
|
+
bottom: previousRect ? previousRect.bottom : nextRect.top,
|
|
130
132
|
height: 0,
|
|
131
133
|
width: 0,
|
|
132
134
|
ownerDocument
|
|
@@ -137,8 +139,8 @@ function BlockPopoverInbetween(_ref) {
|
|
|
137
139
|
return {
|
|
138
140
|
top: previousRect ? previousRect.top : nextRect.top,
|
|
139
141
|
left: previousRect ? previousRect.left : nextRect.right,
|
|
140
|
-
right:
|
|
141
|
-
bottom: previousRect ? previousRect.
|
|
142
|
+
right: previousRect ? previousRect.left : nextRect.right,
|
|
143
|
+
bottom: previousRect ? previousRect.top : nextRect.top,
|
|
142
144
|
height: 0,
|
|
143
145
|
width: 0,
|
|
144
146
|
ownerDocument
|
|
@@ -148,14 +150,51 @@ function BlockPopoverInbetween(_ref) {
|
|
|
148
150
|
return {
|
|
149
151
|
top: previousRect ? previousRect.top : nextRect.top,
|
|
150
152
|
left: previousRect ? previousRect.right : nextRect.left,
|
|
151
|
-
right:
|
|
152
|
-
bottom: previousRect ? previousRect.
|
|
153
|
+
right: previousRect ? previousRect.right : nextRect.left,
|
|
154
|
+
bottom: previousRect ? previousRect.left : nextRect.right,
|
|
153
155
|
height: 0,
|
|
154
156
|
width: 0,
|
|
155
157
|
ownerDocument
|
|
156
158
|
};
|
|
157
|
-
}, [previousElement, nextElement]);
|
|
158
|
-
const popoverScrollRef = (0, _usePopoverScroll.default)(__unstableContentRef); //
|
|
159
|
+
}, [previousElement, nextElement, positionRecompute, isVisible]);
|
|
160
|
+
const popoverScrollRef = (0, _usePopoverScroll.default)(__unstableContentRef); // This is only needed for a smooth transition when moving blocks.
|
|
161
|
+
|
|
162
|
+
(0, _element.useLayoutEffect)(() => {
|
|
163
|
+
if (!previousElement) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const observer = new window.MutationObserver(forceRecompute);
|
|
168
|
+
observer.observe(previousElement, {
|
|
169
|
+
attributes: true
|
|
170
|
+
});
|
|
171
|
+
return () => {
|
|
172
|
+
observer.disconnect();
|
|
173
|
+
};
|
|
174
|
+
}, [previousElement]);
|
|
175
|
+
(0, _element.useLayoutEffect)(() => {
|
|
176
|
+
if (!nextElement) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const observer = new window.MutationObserver(forceRecompute);
|
|
181
|
+
observer.observe(nextElement, {
|
|
182
|
+
attributes: true
|
|
183
|
+
});
|
|
184
|
+
return () => {
|
|
185
|
+
observer.disconnect();
|
|
186
|
+
};
|
|
187
|
+
}, [nextElement]);
|
|
188
|
+
(0, _element.useLayoutEffect)(() => {
|
|
189
|
+
if (!previousElement) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
previousElement.ownerDocument.defaultView.addEventListener('resize', forceRecompute);
|
|
194
|
+
return () => {
|
|
195
|
+
previousElement.ownerDocument.defaultView.removeEventListener('resize', forceRecompute);
|
|
196
|
+
};
|
|
197
|
+
}, [previousElement]); // If there's either a previous or a next element, show the inbetween popover.
|
|
159
198
|
// Note that drag and drop uses the inbetween popover to show the drop indicator
|
|
160
199
|
// before the first block and after the last block.
|
|
161
200
|
|
|
@@ -184,8 +223,11 @@ function BlockPopoverInbetween(_ref) {
|
|
|
184
223
|
key: nextClientId + '--' + rootClientId
|
|
185
224
|
}, props, {
|
|
186
225
|
className: (0, _classnames.default)('block-editor-block-popover', 'block-editor-block-popover__inbetween', props.className),
|
|
187
|
-
|
|
226
|
+
resize: false,
|
|
227
|
+
flip: false,
|
|
228
|
+
placement: "bottom-start"
|
|
188
229
|
}), (0, _element.createElement)("div", {
|
|
230
|
+
className: "block-editor-block-popover__inbetween-container",
|
|
189
231
|
style: style
|
|
190
232
|
}, children));
|
|
191
233
|
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"names":["InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","props","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","blockEditorStore","_rootClientId","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","className"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,OAOI;AAAA,MAP4B;AAC/BC,IAAAA,gBAD+B;AAE/BC,IAAAA,YAF+B;AAG/BC,IAAAA,QAH+B;AAI/BC,IAAAA,qBAJ+B;AAK/BC,IAAAA,oBAL+B;AAM/B,OAAGC;AAN4B,GAO5B;AACH,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,YAAf;AAA6BC,IAAAA;AAA7B,MAA2C,qBAC9CC,MAAF,IAAc;AAAA;;AACb,UAAM;AACLC,MAAAA,oBADK;AAELC,MAAAA,oBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,YAAF,CAJV;;AAMA,UAAMC,aAAa,GAAGH,oBAAoB,CAAEX,gBAAF,CAA1C;;AACA,WAAO;AACNM,MAAAA,WAAW,EACV,0BAAAI,oBAAoB,CAAEI,aAAF,CAApB,gFAAuCR,WAAvC,KACA,UAHK;AAINC,MAAAA,YAAY,EAAEO,aAJR;AAKNN,MAAAA,SAAS,EACRI,cAAc,CAAEZ,gBAAF,CAAd,IACAY,cAAc,CAAEX,YAAF;AAPT,KAAP;AASA,GAlB+C,EAmBhD,CAAED,gBAAF,CAnBgD,CAAjD;AAqBA,QAAMe,eAAe,GAAG,6CAAiBf,gBAAjB,CAAxB;AACA,QAAMgB,WAAW,GAAG,6CAAiBf,YAAjB,CAApB;AACA,QAAMgB,UAAU,GAAGX,WAAW,KAAK,UAAnC;AACA,QAAMY,KAAK,GAAG,sBAAS,MAAM;AAC5B,QAAO,CAAEH,eAAF,IA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AY,GAAG,IAAf,GAAsBM;AAV7B,KAWMF,KAXN;AAYC,IAAA,SAAS,EAAG,yBACX,4BADW,EAEX,uCAFW,EAGXA,KAAK,CAAC4B,SAHK,CAZb;AAiBC,IAAA,uBAAuB;AAjBxB,MAmBC;AAAK,IAAA,KAAK,EAAGf;AAAb,KAAuBhB,QAAvB,CAnBD,CADD;AAuBA;AACA;;eAEcH,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useMemo, createContext } from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId( previousClientId );\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement, isVertical ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\theight: 0,\n\t\t\t\t\twidth: 0,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\theight: 0,\n\t\t\t\twidth: 0,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\theight: 0,\n\t\t\t\twidth: 0,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\theight: 0,\n\t\t\twidth: 0,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\t__unstableForcePosition\n\t\t>\n\t\t\t<div style={ style }>{ children }</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"names":["InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","props","positionRecompute","forceRecompute","s","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","blockEditorStore","_rootClientId","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","height","top","bottom","left","right","getAnchorRect","ownerDocument","popoverScrollRef","observer","window","MutationObserver","observe","attributes","disconnect","defaultView","addEventListener","removeEventListener","className"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AAKO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,OAOI;AAAA,MAP4B;AAC/BC,IAAAA,gBAD+B;AAE/BC,IAAAA,YAF+B;AAG/BC,IAAA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\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ positionRecompute, forceRecompute ] = useReducer(\n\t\t( s ) => s + 1,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousRect ? previousRect.width : nextRect.width,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousRect ? previousRect.height : nextRect.height,\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tisVertical,\n\t\tpositionRecompute,\n\t\tisVisible,\n\t] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\theight: 0,\n\t\t\t\t\twidth: 0,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\theight: 0,\n\t\t\t\twidth: 0,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tbottom: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\theight: 0,\n\t\t\t\twidth: 0,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: previousRect ? previousRect.right : nextRect.left,\n\t\t\tbottom: previousRect ? previousRect.left : nextRect.right,\n\t\t\theight: 0,\n\t\t\twidth: 0,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement, positionRecompute, isVisible ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forceRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forceRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforceRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforceRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"bottom-start\"\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-block-popover__inbetween-container\"\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -13,6 +13,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _compose = require("@wordpress/compose");
|
|
17
|
+
|
|
16
18
|
var _components = require("@wordpress/components");
|
|
17
19
|
|
|
18
20
|
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
|
|
@@ -30,7 +32,7 @@ var _usePopoverScroll = _interopRequireDefault(require("./use-popover-scroll"));
|
|
|
30
32
|
/**
|
|
31
33
|
* Internal dependencies
|
|
32
34
|
*/
|
|
33
|
-
function BlockPopover(_ref) {
|
|
35
|
+
function BlockPopover(_ref, ref) {
|
|
34
36
|
let {
|
|
35
37
|
clientId,
|
|
36
38
|
bottomClientId,
|
|
@@ -43,7 +45,7 @@ function BlockPopover(_ref) {
|
|
|
43
45
|
} = _ref;
|
|
44
46
|
const selectedElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
45
47
|
const lastSelectedElement = (0, _useBlockRefs.__unstableUseBlockElement)(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId);
|
|
46
|
-
const
|
|
48
|
+
const mergedRefs = (0, _compose.useMergeRefs)([ref, (0, _usePopoverScroll.default)(__unstableContentRef)]);
|
|
47
49
|
const style = (0, _element.useMemo)(() => {
|
|
48
50
|
if (!selectedElement || lastSelectedElement !== selectedElement) {
|
|
49
51
|
return {};
|
|
@@ -65,22 +67,25 @@ function BlockPopover(_ref) {
|
|
|
65
67
|
bottom: lastSelectedElement
|
|
66
68
|
};
|
|
67
69
|
return (0, _element.createElement)(_components.Popover, (0, _extends2.default)({
|
|
68
|
-
ref:
|
|
70
|
+
ref: mergedRefs,
|
|
69
71
|
animate: false,
|
|
70
72
|
position: "top right left",
|
|
71
73
|
focusOnMount: false,
|
|
72
74
|
anchorRef: anchorRef // Render in the old slot if needed for backward compatibility,
|
|
73
75
|
// otherwise render in place (not in the default popover slot).
|
|
74
76
|
,
|
|
75
|
-
__unstableSlotName: __unstablePopoverSlot || null
|
|
76
|
-
,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
__unstableShift: true
|
|
77
|
+
__unstableSlotName: __unstablePopoverSlot || null,
|
|
78
|
+
resize: false,
|
|
79
|
+
flip: false,
|
|
80
|
+
shift: true
|
|
80
81
|
}, props, {
|
|
81
82
|
className: (0, _classnames.default)('block-editor-block-popover', props.className)
|
|
82
83
|
}), __unstableCoverTarget && (0, _element.createElement)("div", {
|
|
83
84
|
style: style
|
|
84
85
|
}, children), !__unstableCoverTarget && children);
|
|
85
86
|
}
|
|
87
|
+
|
|
88
|
+
var _default = (0, _element.forwardRef)(BlockPopover);
|
|
89
|
+
|
|
90
|
+
exports.default = _default;
|
|
86
91
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"names":["BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","props","selectedElement","lastSelectedElement","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"names":["BlockPopover","ref","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","props","selectedElement","lastSelectedElement","mergedRefs","style","position","width","offsetWidth","height","offsetHeight","anchorRef","top","bottom","className"],"mappings":";;;;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AA,YAAY,EAAG,KAJhB;AAKC,IAAA,SAAS,EAAGO,SALb,CAMC;AACA;AAPD;AAQC,IAAA,kBAAkB,EAAGZ,qBAAqB,IAAI,IAR/C;AASC,IAAA,MAAM,EAAG,KATV;AAUC,IAAA,IAAI,EAAG,KAVR;AAWC,IAAA,KAAK;AAXN,KAYME,KAZN;AAaC,IAAA,SAAS,EAAG,yBACX,4BADW,EAEXA,KAAK,CAACa,SAFK;AAbb,MAkBGhB,qBAAqB,IAAI;AAAK,IAAA,KAAK,EAAGO;AAAb,KAAuBT,QAAvB,CAlB5B,EAmBG,CAAEE,qBAAF,IAA2BF,QAnB9B,CADD;AAuBA;;eAEc,yBAAYJ,YAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { forwardRef, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstableRefreshSize,\n\t\t__unstableCoverTarget = false,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\tconst style = useMemo( () => {\n\t\tif ( ! selectedElement || lastSelectedElement !== selectedElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tposition: 'absolute',\n\t\t\twidth: selectedElement.offsetWidth,\n\t\t\theight: selectedElement.offsetHeight,\n\t\t};\n\t}, [ selectedElement, lastSelectedElement, __unstableRefreshSize ] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\tconst anchorRef = {\n\t\ttop: selectedElement,\n\t\tbottom: lastSelectedElement,\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tposition=\"top right left\"\n\t\t\tfocusOnMount={ false }\n\t\t\tanchorRef={ anchorRef }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t>\n\t\t\t{ __unstableCoverTarget && <div style={ style }>{ children }</div> }\n\t\t\t{ ! __unstableCoverTarget && children }\n\t\t</Popover>\n\t);\n}\n\nexport default forwardRef( BlockPopover );\n"]}
|
|
@@ -105,9 +105,11 @@ function AutoBlockPreview(_ref) {
|
|
|
105
105
|
documentElement.classList.add('block-editor-block-preview__content-iframe');
|
|
106
106
|
documentElement.style.position = 'absolute';
|
|
107
107
|
documentElement.style.width = '100%';
|
|
108
|
-
bodyElement.style.padding = __experimentalPadding + 'px'; //
|
|
108
|
+
bodyElement.style.padding = __experimentalPadding + 'px'; // Necessary for contentResizeListener to work.
|
|
109
109
|
|
|
110
|
-
bodyElement.style.
|
|
110
|
+
bodyElement.style.boxSizing = 'border-box';
|
|
111
|
+
bodyElement.style.position = 'absolute';
|
|
112
|
+
bodyElement.style.width = '100%';
|
|
111
113
|
}, []),
|
|
112
114
|
"aria-hidden": true,
|
|
113
115
|
tabIndex: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"names":["MemoizedBlockList","MAX_HEIGHT","AutoBlockPreview","viewportWidth","__experimentalPadding","__experimentalMinHeight","containerResizeListener","width","containerWidth","contentResizeListener","height","contentHeight","styles","assets","duotone","select","settings","store","getSettings","__unstableResolvedAssets","__experimentalFeatures","color","editorStyles","css","__unstableType","svgFilters","default","theme","BlockList","scale","transform","maxHeight","undefined","minHeight","bodyElement","ownerDocument","documentElement","classList","add","style","position","padding","pointerEvents","map","preset","slug"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA;AACA,IAAIA,iBAAJ;AAEA,MAAMC,UAAU,GAAG,IAAnB;;AAEA,SAASC,gBAAT,OAII;AAAA,MAJuB;AAC1BC,IAAAA,aAD0B;AAE1BC,IAAAA,qBAF0B;AAG1BC,IAAAA;AAH0B,GAIvB;AACH,QAAM,CAAEC,uBAAF,EAA2B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA3B,IACL,iCADD;AAEA,QAAM,CAAEC,qBAAF,EAAyB;AAAEC,IAAAA,MAAM,EAAEC;AAAV,GAAzB,IACL,iCADD;AAEA,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,MAA8B,qBAAaC,MAAF,IAAc;AAAA;;AAC5D,UAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAgBC,WAAhB,EAAjB;AACA,WAAO;AACNN,MAAAA,MAAM,EAAEI,QAAQ,CAACJ,MADX;AAENC,MAAAA,MAAM,EAAEG,QAAQ,CAACG,wBAFX;AAGNL,MAAAA,OAAO,2BAAEE,QAAQ,CAACI,sBAAX,oFAAE,sBAAiCC,KAAnC,2DAAE,uBAAwCP;AAH3C,KAAP;AAKA,GAPmC,EAOjC,EAPiC,CAApC,CALG,CAcH;;AACA,QAAMQ,YAAY,GAAG,sBAAS,MAAM;AACnC,QAAKV,MAAL,EAAc;AACb,aAAO,CACN,GAAGA,MADG,EAEN;AACCW,QAA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CAACG,KAAhB,CAAsBC,QAAtB,GAAiC,UAAjC;AACAJ,MAAAA,eAAe,CAACG,KAAhB,CAAsBhC,KAAtB,GAA8B,MAA9B;AACA2B,MAAAA,WAAW,CAACK,KAAZ,CAAkBE,OAAlB,GACCrC,qBAAqB,GAAG,IADzB,CAT6C,CAY7C;;AACA8B,MAAAA,WAAW,CAACK,KAAZ,CAAkBC,QAAlB,GAA6B,UAA7B;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"names":["MemoizedBlockList","MAX_HEIGHT","AutoBlockPreview","viewportWidth","__experimentalPadding","__experimentalMinHeight","containerResizeListener","width","containerWidth","contentResizeListener","height","contentHeight","styles","assets","duotone","select","settings","store","getSettings","__unstableResolvedAssets","__experimentalFeatures","color","editorStyles","css","__unstableType","svgFilters","default","theme","BlockList","scale","transform","maxHeight","undefined","minHeight","bodyElement","ownerDocument","documentElement","classList","add","style","position","padding","boxSizing","pointerEvents","map","preset","slug"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA;AACA,IAAIA,iBAAJ;AAEA,MAAMC,UAAU,GAAG,IAAnB;;AAEA,SAASC,gBAAT,OAII;AAAA,MAJuB;AAC1BC,IAAAA,aAD0B;AAE1BC,IAAAA,qBAF0B;AAG1BC,IAAAA;AAH0B,GAIvB;AACH,QAAM,CAAEC,uBAAF,EAA2B;AAAEC,IAAAA,KAAK,EAAEC;AAAT,GAA3B,IACL,iCADD;AAEA,QAAM,CAAEC,qBAAF,EAAyB;AAAEC,IAAAA,MAAM,EAAEC;AAAV,GAAzB,IACL,iCADD;AAEA,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,MAA8B,qBAAaC,MAAF,IAAc;AAAA;;AAC5D,UAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CA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sCE;AACAgB,EAAAA,UAAU,CAACmB,GAAX,CAAkBC,MAAF,IACf,4BAAC,sCAAD;AACC,IAAA,MAAM,EAAGA,MADV;AAEC,IAAA,GAAG,EAAGA,MAAM,CAACC;AAFd,IADD,CAvCF,EA8CC,4BAAC,iBAAD;AAAmB,IAAA,cAAc,EAAG;AAApC,IA9CD,CAZD,CAFD,CADD;AAkEA;;eAEc5C,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { useResizeObserver, pure, useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport Iframe from '../iframe';\nimport EditorStyles from '../editor-styles';\nimport { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '../../components/duotone';\nimport { store } from '../../store';\n\n// This is used to avoid rendering the block list if the sizes change.\nlet MemoizedBlockList;\n\nconst MAX_HEIGHT = 2000;\n\nfunction AutoBlockPreview( {\n\tviewportWidth,\n\t__experimentalPadding,\n\t__experimentalMinHeight,\n} ) {\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst { styles, assets, duotone } = useSelect( ( select ) => {\n\t\tconst settings = select( store ).getSettings();\n\t\treturn {\n\t\t\tstyles: settings.styles,\n\t\t\tassets: settings.__unstableResolvedAssets,\n\t\t\tduotone: settings.__experimentalFeatures?.color?.duotone,\n\t\t};\n\t}, [] );\n\n\t// Avoid scrollbars for pattern previews.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'body{height:auto;overflow:hidden;}',\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\n\tconst svgFilters = useMemo( () => {\n\t\treturn [ ...( duotone?.default ?? [] ), ...( duotone?.theme ?? [] ) ];\n\t}, [ duotone ] );\n\n\t// Initialize on render instead of module top level, to avoid circular dependency issues.\n\tMemoizedBlockList = MemoizedBlockList || pure( BlockList );\n\n\tconst scale = containerWidth / viewportWidth;\n\treturn (\n\t\t<div className=\"block-editor-block-preview__container\">\n\t\t\t{ containerResizeListener }\n\t\t\t<Disabled\n\t\t\t\tclassName=\"block-editor-block-preview__content\"\n\t\t\t\tstyle={ {\n\t\t\t\t\ttransform: `scale(${ scale })`,\n\t\t\t\t\theight: contentHeight * scale,\n\t\t\t\t\tmaxHeight:\n\t\t\t\t\t\tcontentHeight > MAX_HEIGHT\n\t\t\t\t\t\t\t? MAX_HEIGHT * scale\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tminHeight: __experimentalMinHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Iframe\n\t\t\t\t\thead={ <EditorStyles styles={ editorStyles } /> }\n\t\t\t\t\tassets={ assets }\n\t\t\t\t\tcontentRef={ useRefEffect( ( bodyElement ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\townerDocument: { documentElement },\n\t\t\t\t\t\t} = bodyElement;\n\t\t\t\t\t\tdocumentElement.classList.add(\n\t\t\t\t\t\t\t'block-editor-block-preview__content-iframe'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdocumentElement.style.position = 'absolute';\n\t\t\t\t\t\tdocumentElement.style.width = '100%';\n\t\t\t\t\t\tbodyElement.style.padding =\n\t\t\t\t\t\t\t__experimentalPadding + 'px';\n\n\t\t\t\t\t\t// Necessary for contentResizeListener to work.\n\t\t\t\t\t\tbodyElement.style.boxSizing = 'border-box';\n\t\t\t\t\t\tbodyElement.style.position = 'absolute';\n\t\t\t\t\t\tbodyElement.style.width = '100%';\n\t\t\t\t\t}, [] ) }\n\t\t\t\t\taria-hidden\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\twidth: viewportWidth,\n\t\t\t\t\t\theight: contentHeight,\n\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t// This is a catch-all max-height for patterns.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/38175.\n\t\t\t\t\t\tmaxHeight: MAX_HEIGHT,\n\t\t\t\t\t\tminHeight:\n\t\t\t\t\t\t\tscale !== 0 && scale < 1 && __experimentalMinHeight\n\t\t\t\t\t\t\t\t? __experimentalMinHeight / scale\n\t\t\t\t\t\t\t\t: __experimentalMinHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t{\n\t\t\t\t\t\t/* Filters need to be rendered before children to avoid Safari rendering issues. */\n\t\t\t\t\t\tsvgFilters.map( ( preset ) => (\n\t\t\t\t\t\t\t<PresetDuotoneFilter\n\t\t\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) )\n\t\t\t\t\t}\n\t\t\t\t\t<MemoizedBlockList renderAppender={ false } />\n\t\t\t\t</Iframe>\n\t\t\t</Disabled>\n\t\t</div>\n\t);\n}\n\nexport default AutoBlockPreview;\n"]}
|
|
@@ -82,6 +82,7 @@ function BlockSettingsDropdown(_ref2) {
|
|
|
82
82
|
clientIds,
|
|
83
83
|
__experimentalSelectBlock,
|
|
84
84
|
children,
|
|
85
|
+
__unstableDisplayLocation,
|
|
85
86
|
...props
|
|
86
87
|
} = _ref2;
|
|
87
88
|
const blockClientIds = (0, _lodash.castArray)(clientIds);
|
|
@@ -238,7 +239,8 @@ function BlockSettingsDropdown(_ref2) {
|
|
|
238
239
|
fillProps: {
|
|
239
240
|
onClose
|
|
240
241
|
},
|
|
241
|
-
clientIds: clientIds
|
|
242
|
+
clientIds: clientIds,
|
|
243
|
+
__unstableDisplayLocation: __unstableDisplayLocation
|
|
242
244
|
}), typeof children === 'function' ? children({
|
|
243
245
|
onClose
|
|
244
246
|
}) : _element.Children.map(child => (0, _element.cloneElement)(child, {
|