@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mover/index.native.js"],"names":["first","last","partial","castArray","Platform","__","Picker","ToolbarButton","withInstanceId","compose","withSelect","withDispatch","useRef","useState","getMoversSetup","store","blockEditorStore","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","OS","select","clientIds","getBlockIndex","canMoveBlocks","getBlockRootClientId","getBlockOrder","normalizedClientIds","firstClientId","blockOrder","lastIndex","length","dispatch","moveBlocksDown","moveBlocksUp","moveBlocksToPosition","targetIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,IAAhB,EAAsBC,OAAtB,EAA+BC,SAA/B,QAAgD,QAAhD;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA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,UAAU,GAAGsC,aAAa,CAAEK,aAAF,CAAhC;AACA,QAAME,SAAS,GAAGP,aAAa,CAAE/D,IAAI,CAAEmE,mBAAF,CAAN,CAA/B;AAEA,SAAO;AACN1C,IAAAA,UADM;AAENC,IAAAA,cAAc,EAAE2C,UAAU,CAACE,MAAX,GAAoB,CAF9B;AAGNpD,IAAAA,OAAO,EAAEM,UAAU,KAAK,CAHlB;AAINL,IAAAA,MAAM,EAAEkD,SAAS,KAAKD,UAAU,CAACE,MAAX,GAAoB,CAJpC;AAKNlD,IAAAA,OAAO,EAAE2C,aAAa,CAAEF,SAAF,EAAanC,YAAb,CALhB;AAMNA,IAAAA;AANM,GAAP;AAQA,CAtBS,CADW,EAwBrBjB,YAAY,CAAE,CAAE8D,QAAF,YAA6C;AAAA,MAAjC;AAAEV,IAAAA,SAAF;AAAanC,IAAAA;AAAb,GAAiC;AAC1D,QAAM;AAAE8C,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,MAAyDH,QAAQ,CACtEzD,gBADsE,CAAvE;AAGA,SAAO;AACNO,IAAAA,UAAU,EAAErB,OAAO,CAAEwE,cAAF,EAAkBX,SAAlB,EAA6BnC,YAA7B,CADb;AAENJ,IAAAA,QAAQ,EAAEtB,OAAO,CAAEyE,YAAF,EAAgBZ,SAAhB,EAA2BnC,YAA3B,CAFX;AAGNH,IAAAA,UAAU,EAAIoD,WAAF,IACX3E,OAAO,CACN0E,oBADM,EAENb,SAFM,EAGNnC,YAHM,EAINiD,WAJM;AAJF,GAAP;AAWA,CAfW,CAxBS,EAwCrBrE,cAxCqB,CAAP,CAyCZW,UAzCY,CAAf","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":["first","last","partial","castArray","Platform","__","Picker","ToolbarButton","withInstanceId","compose","withSelect","withDispatch","useCallback","useEffect","useRef","useState","getMoversSetup","store","blockEditorStore","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","OS","select","clientIds","getBlockIndex","canMoveBlocks","getBlockRootClientId","getBlockOrder","normalizedClientIds","firstClientId","blockOrder","lastIndex","length","dispatch","moveBlocksDown","moveBlocksUp","moveBlocksToPosition","targetIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,IAAhB,EAAsBC,OAAtB,EAA+BC,SAA/B,QAAgD,QAAhD;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SAASC,cAAT,EAAyBC,OAAzB,QAAwC,oBAAxC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,EAAyCC,QAAzC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,qBAA/B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,OAAO,MAAMC,yBAAyB,GAAG,iCAAlC;AACP,OAAO,MAAMC,4BAA4B,GACxC,oCADM;AAGP,OAAO,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,GAAGlB,MAAM,EAAxB;AACA,QAAM,CAAEmB,mBAAF,EAAuBC,sBAAv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U,CAACE,MAAX,GAAoB,CAJpC;AAKNtD,IAAAA,OAAO,EAAE+C,aAAa,CAAEF,SAAF,EAAavC,YAAb,CALhB;AAMNA,IAAAA;AANM,GAAP;AAQA,CAtBS,CADW,EAwBrBnB,YAAY,CAAE,CAAEoE,QAAF,YAA6C;AAAA,MAAjC;AAAEV,IAAAA,SAAF;AAAavC,IAAAA;AAAb,GAAiC;AAC1D,QAAM;AAAEkD,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,MAAyDH,QAAQ,CACtE7D,gBADsE,CAAvE;AAGA,SAAO;AACNO,IAAAA,UAAU,EAAEvB,OAAO,CAAE8E,cAAF,EAAkBX,SAAlB,EAA6BvC,YAA7B,CADb;AAENJ,IAAAA,QAAQ,EAAExB,OAAO,CAAE+E,YAAF,EAAgBZ,SAAhB,EAA2BvC,YAA3B,CAFX;AAGNH,IAAAA,UAAU,EAAIwD,WAAF,IACXjF,OAAO,CACNgF,oBADM,EAENb,SAFM,EAGNvC,YAHM,EAINqD,WAJM;AAJF,GAAP;AAWA,CAfW,CAxBS,EAwCrB3E,cAxCqB,CAAP,CAyCZa,UAzCY,CAAf","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"]}
|
|
@@ -4,6 +4,11 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* WordPress dependencies
|
|
6
6
|
*/
|
|
7
|
+
import deprecated from '@wordpress/deprecated';
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
import { Button, Dropdown } from '@wordpress/components';
|
|
8
13
|
import { __ } from '@wordpress/i18n';
|
|
9
14
|
import { useSelect } from '@wordpress/data';
|
|
@@ -41,9 +46,12 @@ function BlockNavigationDropdownToggle(_ref) {
|
|
|
41
46
|
function BlockNavigationDropdown(_ref2, ref) {
|
|
42
47
|
let {
|
|
43
48
|
isDisabled,
|
|
44
|
-
__experimentalFeatures,
|
|
45
49
|
...props
|
|
46
50
|
} = _ref2;
|
|
51
|
+
deprecated('wp.blockEditor.BlockNavigationDropdown', {
|
|
52
|
+
since: '6.1',
|
|
53
|
+
alternative: 'wp.components.Dropdown and wp.blockEditor.ListView'
|
|
54
|
+
});
|
|
47
55
|
const hasBlocks = useSelect(select => !!select(blockEditorStore).getBlockCount(), []);
|
|
48
56
|
const isEnabled = hasBlocks && !isDisabled;
|
|
49
57
|
return createElement(Dropdown, {
|
|
@@ -65,10 +73,7 @@ function BlockNavigationDropdown(_ref2, ref) {
|
|
|
65
73
|
className: "block-editor-block-navigation__container"
|
|
66
74
|
}, createElement("p", {
|
|
67
75
|
className: "block-editor-block-navigation__label"
|
|
68
|
-
}, __('List view')), createElement(ListView,
|
|
69
|
-
showNestedBlocks: true,
|
|
70
|
-
__experimentalFeatures: __experimentalFeatures
|
|
71
|
-
}))
|
|
76
|
+
}, __('List view')), createElement(ListView, null))
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["Button","Dropdown","__","useSelect","forwardRef","listView","ListView","store","blockEditorStore","BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","undefined","BlockNavigationDropdown","ref","isDisabled","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"names":["deprecated","Button","Dropdown","__","useSelect","forwardRef","listView","ListView","store","blockEditorStore","BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","undefined","BlockNavigationDropdown","ref","isDisabled","since","alternative","hasBlocks","select","getBlockCount"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,uBAAjC;AACA,SA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AEN,QAAAA,MAAF;AAAUD,QAAAA;AAAV,OAAF;AAAA,aACd,cAAC,6BAAD,eACMG,KADN;AAEC,QAAA,QAAQ,EAAGG,GAFZ;AAGC,QAAA,MAAM,EAAGL,MAHV;AAIC,QAAA,QAAQ,EAAGD,QAJZ;AAKC,QAAA,SAAS,EAAGD;AALb,SADc;AAAA,KAHhB;AAYC,IAAA,aAAa,EAAG,MACf;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAG,MAAA,SAAS,EAAC;AAAb,OACGR,EAAE,CAAE,WAAF,CADL,CADD,EAKC,cAAC,QAAD,OALD;AAbF,IADD;AAwBA;;AAED,eAAeE,UAAU,CAAEY,uBAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\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,173 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
13
|
+
import { useCallback, useMemo, createContext } from '@wordpress/element';
|
|
14
|
+
import { Popover } from '@wordpress/components';
|
|
15
|
+
import { isRTL } from '@wordpress/i18n';
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { store as blockEditorStore } from '../../store';
|
|
21
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
22
|
+
import usePopoverScroll from './use-popover-scroll';
|
|
23
|
+
export const InsertionPointOpenRef = createContext();
|
|
24
|
+
|
|
25
|
+
function BlockPopoverInbetween(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
previousClientId,
|
|
28
|
+
nextClientId,
|
|
29
|
+
children,
|
|
30
|
+
__unstablePopoverSlot,
|
|
31
|
+
__unstableContentRef,
|
|
32
|
+
...props
|
|
33
|
+
} = _ref;
|
|
34
|
+
const {
|
|
35
|
+
orientation,
|
|
36
|
+
rootClientId
|
|
37
|
+
} = useSelect(select => {
|
|
38
|
+
var _getBlockListSettings;
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
getBlockListSettings,
|
|
42
|
+
getBlockRootClientId
|
|
43
|
+
} = select(blockEditorStore);
|
|
44
|
+
|
|
45
|
+
const _rootClientId = getBlockRootClientId(previousClientId);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
orientation: ((_getBlockListSettings = getBlockListSettings(_rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
|
|
49
|
+
rootClientId: _rootClientId
|
|
50
|
+
};
|
|
51
|
+
}, [previousClientId]);
|
|
52
|
+
const previousElement = useBlockElement(previousClientId);
|
|
53
|
+
const nextElement = useBlockElement(nextClientId);
|
|
54
|
+
const isVertical = orientation === 'vertical';
|
|
55
|
+
const style = useMemo(() => {
|
|
56
|
+
if (!previousElement && !nextElement) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
|
61
|
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
62
|
+
|
|
63
|
+
if (isVertical) {
|
|
64
|
+
return {
|
|
65
|
+
width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
|
|
66
|
+
height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let width = 0;
|
|
71
|
+
|
|
72
|
+
if (previousRect && nextRect) {
|
|
73
|
+
width = isRTL() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
width,
|
|
78
|
+
height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
|
|
79
|
+
};
|
|
80
|
+
}, [previousElement, nextElement, isVertical]);
|
|
81
|
+
const getAnchorRect = useCallback(() => {
|
|
82
|
+
if (!previousElement && !nextElement) {
|
|
83
|
+
return {};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const {
|
|
87
|
+
ownerDocument
|
|
88
|
+
} = previousElement || nextElement;
|
|
89
|
+
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
|
|
90
|
+
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
|
|
91
|
+
|
|
92
|
+
if (isVertical) {
|
|
93
|
+
if (isRTL()) {
|
|
94
|
+
return {
|
|
95
|
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
96
|
+
left: previousRect ? previousRect.right : nextRect.right,
|
|
97
|
+
right: previousRect ? previousRect.left : nextRect.left,
|
|
98
|
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
99
|
+
height: 0,
|
|
100
|
+
width: 0,
|
|
101
|
+
ownerDocument
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
top: previousRect ? previousRect.bottom : nextRect.top,
|
|
107
|
+
left: previousRect ? previousRect.left : nextRect.left,
|
|
108
|
+
right: previousRect ? previousRect.right : nextRect.right,
|
|
109
|
+
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
110
|
+
height: 0,
|
|
111
|
+
width: 0,
|
|
112
|
+
ownerDocument
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (isRTL()) {
|
|
117
|
+
return {
|
|
118
|
+
top: previousRect ? previousRect.top : nextRect.top,
|
|
119
|
+
left: previousRect ? previousRect.left : nextRect.right,
|
|
120
|
+
right: nextRect ? nextRect.right : previousRect.left,
|
|
121
|
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
122
|
+
height: 0,
|
|
123
|
+
width: 0,
|
|
124
|
+
ownerDocument
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
top: previousRect ? previousRect.top : nextRect.top,
|
|
130
|
+
left: previousRect ? previousRect.right : nextRect.left,
|
|
131
|
+
right: nextRect ? nextRect.left : previousRect.right,
|
|
132
|
+
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
133
|
+
height: 0,
|
|
134
|
+
width: 0,
|
|
135
|
+
ownerDocument
|
|
136
|
+
};
|
|
137
|
+
}, [previousElement, nextElement]);
|
|
138
|
+
const popoverScrollRef = usePopoverScroll(__unstableContentRef);
|
|
139
|
+
|
|
140
|
+
if (!previousElement || !nextElement) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
144
|
+
// While ideally it would be enough to capture the
|
|
145
|
+
// bubbling focus event from the Inserter, due to the
|
|
146
|
+
// characteristics of click focusing of `button`s in
|
|
147
|
+
// Firefox and Safari, it is not reliable.
|
|
148
|
+
//
|
|
149
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
return createElement(Popover, _extends({
|
|
153
|
+
ref: popoverScrollRef,
|
|
154
|
+
animate: false,
|
|
155
|
+
getAnchorRect: getAnchorRect,
|
|
156
|
+
focusOnMount: false // Render in the old slot if needed for backward compatibility,
|
|
157
|
+
// otherwise render in place (not in the the default popover slot).
|
|
158
|
+
,
|
|
159
|
+
__unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes
|
|
160
|
+
// This makes sure the popover doesn't animate from its previous position.
|
|
161
|
+
,
|
|
162
|
+
key: nextClientId + '--' + rootClientId
|
|
163
|
+
}, props, {
|
|
164
|
+
className: classnames('block-editor-block-popover', props.className),
|
|
165
|
+
__unstableForcePosition: true
|
|
166
|
+
}), createElement("div", {
|
|
167
|
+
style: style
|
|
168
|
+
}, children));
|
|
169
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export default BlockPopoverInbetween;
|
|
173
|
+
//# sourceMappingURL=inbetween.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"names":["classnames","useSelect","useCallback","useMemo","createContext","Popover","isRTL","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","usePopoverScroll","InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","props","orientation","rootClientId","select","getBlockListSettings","getBlockRootClientId","_rootClientId","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,aAA/B,QAAoD,oBAApD;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,8CAA7D;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AAEA,OAAO,MAAMC,qBAAqB,GAAGR,aAAa,EA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,CAACS,KAAhB,GAAwBP,QAAQ,CAACM,IAF7C;AAGNC,MAAAA,KAAK,EAAEP,QAAQ,GAAGA,QAAQ,CAACM,IAAZ,GAAmBR,YAAY,CAACS,KAHzC;AAINF,MAAAA,MAAM,EAAEP,YAAY,GAAGA,YAAY,CAACO,MAAhB,GAAyBL,QAAQ,CAACK,MAJhD;AAKNF,MAAAA,MAAM,EAAE,CALF;AAMNF,MAAAA,KAAK,EAAE,CAND;AAONS,MAAAA;AAPM,KAAP;AASA,GA3DgC,EA2D9B,CAAEhB,eAAF,EAAmBC,WAAnB,CA3D8B,CAAjC;AA6DA,QAAMgB,gBAAgB,GAAGhC,gBAAgB,CAAEO,oBAAF,CAAzC;;AAEA,MAAK,CAAEQ,eAAF,IAAqB,CAAEC,WAA5B,EAA0C;AACzC,WAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SACC,cAAC,OAAD;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,EAAGxB,qBAAqB,IAAI,IAP/C,CAQC;AACA;AATD;AAUC,IAAA,GAAG,EAAGF,YAAY,GAAG,IAAf,GAAsBM;AAV7B,KAWMF,KAXN;AAYC,IAAA,SAAS,EAAGnB,UAAU,CACrB,4BADqB,EAErBmB,KAAK,CAACyB,SAFe,CAZvB;AAgBC,IAAA,uBAAuB;AAhBxB,MAkBC;AAAK,IAAA,KAAK,EAAGf;AAAb,KAAuBb,QAAvB,CAlBD,CADD;AAsBA;AACA;;AAED,eAAeH,qBAAf","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"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Popover } from '@wordpress/components';
|
|
13
|
+
import { useMemo } from '@wordpress/element';
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
19
|
+
import usePopoverScroll from './use-popover-scroll';
|
|
20
|
+
export default function BlockPopover(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
clientId,
|
|
23
|
+
bottomClientId,
|
|
24
|
+
children,
|
|
25
|
+
__unstableRefreshSize,
|
|
26
|
+
__unstableCoverTarget = false,
|
|
27
|
+
__unstablePopoverSlot,
|
|
28
|
+
__unstableContentRef,
|
|
29
|
+
...props
|
|
30
|
+
} = _ref;
|
|
31
|
+
const selectedElement = useBlockElement(clientId);
|
|
32
|
+
const lastSelectedElement = useBlockElement(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId);
|
|
33
|
+
const popoverScrollRef = usePopoverScroll(__unstableContentRef);
|
|
34
|
+
const style = useMemo(() => {
|
|
35
|
+
if (!selectedElement || lastSelectedElement !== selectedElement) {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
width: selectedElement.offsetWidth,
|
|
42
|
+
height: selectedElement.offsetHeight
|
|
43
|
+
};
|
|
44
|
+
}, [selectedElement, lastSelectedElement, __unstableRefreshSize]);
|
|
45
|
+
|
|
46
|
+
if (!selectedElement || bottomClientId && !lastSelectedElement) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const anchorRef = {
|
|
51
|
+
top: selectedElement,
|
|
52
|
+
bottom: lastSelectedElement
|
|
53
|
+
};
|
|
54
|
+
return createElement(Popover, _extends({
|
|
55
|
+
ref: popoverScrollRef,
|
|
56
|
+
animate: false,
|
|
57
|
+
position: "top right left",
|
|
58
|
+
focusOnMount: false,
|
|
59
|
+
anchorRef: anchorRef // Render in the old slot if needed for backward compatibility,
|
|
60
|
+
// otherwise render in place (not in the the default popover slot).
|
|
61
|
+
,
|
|
62
|
+
__unstableSlotName: __unstablePopoverSlot || null // Observe movement for block animations (especially horizontal).
|
|
63
|
+
,
|
|
64
|
+
__unstableObserveElement: selectedElement,
|
|
65
|
+
__unstableForcePosition: true
|
|
66
|
+
}, props, {
|
|
67
|
+
className: classnames('block-editor-block-popover', props.className)
|
|
68
|
+
}), __unstableCoverTarget && createElement("div", {
|
|
69
|
+
style: style
|
|
70
|
+
}, children), !__unstableCoverTarget && children);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"names":["classnames","Popover","useMemo","__unstableUseBlockElement","useBlockElement","usePopoverScroll","BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","props","selectedElement","lastSelectedElement","popoverScrollRef","style","position","width","offsetWidth","height","offsetHeight","anchorRef","top","bottom","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,8CAA7D;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AAEA,eAAe,SAASC,YAAT,OASX;AAAA,MATkC;AACrCC,IAAAA,QADqC;AAErCC,IAAAA,cAFqC;AAGrCC,IAAAA,QAHqC;AAIrCC,IAAAA,qBAJq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ACrB,4BADqB,EAErBc,KAAK,CAACa,SAFe;AAbvB,MAkBGhB,qBAAqB,IAAI;AAAK,IAAA,KAAK,EAAGO;AAAb,KAAuBT,QAAvB,CAlB5B,EAmBG,CAAEE,qBAAF,IAA2BF,QAnB9B,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Popover } from '@wordpress/components';\nimport { 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\nexport default function BlockPopover( {\n\tclientId,\n\tbottomClientId,\n\tchildren,\n\t__unstableRefreshSize,\n\t__unstableCoverTarget = false,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\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={ popoverScrollRef }\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 the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Observe movement for block animations (especially horizontal).\n\t\t\t__unstableObserveElement={ selectedElement }\n\t\t\t__unstableForcePosition\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"]}
|
|
@@ -10,7 +10,7 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
10
10
|
* @param {Object} scrollableRef
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function usePopoverScroll(scrollableRef) {
|
|
14
14
|
return useRefEffect(node => {
|
|
15
15
|
if (!scrollableRef) {
|
|
16
16
|
return;
|
|
@@ -35,4 +35,6 @@ export function usePopoverScroll(scrollableRef) {
|
|
|
35
35
|
};
|
|
36
36
|
}, [scrollableRef]);
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
export default usePopoverScroll;
|
|
38
40
|
//# sourceMappingURL=use-popover-scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-popover/use-popover-scroll.js"],"names":["useRefEffect","usePopoverScroll","scrollableRef","node","onWheel","event","deltaX","deltaY","current","scrollBy","options","passive","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,aAA3B,EAA2C;AAC1C,SAAOF,YAAY,CAChBG,IAAF,IAAY;AACX,QAAK,CAAED,aAAP,EAAuB;AACtB;AACA;;AAED,aAASE,OAAT,CAAkBC,KAAlB,EAA0B;AACzB,YAAM;AAAEC,QAAAA,MAAF;AAAUC,QAAAA;AAAV,UAAqBF,KAA3B;AACAH,MAAAA,aAAa,CAACM,OAAd,CAAsBC,QAAtB,CAAgCH,MAAhC,EAAwCC,MAAxC;AACA,KARU,CASX;AACA;;;AACA,UAAMG,OAAO,GAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAAhB;AACAR,IAAAA,IAAI,CAACS,gBAAL,CAAuB,OAAvB,EAAgCR,OAAhC,EAAyCM,OAAzC;AACA,WAAO,MAAM;AACZP,MAAAA,IAAI,CAACU,mBAAL,CAA0B,OAA1B,EAAmCT,OAAnC,EAA4CM,OAA5C;AACA,KAFD;AAGA,GAjBiB,EAkBlB,CAAER,aAAF,CAlBkB,CAAnB;AAoBA;;AAED,eAAeD,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} scrollableRef\n */\nfunction usePopoverScroll( scrollableRef ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! scrollableRef ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY } = event;\n\t\t\t\tscrollableRef.current.scrollBy( deltaX, deltaY );\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ scrollableRef ]\n\t);\n}\n\nexport default usePopoverScroll;\n"]}
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { useDisabled, useMergeRefs } from '@wordpress/compose';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { memo, useMemo } from '@wordpress/element';
|
|
15
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"names":["castArray","classnames","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"names":["castArray","classnames","useDisabled","useMergeRefs","useSelect","memo","useMemo","BlockEditorProvider","LiveBlockPreview","AutoHeightBlockPreview","store","blockEditorStore","BlockListItems","BlockPreview","blocks","__experimentalPadding","viewportWidth","__experimentalLive","__experimentalOnClick","__experimentalMinHeight","originalSettings","select","getSettings","settings","_settings","__experimentalBlockPatterns","renderedBlocks","length","useBlockPreview","props","__experimentalLayout","disabledRef","ref","children","className"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,oBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,EAAeC,OAAf,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,OAAOC,gBAAP,MAA6B,QAA7B;AACA,OAAOC,sBAAP,MAAmC,QAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,cAAT,QAA+B,eAA/B;AAEA,OAAO,SAASC,YAAT,OAOH;AAAA,MAP0B;AAC7BC,IAAAA,MAD6B;AAE7BC,IAAAA,qBAAqB,GAAG,CAFK;AAG7BC,IAAAA,aAAa,GAAG,IAHa;AAI7BC,IAAAA,kBAAkB,GAAG,KAJQ;AAK7BC,IAAAA,qBAL6B;AAM7BC,IAAAA;AAN6B,GAO1B;AACH,QAAMC,gBAAgB,GAAGhB,SAAS,CAC/BiB,MAAF,IAAcA,MAAM,CAAEV,gBAAF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AAW,EAA/B;AACA,QAAM8B,GAAG,GAAG7B,YAAY,CAAE,CAAE0B,KAAK,CAACG,GAAR,EAAaD,WAAb,CAAF,CAAxB;AACA,QAAMR,QAAQ,GAAGjB,OAAO,CACvB,OAAQ,EAAE,GAAGc,gBAAL;AAAuBK,IAAAA,2BAA2B,EAAE;AAApD,GAAR,CADuB,EAEvB,CAAEL,gBAAF,CAFuB,CAAxB;AAIA,QAAMM,cAAc,GAAGpB,OAAO,CAAE,MAAMN,SAAS,CAAEc,MAAF,CAAjB,EAA6B,CAAEA,MAAF,CAA7B,CAA9B;AAEA,QAAMmB,QAAQ,GACb,cAAC,mBAAD;AAAqB,IAAA,KAAK,EAAGP,cAA7B;AAA8C,IAAA,QAAQ,EAAGH;AAAzD,KACC,cAAC,cAAD;AACC,IAAA,cAAc,EAAG,KADlB;AAEC,IAAA,oBAAoB,EAAGO;AAFxB,IADD,CADD;AASA,SAAO,EACN,GAAGD,KADG;AAENG,IAAAA,GAFM;AAGNE,IAAAA,SAAS,EAAEjC,UAAU,CACpB4B,KAAK,CAACK,SADc,EAEpB,0CAFoB,EAGpB,qBAHoB,CAHf;AAQND,IAAAA,QAAQ,EAAEnB,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEa,MAAR,GAAiBM,QAAjB,GAA4B;AARhC,GAAP;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockEditorProvider from '../provider';\nimport LiveBlockPreview from './live';\nimport AutoHeightBlockPreview from './auto';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\n\nexport function BlockPreview( {\n\tblocks,\n\t__experimentalPadding = 0,\n\tviewportWidth = 1200,\n\t__experimentalLive = false,\n\t__experimentalOnClick,\n\t__experimentalMinHeight,\n} ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo( () => {\n\t\tconst _settings = { ...originalSettings };\n\t\t_settings.__experimentalBlockPatterns = [];\n\t\treturn _settings;\n\t}, [ originalSettings ] );\n\tconst renderedBlocks = useMemo( () => castArray( blocks ), [ blocks ] );\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BlockEditorProvider value={ renderedBlocks } settings={ settings }>\n\t\t\t{ __experimentalLive ? (\n\t\t\t\t<LiveBlockPreview onClick={ __experimentalOnClick } />\n\t\t\t) : (\n\t\t\t\t<AutoHeightBlockPreview\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t__experimentalPadding={ __experimentalPadding }\n\t\t\t\t\t__experimentalMinHeight={ __experimentalMinHeight }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockEditorProvider>\n\t);\n}\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {WPComponent} The component to be rendered.\n */\nexport default memo( BlockPreview );\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.__experimentalLayout Layout settings to be used in the preview.\n *\n */\nexport function useBlockPreview( {\n\tblocks,\n\tprops = {},\n\t__experimentalLayout,\n} ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __experimentalBlockPatterns: [] } ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo( () => castArray( blocks ), [ blocks ] );\n\n\tconst children = (\n\t\t<BlockEditorProvider value={ renderedBlocks } settings={ settings }>\n\t\t\t<BlockListItems\n\t\t\t\trenderAppender={ false }\n\t\t\t\t__experimentalLayout={ __experimentalLayout }\n\t\t\t/>\n\t\t</BlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"]}
|
|
@@ -11,7 +11,6 @@ import classnames from 'classnames';
|
|
|
11
11
|
|
|
12
12
|
import { useState, useLayoutEffect } from '@wordpress/element';
|
|
13
13
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
|
-
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
15
14
|
import { Button, __experimentalText as Text, Slot, Fill } from '@wordpress/components';
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
@@ -113,15 +112,8 @@ function BlockStyles(_ref3) {
|
|
|
113
112
|
onFocus: () => styleItemHandler(style),
|
|
114
113
|
onMouseLeave: () => styleItemHandler(null),
|
|
115
114
|
onBlur: () => styleItemHandler(null),
|
|
116
|
-
onKeyDown: event => {
|
|
117
|
-
if (ENTER === event.keyCode || SPACE === event.keyCode) {
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
onSelectStylePreview(style);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
115
|
onClick: () => onSelectStylePreview(style),
|
|
123
|
-
|
|
124
|
-
tabIndex: "0"
|
|
116
|
+
"aria-current": activeStyle.name === style.name
|
|
125
117
|
}, createElement(Text, {
|
|
126
118
|
as: "span",
|
|
127
119
|
limit: 12,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","debounce","classnames","useState","useLayoutEffect","useViewportMatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","debounce","classnames","useState","useLayoutEffect","useViewportMatch","Button","__experimentalText","Text","Slot","Fill","BlockStylesPreviewPanel","useStylesForBlocks","BlockStylesPreviewPanelSlot","scope","BlockStylesPreviewPanelFill","children","props","DEFAULT_POSITION_TOP","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","containerScrollTop","setContainerScrollTop","isMobileViewport","scrollContainer","document","querySelector","scrollTop","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","top"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,QAAf,QAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,oBAA1C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SACCC,MADD,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,IAHD,EAICC,IAJD,QAKO,uBALP;AAOA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,iBAApC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;;AAEA,SAASC,2BAAT,OAAkD;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AACjD,SAAO,cAAC,IAAD;AAAM,IAAA,IAAI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AAaC,MAAA,YAAY,EAAG,MAAME,gBAAgB,CAAE,IAAF,CAbtC;AAcC,MAAA,MAAM,EAAG,MAAMA,gBAAgB,CAAE,IAAF,CAdhC;AAeC,MAAA,OAAO,EAAG,MAAMH,oBAAoB,CAAEC,KAAF,CAfrC;AAgBC,sBAAehB,WAAW,CAACoB,IAAZ,KAAqBJ,KAAK,CAACI;AAhB3C,OAkBC,cAAC,IAAD;AACC,MAAA,EAAE,EAAC,MADJ;AAEC,MAAA,KAAK,EAAG,EAFT;AAGC,MAAA,aAAa,EAAC,MAHf;AAIC,MAAA,SAAS,EAAC,sCAJX;AAKC,MAAA,QAAQ;AALT,OAOGE,UAPH,CAlBD,CADD;AA8BA,GAjCC,CADH,CADD,EAqCGlB,YAAY,IAAI,CAAEI,gBAAlB,IACD,cAAC,2BAAD;AACC,IAAA,KAAK,EAAGnB,KADT;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,KAAK,EAAG;AAAEmC,MAAAA,GAAG,EAAElB;AAAP,KAHT;AAIC,IAAA,YAAY,EAAG,MAAMY,gBAAgB,CAAE,IAAF;AAJtC,KAMC,cAAC,uBAAD;AACC,IAAA,WAAW,EAAGlB,WADf;AAEC,IAAA,SAAS,EAAGG,gBAFb;AAGC,IAAA,mBAAmB,EAAGF,mBAHvB;AAIC,IAAA,KAAK,EAAGG;AAJT,IAND,CAtCF,CADD;AAuDA;;AAEDV,WAAW,CAACV,IAAZ,GAAmBI,2BAAnB;AACA,eAAeM,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { noop, debounce } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useLayoutEffect } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\tSlot,\n\tFill,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nfunction BlockStylesPreviewPanelSlot( { scope } ) {\n\treturn <Slot name={ `BlockStylesPreviewPanel/${ scope }` } />;\n}\n\nfunction BlockStylesPreviewPanelFill( { children, scope, ...props } ) {\n\treturn (\n\t\t<Fill name={ `BlockStylesPreviewPanel/${ scope }` }>\n\t\t\t<div { ...props }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\n// Top position (in px) of the Block Styles container\n// relative to the editor pane.\n// The value is the equivalent of the container's right position.\nconst DEFAULT_POSITION_TOP = 16;\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( {\n\tclientId,\n\tonSwitch = noop,\n\tonHoverClassName = noop,\n\tscope,\n} ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst [ containerScrollTop, setContainerScrollTop ] = useState( 0 );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tuseLayoutEffect( () => {\n\t\tconst scrollContainer = document.querySelector(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\t\tsetContainerScrollTop( scrollTop + DEFAULT_POSITION_TOP );\n\t}, [ hoveredStyle ] );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\taria-current={ activeStyle.name === style.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tlimit={ 12 }\n\t\t\t\t\t\t\t\tellipsizeMode=\"tail\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t\ttruncate\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<BlockStylesPreviewPanelFill\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\tstyle={ { top: containerScrollTop } }\n\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t>\n\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t/>\n\t\t\t\t</BlockStylesPreviewPanelFill>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nBlockStyles.Slot = BlockStylesPreviewPanelSlot;\nexport default BlockStyles;\n"]}
|
|
@@ -11,7 +11,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import InsertionPoint, { InsertionPointOpenRef } from './insertion-point';
|
|
14
|
-
import BlockPopover from './block-popover';
|
|
14
|
+
import BlockPopover from './selected-block-popover';
|
|
15
15
|
export default function BlockToolsBackCompat(_ref) {
|
|
16
16
|
let {
|
|
17
17
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"names":["useContext","Disabled","deprecated","InsertionPoint","InsertionPointOpenRef","BlockPopover","BlockToolsBackCompat","children","openRef","isDisabled","Context","alternative","since"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,IAAyBC,qBAAzB,QAAsD,mBAAtD;AACA,OAAOC,YAAP,MAAyB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"names":["useContext","Disabled","deprecated","InsertionPoint","InsertionPointOpenRef","BlockPopover","BlockToolsBackCompat","children","openRef","isDisabled","Context","alternative","since"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,IAAyBC,qBAAzB,QAAsD,mBAAtD;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AAEA,eAAe,SAASC,oBAAT,OAA8C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC5D,QAAMC,OAAO,GAAGR,UAAU,CAAEI,qBAAF,CAA1B;AACA,QAAMK,UAAU,GAAGT,UAAU,CAAEC,QAAQ,CAACS,OAAX,CAA7B,CAF4D,CAI5D;;AACA,MAAKF,OAAO,IAAIC,UAAhB,EAA6B;AAC5B,WAAOF,QAAP;AACA;;AAEDL,EAAAA,UAAU,CAAE,iDAAF,EAAqD;AAC9DS,IAAAA,WAAW,EAAE,2BADiD;AAE9DC,IAAAA,KAAK,EAAE;AAFuD,GAArD,CAAV;AAKA,SACC,cAAC,cAAD;AAAgB,IAAA,qBAAqB,EAAC;AAAtC,KACC,cAAC,YAAD;AAAc,IAAA,qBAAqB,EAAC;AAApC,IADD,EAEGL,QAFH,CADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InsertionPoint, { InsertionPointOpenRef } from './insertion-point';\nimport BlockPopover from './selected-block-popover';\n\nexport default function BlockToolsBackCompat( { children } ) {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// If context is set, `BlockTools` is a parent component.\n\tif ( openRef || isDisabled ) {\n\t\treturn children;\n\t}\n\n\tdeprecated( 'wp.components.Popover.Slot name=\"block-toolbar\"', {\n\t\talternative: 'wp.blockEditor.BlockTools',\n\t\tsince: '5.8',\n\t} );\n\n\treturn (\n\t\t<InsertionPoint __unstablePopoverSlot=\"block-toolbar\">\n\t\t\t<BlockPopover __unstablePopoverSlot=\"block-toolbar\" />\n\t\t\t{ children }\n\t\t</InsertionPoint>\n\t);\n}\n"]}
|
|
@@ -27,6 +27,7 @@ import BlockIcon from '../block-icon';
|
|
|
27
27
|
import { store as blockEditorStore } from '../../store';
|
|
28
28
|
import BlockDraggable from '../block-draggable';
|
|
29
29
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
30
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
30
31
|
/**
|
|
31
32
|
* Block selection button component, displaying the label of the block. If the block
|
|
32
33
|
* descends from a root block, a button is displayed enabling the user to select
|
|
@@ -41,8 +42,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
41
42
|
function BlockSelectionButton(_ref) {
|
|
42
43
|
let {
|
|
43
44
|
clientId,
|
|
44
|
-
rootClientId
|
|
45
|
-
blockElement
|
|
45
|
+
rootClientId
|
|
46
46
|
} = _ref;
|
|
47
47
|
const blockInformation = useBlockDisplayInformation(clientId);
|
|
48
48
|
const selected = useSelect(select => {
|
|
@@ -87,6 +87,7 @@ function BlockSelectionButton(_ref) {
|
|
|
87
87
|
ref.current.focus();
|
|
88
88
|
speak(label);
|
|
89
89
|
}, [label]);
|
|
90
|
+
const blockElement = useBlockElement(clientId);
|
|
90
91
|
const {
|
|
91
92
|
hasBlockMovingClientId,
|
|
92
93
|
getBlockIndex,
|