@wordpress/block-editor 8.5.7 → 9.1.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 +11 -0
- package/README.md +5 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -6
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +5 -74
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +64 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.native.js +484 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.native.js +29 -6
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- 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 +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +34 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +2 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +4 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +9 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +39 -65
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/inbetween.js +191 -0
- package/build/components/block-popover/inbetween.js.map +1 -0
- package/build/components/block-popover/index.js +85 -0
- package/build/components/block-popover/index.js.map +1 -0
- package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
- package/build/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -10
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +5 -5
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -121
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +216 -0
- package/build/components/block-tools/selected-block-popover.js.map +1 -0
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +149 -44
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +5 -23
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.native.js +31 -9
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -6
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/url-input/index.js +11 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +3 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +463 -44
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +3 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-border-props.js +22 -32
- package/build/hooks/use-border-props.js.map +1 -1
- package/build/store/actions.js +14 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +0 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +47 -15
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-alignment-matrix-control/index.js +1 -6
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +4 -70
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +50 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.native.js +449 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +28 -6
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- 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 +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +34 -5
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +2 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +4 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +8 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +5 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +38 -63
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +173 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -0
- package/build-module/components/block-popover/index.js +72 -0
- package/build-module/components/block-popover/index.js.map +1 -0
- package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -9
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +3 -3
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +16 -121
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +199 -0
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +151 -46
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/duotone-control/index.js +4 -1
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +1 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +32 -11
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -4
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +3 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +453 -44
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/dimensions.js +5 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-border-props.js +21 -30
- package/build-module/hooks/use-border-props.js.map +1 -1
- package/build-module/store/actions.js +14 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +0 -24
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +44 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +148 -410
- package/build-style/style.css +148 -410
- package/package.json +28 -28
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-content-overlay/index.js +9 -79
- package/src/components/block-content-overlay/style.scss +2 -11
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.native.js +458 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +7 -11
- package/src/components/block-list/block.native.js +38 -8
- package/src/components/block-list/index.native.js +54 -13
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/test/block-list-context.native.js +253 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +10 -5
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-lock/modal.js +42 -3
- package/src/components/block-lock/toolbar.js +2 -2
- package/src/components/block-lock/use-block-lock.js +4 -1
- package/src/components/block-mobile-toolbar/index.native.js +8 -1
- package/src/components/block-mover/button.js +5 -7
- package/src/components/block-mover/index.js +37 -60
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/stories/index.js +110 -0
- package/src/components/block-mover/style.scss +48 -138
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +6 -0
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/README.md +41 -0
- package/src/components/block-popover/inbetween.js +188 -0
- package/src/components/block-popover/index.js +75 -0
- package/src/components/block-popover/style.scss +28 -0
- package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-styles/index.js +1 -12
- package/src/components/block-switcher/style.scss +2 -43
- package/src/components/block-toolbar/style.scss +0 -12
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-selection-button.js +3 -1
- package/src/components/block-tools/index.js +6 -4
- package/src/components/block-tools/insertion-point.js +19 -152
- package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -151
- package/src/components/block-tools/style.scss +12 -135
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +7 -3
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/colors-gradients/dropdown.js +156 -62
- package/src/components/colors-gradients/style.scss +51 -23
- package/src/components/default-block-appender/style.scss +1 -2
- package/src/components/duotone-control/index.js +8 -1
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/gradients/README.md +29 -0
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +1 -3
- package/src/components/inserter/index.native.js +60 -25
- package/src/components/inserter/style.native.scss +25 -3
- package/src/components/inserter/style.scss +2 -1
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/use-search-handler.js +11 -5
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/index.js +11 -41
- package/src/components/list-view/style.scss +2 -1
- package/src/components/navigable-toolbar/README.md +16 -0
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +1 -3
- package/src/components/rich-text/index.native.js +0 -4
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +9 -4
- package/src/components/use-block-display-information/index.js +2 -0
- package/src/components/use-block-drop-zone/index.native.js +173 -0
- package/src/components/use-on-block-drop/index.native.js +119 -0
- package/src/components/use-setting/index.js +57 -21
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +429 -72
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.scss +0 -62
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +2 -1
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/style.js +25 -39
- package/src/hooks/test/settings.js +48 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/use-border-props.js +15 -32
- package/src/store/actions.js +14 -2
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +46 -15
- package/src/store/test/actions.js +0 -18
- package/src/store/test/reducer.js +0 -19
- package/src/store/test/selectors.js +17 -19
- package/src/style.scss +2 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-mobile-toolbar/index.js +0 -42
- package/build/components/block-mobile-toolbar/index.js.map +0 -1
- package/build/components/block-tools/block-popover.js +0 -327
- package/build/components/block-tools/block-popover.js.map +0 -1
- package/build/components/block-tools/use-popover-scroll.js.map +0 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build/components/list-view/appender.js +0 -93
- package/build/components/list-view/appender.js.map +0 -1
- package/build/components/list-view/list-item.js +0 -62
- package/build/components/list-view/list-item.js.map +0 -1
- package/build/components/rich-text/use-caret-in-format.js +0 -43
- package/build/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build/hooks/border-color.js +0 -302
- package/build/hooks/border-color.js.map +0 -1
- package/build/hooks/border-style.js +0 -96
- package/build/hooks/border-style.js.map +0 -1
- package/build/hooks/border-width.js +0 -162
- package/build/hooks/border-width.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.js +0 -31
- package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
- package/build-module/components/block-tools/block-popover.js +0 -306
- package/build-module/components/block-tools/block-popover.js.map +0 -1
- package/build-module/components/block-tools/use-popover-scroll.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/list-view/appender.js +0 -76
- package/build-module/components/list-view/appender.js.map +0 -1
- package/build-module/components/list-view/list-item.js +0 -47
- package/build-module/components/list-view/list-item.js.map +0 -1
- package/build-module/components/rich-text/use-caret-in-format.js +0 -33
- package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build-module/hooks/border-color.js +0 -276
- package/build-module/hooks/border-color.js.map +0 -1
- package/build-module/hooks/border-style.js +0 -78
- package/build-module/hooks/border-style.js.map +0 -1
- package/build-module/hooks/border-width.js +0 -143
- package/build-module/hooks/border-width.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/block-mobile-toolbar/index.js +0 -24
- package/src/components/block-mobile-toolbar/style.scss +0 -29
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
- package/src/components/list-view/appender.js +0 -82
- package/src/components/list-view/list-item.js +0 -59
- package/src/components/rich-text/use-caret-in-format.js +0 -28
- package/src/hooks/border-color.js +0 -315
- package/src/hooks/border-style.js +0 -64
- package/src/hooks/border-width.js +0 -139
|
@@ -19,8 +19,6 @@ var _icons = require("@wordpress/icons");
|
|
|
19
19
|
|
|
20
20
|
var _components = require("@wordpress/components");
|
|
21
21
|
|
|
22
|
-
var _blocks = require("@wordpress/blocks");
|
|
23
|
-
|
|
24
22
|
var _data = require("@wordpress/data");
|
|
25
23
|
|
|
26
24
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -44,38 +42,53 @@ var _store = require("../../store");
|
|
|
44
42
|
*/
|
|
45
43
|
function BlockMover(_ref) {
|
|
46
44
|
let {
|
|
47
|
-
isFirst,
|
|
48
|
-
isLast,
|
|
49
45
|
clientIds,
|
|
50
|
-
canMove,
|
|
51
|
-
isHidden,
|
|
52
|
-
rootClientId,
|
|
53
|
-
orientation,
|
|
54
46
|
hideDragHandle
|
|
55
47
|
} = _ref;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const {
|
|
49
|
+
canMove,
|
|
50
|
+
rootClientId,
|
|
51
|
+
isFirst,
|
|
52
|
+
isLast,
|
|
53
|
+
orientation
|
|
54
|
+
} = (0, _data.useSelect)(select => {
|
|
55
|
+
var _getBlockListSettings;
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
getBlockIndex,
|
|
59
|
+
getBlockListSettings,
|
|
60
|
+
canMoveBlocks,
|
|
61
|
+
getBlockOrder,
|
|
62
|
+
getBlockRootClientId
|
|
63
|
+
} = select(_store.store);
|
|
64
|
+
const normalizedClientIds = (0, _lodash.castArray)(clientIds);
|
|
65
|
+
const firstClientId = (0, _lodash.first)(normalizedClientIds);
|
|
66
|
+
|
|
67
|
+
const _rootClientId = getBlockRootClientId((0, _lodash.first)(normalizedClientIds));
|
|
68
|
+
|
|
69
|
+
const firstIndex = getBlockIndex(firstClientId);
|
|
70
|
+
const lastIndex = getBlockIndex((0, _lodash.last)(normalizedClientIds));
|
|
71
|
+
const blockOrder = getBlockOrder(_rootClientId);
|
|
72
|
+
return {
|
|
73
|
+
canMove: canMoveBlocks(clientIds, _rootClientId),
|
|
74
|
+
rootClientId: _rootClientId,
|
|
75
|
+
isFirst: firstIndex === 0,
|
|
76
|
+
isLast: lastIndex === blockOrder.length - 1,
|
|
77
|
+
orientation: (_getBlockListSettings = getBlockListSettings(_rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation
|
|
78
|
+
};
|
|
79
|
+
}, [clientIds]);
|
|
61
80
|
|
|
62
81
|
if (!canMove || isFirst && isLast && !rootClientId) {
|
|
63
82
|
return null;
|
|
64
83
|
}
|
|
65
84
|
|
|
66
|
-
const dragHandleLabel = (0, _i18n.__)('Drag');
|
|
67
|
-
|
|
68
|
-
// to an unfocused state (body as active element) without firing blur on,
|
|
69
|
-
// the rendering parent, leaving it unable to react to focus out.
|
|
70
|
-
|
|
71
|
-
return (0, _element.createElement)("div", {
|
|
85
|
+
const dragHandleLabel = (0, _i18n.__)('Drag');
|
|
86
|
+
return (0, _element.createElement)(_components.ToolbarGroup, {
|
|
72
87
|
className: (0, _classnames.default)('block-editor-block-mover', {
|
|
73
|
-
'is-visible': isFocused || !isHidden,
|
|
74
88
|
'is-horizontal': orientation === 'horizontal'
|
|
75
89
|
})
|
|
76
90
|
}, !hideDragHandle && (0, _element.createElement)(_blockDraggable.default, {
|
|
77
|
-
clientIds: clientIds
|
|
78
|
-
cloneClassname: "block-editor-block-mover__drag-clone"
|
|
91
|
+
clientIds: clientIds
|
|
79
92
|
}, draggableProps => (0, _element.createElement)(_components.Button, (0, _extends2.default)({
|
|
80
93
|
icon: _icons.dragHandle,
|
|
81
94
|
className: "block-editor-block-mover__drag-handle",
|
|
@@ -84,17 +97,11 @@ function BlockMover(_ref) {
|
|
|
84
97
|
// button can only be used with a pointer device.
|
|
85
98
|
,
|
|
86
99
|
tabIndex: "-1"
|
|
87
|
-
}, draggableProps))), (0, _element.createElement)(
|
|
100
|
+
}, draggableProps))), (0, _element.createElement)("div", {
|
|
88
101
|
className: "block-editor-block-mover__move-button-container"
|
|
89
|
-
}, (0, _element.createElement)(_components.ToolbarItem, {
|
|
90
|
-
onFocus: onFocus,
|
|
91
|
-
onBlur: onBlur
|
|
92
|
-
}, itemProps => (0, _element.createElement)(_button.BlockMoverUpButton, (0, _extends2.default)({
|
|
102
|
+
}, (0, _element.createElement)(_components.ToolbarItem, null, itemProps => (0, _element.createElement)(_button.BlockMoverUpButton, (0, _extends2.default)({
|
|
93
103
|
clientIds: clientIds
|
|
94
|
-
}, itemProps))), (0, _element.createElement)(_components.ToolbarItem, {
|
|
95
|
-
onFocus: onFocus,
|
|
96
|
-
onBlur: onBlur
|
|
97
|
-
}, itemProps => (0, _element.createElement)(_button.BlockMoverDownButton, (0, _extends2.default)({
|
|
104
|
+
}, itemProps))), (0, _element.createElement)(_components.ToolbarItem, null, itemProps => (0, _element.createElement)(_button.BlockMoverDownButton, (0, _extends2.default)({
|
|
98
105
|
clientIds: clientIds
|
|
99
106
|
}, itemProps)))));
|
|
100
107
|
}
|
|
@@ -103,39 +110,6 @@ function BlockMover(_ref) {
|
|
|
103
110
|
*/
|
|
104
111
|
|
|
105
112
|
|
|
106
|
-
var _default =
|
|
107
|
-
var _getBlockListSettings;
|
|
108
|
-
|
|
109
|
-
let {
|
|
110
|
-
clientIds
|
|
111
|
-
} = _ref2;
|
|
112
|
-
const {
|
|
113
|
-
getBlock,
|
|
114
|
-
getBlockIndex,
|
|
115
|
-
getBlockListSettings,
|
|
116
|
-
canMoveBlocks,
|
|
117
|
-
getBlockOrder,
|
|
118
|
-
getBlockRootClientId
|
|
119
|
-
} = select(_store.store);
|
|
120
|
-
const normalizedClientIds = (0, _lodash.castArray)(clientIds);
|
|
121
|
-
const firstClientId = (0, _lodash.first)(normalizedClientIds);
|
|
122
|
-
const block = getBlock(firstClientId);
|
|
123
|
-
const rootClientId = getBlockRootClientId((0, _lodash.first)(normalizedClientIds));
|
|
124
|
-
const firstIndex = getBlockIndex(firstClientId);
|
|
125
|
-
const lastIndex = getBlockIndex((0, _lodash.last)(normalizedClientIds));
|
|
126
|
-
const blockOrder = getBlockOrder(rootClientId);
|
|
127
|
-
const isFirst = firstIndex === 0;
|
|
128
|
-
const isLast = lastIndex === blockOrder.length - 1;
|
|
129
|
-
return {
|
|
130
|
-
blockType: block ? (0, _blocks.getBlockType)(block.name) : null,
|
|
131
|
-
canMove: canMoveBlocks(clientIds, rootClientId),
|
|
132
|
-
rootClientId,
|
|
133
|
-
firstIndex,
|
|
134
|
-
isFirst,
|
|
135
|
-
isLast,
|
|
136
|
-
orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation
|
|
137
|
-
};
|
|
138
|
-
})(BlockMover);
|
|
139
|
-
|
|
113
|
+
var _default = BlockMover;
|
|
140
114
|
exports.default = _default;
|
|
141
115
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"names":["BlockMover","
|
|
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","blockOrder","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EN,SAAF,CA1B+D,CAAhE;;AA6BA,MAAK,CAAEE,OAAF,IAAeE,OAAO,IAAIC,MAAX,IAAqB,CAAEF,YAA3C,EAA4D;AAC3D,WAAO,IAAP;AACA;;AAED,QAAMkB,eAAe,GAAG,cAAI,MAAJ,CAAxB;AAEA,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAG,yBAAY,0BAAZ,EAAwC;AACnD,uBAAiBf,WAAW,KAAK;AADkB,KAAxC;AADb,KAKG,CAAEL,cAAF,IACD,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGD;AAA5B,KACKsB,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,EAAGxB;AADb,KAEMwB,SAFN,EAFF,CADD,EASC,4BAAC,uBAAD,QACKA,SAAF,IACD,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAGxB;AADb,KAEMwB,SAFN,EAFF,CATD,CArBD,CADD;AA0CA;AAED;AACA;AACA;;;eACezB,U","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last, castArray } from 'lodash';\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 = castArray( clientIds );\n\t\t\tconst firstClientId = first( normalizedClientIds );\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tfirst( normalizedClientIds )\n\t\t\t);\n\t\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\t\tconst lastIndex = getBlockIndex( last( normalizedClientIds ) );\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"]}
|
|
@@ -53,6 +53,7 @@ const BlockMover = _ref => {
|
|
|
53
53
|
isStackedHorizontally
|
|
54
54
|
} = _ref;
|
|
55
55
|
const pickerRef = (0, _element.useRef)();
|
|
56
|
+
const [shouldPresentPicker, setShouldPresentPicker] = (0, _element.useState)(false);
|
|
56
57
|
const [blockPageMoverState, setBlockPageMoverState] = (0, _element.useState)(undefined);
|
|
57
58
|
|
|
58
59
|
const showBlockPageMover = direction => () => {
|
|
@@ -62,9 +63,18 @@ const BlockMover = _ref => {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
setBlockPageMoverState(direction);
|
|
65
|
-
|
|
66
|
-
};
|
|
66
|
+
setShouldPresentPicker(true);
|
|
67
|
+
}; // Ensure that the picker is only presented after state updates.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
(0, _element.useEffect)(() => {
|
|
71
|
+
if (shouldPresentPicker) {
|
|
72
|
+
var _pickerRef$current;
|
|
67
73
|
|
|
74
|
+
(_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : _pickerRef$current.presentPicker();
|
|
75
|
+
setShouldPresentPicker(false);
|
|
76
|
+
}
|
|
77
|
+
}, [shouldPresentPicker]);
|
|
68
78
|
const {
|
|
69
79
|
description: {
|
|
70
80
|
backwardButtonHint,
|
|
@@ -104,6 +114,9 @@ const BlockMover = _ref => {
|
|
|
104
114
|
if (option && option.onSelect) option.onSelect();
|
|
105
115
|
};
|
|
106
116
|
|
|
117
|
+
const onLongPressMoveUp = (0, _element.useCallback)(showBlockPageMover(BLOCK_MOVER_DIRECTION_TOP), []);
|
|
118
|
+
const onLongPressMoveDown = (0, _element.useCallback)(showBlockPageMover(BLOCK_MOVER_DIRECTION_BOTTOM), []);
|
|
119
|
+
|
|
107
120
|
if (!canMove || isFirst && isLast && !rootClientId) {
|
|
108
121
|
return null;
|
|
109
122
|
}
|
|
@@ -112,7 +125,7 @@ const BlockMover = _ref => {
|
|
|
112
125
|
title: !isFirst ? backwardButtonTitle : firstBlockTitle,
|
|
113
126
|
isDisabled: isFirst,
|
|
114
127
|
onClick: onMoveUp,
|
|
115
|
-
onLongPress:
|
|
128
|
+
onLongPress: onLongPressMoveUp,
|
|
116
129
|
icon: backwardButtonIcon,
|
|
117
130
|
extraProps: {
|
|
118
131
|
hint: backwardButtonHint
|
|
@@ -121,7 +134,7 @@ const BlockMover = _ref => {
|
|
|
121
134
|
title: !isLast ? forwardButtonTitle : lastBlockTitle,
|
|
122
135
|
isDisabled: isLast,
|
|
123
136
|
onClick: onMoveDown,
|
|
124
|
-
onLongPress:
|
|
137
|
+
onLongPress: onLongPressMoveDown,
|
|
125
138
|
icon: forwardButtonIcon,
|
|
126
139
|
extraProps: {
|
|
127
140
|
hint: forwardButtonHint
|
|
@@ -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","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","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,uBACvDC,SADuD,CAAxD;;AAGA,QAAMC,kBAAkB,GAAKC,SAAF,IAAiB,MAAM;AACjD,QAAK,CAAEL,SAAS,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,GAAP;AAWA,CAfD,CAxBc,EAwCdC,uBAxCc,EAyCZ7D,UAzCY,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 { 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 [ blockPageMoverState, setBlockPageMoverState ] = useState(\n\t\tundefined\n\t);\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\tpickerRef.current.presentPicker();\n\t};\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\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={ showBlockPageMover( BLOCK_MOVER_DIRECTION_TOP ) }\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={ showBlockPageMover(\n\t\t\t\t\tBLOCK_MOVER_DIRECTION_BOTTOM\n\t\t\t\t) }\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 } = dispatch(\n\t\t\tblockEditorStore\n\t\t);\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","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,IAAkD,uBACvDC,SADuD,CAAxD;;AAGA,QAAMC,kBAAkB,GAAKC,SAAF,IAAiB,MAAM;AACjD,QAAK,CAAEP,SAAS,CAACQ,OAAjB,EAA2B;AAC1BJ,MAAAA,s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,YADsE,CAAvE;AAGA,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,CAfD,CAxBc,EAwCdC,uBAxCc,EAyCZjE,UAzCY,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 ] = useState(\n\t\tundefined\n\t);\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 } = dispatch(\n\t\t\tblockEditorStore\n\t\t);\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"]}
|
|
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
+
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
15
|
+
|
|
14
16
|
var _components = require("@wordpress/components");
|
|
15
17
|
|
|
16
18
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -23,6 +25,10 @@ var _listView = _interopRequireDefault(require("../list-view"));
|
|
|
23
25
|
|
|
24
26
|
var _store = require("../../store");
|
|
25
27
|
|
|
28
|
+
/**
|
|
29
|
+
* WordPress dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* WordPress dependencies
|
|
28
34
|
*/
|
|
@@ -55,9 +61,12 @@ function BlockNavigationDropdownToggle(_ref) {
|
|
|
55
61
|
function BlockNavigationDropdown(_ref2, ref) {
|
|
56
62
|
let {
|
|
57
63
|
isDisabled,
|
|
58
|
-
__experimentalFeatures,
|
|
59
64
|
...props
|
|
60
65
|
} = _ref2;
|
|
66
|
+
(0, _deprecated.default)('wp.blockEditor.BlockNavigationDropdown', {
|
|
67
|
+
since: '6.1',
|
|
68
|
+
alternative: 'wp.components.Dropdown and wp.blockEditor.ListView'
|
|
69
|
+
});
|
|
61
70
|
const hasBlocks = (0, _data.useSelect)(select => !!select(_store.store).getBlockCount(), []);
|
|
62
71
|
const isEnabled = hasBlocks && !isDisabled;
|
|
63
72
|
return (0, _element.createElement)(_components.Dropdown, {
|
|
@@ -79,10 +88,7 @@ function BlockNavigationDropdown(_ref2, ref) {
|
|
|
79
88
|
className: "block-editor-block-navigation__container"
|
|
80
89
|
}, (0, _element.createElement)("p", {
|
|
81
90
|
className: "block-editor-block-navigation__label"
|
|
82
|
-
}, (0, _i18n.__)('List view')), (0, _element.createElement)(_listView.default,
|
|
83
|
-
showNestedBlocks: true,
|
|
84
|
-
__experimentalFeatures: __experimentalFeatures
|
|
85
|
-
}))
|
|
91
|
+
}, (0, _i18n.__)('List view')), (0, _element.createElement)(_listView.default, null))
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","listView","undefined","BlockNavigationDropdown","ref","isDisabled","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","listView","undefined","BlockNavigationDropdown","ref","isDisabled","since","alternative","hasBlocks","select","blockEditorStore","getBlockCount"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,6BAAT,OAMI;AAAA,MANoC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,QAFuC;AAGvCC,IAAAA,MAHuC;AAIvCC,IAAAA,QAJuC;AAKvC,OAAGC;AALoC,GAMpC;AACH,SACC,4BAAC,kBAAD,6BACMA,KADN;AAEC,IAAA,GAAG,EAAGD,QAF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ated';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { listView } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ListView from '../list-view';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockNavigationDropdownToggle( {\n\tisEnabled,\n\tonToggle,\n\tisOpen,\n\tinnerRef,\n\t...props\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ innerRef }\n\t\t\ticon={ listView }\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-haspopup=\"true\"\n\t\t\tonClick={ isEnabled ? onToggle : undefined }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'List view' ) }\n\t\t\tclassName=\"block-editor-block-navigation\"\n\t\t\taria-disabled={ ! isEnabled }\n\t\t/>\n\t);\n}\n\nfunction BlockNavigationDropdown( { isDisabled, ...props }, ref ) {\n\tdeprecated( 'wp.blockEditor.BlockNavigationDropdown', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.components.Dropdown and wp.blockEditor.ListView',\n\t} );\n\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\tconst isEnabled = hasBlocks && ! isDisabled;\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"block-editor-block-navigation__popover\"\n\t\t\tposition=\"bottom right\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<BlockNavigationDropdownToggle\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tinnerRef={ ref }\n\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tisEnabled={ isEnabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<div className=\"block-editor-block-navigation__container\">\n\t\t\t\t\t<p className=\"block-editor-block-navigation__label\">\n\t\t\t\t\t\t{ __( 'List view' ) }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<ListView />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( BlockNavigationDropdown );\n"]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.InsertionPointOpenRef = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _components = require("@wordpress/components");
|
|
19
|
+
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
22
|
+
var _store = require("../../store");
|
|
23
|
+
|
|
24
|
+
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
|
|
25
|
+
|
|
26
|
+
var _usePopoverScroll = _interopRequireDefault(require("./use-popover-scroll"));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* External dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* WordPress dependencies
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Internal dependencies
|
|
38
|
+
*/
|
|
39
|
+
const InsertionPointOpenRef = (0, _element.createContext)();
|
|
40
|
+
exports.InsertionPointOpenRef = InsertionPointOpenRef;
|
|
41
|
+
|
|
42
|
+
function BlockPopoverInbetween(_ref) {
|
|
43
|
+
let {
|
|
44
|
+
previousClientId,
|
|
45
|
+
nextClientId,
|
|
46
|
+
children,
|
|
47
|
+
__unstablePopoverSlot,
|
|
48
|
+
__unstableContentRef,
|
|
49
|
+
...props
|
|
50
|
+
} = _ref;
|
|
51
|
+
const {
|
|
52
|
+
orientation,
|
|
53
|
+
rootClientId
|
|
54
|
+
} = (0, _data.useSelect)(select => {
|
|
55
|
+
var _getBlockListSettings;
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
getBlockListSettings,
|
|
59
|
+
getBlockRootClientId
|
|
60
|
+
} = select(_store.store);
|
|
61
|
+
|
|
62
|
+
const _rootClientId = getBlockRootClientId(previousClientId);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
orientation: ((_getBlockListSettings = getBlockListSettings(_rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
|
|
66
|
+
rootClientId: _rootClientId
|
|
67
|
+
};
|
|
68
|
+
}, [previousClientId]);
|
|
69
|
+
const previousElement = (0, _useBlockRefs.__unstableUseBlockElement)(previousClientId);
|
|
70
|
+
const nextElement = (0, _useBlockRefs.__unstableUseBlockElement)(nextClientId);
|
|
71
|
+
const isVertical = orientation === 'vertical';
|
|
72
|
+
const style = (0, _element.useMemo)(() => {
|
|
73
|
+
if (!previousElement && !nextElement) {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
|
78
|
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
79
|
+
|
|
80
|
+
if (isVertical) {
|
|
81
|
+
return {
|
|
82
|
+
width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
|
|
83
|
+
height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let width = 0;
|
|
88
|
+
|
|
89
|
+
if (previousRect && nextRect) {
|
|
90
|
+
width = (0, _i18n.isRTL)() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
width,
|
|
95
|
+
height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
|
|
96
|
+
};
|
|
97
|
+
}, [previousElement, nextElement, isVertical]);
|
|
98
|
+
const getAnchorRect = (0, _element.useCallback)(() => {
|
|
99
|
+
if (!previousElement && !nextElement) {
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const {
|
|
104
|
+
ownerDocument
|
|
105
|
+
} = previousElement || nextElement;
|
|
106
|
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
|
107
|
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
108
|
+
|
|
109
|
+
if (isVertical) {
|
|
110
|
+
if ((0, _i18n.isRTL)()) {
|
|
111
|
+
return {
|
|
112
|
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
113
|
+
left: previousRect ? previousRect.right : nextRect.right,
|
|
114
|
+
right: previousRect ? previousRect.left : nextRect.left,
|
|
115
|
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
116
|
+
height: 0,
|
|
117
|
+
width: 0,
|
|
118
|
+
ownerDocument
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
124
|
+
left: previousRect ? previousRect.left : nextRect.left,
|
|
125
|
+
right: previousRect ? previousRect.right : nextRect.right,
|
|
126
|
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
127
|
+
height: 0,
|
|
128
|
+
width: 0,
|
|
129
|
+
ownerDocument
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if ((0, _i18n.isRTL)()) {
|
|
134
|
+
return {
|
|
135
|
+
top: previousRect ? previousRect.top : nextRect.top,
|
|
136
|
+
left: previousRect ? previousRect.left : nextRect.right,
|
|
137
|
+
right: nextRect ? nextRect.right : previousRect.left,
|
|
138
|
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
139
|
+
height: 0,
|
|
140
|
+
width: 0,
|
|
141
|
+
ownerDocument
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
top: previousRect ? previousRect.top : nextRect.top,
|
|
147
|
+
left: previousRect ? previousRect.right : nextRect.left,
|
|
148
|
+
right: nextRect ? nextRect.left : previousRect.right,
|
|
149
|
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
150
|
+
height: 0,
|
|
151
|
+
width: 0,
|
|
152
|
+
ownerDocument
|
|
153
|
+
};
|
|
154
|
+
}, [previousElement, nextElement]);
|
|
155
|
+
const popoverScrollRef = (0, _usePopoverScroll.default)(__unstableContentRef);
|
|
156
|
+
|
|
157
|
+
if (!previousElement || !nextElement) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
161
|
+
// While ideally it would be enough to capture the
|
|
162
|
+
// bubbling focus event from the Inserter, due to the
|
|
163
|
+
// characteristics of click focusing of `button`s in
|
|
164
|
+
// Firefox and Safari, it is not reliable.
|
|
165
|
+
//
|
|
166
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
return (0, _element.createElement)(_components.Popover, (0, _extends2.default)({
|
|
170
|
+
ref: popoverScrollRef,
|
|
171
|
+
animate: false,
|
|
172
|
+
getAnchorRect: getAnchorRect,
|
|
173
|
+
focusOnMount: false // Render in the old slot if needed for backward compatibility,
|
|
174
|
+
// otherwise render in place (not in the the default popover slot).
|
|
175
|
+
,
|
|
176
|
+
__unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes
|
|
177
|
+
// This makes sure the popover doesn't animate from its previous position.
|
|
178
|
+
,
|
|
179
|
+
key: nextClientId + '--' + rootClientId
|
|
180
|
+
}, props, {
|
|
181
|
+
className: (0, _classnames.default)('block-editor-block-popover', props.className),
|
|
182
|
+
__unstableForcePosition: true
|
|
183
|
+
}), (0, _element.createElement)("div", {
|
|
184
|
+
style: style
|
|
185
|
+
}, children));
|
|
186
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
var _default = BlockPopoverInbetween;
|
|
190
|
+
exports.default = _default;
|
|
191
|
+
//# sourceMappingURL=inbetween.js.map
|
|
@@ -0,0 +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","select","getBlockListSettings","getBlockRootClientId","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;AAAf,MAAgC,qBACnCC,MAAF,IAAc;AAAA;;AACb,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AA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B,GAAG,+BAAkB1B,oBAAlB,CAAzB;;AAEA,MAAK,CAAES,eAAF,IAAqB,CAAEC,WAA5B,EAA0C;AACzC,WAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SACC,4BAAC,mBAAD;AACC,IAAA,GAAG,EAAGgB,gBADP;AAEC,IAAA,OAAO,EAAG,KAFX;AAGC,IAAA,aAAa,EAAGF,aAHjB;AAIC,IAAA,YAAY,EAAG,KAJhB,CAKC;AACA;AAND;AAOC,IAAA,kBAAkB,EAAGzB,qBAAqB,IAAI,IAP/C,CAQC;AACA;AATD;AAUC,IAAA,GAAG,EAAGF,YAAY,GAAG,IAAf,GAAsBM;AAV7B,KAWMF,KAXN;AAYC,IAAA,SAAS,EAAG,yBACX,4BADW,EAEXA,KAAK,CAAC0B,SAFK,CAZb;AAgBC,IAAA,uBAAuB;AAhBxB,MAkBC;AAAK,IAAA,KAAK,EAAGf;AAAb,KAAuBd,QAAvB,CAlBD,CADD;AAsBA;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 } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockListSettings, getBlockRootClientId } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\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};\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 ) {\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 ) {\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\tif ( ! previousElement || ! nextElement ) {\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 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\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"]}
|