@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/index.native.js"],"names":["CHIP_OFFSET_TO_TOUCH_POSITION","BLOCK_OPACITY_ANIMATION_CONFIG","duration","BLOCK_OPACITY_ANIMATION_DELAY","DEFAULT_LONG_PRESS_MIN_DURATION","DEFAULT_IOS_LONG_PRESS_MIN_DURATION","BlockDraggableWrapper","children","isRTL","draggedBlockIcon","setDraggedBlockIcon","selectBlock","startDraggingBlocks","stopDraggingBlocks","blockEditorStore","scrollRef","animatedScrollRef","left","right","width","safeAreaOffset","contentWidth","scroll","offsetY","chip","x","y","height","currentYPosition","isDragging","startScrolling","scrollOnDragOver","stopScrolling","draggingScrollHandler","scrollHandler","event","contentOffset","value","onBlockDragOver","onBlockDragEnd","onBlockDrop","targetBlockIndex","setDraggedBlockIconByClientId","clientId","blockName","getBlockName","blockIcon","icon","onStartDragging","position","stopDragging","onStopDragging","srcRootClientId","srcClientIds","type","undefined","onChipLayout","nativeEvent","layout","startDragging","id","dragPosition","updateDragging","chipDynamicStyles","chipOffset","translateX","transform","translateY","chipStyles","styles","exitingAnimation","currentHeight","currentWidth","animations","scale","initialValues","onScroll","ZoomInEasyDown","BlockDraggable","draggingClientId","enabled","wasBeingDragged","isEditingText","setIsEditingText","isScreenReaderEnabled","setIsScreenReaderEnabled","draggingAnimation","opacity","startDraggingBlock","stopDraggingBlock","isDraggable","isBeingDragged","isBlockSelected","_select","getBlockRootClientId","getTemplateLock","isBlockBeingDragged","getSelectedBlockClientId","rootClientId","templateLock","selectedBlockClientId","current","onFocusChangeAztec","isFocused","mounted","isAnyAztecInputFocused","RCTAztecView","InputState","addFocusChangeListener","screenReaderChangedListener","AccessibilityInfo","addEventListener","then","screenReaderEnabled","removeFocusChangeListener","remove","onLongPressDraggable","blurCurrentFocusedElement","animatedWrapperStyles","wrapperStyles","canDragBlock","Platform","select","ios","android"],"mappings":";;;;;;;;;AAwBA;;AArBA;;AACA;;AAIA;;AAcA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA5CA;AACA;AACA;;AAiBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAMA,6BAA6B,GAAG,EAAtC;AACA,MAAMC,8BAA8B,GAAG;AAAEC,EAAAA,QAAQ,EAAE;AAAZ,CAAvC;AACA,MAAMC,6BAA6B,GAAG,GAAtC;AACA,MAAMC,+BAA+B,GAAG,GAAxC;AACA,MAAMC,mCAAmC,GACxCD,+BAA+B,GAAG,EADnC;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,qBAAqB,GAAG,QAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AACxD,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,wBAAlD;AAEA,QAAM;AACLC,IAAAA,WADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,4CAAtB;AACA,QAAMC,iBAAiB,GAAG,4CAA1B;AACA,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAkB,oDAAxB;AACA,QAAM;AAAE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AAiCA,QAAMC,oBAAoB,GAAG,0BAAa,MAAM;AAC/C;AACAV,8BAAaC,UAAb,CAAwBU,yBAAxB;AACA,GAH4B,EAG1B,EAH0B,CAA7B;AAKA,QAAMC,qBAAqB,GAAG,6CAAkB,MAAM;AACrD,WAAO;AACN/B,MAAAA,OAAO,EAAED,iBAAiB,CAACC,OAAlB,CAA0BlD;AAD7B,KAAP;AAGA,GAJ6B,CAA9B;AAKA,QAAMkF,aAAa,GAAG,CACrBD,qBADqB,EAErBjD,eAAQ,8BAAR,CAFqB,CAAtB;AAKA,QAAMmD,YAAY,GACjBxC,OAAO,IACP,CAAEI,qBADF,KAEE,CAAEQ,eAAF,IAAqB,CAAEV,aAFzB,CADD;;AAKA,MAAK,CAAEQ,WAAP,EAAqB;AACpB,WAAOnF,QAAQ,CAAE;AAAEmF,MAAAA,WAAW,EAAE;AAAf,KAAF,CAAf;AACA;;AAED,SACC,4BAAC,4BAAD;AACC,IAAA,EAAE,EAAGX,gBAAgB,IAAIpC,QAD1B;AAEC,IAAA,OAAO,EAAGqC,OAAO,IAAIwC,YAFtB;AAGC,IAAA,WAAW,EAAGC,kBAASC,MAAT,CAAiB;AAC9B;AACA;AACA;AACA;AACAC,MAAAA,GAAG,EAAEH,YAAY,GACdnH,mCADc,GAEdD,+BAP2B;AAQ9BwH,MAAAA,OAAO,EAAExH;AARqB,KAAjB,CAHf;AAaC,IAAA,WAAW,EAAGgH;AAbf,KAeC,4BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAGG;AAAvB,KACGhH,QAAQ,CAAE;AAAEmF,IAAAA,WAAW,EAAE;AAAf,GAAF,CADX,CAfD,CADD;AAqBA,CAnJD;;eAsJeZ,c","sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo } from 'react-native';\nimport {\n\tuseSafeAreaInsets,\n\tuseSafeAreaFrame,\n} from 'react-native-safe-area-context';\nimport Animated, {\n\trunOnJS,\n\trunOnUI,\n\tuseAnimatedRef,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithDelay,\n\twithTiming,\n\tZoomInEasyDown,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { Draggable, DraggableTrigger } from '@wordpress/components';\nimport { select, useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tPlatform,\n} from '@wordpress/element';\nimport { getBlockType } from '@wordpress/blocks';\nimport { generateHapticFeedback } from '@wordpress/react-native-bridge';\nimport RCTAztecView from '@wordpress/react-native-aztec';\n\n/**\n * Internal dependencies\n */\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport DraggableChip from './draggable-chip';\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockListContext } from '../block-list/block-list-context';\nimport DroppingInsertionPoint from './dropping-insertion-point';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport styles from './style.scss';\n\nconst CHIP_OFFSET_TO_TOUCH_POSITION = 32;\nconst BLOCK_OPACITY_ANIMATION_CONFIG = { duration: 350 };\nconst BLOCK_OPACITY_ANIMATION_DELAY = 250;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 500;\nconst DEFAULT_IOS_LONG_PRESS_MIN_DURATION =\n\tDEFAULT_LONG_PRESS_MIN_DURATION - 50;\n\n/**\n * Block draggable wrapper component\n *\n * This component handles all the interactions for dragging blocks.\n * It relies on the block list and its context for dragging, hence it\n * should be rendered between the `BlockListProvider` component and the\n * block list rendering. It also requires listening to scroll events,\n * therefore for this purpose, it returns the `onScroll` event handler\n * that should be attached to the list that renders the blocks.\n *\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {boolean} props.isRTL Check if current locale is RTL.\n *\n * @return {Function} Render function that passes `onScroll` event handler.\n */\nconst BlockDraggableWrapper = ( { children, isRTL } ) => {\n\tconst [ draggedBlockIcon, setDraggedBlockIcon ] = useState();\n\n\tconst {\n\t\tselectBlock,\n\t\tstartDraggingBlocks,\n\t\tstopDraggingBlocks,\n\t} = useDispatch( blockEditorStore );\n\n\tconst { scrollRef } = useBlockListContext();\n\tconst animatedScrollRef = useAnimatedRef();\n\tconst { left, right } = useSafeAreaInsets();\n\tconst { width } = useSafeAreaFrame();\n\tconst safeAreaOffset = left + right;\n\tconst contentWidth = width - safeAreaOffset;\n\tanimatedScrollRef( scrollRef );\n\n\tconst scroll = {\n\t\toffsetY: useSharedValue( 0 ),\n\t};\n\tconst chip = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t\twidth: useSharedValue( 0 ),\n\t\theight: useSharedValue( 0 ),\n\t};\n\tconst currentYPosition = useSharedValue( 0 );\n\tconst isDragging = useSharedValue( false );\n\n\tconst [\n\t\tstartScrolling,\n\t\tscrollOnDragOver,\n\t\tstopScrolling,\n\t\tdraggingScrollHandler,\n\t] = useScrollWhenDragging();\n\n\tconst scrollHandler = ( event ) => {\n\t\t'worklet';\n\t\tconst { contentOffset } = event;\n\t\tscroll.offsetY.value = contentOffset.y;\n\n\t\tdraggingScrollHandler( event );\n\t};\n\n\tconst {\n\t\tonBlockDragOver,\n\t\tonBlockDragEnd,\n\t\tonBlockDrop,\n\t\ttargetBlockIndex,\n\t} = useBlockDropZone();\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.value ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tconst setDraggedBlockIconByClientId = ( clientId ) => {\n\t\tconst blockName = select( blockEditorStore ).getBlockName( clientId );\n\t\tconst blockIcon = getBlockType( blockName )?.icon;\n\t\tif ( blockIcon ) {\n\t\t\tsetDraggedBlockIcon( blockIcon );\n\t\t}\n\t};\n\n\tconst onStartDragging = ( { clientId, position } ) => {\n\t\tif ( clientId ) {\n\t\t\tstartDraggingBlocks( [ clientId ] );\n\t\t\tsetDraggedBlockIconByClientId( clientId );\n\t\t\trunOnUI( startScrolling )( position.y );\n\t\t\tgenerateHapticFeedback();\n\t\t} else {\n\t\t\t// We stop dragging if no block is found.\n\t\t\trunOnUI( stopDragging )();\n\t\t}\n\t};\n\n\tconst onStopDragging = ( { clientId } ) => {\n\t\tif ( clientId ) {\n\t\t\tonBlockDrop( {\n\t\t\t\t// Dropping is only allowed at root level\n\t\t\t\tsrcRootClientId: '',\n\t\t\t\tsrcClientIds: [ clientId ],\n\t\t\t\ttype: 'block',\n\t\t\t} );\n\t\t\tselectBlock( clientId );\n\t\t\tsetDraggedBlockIcon( undefined );\n\t\t}\n\t\tonBlockDragEnd();\n\t\tstopDraggingBlocks();\n\t};\n\n\tconst onChipLayout = ( { nativeEvent: { layout } } ) => {\n\t\tif ( layout.width > 0 ) {\n\t\t\tchip.width.value = layout.width;\n\t\t}\n\t\tif ( layout.height > 0 ) {\n\t\t\tchip.height.value = layout.height;\n\t\t}\n\t};\n\n\tconst startDragging = ( { x, y, id } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\tisDragging.value = true;\n\n\t\trunOnJS( onStartDragging )( { clientId: id, position: dragPosition } );\n\t};\n\n\tconst updateDragging = ( { x, y } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\trunOnJS( onBlockDragOver )( { x, y: y + scroll.offsetY.value } );\n\n\t\t// Update scrolling velocity\n\t\tscrollOnDragOver( dragPosition.y );\n\t};\n\n\tconst stopDragging = ( { id } ) => {\n\t\t'worklet';\n\t\tisDragging.value = false;\n\n\t\tstopScrolling();\n\t\trunOnJS( onStopDragging )( { clientId: id } );\n\t};\n\n\tconst chipDynamicStyles = useAnimatedStyle( () => {\n\t\tconst chipOffset = chip.width.value / 2;\n\t\tconst translateX = ! isRTL\n\t\t\t? chip.x.value - chipOffset\n\t\t\t: -( contentWidth - ( chip.x.value + chipOffset ) );\n\n\t\treturn {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateX,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateY:\n\t\t\t\t\t\tchip.y.value -\n\t\t\t\t\t\tchip.height.value -\n\t\t\t\t\t\tCHIP_OFFSET_TO_TOUCH_POSITION,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t} );\n\tconst chipStyles = [\n\t\tchipDynamicStyles,\n\t\tstyles[ 'draggable-chip__wrapper' ],\n\t];\n\n\tconst exitingAnimation = ( { currentHeight, currentWidth } ) => {\n\t\t'worklet';\n\t\tconst translateX = ! isRTL ? 0 : currentWidth * -1;\n\t\tconst duration = 150;\n\t\tconst animations = {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: withTiming( currentHeight, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateX: withTiming( translateX, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{ scale: withTiming( 0, { duration } ) },\n\t\t\t],\n\t\t};\n\t\tconst initialValues = {\n\t\t\ttransform: [ { translateY: 0 }, { translateX }, { scale: 1 } ],\n\t\t};\n\t\treturn {\n\t\t\tinitialValues,\n\t\t\tanimations,\n\t\t};\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DroppingInsertionPoint\n\t\t\t\tscroll={ scroll }\n\t\t\t\tcurrentYPosition={ currentYPosition }\n\t\t\t\tisDragging={ isDragging }\n\t\t\t\ttargetBlockIndex={ targetBlockIndex }\n\t\t\t/>\n\t\t\t<Draggable\n\t\t\t\tonDragStart={ startDragging }\n\t\t\t\tonDragOver={ updateDragging }\n\t\t\t\tonDragEnd={ stopDragging }\n\t\t\t>\n\t\t\t\t{ children( { onScroll: scrollHandler } ) }\n\t\t\t</Draggable>\n\t\t\t<Animated.View\n\t\t\t\tonLayout={ onChipLayout }\n\t\t\t\tstyle={ chipStyles }\n\t\t\t\tpointerEvents=\"none\"\n\t\t\t>\n\t\t\t\t{ draggedBlockIcon && (\n\t\t\t\t\t<Animated.View\n\t\t\t\t\t\tentering={ ZoomInEasyDown.duration( 200 ) }\n\t\t\t\t\t\texiting={ exitingAnimation }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DraggableChip icon={ draggedBlockIcon } />\n\t\t\t\t\t</Animated.View>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\n/**\n * Block draggable component\n *\n * This component serves for animating the block when it is being dragged.\n * Hence, it should be wrapped around the rendering of a block.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {string} props.clientId Client id of the block.\n * @param {string} [props.draggingClientId] Client id to use for dragging. If not defined, the value from `clientId` will be used.\n * @param {boolean} [props.enabled] Enables the draggable trigger.\n *\n * @return {Function} Render function which includes the parameter `isDraggable` to determine if the block can be dragged.\n */\nconst BlockDraggable = ( {\n\tclientId,\n\tchildren,\n\tdraggingClientId,\n\tenabled = true,\n} ) => {\n\tconst wasBeingDragged = useRef( false );\n\tconst [ isEditingText, setIsEditingText ] = useState( false );\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tconst draggingAnimation = {\n\t\topacity: useSharedValue( 1 ),\n\t};\n\n\tconst startDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withTiming(\n\t\t\t0.4,\n\t\t\tBLOCK_OPACITY_ANIMATION_CONFIG\n\t\t);\n\t};\n\n\tconst stopDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withDelay(\n\t\t\tBLOCK_OPACITY_ANIMATION_DELAY,\n\t\t\twithTiming( 1, BLOCK_OPACITY_ANIMATION_CONFIG )\n\t\t);\n\t};\n\n\tconst { isDraggable, isBeingDragged, isBlockSelected } = useSelect(\n\t\t( _select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = _select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst templateLock = rootClientId\n\t\t\t\t? getTemplateLock( rootClientId )\n\t\t\t\t: null;\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisBeingDragged: isBlockBeingDragged( clientId ),\n\t\t\t\tisDraggable: 'all' !== templateLock,\n\t\t\t\tisBlockSelected:\n\t\t\t\t\tselectedBlockClientId && selectedBlockClientId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isBeingDragged !== wasBeingDragged.current ) {\n\t\t\tif ( isBeingDragged ) {\n\t\t\t\tstartDraggingBlock();\n\t\t\t} else {\n\t\t\t\tstopDraggingBlock();\n\t\t\t}\n\t\t}\n\t\twasBeingDragged.current = isBeingDragged;\n\t}, [ isBeingDragged ] );\n\n\tconst onFocusChangeAztec = useCallback( ( { isFocused } ) => {\n\t\tsetIsEditingText( isFocused );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet mounted = true;\n\n\t\tconst isAnyAztecInputFocused = RCTAztecView.InputState.isFocused();\n\t\tif ( isAnyAztecInputFocused ) {\n\t\t\tsetIsEditingText( isAnyAztecInputFocused );\n\t\t}\n\n\t\tRCTAztecView.InputState.addFocusChangeListener( onFocusChangeAztec );\n\n\t\tconst screenReaderChangedListener = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tif ( mounted ) {\n\t\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tmounted = false;\n\n\t\t\tRCTAztecView.InputState.removeFocusChangeListener(\n\t\t\t\tonFocusChangeAztec\n\t\t\t);\n\n\t\t\tscreenReaderChangedListener.remove();\n\t\t};\n\t}, [] );\n\n\tconst onLongPressDraggable = useCallback( () => {\n\t\t// Ensure that no text input is focused when starting the dragging gesture in order to prevent conflicts with text editing.\n\t\tRCTAztecView.InputState.blurCurrentFocusedElement();\n\t}, [] );\n\n\tconst animatedWrapperStyles = useAnimatedStyle( () => {\n\t\treturn {\n\t\t\topacity: draggingAnimation.opacity.value,\n\t\t};\n\t} );\n\tconst wrapperStyles = [\n\t\tanimatedWrapperStyles,\n\t\tstyles[ 'draggable-wrapper__container' ],\n\t];\n\n\tconst canDragBlock =\n\t\tenabled &&\n\t\t! isScreenReaderEnabled &&\n\t\t( ! isBlockSelected || ! isEditingText );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { isDraggable: false } );\n\t}\n\n\treturn (\n\t\t<DraggableTrigger\n\t\t\tid={ draggingClientId || clientId }\n\t\t\tenabled={ enabled && canDragBlock }\n\t\t\tminDuration={ Platform.select( {\n\t\t\t\t// On iOS, using a lower min duration than the default\n\t\t\t\t// value prevents the long-press gesture from being\n\t\t\t\t// triggered in underneath elements. This is required to\n\t\t\t\t// prevent enabling text editing when dragging is available.\n\t\t\t\tios: canDragBlock\n\t\t\t\t\t? DEFAULT_IOS_LONG_PRESS_MIN_DURATION\n\t\t\t\t\t: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t\tandroid: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t} ) }\n\t\t\tonLongPress={ onLongPressDraggable }\n\t\t>\n\t\t\t<Animated.View style={ wrapperStyles }>\n\t\t\t\t{ children( { isDraggable: true } ) }\n\t\t\t</Animated.View>\n\t\t</DraggableTrigger>\n\t);\n};\n\nexport { BlockDraggableWrapper };\nexport default BlockDraggable;\n"]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useScrollWhenDragging;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
11
|
+
|
|
12
|
+
var _blockListContext = require("../block-list/block-list-context");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
const SCROLL_INACTIVE_DISTANCE_PX = 50;
|
|
22
|
+
const SCROLL_INTERVAL_MS = 1000;
|
|
23
|
+
const VELOCITY_MULTIPLIER = 5000;
|
|
24
|
+
/**
|
|
25
|
+
* React hook that scrolls the scroll container when a block is being dragged.
|
|
26
|
+
*
|
|
27
|
+
* @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling`
|
|
28
|
+
* functions to be called in `onDragStart`, `onDragOver`
|
|
29
|
+
* and `onDragEnd` events respectively. Additionally,
|
|
30
|
+
* `scrollHandler` function is returned which should be
|
|
31
|
+
* called in the `onScroll` event of the block list.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function useScrollWhenDragging() {
|
|
35
|
+
const {
|
|
36
|
+
scrollRef
|
|
37
|
+
} = (0, _blockListContext.useBlockListContext)();
|
|
38
|
+
const animatedScrollRef = (0, _reactNativeReanimated.useAnimatedRef)();
|
|
39
|
+
animatedScrollRef(scrollRef);
|
|
40
|
+
const {
|
|
41
|
+
height: windowHeight
|
|
42
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
43
|
+
const velocityY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
44
|
+
const offsetY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
45
|
+
const dragStartY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
46
|
+
const animationTimer = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
47
|
+
const isAnimationTimerActive = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
48
|
+
const isScrollActive = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
49
|
+
const scroll = {
|
|
50
|
+
offsetY: (0, _reactNativeReanimated.useSharedValue)(0),
|
|
51
|
+
maxOffsetY: (0, _reactNativeReanimated.useSharedValue)(0)
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const scrollHandler = event => {
|
|
55
|
+
'worklet';
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
contentSize,
|
|
59
|
+
contentOffset,
|
|
60
|
+
layoutMeasurement
|
|
61
|
+
} = event;
|
|
62
|
+
scroll.offsetY.value = contentOffset.y;
|
|
63
|
+
scroll.maxOffsetY.value = contentSize.height - layoutMeasurement.height;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const stopScrolling = () => {
|
|
67
|
+
'worklet';
|
|
68
|
+
|
|
69
|
+
(0, _reactNativeReanimated.cancelAnimation)(animationTimer);
|
|
70
|
+
isAnimationTimerActive.value = false;
|
|
71
|
+
isScrollActive.value = false;
|
|
72
|
+
velocityY.value = 0;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const startScrolling = y => {
|
|
76
|
+
'worklet';
|
|
77
|
+
|
|
78
|
+
stopScrolling();
|
|
79
|
+
offsetY.value = scroll.offsetY.value;
|
|
80
|
+
dragStartY.value = y;
|
|
81
|
+
animationTimer.value = 0;
|
|
82
|
+
animationTimer.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(1, {
|
|
83
|
+
duration: SCROLL_INTERVAL_MS,
|
|
84
|
+
easing: _reactNativeReanimated.Easing.linear
|
|
85
|
+
}), -1, true);
|
|
86
|
+
isAnimationTimerActive.value = true;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const scrollOnDragOver = y => {
|
|
90
|
+
'worklet';
|
|
91
|
+
|
|
92
|
+
const dragDistance = Math.max(Math.abs(y - dragStartY.value) - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
|
93
|
+
const distancePercentage = dragDistance / windowHeight;
|
|
94
|
+
|
|
95
|
+
if (!isScrollActive.value) {
|
|
96
|
+
isScrollActive.value = dragDistance > 0;
|
|
97
|
+
} else if (y > dragStartY.value) {
|
|
98
|
+
// User is dragging downwards.
|
|
99
|
+
velocityY.value = VELOCITY_MULTIPLIER * distancePercentage;
|
|
100
|
+
} else if (y < dragStartY.value) {
|
|
101
|
+
// User is dragging upwards.
|
|
102
|
+
velocityY.value = -VELOCITY_MULTIPLIER * distancePercentage;
|
|
103
|
+
} else {
|
|
104
|
+
velocityY.value = 0;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => animationTimer.value, (value, previous) => {
|
|
109
|
+
if (velocityY.value === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const delta = Math.abs(value - previous);
|
|
114
|
+
let newOffset = offsetY.value + delta * velocityY.value;
|
|
115
|
+
|
|
116
|
+
if (scroll.maxOffsetY.value !== 0) {
|
|
117
|
+
newOffset = Math.max(0, Math.min(scroll.maxOffsetY.value, newOffset));
|
|
118
|
+
} else {
|
|
119
|
+
// Scroll values are empty until receiving the first scroll event.
|
|
120
|
+
// In that case, the max offset is unknown and we can't clamp the
|
|
121
|
+
// new offset value.
|
|
122
|
+
newOffset = Math.max(0, newOffset);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
offsetY.value = newOffset;
|
|
126
|
+
(0, _reactNativeReanimated.scrollTo)(animatedScrollRef, 0, offsetY.value, false);
|
|
127
|
+
});
|
|
128
|
+
return [startScrolling, scrollOnDragOver, stopScrolling, scrollHandler];
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=use-scroll-when-dragging.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/use-scroll-when-dragging.native.js"],"names":["SCROLL_INACTIVE_DISTANCE_PX","SCROLL_INTERVAL_MS","VELOCITY_MULTIPLIER","useScrollWhenDragging","scrollRef","animatedScrollRef","height","windowHeight","velocityY","offsetY","dragStartY","animationTimer","isAnimationTimerActive","isScrollActive","scroll","maxOffsetY","scrollHandler","event","contentSize","contentOffset","layoutMeasurement","value","y","stopScrolling","startScrolling","duration","easing","Easing","linear","scrollOnDragOver","dragDistance","Math","max","abs","distancePercentage","previous","delta","newOffset","min"],"mappings":";;;;;;;AAGA;;AACA;;AAcA;;AAlBA;AACA;AACA;;AAaA;AACA;AACA;AAGA,MAAMA,2BAA2B,GAAG,EAApC;AACA,MAAMC,kBAAkB,GAAG,IAA3B;AACA,MAAMC,mBAAmB,GAAG,IAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,qBAAT,GAAiC;AAC/C,QAAM;AAAEC,IAAAA;AAAF,MAAgB,4CAAtB;AACA,QAAMC,iBAAiB,GAAG,4CAA1B;AACAA,EAAAA,iBAAiB,CAAED,SAAF,CAAjB;AAEA,QAAM;AAAEE,IAAAA,MAAM,EAAEC;AAAV,MAA2B,uCAAjC;AAEA,QAAMC,SAAS,GAAG,2CAAgB,CAAhB,CAAlB;AACA,QAAMC,OAAO,GAAG,2CAAgB,CAAhB,CAAhB;AACA,QAAMC,UAAU,GAAG,2CAAgB,CAAhB,CAAnB;AACA,QAAMC,cAAc,GAAG,2CAAgB,CAAhB,CAAvB;AACA,QAAMC,sBAAsB,GAAG,2CAAgB,KAAhB,CAA/B;AACA,QAAMC,cAAc,GAAG,2CAAgB,KAAhB,CAAvB;AAEA,QAAMC,MAAM,GAAG;AACdL,IAAAA,OAAO,EAAE,2CAAgB,CAAhB,CADK;AAEdM,IAAAA,UAAU,EAAE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GAAgBgB,SAAhB;AACA,yCAAUhC,iBAAV,EAA6B,CAA7B,EAAgCI,OAAO,CAACY,KAAxC,EAA+C,KAA/C;AACA,GAxBF;AA2BA,SAAO,CAAEG,cAAF,EAAkBK,gBAAlB,EAAoCN,aAApC,EAAmDP,aAAnD,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { useWindowDimensions } from 'react-native';\nimport {\n\tuseSharedValue,\n\tuseAnimatedRef,\n\tscrollTo,\n\tuseAnimatedReaction,\n\twithTiming,\n\twithRepeat,\n\tcancelAnimation,\n\tEasing,\n} from 'react-native-reanimated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockListContext } from '../block-list/block-list-context';\n\nconst SCROLL_INACTIVE_DISTANCE_PX = 50;\nconst SCROLL_INTERVAL_MS = 1000;\nconst VELOCITY_MULTIPLIER = 5000;\n\n/**\n * React hook that scrolls the scroll container when a block is being dragged.\n *\n * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling`\n * functions to be called in `onDragStart`, `onDragOver`\n * and `onDragEnd` events respectively. Additionally,\n * \t\t\t\t\t\t`scrollHandler` function is returned which should be\n * \t\t\t\t\t\tcalled in the `onScroll` event of the block list.\n */\nexport default function useScrollWhenDragging() {\n\tconst { scrollRef } = useBlockListContext();\n\tconst animatedScrollRef = useAnimatedRef();\n\tanimatedScrollRef( scrollRef );\n\n\tconst { height: windowHeight } = useWindowDimensions();\n\n\tconst velocityY = useSharedValue( 0 );\n\tconst offsetY = useSharedValue( 0 );\n\tconst dragStartY = useSharedValue( 0 );\n\tconst animationTimer = useSharedValue( 0 );\n\tconst isAnimationTimerActive = useSharedValue( false );\n\tconst isScrollActive = useSharedValue( false );\n\n\tconst scroll = {\n\t\toffsetY: useSharedValue( 0 ),\n\t\tmaxOffsetY: useSharedValue( 0 ),\n\t};\n\tconst scrollHandler = ( event ) => {\n\t\t'worklet';\n\t\tconst { contentSize, contentOffset, layoutMeasurement } = event;\n\t\tscroll.offsetY.value = contentOffset.y;\n\t\tscroll.maxOffsetY.value = contentSize.height - layoutMeasurement.height;\n\t};\n\n\tconst stopScrolling = () => {\n\t\t'worklet';\n\t\tcancelAnimation( animationTimer );\n\n\t\tisAnimationTimerActive.value = false;\n\t\tisScrollActive.value = false;\n\t\tvelocityY.value = 0;\n\t};\n\n\tconst startScrolling = ( y ) => {\n\t\t'worklet';\n\t\tstopScrolling();\n\t\toffsetY.value = scroll.offsetY.value;\n\t\tdragStartY.value = y;\n\n\t\tanimationTimer.value = 0;\n\t\tanimationTimer.value = withRepeat(\n\t\t\twithTiming( 1, {\n\t\t\t\tduration: SCROLL_INTERVAL_MS,\n\t\t\t\teasing: Easing.linear,\n\t\t\t} ),\n\t\t\t-1,\n\t\t\ttrue\n\t\t);\n\t\tisAnimationTimerActive.value = true;\n\t};\n\n\tconst scrollOnDragOver = ( y ) => {\n\t\t'worklet';\n\t\tconst dragDistance = Math.max(\n\t\t\tMath.abs( y - dragStartY.value ) - SCROLL_INACTIVE_DISTANCE_PX,\n\t\t\t0\n\t\t);\n\t\tconst distancePercentage = dragDistance / windowHeight;\n\n\t\tif ( ! isScrollActive.value ) {\n\t\t\tisScrollActive.value = dragDistance > 0;\n\t\t} else if ( y > dragStartY.value ) {\n\t\t\t// User is dragging downwards.\n\t\t\tvelocityY.value = VELOCITY_MULTIPLIER * distancePercentage;\n\t\t} else if ( y < dragStartY.value ) {\n\t\t\t// User is dragging upwards.\n\t\t\tvelocityY.value = -VELOCITY_MULTIPLIER * distancePercentage;\n\t\t} else {\n\t\t\tvelocityY.value = 0;\n\t\t}\n\t};\n\n\tuseAnimatedReaction(\n\t\t() => animationTimer.value,\n\t\t( value, previous ) => {\n\t\t\tif ( velocityY.value === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst delta = Math.abs( value - previous );\n\t\t\tlet newOffset = offsetY.value + delta * velocityY.value;\n\n\t\t\tif ( scroll.maxOffsetY.value !== 0 ) {\n\t\t\t\tnewOffset = Math.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min( scroll.maxOffsetY.value, newOffset )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Scroll values are empty until receiving the first scroll event.\n\t\t\t\t// In that case, the max offset is unknown and we can't clamp the\n\t\t\t\t// new offset value.\n\t\t\t\tnewOffset = Math.max( 0, newOffset );\n\t\t\t}\n\n\t\t\toffsetY.value = newOffset;\n\t\t\tscrollTo( animatedScrollRef, 0, offsetY.value, false );\n\t\t}\n\t);\n\n\treturn [ startScrolling, scrollOnDragOver, stopScrolling, scrollHandler ];\n}\n"]}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_BLOCK_LIST_CONTEXT = exports.BlockListProvider = exports.BlockListConsumer = void 0;
|
|
7
|
+
exports.deleteBlockLayoutByClientId = deleteBlockLayoutByClientId;
|
|
8
|
+
exports.useBlockListContext = void 0;
|
|
9
|
+
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_BLOCK_LIST_CONTEXT = {
|
|
22
|
+
scrollRef: null,
|
|
23
|
+
blocksLayouts: {
|
|
24
|
+
current: {}
|
|
25
|
+
},
|
|
26
|
+
findBlockLayoutByClientId,
|
|
27
|
+
getBlockLayoutsOrderedByYCoord,
|
|
28
|
+
findBlockLayoutByPosition,
|
|
29
|
+
updateBlocksLayouts
|
|
30
|
+
};
|
|
31
|
+
exports.DEFAULT_BLOCK_LIST_CONTEXT = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
32
|
+
const Context = (0, _element.createContext)(DEFAULT_BLOCK_LIST_CONTEXT);
|
|
33
|
+
const {
|
|
34
|
+
Provider,
|
|
35
|
+
Consumer
|
|
36
|
+
} = Context;
|
|
37
|
+
/**
|
|
38
|
+
* Finds a block's layout data by position.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} data Blocks layouts object.
|
|
41
|
+
* @param {Object} position Position to use for finding the block.
|
|
42
|
+
* @param {number} position.x X coordinate.
|
|
43
|
+
* @param {number} position.y Y coordinate.
|
|
44
|
+
*
|
|
45
|
+
* @return {Object|undefined} Found block layout data that matches the provided position. If none is found, `undefined` will be returned.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
exports.BlockListConsumer = Consumer;
|
|
49
|
+
exports.BlockListProvider = Provider;
|
|
50
|
+
|
|
51
|
+
function findBlockLayoutByPosition(data, position) {
|
|
52
|
+
// Only enabled for root level blocks
|
|
53
|
+
return Object.values(data).find(block => {
|
|
54
|
+
return position.x >= block.x && position.x <= block.x + block.width && position.y >= block.y && position.y <= block.y + block.height;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Finds a block's layout data by its client Id.
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} data Blocks layouts object.
|
|
61
|
+
* @param {string} clientId Block's clientId.
|
|
62
|
+
*
|
|
63
|
+
* @return {Object} Found block layout data.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function findBlockLayoutByClientId(data, clientId) {
|
|
68
|
+
return Object.entries(data).reduce((acc, entry) => {
|
|
69
|
+
const item = entry[1];
|
|
70
|
+
|
|
71
|
+
if (acc) {
|
|
72
|
+
return acc;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if ((item === null || item === void 0 ? void 0 : item.clientId) === clientId) {
|
|
76
|
+
return item;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (item !== null && item !== void 0 && item.innerBlocks && Object.keys(item.innerBlocks).length > 0) {
|
|
80
|
+
return findBlockLayoutByClientId(item.innerBlocks, clientId);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}, null);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Deletes the layout data of a block by its client Id.
|
|
88
|
+
*
|
|
89
|
+
* @param {Object} data Blocks layouts object.
|
|
90
|
+
* @param {string} clientId Block's clientsId.
|
|
91
|
+
*
|
|
92
|
+
* @return {Object} Updated data object.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
function deleteBlockLayoutByClientId(data, clientId) {
|
|
97
|
+
return Object.keys(data).reduce((acc, key) => {
|
|
98
|
+
var _data$key;
|
|
99
|
+
|
|
100
|
+
if (key !== clientId) {
|
|
101
|
+
acc[key] = data[key];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if ((_data$key = data[key]) !== null && _data$key !== void 0 && _data$key.innerBlocks && Object.keys(data[key].innerBlocks).length > 0) {
|
|
105
|
+
if (acc[key]) {
|
|
106
|
+
acc[key].innerBlocks = deleteBlockLayoutByClientId(data[key].innerBlocks, clientId);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return acc;
|
|
111
|
+
}, {});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Orders the block's layout data by its Y coordinate.
|
|
115
|
+
*
|
|
116
|
+
* @param {Object} data Blocks layouts object.
|
|
117
|
+
*
|
|
118
|
+
* @return {Object} Blocks layouts object ordered by its Y coordinate.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
function getBlockLayoutsOrderedByYCoord(data) {
|
|
123
|
+
// Only enabled for root level blocks.
|
|
124
|
+
// Using lodash orderBy due to hermes not having
|
|
125
|
+
// stable support for native .sort(). It will be
|
|
126
|
+
// supported in the React Native version 0.68.0.
|
|
127
|
+
return (0, _lodash.orderBy)(data, ['y', 'asc']);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Updates or deletes a block's layout data in the blocksLayouts object,
|
|
131
|
+
* in case of deletion, the layout data is not required.
|
|
132
|
+
*
|
|
133
|
+
* @param {Object} blocksLayouts Blocks layouts object.
|
|
134
|
+
* @param {Object} blockData Block's layout data to add or remove to/from the blockLayouts object.
|
|
135
|
+
* @param {string} blockData.clientId Block's clientId.
|
|
136
|
+
* @param {?string} blockData.rootClientId Optional. Block's rootClientId.
|
|
137
|
+
* @param {?boolean} blockData.shouldRemove Optional. Flag to remove it from the blocksLayout list.
|
|
138
|
+
* @param {number} blockData.width Block's width.
|
|
139
|
+
* @param {number} blockData.height Block's height.
|
|
140
|
+
* @param {number} blockData.x Block's x coordinate (relative to the parent).
|
|
141
|
+
* @param {number} blockData.y Block's y coordinate (relative to the parent).
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
function updateBlocksLayouts(blocksLayouts, blockData) {
|
|
146
|
+
const {
|
|
147
|
+
clientId,
|
|
148
|
+
rootClientId,
|
|
149
|
+
shouldRemove,
|
|
150
|
+
...layoutProps
|
|
151
|
+
} = blockData;
|
|
152
|
+
|
|
153
|
+
if (clientId && shouldRemove) {
|
|
154
|
+
blocksLayouts.current = deleteBlockLayoutByClientId(blocksLayouts.current, clientId);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (clientId && !rootClientId) {
|
|
159
|
+
var _blocksLayouts$curren;
|
|
160
|
+
|
|
161
|
+
blocksLayouts.current[clientId] = {
|
|
162
|
+
clientId,
|
|
163
|
+
rootClientId,
|
|
164
|
+
...layoutProps,
|
|
165
|
+
innerBlocks: { ...((_blocksLayouts$curren = blocksLayouts.current[clientId]) === null || _blocksLayouts$curren === void 0 ? void 0 : _blocksLayouts$curren.innerBlocks)
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
} else if (clientId && rootClientId) {
|
|
169
|
+
const block = findBlockLayoutByClientId(blocksLayouts.current, rootClientId);
|
|
170
|
+
|
|
171
|
+
if (block) {
|
|
172
|
+
var _block$innerBlocks$cl;
|
|
173
|
+
|
|
174
|
+
block.innerBlocks[clientId] = {
|
|
175
|
+
clientId,
|
|
176
|
+
rootClientId,
|
|
177
|
+
...layoutProps,
|
|
178
|
+
innerBlocks: { ...((_block$innerBlocks$cl = block.innerBlocks[clientId]) === null || _block$innerBlocks$cl === void 0 ? void 0 : _block$innerBlocks$cl.innerBlocks)
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Hook that returns the block list context.
|
|
187
|
+
*
|
|
188
|
+
* @return {Object} Block list context
|
|
189
|
+
*/
|
|
190
|
+
const useBlockListContext = () => {
|
|
191
|
+
return (0, _element.useContext)(Context);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
exports.useBlockListContext = useBlockListContext;
|
|
195
|
+
//# sourceMappingURL=block-list-context.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-context.native.js"],"names":["DEFAULT_BLOCK_LIST_CONTEXT","scrollRef","blocksLayouts","current","findBlockLayoutByClientId","getBlockLayoutsOrderedByYCoord","findBlockLayoutByPosition","updateBlocksLayouts","Context","Provider","Consumer","data","position","Object","values","find","block","x","width","y","height","clientId","entries","reduce","acc","entry","item","innerBlocks","keys","length","deleteBlockLayoutByClientId","key","blockData","rootClientId","shouldRemove","layoutProps","useBlockListContext"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,0BAA0B,GAAG;AACzCC,EAAAA,SAAS,EAAE,IAD8B;AAEzCC,EAAAA,aAAa,EAAE;AAAEC,IAAAA,OAAO,EAAE;AAAX,GAF0B;AAGzCC,EAAAA,yBAHyC;AAIzCC,EAAAA,8BAJyC;AAKzCC,EAAAA,yBALyC;AAMzCC,EAAAA;AANyC,CAAnC;;AASP,M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;AAA3C,MAA2DH,SAAjE;;AAEA,MAAKX,QAAQ,IAAIa,YAAjB,EAAgC;AAC/BhC,IAAAA,aAAa,CAACC,OAAd,GAAwB2B,2BAA2B,CAClD5B,aAAa,CAACC,OADoC,EAElDkB,QAFkD,CAAnD;AAIA;AACA;;AAED,MAAKA,QAAQ,IAAI,CAAEY,YAAnB,EAAkC;AAAA;;AACjC/B,IAAAA,aAAa,CAACC,OAAd,CAAuBkB,QAAvB,IAAoC;AACnCA,MAAAA,QADmC;AAEnCY,MAAAA,YAFmC;AAGnC,SAAGE,WAHgC;AAInCR,MAAAA,WAAW,EAAE,EACZ,6BAAGzB,aAAa,CAACC,OAAd,CAAuBkB,QAAvB,CAAH,0DAAG,sBAAmCM,WAAtC;AADY;AAJsB,KAApC;AAQA,GATD,MASO,IAAKN,QAAQ,IAAIY,YAAjB,EAAgC;AACtC,UAAMjB,KAAK,GAAGZ,yBAAyB,CACtCF,aAAa,CAACC,OADwB,EAEtC8B,YAFsC,CAAvC;;AAKA,QAAKjB,KAAL,EAAa;AAAA;;AACZA,MAAAA,KAAK,CAACW,WAAN,CAAmBN,QAAnB,IAAgC;AAC/BA,QAAAA,QAD+B;AAE/BY,QAAAA,YAF+B;AAG/B,WAAGE,WAH4B;AAI/BR,QAAAA,WAAW,EAAE,EACZ,6BAAGX,KAAK,CAACW,WAAN,CAAmBN,QAAnB,CAAH,0DAAG,sBAA+BM,WAAlC;AADY;AAJkB,OAAhC;AAQA;AACD;AACD;;AAID;AACA;AACA;AACA;AACA;AACO,MAAMS,mBAAmB,GAAG,MAAM;AACxC,SAAO,yBAAY5B,OAAZ,CAAP;AACA,CAFM","sourcesContent":["/**\n * External dependencies\n */\nimport { orderBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const DEFAULT_BLOCK_LIST_CONTEXT = {\n\tscrollRef: null,\n\tblocksLayouts: { current: {} },\n\tfindBlockLayoutByClientId,\n\tgetBlockLayoutsOrderedByYCoord,\n\tfindBlockLayoutByPosition,\n\tupdateBlocksLayouts,\n};\n\nconst Context = createContext( DEFAULT_BLOCK_LIST_CONTEXT );\nconst { Provider, Consumer } = Context;\n\n/**\n * Finds a block's layout data by position.\n *\n * @param {Object} data Blocks layouts object.\n * @param {Object} position Position to use for finding the block.\n * @param {number} position.x X coordinate.\n * @param {number} position.y Y coordinate.\n *\n * @return {Object|undefined} Found block layout data that matches the provided position. If none is found, `undefined` will be returned.\n */\nfunction findBlockLayoutByPosition( data, position ) {\n\t// Only enabled for root level blocks\n\treturn Object.values( data ).find( ( block ) => {\n\t\treturn (\n\t\t\tposition.x >= block.x &&\n\t\t\tposition.x <= block.x + block.width &&\n\t\t\tposition.y >= block.y &&\n\t\t\tposition.y <= block.y + block.height\n\t\t);\n\t} );\n}\n\n/**\n * Finds a block's layout data by its client Id.\n *\n * @param {Object} data Blocks layouts object.\n * @param {string} clientId Block's clientId.\n *\n * @return {Object} Found block layout data.\n */\nfunction findBlockLayoutByClientId( data, clientId ) {\n\treturn Object.entries( data ).reduce( ( acc, entry ) => {\n\t\tconst item = entry[ 1 ];\n\t\tif ( acc ) {\n\t\t\treturn acc;\n\t\t}\n\t\tif ( item?.clientId === clientId ) {\n\t\t\treturn item;\n\t\t}\n\t\tif ( item?.innerBlocks && Object.keys( item.innerBlocks ).length > 0 ) {\n\t\t\treturn findBlockLayoutByClientId( item.innerBlocks, clientId );\n\t\t}\n\t\treturn null;\n\t}, null );\n}\n\n/**\n * Deletes the layout data of a block by its client Id.\n *\n * @param {Object} data Blocks layouts object.\n * @param {string} clientId Block's clientsId.\n *\n * @return {Object} Updated data object.\n */\nexport function deleteBlockLayoutByClientId( data, clientId ) {\n\treturn Object.keys( data ).reduce( ( acc, key ) => {\n\t\tif ( key !== clientId ) {\n\t\t\tacc[ key ] = data[ key ];\n\t\t}\n\t\tif (\n\t\t\tdata[ key ]?.innerBlocks &&\n\t\t\tObject.keys( data[ key ].innerBlocks ).length > 0\n\t\t) {\n\t\t\tif ( acc[ key ] ) {\n\t\t\t\tacc[ key ].innerBlocks = deleteBlockLayoutByClientId(\n\t\t\t\t\tdata[ key ].innerBlocks,\n\t\t\t\t\tclientId\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn acc;\n\t}, {} );\n}\n\n/**\n * Orders the block's layout data by its Y coordinate.\n *\n * @param {Object} data Blocks layouts object.\n *\n * @return {Object} Blocks layouts object ordered by its Y coordinate.\n */\nfunction getBlockLayoutsOrderedByYCoord( data ) {\n\t// Only enabled for root level blocks.\n\t// Using lodash orderBy due to hermes not having\n\t// stable support for native .sort(). It will be\n\t// supported in the React Native version 0.68.0.\n\treturn orderBy( data, [ 'y', 'asc' ] );\n}\n\n/**\n * Updates or deletes a block's layout data in the blocksLayouts object,\n * in case of deletion, the layout data is not required.\n *\n * @param {Object} blocksLayouts Blocks layouts object.\n * @param {Object} blockData Block's layout data to add or remove to/from the blockLayouts object.\n * @param {string} blockData.clientId Block's clientId.\n * @param {?string} blockData.rootClientId Optional. Block's rootClientId.\n * @param {?boolean} blockData.shouldRemove Optional. Flag to remove it from the blocksLayout list.\n * @param {number} blockData.width Block's width.\n * @param {number} blockData.height Block's height.\n * @param {number} blockData.x Block's x coordinate (relative to the parent).\n * @param {number} blockData.y Block's y coordinate (relative to the parent).\n */\n\nfunction updateBlocksLayouts( blocksLayouts, blockData ) {\n\tconst { clientId, rootClientId, shouldRemove, ...layoutProps } = blockData;\n\n\tif ( clientId && shouldRemove ) {\n\t\tblocksLayouts.current = deleteBlockLayoutByClientId(\n\t\t\tblocksLayouts.current,\n\t\t\tclientId\n\t\t);\n\t\treturn;\n\t}\n\n\tif ( clientId && ! rootClientId ) {\n\t\tblocksLayouts.current[ clientId ] = {\n\t\t\tclientId,\n\t\t\trootClientId,\n\t\t\t...layoutProps,\n\t\t\tinnerBlocks: {\n\t\t\t\t...blocksLayouts.current[ clientId ]?.innerBlocks,\n\t\t\t},\n\t\t};\n\t} else if ( clientId && rootClientId ) {\n\t\tconst block = findBlockLayoutByClientId(\n\t\t\tblocksLayouts.current,\n\t\t\trootClientId\n\t\t);\n\n\t\tif ( block ) {\n\t\t\tblock.innerBlocks[ clientId ] = {\n\t\t\t\tclientId,\n\t\t\t\trootClientId,\n\t\t\t\t...layoutProps,\n\t\t\t\tinnerBlocks: {\n\t\t\t\t\t...block.innerBlocks[ clientId ]?.innerBlocks,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n}\n\nexport { Provider as BlockListProvider, Consumer as BlockListConsumer };\n\n/**\n * Hook that returns the block list context.\n *\n * @return {Object} Block list context\n */\nexport const useBlockListContext = () => {\n\treturn useContext( Context );\n};\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _blockListContext = require("./block-list-context");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
function BlockListItemCell(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
children,
|
|
28
|
+
clientId,
|
|
29
|
+
rootClientId,
|
|
30
|
+
onLayout
|
|
31
|
+
} = _ref;
|
|
32
|
+
const {
|
|
33
|
+
blocksLayouts,
|
|
34
|
+
updateBlocksLayouts
|
|
35
|
+
} = (0, _blockListContext.useBlockListContext)();
|
|
36
|
+
(0, _element.useEffect)(() => {
|
|
37
|
+
return () => {
|
|
38
|
+
updateBlocksLayouts(blocksLayouts, {
|
|
39
|
+
clientId,
|
|
40
|
+
shouldRemove: true
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
const onCellLayout = (0, _element.useCallback)(event => {
|
|
45
|
+
const {
|
|
46
|
+
nativeEvent: {
|
|
47
|
+
layout
|
|
48
|
+
}
|
|
49
|
+
} = event;
|
|
50
|
+
updateBlocksLayouts(blocksLayouts, {
|
|
51
|
+
clientId,
|
|
52
|
+
rootClientId,
|
|
53
|
+
...layout
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (onLayout) {
|
|
57
|
+
onLayout(event);
|
|
58
|
+
}
|
|
59
|
+
}, [clientId, rootClientId, updateBlocksLayouts, onLayout]);
|
|
60
|
+
return (0, _element.createElement)(_reactNative.View, {
|
|
61
|
+
onLayout: onCellLayout
|
|
62
|
+
}, children);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var _default = BlockListItemCell;
|
|
66
|
+
exports.default = _default;
|
|
67
|
+
//# sourceMappingURL=block-list-item-cell.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item-cell.native.js"],"names":["BlockListItemCell","children","clientId","rootClientId","onLayout","blocksLayouts","updateBlocksLayouts","shouldRemove","onCellLayout","event","nativeEvent","layout"],"mappings":";;;;;;;AAQA;;AALA;;AAUA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,iBAAT,OAA6E;AAAA,MAAjD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,YAAtB;AAAoCC,IAAAA;AAApC,GAAiD;AAC5E,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAyC,4CAA/C;AAEA,0BAAW,MAAM;AAChB,WAAO,MAAM;AACZA,MAAAA,mBAAmB,CAAED,aAAF,EAAiB;AACnCH,QAAAA,QADmC;AAEnCK,QAAAA,YAAY,EAAE;AAFqB,OAAjB,CAAnB;AAIA,KALD;AAMA,GAPD,EAOG,EAPH;AASA,QAAMC,YAAY,GAAG,0BAClBC,KAAF,IAAa;AACZ,UAAM;AACLC,MAAAA,WAAW,EAAE;AAAEC,QAAAA;AAAF;AADR,QAEFF,KAFJ;AAGAH,IAAAA,mBAAmB,CAAED,aAAF,EAAiB;AACnCH,MAAAA,QADmC;AAEnCC,MAAAA,YAFmC;AAGnC,SAAGQ;AAHgC,KAAjB,CAAnB;;AAMA,QAAKP,QAAL,EAAgB;AACfA,MAAAA,QAAQ,CAAEK,KAAF,CAAR;AACA;AACD,GAdmB,EAepB,CAAEP,QAAF,EAAYC,YAAZ,EAA0BG,mBAA1B,EAA+CF,QAA/C,CAfoB,CAArB;AAkBA,SAAO,4BAAC,iBAAD;AAAM,IAAA,QAAQ,EAAGI;AAAjB,KAAkCP,QAAlC,CAAP;AACA;;eAEcD,iB","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockListContext } from './block-list-context';\n\nfunction BlockListItemCell( { children, clientId, rootClientId, onLayout } ) {\n\tconst { blocksLayouts, updateBlocksLayouts } = useBlockListContext();\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tupdateBlocksLayouts( blocksLayouts, {\n\t\t\t\tclientId,\n\t\t\t\tshouldRemove: true,\n\t\t\t} );\n\t\t};\n\t}, [] );\n\n\tconst onCellLayout = useCallback(\n\t\t( event ) => {\n\t\t\tconst {\n\t\t\t\tnativeEvent: { layout },\n\t\t\t} = event;\n\t\t\tupdateBlocksLayouts( blocksLayouts, {\n\t\t\t\tclientId,\n\t\t\t\trootClientId,\n\t\t\t\t...layout,\n\t\t\t} );\n\n\t\t\tif ( onLayout ) {\n\t\t\t\tonLayout( event );\n\t\t\t}\n\t\t},\n\t\t[ clientId, rootClientId, updateBlocksLayouts, onLayout ]\n\t);\n\n\treturn <View onLayout={ onCellLayout }>{ children }</View>;\n}\n\nexport default BlockListItemCell;\n"]}
|
|
@@ -154,23 +154,26 @@ class BlockListItem extends _element.Component {
|
|
|
154
154
|
|
|
155
155
|
render() {
|
|
156
156
|
const {
|
|
157
|
-
gridProperties,
|
|
158
|
-
clientId,
|
|
159
157
|
parentWidth,
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
blockWidth,
|
|
159
|
+
isGridItem
|
|
162
160
|
} = this.props;
|
|
163
161
|
|
|
164
162
|
if (!blockWidth) {
|
|
165
163
|
return null;
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
if (
|
|
166
|
+
if (isGridItem) {
|
|
167
|
+
const {
|
|
168
|
+
numOfColumns,
|
|
169
|
+
tileCount,
|
|
170
|
+
tileIndex
|
|
171
|
+
} = this.props;
|
|
169
172
|
return (0, _element.createElement)(_gridItem.default, {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
maxWidth: parentWidth,
|
|
174
|
+
numOfColumns: numOfColumns,
|
|
175
|
+
tileCount: tileCount,
|
|
176
|
+
index: tileIndex
|
|
174
177
|
}, this.renderContent());
|
|
175
178
|
}
|
|
176
179
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item.native.js"],"names":["stretchStyle","flex","BlockListItem","Component","getMarginHorizontal","blockAlignment","marginHorizontal","parentBlockAlignment","hasParents","blockName","parentBlockName","parentWidth","blockWidth","props","isFullWidth","isWideWidth","isWider","isContainerRelated","alignmentHelpers","screenWidth","Math","floor","Dimensions","get","width","isScreenWidthEqual","getContentStyles","readableContentViewStyle","styles","fullAlignment","paddingHorizontal","fullAlignmentPadding","paddingLeft","renderContent","clientId","isReadOnly","shouldShowInsertionPointBefore","shouldShowInsertionPointAfter","contentResizeMode","shouldShowInnerBlockAppender","restProps","maxWidth","render","gridProperties","items","numColumns","length","indexOf","select","rootClientId","isStackedHorizontally","getBlockOrder","getBlockInsertionPoint","isBlockInsertionPointVisible","getSettings","getBlockParents","getBlock","blockEditorStore","blockClientIds","insertionPoint","blockInsertionPointIsVisible","index","readOnly","attributes","name","align","parents","parentBlock"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAQA,MAAMA,YAAY,GAAG;AACpBC,EAAAA,IAAI,EAAE;AADc,CAArB;;AAIO,MAAMC,aAAN,SAA4BC,kBAA5B,CAAsC;AAC5CC,EAAAA,mBAAmB,GAAG;AACrB,UAAM;AACLC,MAAAA,cADK;AAELC,MAAAA,gBAFK;AAGLC,MAAAA,oBAHK;AAILC,MAAAA,UAJK;AAKLC,MAAAA,SALK;AAMLC,MAAAA,eANK;AAOLC,MAAAA,WAPK;AAQLC,MAAAA;AARK,QASF,KAAKC,KATT;AAUA,UAAM;AACLC,MAAAA,WADK;AAELC,MAAAA,WAFK;AAGLC,MAAAA,OAHK;AAILC,MAAAA;AAJK,QAKFC,4BALJ;;AAOA,QAAKJ,WAAW,CAAET,cAAF,CAAhB,EAAqC;AACpC,UAAK,CAAEG,UAAP,EAAoB;AACnB,eAAO,CAAP;AACA;;AACD,aAAOF,gBAAP;AACA;;AACD,QAAKS,WAAW,CAAEV,cAAF,CAAhB,EAAqC;AACpC,aAAOC,gBAAP;AACA;;AAED,UAAMa,WAAW,GAAGC,IAAI,CAACC,KAAL,CAAYC,wBAAWC,GAAX,CAAgB,QAAhB,EAA2BC,KAAvC,CAApB;;AAEA,QACCV,WAAW,CAAEP,oBAAF,CAAX,IACA,CAAES,OAAO,CAAEJ,UAAF,EAAc,QAAd,CAFV,EAGE;AACD,UACCK,kBAAkB,CAAER,SAAF,CAAlB,IACAO,OAAO,CAAEG,WAAF,EAAe,QAAf,CAFR,EAGE;AACD,eAAOb,gBAAP;AACA;;AACD,aAA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AF,EAAY,IAAZ,CAA/B;AACA,QAAM1B,UAAU,GAAG,CAAC,CAAE0D,OAAO,CAACpB,MAA9B;AACA,QAAMqB,WAAW,GAAG3D,UAAU,GAAGgD,QAAQ,CAAEU,OAAO,CAAE,CAAF,CAAT,CAAX,GAA8B,EAA5D;AACA,QAAM;AAAED,IAAAA,KAAK,EAAE1D;AAAT,MACL,CAAA4D,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEJ,UAAb,KAA2B,EAD5B;AAEA,QAAM;AAAEC,IAAAA,IAAI,EAAEtD;AAAR,MAA4ByD,WAAW,IAAI,EAAjD;AAEA,SAAO;AACN/B,IAAAA,8BADM;AAENC,IAAAA,6BAFM;AAGNF,IAAAA,UAHM;AAIN3B,IAAAA,UAJM;AAKNH,IAAAA,cAAc,EAAE4D,KALV;AAMN1D,IAAAA,oBANM;AAONE,IAAAA,SAAS,EAAEuD,IAPL;AAQNtD,IAAAA;AARM,GAAP;AAUA,CArDF,CADuB,CAAT,EAwDVR,aAxDU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { ReadableContentView, alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockInsertionPoint from './insertion-point';\nimport Grid from './grid-item';\n\nimport styles from './block-list-item.native.scss';\nimport { store as blockEditorStore } from '../../store';\n\nconst stretchStyle = {\n\tflex: 1,\n};\n\nexport class BlockListItem extends Component {\n\tgetMarginHorizontal() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tmarginHorizontal,\n\t\t\tparentBlockAlignment,\n\t\t\thasParents,\n\t\t\tblockName,\n\t\t\tparentBlockName,\n\t\t\tparentWidth,\n\t\t\tblockWidth,\n\t\t} = this.props;\n\t\tconst {\n\t\t\tisFullWidth,\n\t\t\tisWideWidth,\n\t\t\tisWider,\n\t\t\tisContainerRelated,\n\t\t} = alignmentHelpers;\n\n\t\tif ( isFullWidth( blockAlignment ) ) {\n\t\t\tif ( ! hasParents ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn marginHorizontal;\n\t\t}\n\t\tif ( isWideWidth( blockAlignment ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\n\t\tif (\n\t\t\tisFullWidth( parentBlockAlignment ) &&\n\t\t\t! isWider( blockWidth, 'medium' )\n\t\t) {\n\t\t\tif (\n\t\t\t\tisContainerRelated( blockName ) ||\n\t\t\t\tisWider( screenWidth, 'mobile' )\n\t\t\t) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t\treturn marginHorizontal * 2;\n\t\t}\n\n\t\tif (\n\t\t\tisContainerRelated( parentBlockName ) &&\n\t\t\t! isContainerRelated( blockName )\n\t\t) {\n\t\t\tconst isScreenWidthEqual = parentWidth === screenWidth;\n\t\t\tif ( isScreenWidthEqual || isWider( screenWidth, 'mobile' ) ) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t}\n\n\t\treturn marginHorizontal;\n\t}\n\n\tgetContentStyles( readableContentViewStyle ) {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tblockName,\n\t\t\thasParents,\n\t\t\tparentBlockName,\n\t\t} = this.props;\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\n\t\treturn [\n\t\t\treadableContentViewStyle,\n\t\t\tisFullWidth( blockAlignment ) &&\n\t\t\t\t! hasParents && {\n\t\t\t\t\twidth: styles.fullAlignment.width,\n\t\t\t\t},\n\t\t\t! blockAlignment &&\n\t\t\t\thasParents &&\n\t\t\t\t! isContainerRelated( parentBlockName ) &&\n\t\t\t\tisContainerRelated( blockName ) && {\n\t\t\t\t\tpaddingHorizontal: styles.fullAlignmentPadding.paddingLeft,\n\t\t\t\t},\n\t\t];\n\t}\n\n\trenderContent() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tclientId,\n\t\t\tisReadOnly,\n\t\t\tshouldShowInsertionPointBefore,\n\t\t\tshouldShowInsertionPointAfter,\n\t\t\tcontentResizeMode,\n\t\t\tshouldShowInnerBlockAppender,\n\t\t\tparentWidth,\n\t\t\tmarginHorizontal,\n\t\t\tblockName,\n\t\t\tblockWidth,\n\t\t\t...restProps\n\t\t} = this.props;\n\t\tconst readableContentViewStyle =\n\t\t\tcontentResizeMode === 'stretch' && stretchStyle;\n\t\tconst { isContainerRelated } = alignmentHelpers;\n\n\t\treturn (\n\t\t\t<ReadableContentView\n\t\t\t\talign={ blockAlignment }\n\t\t\t\tstyle={ [\n\t\t\t\t\treadableContentViewStyle,\n\t\t\t\t\tisContainerRelated( blockName ) &&\n\t\t\t\t\t\tparentWidth && {\n\t\t\t\t\t\t\tmaxWidth: parentWidth + 2 * marginHorizontal,\n\t\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ this.getContentStyles( readableContentViewStyle ) }\n\t\t\t\t\tpointerEvents={ isReadOnly ? 'box-only' : 'auto' }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowInsertionPointBefore && (\n\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t\tmarginHorizontal={ this.getMarginHorizontal() }\n\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! shouldShowInnerBlockAppender() &&\n\t\t\t\t\t\tshouldShowInsertionPointAfter && (\n\t\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</ReadableContentView>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tgridProperties,\n\t\t\tclientId,\n\t\t\tparentWidth,\n\t\t\titems,\n\t\t\tblockWidth,\n\t\t} = this.props;\n\n\t\tif ( ! blockWidth ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( gridProperties ) {\n\t\t\treturn (\n\t\t\t\t<Grid\n\t\t\t\t\tnumOfColumns={ gridProperties.numColumns }\n\t\t\t\t\ttileCount={ items.length }\n\t\t\t\t\tindex={ items.indexOf( clientId ) }\n\t\t\t\t\tmaxWidth={ parentWidth }\n\t\t\t\t>\n\t\t\t\t\t{ this.renderContent() }\n\t\t\t\t</Grid>\n\t\t\t);\n\t\t}\n\t\treturn this.renderContent();\n\t}\n}\n\nexport default compose( [\n\twithSelect(\n\t\t( select, { rootClientId, isStackedHorizontally, clientId } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst blockInsertionPointIsVisible = isBlockInsertionPointVisible();\n\t\t\tconst shouldShowInsertionPointBefore =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If list is empty, show the insertion point (via the default appender)\n\t\t\t\t( blockClientIds.length === 0 ||\n\t\t\t\t\t// Or if the insertion point is right before the denoted block.\n\t\t\t\t\tblockClientIds[ insertionPoint.index ] === clientId );\n\n\t\t\tconst shouldShowInsertionPointAfter =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If the insertion point is at the end of the list.\n\t\t\t\tblockClientIds.length === insertionPoint.index &&\n\t\t\t\t// And the denoted block is the last one on the list, show the indicator at the end of the block.\n\t\t\t\tblockClientIds[ insertionPoint.index - 1 ] === clientId;\n\n\t\t\tconst isReadOnly = getSettings().readOnly;\n\n\t\t\tconst { attributes, name } = getBlock( clientId ) || {};\n\t\t\tconst { align } = attributes || {};\n\t\t\tconst parents = getBlockParents( clientId, true );\n\t\t\tconst hasParents = !! parents.length;\n\t\t\tconst parentBlock = hasParents ? getBlock( parents[ 0 ] ) : {};\n\t\t\tconst { align: parentBlockAlignment } =\n\t\t\t\tparentBlock?.attributes || {};\n\t\t\tconst { name: parentBlockName } = parentBlock || {};\n\n\t\t\treturn {\n\t\t\t\tshouldShowInsertionPointBefore,\n\t\t\t\tshouldShowInsertionPointAfter,\n\t\t\t\tisReadOnly,\n\t\t\t\thasParents,\n\t\t\t\tblockAlignment: align,\n\t\t\t\tparentBlockAlignment,\n\t\t\t\tblockName: name,\n\t\t\t\tparentBlockName,\n\t\t\t};\n\t\t}\n\t),\n] )( BlockListItem );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item.native.js"],"names":["stretchStyle","flex","BlockListItem","Component","getMarginHorizontal","blockAlignment","marginHorizontal","parentBlockAlignment","hasParents","blockName","parentBlockName","parentWidth","blockWidth","props","isFullWidth","isWideWidth","isWider","isContainerRelated","alignmentHelpers","screenWidth","Math","floor","Dimensions","get","width","isScreenWidthEqual","getContentStyles","readableContentViewStyle","styles","fullAlignment","paddingHorizontal","fullAlignmentPadding","paddingLeft","renderContent","clientId","isReadOnly","shouldShowInsertionPointBefore","shouldShowInsertionPointAfter","contentResizeMode","shouldShowInnerBlockAppender","restProps","maxWidth","render","isGridItem","numOfColumns","tileCount","tileIndex","select","rootClientId","isStackedHorizontally","getBlockOrder","getBlockInsertionPoint","isBlockInsertionPointVisible","getSettings","getBlockParents","getBlock","blockEditorStore","blockClientIds","insertionPoint","blockInsertionPointIsVisible","length","index","readOnly","attributes","name","align","parents","parentBlock"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAQA,MAAMA,YAAY,GAAG;AACpBC,EAAAA,IAAI,EAAE;AADc,CAArB;;AAIO,MAAMC,aAAN,SAA4BC,kBAA5B,CAAsC;AAC5CC,EAAAA,mBAAmB,GAAG;AACrB,UAAM;AACLC,MAAAA,cADK;AAELC,MAAAA,gBAFK;AAGLC,MAAAA,oBAHK;AAILC,MAAAA,UAJK;AAKLC,MAAAA,SALK;AAMLC,MAAAA,eANK;AAOLC,MAAAA,WAPK;AAQLC,MAAAA;AARK,QASF,KAAKC,KATT;AAUA,UAAM;AACLC,MAAAA,WADK;AAELC,MAAAA,WAFK;AAGLC,MAAAA,OAHK;AAILC,MAAAA;AAJK,QAKFC,4BALJ;;AAOA,QAAKJ,WAAW,CAAET,cAAF,CAAhB,EAAqC;AACpC,UAAK,CAAEG,UAAP,EAAoB;AACnB,eAAO,CAAP;AACA;;AACD,aAAOF,gBAAP;AACA;;AACD,QAAKS,WAAW,CAAEV,cAAF,CAAhB,EAAqC;AACpC,aAAOC,gBAAP;AACA;;AAED,UAAMa,WAAW,GAAGC,IAAI,CAACC,KAAL,CAAYC,wBAAWC,GAAX,CAAgB,QAAhB,EAA2BC,KAAvC,CAApB;;AAEA,QACCV,WAAW,CAAEP,oBAAF,CAAX,IACA,CAAES,OAAO,CAAEJ,UAAF,EAAc,QAAd,CAFV,EAGE;AACD,UACCK,kBAAkB,CAAER,SAAF,CAAlB,IACAO,OAAO,CAAEG,WAAF,EAAe,QAAf,CAFR,EAGE;AACD,eAAOb,gBAAP;AACA;;AACD,aAAOA,gBAAgB,GAAG,CAA1B;AACA;;AAED,QACCW,kBAAkB,CAAEP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CAAC,CAAE0D,OAAO,CAACN,MAA9B;AACA,QAAMO,WAAW,GAAG3D,UAAU,GAAG+C,QAAQ,CAAEW,OAAO,CAAE,CAAF,CAAT,CAAX,GAA8B,EAA5D;AACA,QAAM;AAAED,IAAAA,KAAK,EAAE1D;AAAT,MACL,CAAA4D,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEJ,UAAb,KAA2B,EAD5B;AAEA,QAAM;AAAEC,IAAAA,IAAI,EAAEtD;AAAR,MAA4ByD,WAAW,IAAI,EAAjD;AAEA,SAAO;AACN/B,IAAAA,8BADM;AAENC,IAAAA,6BAFM;AAGNF,IAAAA,UAHM;AAIN3B,IAAAA,UAJM;AAKNH,IAAAA,cAAc,EAAE4D,KALV;AAMN1D,IAAAA,oBANM;AAONE,IAAAA,SAAS,EAAEuD,IAPL;AAQNtD,IAAAA;AARM,GAAP;AAUA,CArDF,CADuB,CAAT,EAwDVR,aAxDU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { ReadableContentView, alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockInsertionPoint from './insertion-point';\nimport Grid from './grid-item';\n\nimport styles from './block-list-item.native.scss';\nimport { store as blockEditorStore } from '../../store';\n\nconst stretchStyle = {\n\tflex: 1,\n};\n\nexport class BlockListItem extends Component {\n\tgetMarginHorizontal() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tmarginHorizontal,\n\t\t\tparentBlockAlignment,\n\t\t\thasParents,\n\t\t\tblockName,\n\t\t\tparentBlockName,\n\t\t\tparentWidth,\n\t\t\tblockWidth,\n\t\t} = this.props;\n\t\tconst {\n\t\t\tisFullWidth,\n\t\t\tisWideWidth,\n\t\t\tisWider,\n\t\t\tisContainerRelated,\n\t\t} = alignmentHelpers;\n\n\t\tif ( isFullWidth( blockAlignment ) ) {\n\t\t\tif ( ! hasParents ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn marginHorizontal;\n\t\t}\n\t\tif ( isWideWidth( blockAlignment ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\n\t\tif (\n\t\t\tisFullWidth( parentBlockAlignment ) &&\n\t\t\t! isWider( blockWidth, 'medium' )\n\t\t) {\n\t\t\tif (\n\t\t\t\tisContainerRelated( blockName ) ||\n\t\t\t\tisWider( screenWidth, 'mobile' )\n\t\t\t) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t\treturn marginHorizontal * 2;\n\t\t}\n\n\t\tif (\n\t\t\tisContainerRelated( parentBlockName ) &&\n\t\t\t! isContainerRelated( blockName )\n\t\t) {\n\t\t\tconst isScreenWidthEqual = parentWidth === screenWidth;\n\t\t\tif ( isScreenWidthEqual || isWider( screenWidth, 'mobile' ) ) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t}\n\n\t\treturn marginHorizontal;\n\t}\n\n\tgetContentStyles( readableContentViewStyle ) {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tblockName,\n\t\t\thasParents,\n\t\t\tparentBlockName,\n\t\t} = this.props;\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\n\t\treturn [\n\t\t\treadableContentViewStyle,\n\t\t\tisFullWidth( blockAlignment ) &&\n\t\t\t\t! hasParents && {\n\t\t\t\t\twidth: styles.fullAlignment.width,\n\t\t\t\t},\n\t\t\t! blockAlignment &&\n\t\t\t\thasParents &&\n\t\t\t\t! isContainerRelated( parentBlockName ) &&\n\t\t\t\tisContainerRelated( blockName ) && {\n\t\t\t\t\tpaddingHorizontal: styles.fullAlignmentPadding.paddingLeft,\n\t\t\t\t},\n\t\t];\n\t}\n\n\trenderContent() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tclientId,\n\t\t\tisReadOnly,\n\t\t\tshouldShowInsertionPointBefore,\n\t\t\tshouldShowInsertionPointAfter,\n\t\t\tcontentResizeMode,\n\t\t\tshouldShowInnerBlockAppender,\n\t\t\tparentWidth,\n\t\t\tmarginHorizontal,\n\t\t\tblockName,\n\t\t\tblockWidth,\n\t\t\t...restProps\n\t\t} = this.props;\n\n\t\tconst readableContentViewStyle =\n\t\t\tcontentResizeMode === 'stretch' && stretchStyle;\n\t\tconst { isContainerRelated } = alignmentHelpers;\n\n\t\treturn (\n\t\t\t<ReadableContentView\n\t\t\t\talign={ blockAlignment }\n\t\t\t\tstyle={ [\n\t\t\t\t\treadableContentViewStyle,\n\t\t\t\t\tisContainerRelated( blockName ) &&\n\t\t\t\t\t\tparentWidth && {\n\t\t\t\t\t\t\tmaxWidth: parentWidth + 2 * marginHorizontal,\n\t\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ this.getContentStyles( readableContentViewStyle ) }\n\t\t\t\t\tpointerEvents={ isReadOnly ? 'box-only' : 'auto' }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowInsertionPointBefore && (\n\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t\tmarginHorizontal={ this.getMarginHorizontal() }\n\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! shouldShowInnerBlockAppender() &&\n\t\t\t\t\t\tshouldShowInsertionPointAfter && (\n\t\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</ReadableContentView>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst { parentWidth, blockWidth, isGridItem } = this.props;\n\n\t\tif ( ! blockWidth ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( isGridItem ) {\n\t\t\tconst { numOfColumns, tileCount, tileIndex } = this.props;\n\t\t\treturn (\n\t\t\t\t<Grid\n\t\t\t\t\tmaxWidth={ parentWidth }\n\t\t\t\t\tnumOfColumns={ numOfColumns }\n\t\t\t\t\ttileCount={ tileCount }\n\t\t\t\t\tindex={ tileIndex }\n\t\t\t\t>\n\t\t\t\t\t{ this.renderContent() }\n\t\t\t\t</Grid>\n\t\t\t);\n\t\t}\n\t\treturn this.renderContent();\n\t}\n}\n\nexport default compose( [\n\twithSelect(\n\t\t( select, { rootClientId, isStackedHorizontally, clientId } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst blockInsertionPointIsVisible = isBlockInsertionPointVisible();\n\t\t\tconst shouldShowInsertionPointBefore =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If list is empty, show the insertion point (via the default appender)\n\t\t\t\t( blockClientIds.length === 0 ||\n\t\t\t\t\t// Or if the insertion point is right before the denoted block.\n\t\t\t\t\tblockClientIds[ insertionPoint.index ] === clientId );\n\n\t\t\tconst shouldShowInsertionPointAfter =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If the insertion point is at the end of the list.\n\t\t\t\tblockClientIds.length === insertionPoint.index &&\n\t\t\t\t// And the denoted block is the last one on the list, show the indicator at the end of the block.\n\t\t\t\tblockClientIds[ insertionPoint.index - 1 ] === clientId;\n\n\t\t\tconst isReadOnly = getSettings().readOnly;\n\n\t\t\tconst { attributes, name } = getBlock( clientId ) || {};\n\t\t\tconst { align } = attributes || {};\n\t\t\tconst parents = getBlockParents( clientId, true );\n\t\t\tconst hasParents = !! parents.length;\n\t\t\tconst parentBlock = hasParents ? getBlock( parents[ 0 ] ) : {};\n\t\t\tconst { align: parentBlockAlignment } =\n\t\t\t\tparentBlock?.attributes || {};\n\t\t\tconst { name: parentBlockName } = parentBlock || {};\n\n\t\t\treturn {\n\t\t\t\tshouldShowInsertionPointBefore,\n\t\t\t\tshouldShowInsertionPointAfter,\n\t\t\t\tisReadOnly,\n\t\t\t\thasParents,\n\t\t\t\tblockAlignment: align,\n\t\t\t\tparentBlockAlignment,\n\t\t\t\tblockName: name,\n\t\t\t\tparentBlockName,\n\t\t\t};\n\t\t}\n\t),\n] )( BlockListItem );\n"]}
|