@wordpress/block-editor 9.0.0 → 9.3.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 +10 -0
- package/README.md +1 -0
- package/build/autocompleters/block.js +3 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +4 -13
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-context/index.js.map +1 -1
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +65 -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.js.map +1 -1
- package/build/components/block-draggable/index.native.js +488 -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-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +27 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.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-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.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-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +10 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/button.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-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +19 -8
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +5 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +3 -7
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +6 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +6 -3
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +3 -7
- package/build/components/block-styles/menu-items.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-toolbar/utils.js +5 -8
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- 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.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +122 -41
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/copy-handler/index.js +17 -1
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.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/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +31 -13
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/no-results.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +1 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +56 -0
- package/build/components/inspector-popover-header/index.js.map +1 -0
- package/build/components/line-height-control/index.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/index.js +4 -4
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -3
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +5 -3
- package/build/components/link-control/search-input.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/settings-drawer.js +3 -7
- package/build/components/link-control/settings-drawer.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-contents.js.map +1 -1
- package/build/components/list-view/branch.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.map +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +1 -7
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -6
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +20 -7
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.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/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +4 -0
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +5 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +53 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/embed-handler-picker.native.js +4 -8
- package/build/components/rich-text/embed-handler-picker.native.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 +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +3 -7
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +18 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/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-display-block-controls/index.native.js.map +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- 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.map +1 -1
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +12 -12
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/elements/index.js +9 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- 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/color-panel.native.js.map +1 -1
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +14 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +38 -1
- package/build/hooks/layout.js.map +1 -1
- 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/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +5 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +14 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +17 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +30 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/autocompleters/block.js +4 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +3 -11
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-context/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +51 -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.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +453 -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-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +26 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.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-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.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-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +9 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.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-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -1
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +19 -8
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +5 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- 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-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -5
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +9 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +5 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +3 -5
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/utils.js +3 -5
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- 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.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +124 -43
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/copy-handler/index.js +18 -2
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.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/image-size-control/index.js +4 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +4 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -5
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +2 -2
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +46 -0
- package/build-module/components/inspector-popover-header/index.js.map +1 -0
- package/build-module/components/line-height-control/index.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/index.js +2 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -2
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +3 -1
- package/build-module/components/link-control/search-input.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/settings-drawer.js +2 -5
- package/build-module/components/link-control/settings-drawer.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-contents.js.map +1 -1
- package/build-module/components/list-view/branch.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.map +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -6
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +22 -9
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.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/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -0
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +4 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +40 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js +3 -5
- package/build-module/components/rich-text/embed-handler-picker.native.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 +2 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -5
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +15 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/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-display-block-controls/index.native.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- 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.map +1 -1
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +12 -11
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/elements/index.js +2 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- 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/color-panel.native.js.map +1 -1
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +14 -4
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +39 -2
- package/build-module/hooks/layout.js.map +1 -1
- 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/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +4 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +25 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +79 -197
- package/build-style/style.css +79 -197
- package/package.json +30 -30
- package/src/autocompleters/block.js +2 -1
- package/src/components/block-actions/index.js +2 -3
- package/src/components/block-alignment-control/ui.js +4 -6
- package/src/components/block-alignment-matrix-control/index.js +3 -9
- package/src/components/block-breadcrumb/index.js +2 -5
- package/src/components/block-compare/test/block-view.js +2 -1
- package/src/components/block-content-overlay/index.js +10 -100
- package/src/components/block-content-overlay/style.scss +2 -11
- package/src/components/block-context/index.js +4 -4
- package/src/components/block-controls/hook.js +2 -3
- 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.js +6 -13
- package/src/components/block-draggable/index.native.js +454 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +493 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-edit/test/edit.js +2 -1
- 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 +11 -23
- package/src/components/block-list/block-selection-button.native.js +2 -3
- package/src/components/block-list/block.js +8 -10
- package/src/components/block-list/block.native.js +47 -23
- package/src/components/block-list/index.js +46 -47
- package/src/components/block-list/index.native.js +63 -31
- package/src/components/block-list/test/block-list-context.native.js +245 -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 +16 -8
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +2 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -3
- package/src/components/block-list/use-in-between-inserter.js +3 -4
- package/src/components/block-list-appender/index.js +2 -5
- package/src/components/block-list-appender/index.native.js +2 -3
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
- package/src/components/block-mobile-toolbar/index.native.js +9 -1
- package/src/components/block-mover/button.js +2 -3
- package/src/components/block-mover/index.native.js +26 -12
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -0
- package/src/components/block-parent-selector/index.js +2 -3
- package/src/components/block-pattern-setup/index.js +3 -5
- package/src/components/block-popover/inbetween.js +21 -8
- package/src/components/block-popover/index.js +2 -16
- package/src/components/block-popover/style.scss +1 -0
- package/src/components/block-preview/auto.js +4 -8
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-selection-clearer/index.js +2 -3
- package/src/components/block-settings-menu/block-mode-toggle.js +4 -8
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -9
- package/src/components/block-styles/index.js +3 -1
- package/src/components/block-styles/menu-items.js +2 -5
- package/src/components/block-switcher/block-transformations-menu.js +2 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-toolbar/index.native.js +2 -5
- package/src/components/block-toolbar/utils.js +3 -11
- package/src/components/block-tools/block-contextual-toolbar.js +2 -5
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-tools/index.js +2 -3
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/block-types-list/index.native.js +2 -4
- package/src/components/block-variation-transforms/index.js +10 -8
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/color-palette/test/control.js +2 -1
- package/src/components/color-style-selector/index.js +27 -28
- package/src/components/colors/test/with-colors.js +14 -14
- package/src/components/colors/with-colors.js +8 -12
- package/src/components/colors-gradients/dropdown.js +135 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +52 -50
- package/src/components/colors-gradients/test/control.js +10 -10
- package/src/components/convert-to-group-buttons/toolbar.js +32 -19
- package/src/components/copy-handler/README.md +7 -2
- package/src/components/copy-handler/index.js +26 -6
- package/src/components/default-block-appender/index.js +4 -6
- package/src/components/default-block-appender/index.native.js +4 -9
- package/src/components/default-style-picker/index.js +20 -21
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/font-sizes/with-font-sizes.js +2 -3
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/aspect-ratio-dropdown.js +2 -6
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/image-size-control/index.js +4 -7
- package/src/components/index.js +4 -2
- package/src/components/inner-blocks/use-inner-block-template-sync.js +2 -3
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -9
- package/src/components/inserter/block-types-tab.native.js +2 -3
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -3
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/hooks/use-patterns-state.js +4 -5
- package/src/components/inserter/index.js +4 -6
- package/src/components/inserter/index.native.js +7 -12
- package/src/components/inserter/library.js +2 -5
- package/src/components/inserter/menu.js +14 -19
- package/src/components/inserter/menu.native.js +8 -6
- package/src/components/inserter/no-results.native.js +2 -1
- package/src/components/inserter/quick-inserter.js +2 -3
- package/src/components/inserter/search-items.js +6 -6
- package/src/components/inserter/search-results.native.js +4 -6
- package/src/components/inserter/style.scss +2 -1
- package/src/components/inspector-popover-header/README.md +76 -0
- package/src/components/inspector-popover-header/index.js +56 -0
- package/src/components/inspector-popover-header/style.scss +16 -0
- package/src/components/line-height-control/index.js +1 -2
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/index.js +4 -4
- package/src/components/link-control/search-create-button.js +4 -2
- package/src/components/link-control/search-input.js +3 -1
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/settings-drawer.js +2 -5
- package/src/components/link-control/test/fixtures/index.js +3 -4
- package/src/components/link-control/test/index.js +24 -36
- package/src/components/link-control/use-search-handler.js +13 -7
- package/src/components/list-view/block-contents.js +2 -4
- package/src/components/list-view/branch.js +22 -23
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/index.js +4 -8
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/use-block-selection.js +5 -5
- package/src/components/list-view/use-list-view-drop-zone.js +2 -1
- package/src/components/list-view/utils.js +1 -6
- package/src/components/media-placeholder/index.js +2 -3
- package/src/components/media-replace-flow/index.js +77 -48
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/navigable-toolbar/index.js +13 -4
- package/src/components/panel-color-settings/test/index.js +2 -1
- package/src/components/plain-text/index.native.js +60 -8
- package/src/components/preview-options/index.js +4 -0
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/provider/use-block-sync.js +5 -2
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +39 -0
- package/src/components/responsive-block-control/test/index.js +3 -2
- package/src/components/rich-text/embed-handler-picker.native.js +2 -5
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +10 -5
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/rich-text/use-format-types.js +16 -16
- package/src/components/rich-text/use-mark-persistent.js +2 -3
- package/src/components/skip-to-selected-block/index.js +2 -3
- package/src/components/ungroup-button/index.native.js +4 -8
- package/src/components/url-input/index.js +24 -21
- package/src/components/use-block-display-information/index.js +4 -6
- package/src/components/use-block-drop-zone/index.js +2 -3
- package/src/components/use-block-drop-zone/index.native.js +171 -0
- package/src/components/use-block-drop-zone/test/index.js +22 -23
- package/src/components/use-display-block-controls/index.native.js +2 -3
- package/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js +2 -3
- package/src/components/use-on-block-drop/index.js +2 -5
- package/src/components/use-on-block-drop/index.native.js +115 -0
- package/src/components/use-setting/index.js +8 -6
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/components/writing-flow/test/index.js +22 -4
- package/src/components/writing-flow/use-arrow-nav.js +22 -10
- package/src/components/writing-flow/use-click-selection.js +2 -5
- package/src/components/writing-flow/use-drag-selection.js +6 -9
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/components/writing-flow/use-multi-selection.js +2 -4
- package/src/components/writing-flow/use-select-all.js +2 -5
- package/src/components/writing-flow/use-selection-observer.js +4 -6
- package/src/components/writing-flow/use-tab-nav.js +2 -5
- package/src/elements/index.js +1 -0
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +17 -13
- package/src/hooks/color-panel.native.js +2 -2
- package/src/hooks/color.js +7 -76
- package/src/hooks/color.scss +5 -58
- package/src/hooks/dimensions.js +11 -3
- package/src/hooks/font-family.js +4 -2
- package/src/hooks/gap.js +2 -3
- package/src/hooks/layout.js +54 -4
- package/src/hooks/style.js +25 -39
- package/src/hooks/test/align.js +2 -1
- package/src/hooks/test/generated-class-name.js +2 -5
- package/src/hooks/test/utils.js +2 -5
- package/src/hooks/typography.js +2 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +11 -3
- package/src/store/actions.js +784 -728
- package/src/store/reducer.js +202 -178
- package/src/store/selectors.js +82 -54
- package/src/store/test/actions.js +2 -1
- package/src/store/test/reducer.js +8 -1
- package/src/store/test/selectors.js +17 -21
- package/src/style.scss +1 -1
- package/src/utils/pasting.js +3 -3
- package/src/utils/transform-styles/transforms/wrap.js +30 -28
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.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-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.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/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useWindowDimensions } from 'react-native';
|
|
5
|
+
import { useSharedValue, useAnimatedRef, scrollTo, useAnimatedReaction, withTiming, withRepeat, cancelAnimation, Easing } from 'react-native-reanimated';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useBlockListContext } from '../block-list/block-list-context';
|
|
11
|
+
const SCROLL_INACTIVE_DISTANCE_PX = 50;
|
|
12
|
+
const SCROLL_INTERVAL_MS = 1000;
|
|
13
|
+
const VELOCITY_MULTIPLIER = 5000;
|
|
14
|
+
/**
|
|
15
|
+
* React hook that scrolls the scroll container when a block is being dragged.
|
|
16
|
+
*
|
|
17
|
+
* @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling`
|
|
18
|
+
* functions to be called in `onDragStart`, `onDragOver`
|
|
19
|
+
* and `onDragEnd` events respectively. Additionally,
|
|
20
|
+
* `scrollHandler` function is returned which should be
|
|
21
|
+
* called in the `onScroll` event of the block list.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export default function useScrollWhenDragging() {
|
|
25
|
+
const {
|
|
26
|
+
scrollRef
|
|
27
|
+
} = useBlockListContext();
|
|
28
|
+
const animatedScrollRef = useAnimatedRef();
|
|
29
|
+
animatedScrollRef(scrollRef);
|
|
30
|
+
const {
|
|
31
|
+
height: windowHeight
|
|
32
|
+
} = useWindowDimensions();
|
|
33
|
+
const velocityY = useSharedValue(0);
|
|
34
|
+
const offsetY = useSharedValue(0);
|
|
35
|
+
const dragStartY = useSharedValue(0);
|
|
36
|
+
const animationTimer = useSharedValue(0);
|
|
37
|
+
const isAnimationTimerActive = useSharedValue(false);
|
|
38
|
+
const isScrollActive = useSharedValue(false);
|
|
39
|
+
const scroll = {
|
|
40
|
+
offsetY: useSharedValue(0),
|
|
41
|
+
maxOffsetY: useSharedValue(0)
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const scrollHandler = event => {
|
|
45
|
+
'worklet';
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
contentSize,
|
|
49
|
+
contentOffset,
|
|
50
|
+
layoutMeasurement
|
|
51
|
+
} = event;
|
|
52
|
+
scroll.offsetY.value = contentOffset.y;
|
|
53
|
+
scroll.maxOffsetY.value = contentSize.height - layoutMeasurement.height;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const stopScrolling = () => {
|
|
57
|
+
'worklet';
|
|
58
|
+
|
|
59
|
+
cancelAnimation(animationTimer);
|
|
60
|
+
isAnimationTimerActive.value = false;
|
|
61
|
+
isScrollActive.value = false;
|
|
62
|
+
velocityY.value = 0;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const startScrolling = y => {
|
|
66
|
+
'worklet';
|
|
67
|
+
|
|
68
|
+
stopScrolling();
|
|
69
|
+
offsetY.value = scroll.offsetY.value;
|
|
70
|
+
dragStartY.value = y;
|
|
71
|
+
animationTimer.value = 0;
|
|
72
|
+
animationTimer.value = withRepeat(withTiming(1, {
|
|
73
|
+
duration: SCROLL_INTERVAL_MS,
|
|
74
|
+
easing: Easing.linear
|
|
75
|
+
}), -1, true);
|
|
76
|
+
isAnimationTimerActive.value = true;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const scrollOnDragOver = y => {
|
|
80
|
+
'worklet';
|
|
81
|
+
|
|
82
|
+
const dragDistance = Math.max(Math.abs(y - dragStartY.value) - SCROLL_INACTIVE_DISTANCE_PX, 0);
|
|
83
|
+
const distancePercentage = dragDistance / windowHeight;
|
|
84
|
+
|
|
85
|
+
if (!isScrollActive.value) {
|
|
86
|
+
isScrollActive.value = dragDistance > 0;
|
|
87
|
+
} else if (y > dragStartY.value) {
|
|
88
|
+
// User is dragging downwards.
|
|
89
|
+
velocityY.value = VELOCITY_MULTIPLIER * distancePercentage;
|
|
90
|
+
} else if (y < dragStartY.value) {
|
|
91
|
+
// User is dragging upwards.
|
|
92
|
+
velocityY.value = -VELOCITY_MULTIPLIER * distancePercentage;
|
|
93
|
+
} else {
|
|
94
|
+
velocityY.value = 0;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
useAnimatedReaction(() => animationTimer.value, (value, previous) => {
|
|
99
|
+
if (velocityY.value === 0) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const delta = Math.abs(value - previous);
|
|
104
|
+
let newOffset = offsetY.value + delta * velocityY.value;
|
|
105
|
+
|
|
106
|
+
if (scroll.maxOffsetY.value !== 0) {
|
|
107
|
+
newOffset = Math.max(0, Math.min(scroll.maxOffsetY.value, newOffset));
|
|
108
|
+
} else {
|
|
109
|
+
// Scroll values are empty until receiving the first scroll event.
|
|
110
|
+
// In that case, the max offset is unknown and we can't clamp the
|
|
111
|
+
// new offset value.
|
|
112
|
+
newOffset = Math.max(0, newOffset);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
offsetY.value = newOffset;
|
|
116
|
+
scrollTo(animatedScrollRef, 0, offsetY.value, false);
|
|
117
|
+
});
|
|
118
|
+
return [startScrolling, scrollOnDragOver, stopScrolling, scrollHandler];
|
|
119
|
+
}
|
|
120
|
+
//# 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":["useWindowDimensions","useSharedValue","useAnimatedRef","scrollTo","useAnimatedReaction","withTiming","withRepeat","cancelAnimation","Easing","useBlockListContext","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","linear","scrollOnDragOver","dragDistance","Math","max","abs","distancePercentage","previous","delta","newOffset","min"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAT,QAAoC,cAApC;AACA,SACCC,cADD,EAECC,cAFD,EAGCC,QAHD,EAICC,mBAJD,EAKCC,UALD,EAMCC,UAND,EAOCC,eAPD,EAQCC,MARD,QASO,yBATP;AAWA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,kCAApC;AAEA,MAAMC,2BAA2B,GAAG,EAApC;AACA,MAAMC,kBAAkB,GAAG,IAA3B;AACA,MAAMC,mBAAmB,GAAG,IAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAM;AAAEC,IAAAA;AAAF,MAAgBL,mBAAmB,EAAzC;AACA,QAAMM,iBAAiB,GAAGb,cAAc,EAAxC;AACAa,EAAAA,iBAAiB,CAAED,SAAF,CAAjB;AAEA,QAAM;AAAEE,IAAAA,MAAM,EAAEC;AAAV,MAA2BjB,mBAAmB,EAApD;AAEA,QAAMkB,SAAS,GAAGjB,cAAc,CAAE,CAAF,CAAhC;AACA,QAAMkB,OAAO,GAAGlB,cAAc,CAAE,CAAF,CAA9B;AACA,QAAMmB,UAAU,GAAGnB,cAAc,CAAE,C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,KAAlB,KAA4B,CAAjC,EAAqC;AACpCe,MAAAA,SAAS,GAAGN,IAAI,CAACC,GAAL,CACX,CADW,EAEXD,IAAI,CAACO,GAAL,CAAUvB,MAAM,CAACC,UAAP,CAAkBM,KAA5B,EAAmCe,SAAnC,CAFW,CAAZ;AAIA,KALD,MAKO;AACN;AACA;AACA;AACAA,MAAAA,SAAS,GAAGN,IAAI,CAACC,GAAL,CAAU,CAAV,EAAaK,SAAb,CAAZ;AACA;;AAED3B,IAAAA,OAAO,CAACY,KAAR,GAAgBe,SAAhB;AACA3C,IAAAA,QAAQ,CAAEY,iBAAF,EAAqB,CAArB,EAAwBI,OAAO,CAACY,KAAhC,EAAuC,KAAvC,CAAR;AACA,GAxBiB,CAAnB;AA2BA,SAAO,CAAEG,cAAF,EAAkBI,gBAAlB,EAAoCL,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,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { orderBy } from 'lodash';
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createContext, useContext } from '@wordpress/element';
|
|
10
|
+
export const DEFAULT_BLOCK_LIST_CONTEXT = {
|
|
11
|
+
scrollRef: null,
|
|
12
|
+
blocksLayouts: {
|
|
13
|
+
current: {}
|
|
14
|
+
},
|
|
15
|
+
findBlockLayoutByClientId,
|
|
16
|
+
getBlockLayoutsOrderedByYCoord,
|
|
17
|
+
findBlockLayoutByPosition,
|
|
18
|
+
updateBlocksLayouts
|
|
19
|
+
};
|
|
20
|
+
const Context = createContext(DEFAULT_BLOCK_LIST_CONTEXT);
|
|
21
|
+
const {
|
|
22
|
+
Provider,
|
|
23
|
+
Consumer
|
|
24
|
+
} = Context;
|
|
25
|
+
/**
|
|
26
|
+
* Finds a block's layout data by position.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} data Blocks layouts object.
|
|
29
|
+
* @param {Object} position Position to use for finding the block.
|
|
30
|
+
* @param {number} position.x X coordinate.
|
|
31
|
+
* @param {number} position.y Y coordinate.
|
|
32
|
+
*
|
|
33
|
+
* @return {Object|undefined} Found block layout data that matches the provided position. If none is found, `undefined` will be returned.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
function findBlockLayoutByPosition(data, position) {
|
|
37
|
+
// Only enabled for root level blocks
|
|
38
|
+
return Object.values(data).find(block => {
|
|
39
|
+
return position.x >= block.x && position.x <= block.x + block.width && position.y >= block.y && position.y <= block.y + block.height;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Finds a block's layout data by its client Id.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} data Blocks layouts object.
|
|
46
|
+
* @param {string} clientId Block's clientId.
|
|
47
|
+
*
|
|
48
|
+
* @return {Object} Found block layout data.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function findBlockLayoutByClientId(data, clientId) {
|
|
53
|
+
return Object.entries(data).reduce((acc, entry) => {
|
|
54
|
+
const item = entry[1];
|
|
55
|
+
|
|
56
|
+
if (acc) {
|
|
57
|
+
return acc;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if ((item === null || item === void 0 ? void 0 : item.clientId) === clientId) {
|
|
61
|
+
return item;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (item !== null && item !== void 0 && item.innerBlocks && Object.keys(item.innerBlocks).length > 0) {
|
|
65
|
+
return findBlockLayoutByClientId(item.innerBlocks, clientId);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return null;
|
|
69
|
+
}, null);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Deletes the layout data of a block by its client Id.
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} data Blocks layouts object.
|
|
75
|
+
* @param {string} clientId Block's clientsId.
|
|
76
|
+
*
|
|
77
|
+
* @return {Object} Updated data object.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
export function deleteBlockLayoutByClientId(data, clientId) {
|
|
82
|
+
return Object.keys(data).reduce((acc, key) => {
|
|
83
|
+
var _data$key;
|
|
84
|
+
|
|
85
|
+
if (key !== clientId) {
|
|
86
|
+
acc[key] = data[key];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((_data$key = data[key]) !== null && _data$key !== void 0 && _data$key.innerBlocks && Object.keys(data[key].innerBlocks).length > 0) {
|
|
90
|
+
if (acc[key]) {
|
|
91
|
+
acc[key].innerBlocks = deleteBlockLayoutByClientId(data[key].innerBlocks, clientId);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return acc;
|
|
96
|
+
}, {});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Orders the block's layout data by its Y coordinate.
|
|
100
|
+
*
|
|
101
|
+
* @param {Object} data Blocks layouts object.
|
|
102
|
+
*
|
|
103
|
+
* @return {Object} Blocks layouts object ordered by its Y coordinate.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
function getBlockLayoutsOrderedByYCoord(data) {
|
|
107
|
+
// Only enabled for root level blocks.
|
|
108
|
+
// Using lodash orderBy due to hermes not having
|
|
109
|
+
// stable support for native .sort(). It will be
|
|
110
|
+
// supported in the React Native version 0.68.0.
|
|
111
|
+
return orderBy(data, ['y', 'asc']);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Updates or deletes a block's layout data in the blocksLayouts object,
|
|
115
|
+
* in case of deletion, the layout data is not required.
|
|
116
|
+
*
|
|
117
|
+
* @param {Object} blocksLayouts Blocks layouts object.
|
|
118
|
+
* @param {Object} blockData Block's layout data to add or remove to/from the blockLayouts object.
|
|
119
|
+
* @param {string} blockData.clientId Block's clientId.
|
|
120
|
+
* @param {?string} blockData.rootClientId Optional. Block's rootClientId.
|
|
121
|
+
* @param {?boolean} blockData.shouldRemove Optional. Flag to remove it from the blocksLayout list.
|
|
122
|
+
* @param {number} blockData.width Block's width.
|
|
123
|
+
* @param {number} blockData.height Block's height.
|
|
124
|
+
* @param {number} blockData.x Block's x coordinate (relative to the parent).
|
|
125
|
+
* @param {number} blockData.y Block's y coordinate (relative to the parent).
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
function updateBlocksLayouts(blocksLayouts, blockData) {
|
|
130
|
+
const {
|
|
131
|
+
clientId,
|
|
132
|
+
rootClientId,
|
|
133
|
+
shouldRemove,
|
|
134
|
+
...layoutProps
|
|
135
|
+
} = blockData;
|
|
136
|
+
|
|
137
|
+
if (clientId && shouldRemove) {
|
|
138
|
+
blocksLayouts.current = deleteBlockLayoutByClientId(blocksLayouts.current, clientId);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (clientId && !rootClientId) {
|
|
143
|
+
var _blocksLayouts$curren;
|
|
144
|
+
|
|
145
|
+
blocksLayouts.current[clientId] = {
|
|
146
|
+
clientId,
|
|
147
|
+
rootClientId,
|
|
148
|
+
...layoutProps,
|
|
149
|
+
innerBlocks: { ...((_blocksLayouts$curren = blocksLayouts.current[clientId]) === null || _blocksLayouts$curren === void 0 ? void 0 : _blocksLayouts$curren.innerBlocks)
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
} else if (clientId && rootClientId) {
|
|
153
|
+
const block = findBlockLayoutByClientId(blocksLayouts.current, rootClientId);
|
|
154
|
+
|
|
155
|
+
if (block) {
|
|
156
|
+
var _block$innerBlocks$cl;
|
|
157
|
+
|
|
158
|
+
block.innerBlocks[clientId] = {
|
|
159
|
+
clientId,
|
|
160
|
+
rootClientId,
|
|
161
|
+
...layoutProps,
|
|
162
|
+
innerBlocks: { ...((_block$innerBlocks$cl = block.innerBlocks[clientId]) === null || _block$innerBlocks$cl === void 0 ? void 0 : _block$innerBlocks$cl.innerBlocks)
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export { Provider as BlockListProvider, Consumer as BlockListConsumer };
|
|
170
|
+
/**
|
|
171
|
+
* Hook that returns the block list context.
|
|
172
|
+
*
|
|
173
|
+
* @return {Object} Block list context
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
export const useBlockListContext = () => {
|
|
177
|
+
return useContext(Context);
|
|
178
|
+
};
|
|
179
|
+
//# 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":["orderBy","createContext","useContext","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","BlockListProvider","BlockListConsumer","useBlockListContext"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,oBAA1C;AAEA,OAAO,MAAMC,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,MAAMC,OAAO,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AGC;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;;AAED,SAASlB,QAAQ,IAAI2B,iBAArB,EAAwC1B,QAAQ,IAAI2B,iBAApD;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACxC,SAAOvC,UAAU,CAAES,OAAF,CAAjB;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,59 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { View } from 'react-native';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useEffect, useCallback } from '@wordpress/element';
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useBlockListContext } from './block-list-context';
|
|
17
|
+
|
|
18
|
+
function BlockListItemCell(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
clientId,
|
|
22
|
+
rootClientId,
|
|
23
|
+
onLayout
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
blocksLayouts,
|
|
27
|
+
updateBlocksLayouts
|
|
28
|
+
} = useBlockListContext();
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
return () => {
|
|
31
|
+
updateBlocksLayouts(blocksLayouts, {
|
|
32
|
+
clientId,
|
|
33
|
+
shouldRemove: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
const onCellLayout = useCallback(event => {
|
|
38
|
+
const {
|
|
39
|
+
nativeEvent: {
|
|
40
|
+
layout
|
|
41
|
+
}
|
|
42
|
+
} = event;
|
|
43
|
+
updateBlocksLayouts(blocksLayouts, {
|
|
44
|
+
clientId,
|
|
45
|
+
rootClientId,
|
|
46
|
+
...layout
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (onLayout) {
|
|
50
|
+
onLayout(event);
|
|
51
|
+
}
|
|
52
|
+
}, [clientId, rootClientId, updateBlocksLayouts, onLayout]);
|
|
53
|
+
return createElement(View, {
|
|
54
|
+
onLayout: onCellLayout
|
|
55
|
+
}, children);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default BlockListItemCell;
|
|
59
|
+
//# 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":["View","useEffect","useCallback","useBlockListContext","BlockListItemCell","children","clientId","rootClientId","onLayout","blocksLayouts","updateBlocksLayouts","shouldRemove","onCellLayout","event","nativeEvent","layout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,oBAAvC;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,sBAApC;;AAEA,SAASC,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,MAAyCP,mBAAmB,EAAlE;AAEAF,EAAAA,SAAS,CAAE,MAAM;AAChB,WAAO,MAAM;AACZS,MAAAA,mBAAmB,CAAED,aAAF,EAAiB;AACnCH,QAAAA,QADmC;AAEnCK,QAAAA,YAAY,EAAE;AAFqB,OAAjB,CAAnB;AAIA,KALD;AAMA,GAPQ,EAON,EAPM,CAAT;AASA,QAAMC,YAAY,GAAGV,WAAW,CAC7BW,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,GAd8B,EAe/B,CAAEP,QAAF,EAAYC,YAAZ,EAA0BG,mBAA1B,EAA+CF,QAA/C,CAf+B,CAAhC;AAkBA,SAAO,cAAC,IAAD;AAAM,IAAA,QAAQ,EAAGI;AAAjB,KAAkCP,QAAlC,CAAP;AACA;;AAED,eAAeD,iBAAf","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"]}
|
|
@@ -135,23 +135,26 @@ export class BlockListItem extends Component {
|
|
|
135
135
|
|
|
136
136
|
render() {
|
|
137
137
|
const {
|
|
138
|
-
gridProperties,
|
|
139
|
-
clientId,
|
|
140
138
|
parentWidth,
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
blockWidth,
|
|
140
|
+
isGridItem
|
|
143
141
|
} = this.props;
|
|
144
142
|
|
|
145
143
|
if (!blockWidth) {
|
|
146
144
|
return null;
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
if (
|
|
147
|
+
if (isGridItem) {
|
|
148
|
+
const {
|
|
149
|
+
numOfColumns,
|
|
150
|
+
tileCount,
|
|
151
|
+
tileIndex
|
|
152
|
+
} = this.props;
|
|
150
153
|
return createElement(Grid, {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
maxWidth: parentWidth,
|
|
155
|
+
numOfColumns: numOfColumns,
|
|
156
|
+
tileCount: tileCount,
|
|
157
|
+
index: tileIndex
|
|
155
158
|
}, this.renderContent());
|
|
156
159
|
}
|
|
157
160
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item.native.js"],"names":["View","Dimensions","Component","withSelect","compose","ReadableContentView","alignmentHelpers","BlockListBlock","BlockInsertionPoint","Grid","styles","store","blockEditorStore","stretchStyle","flex","BlockListItem","getMarginHorizontal","blockAlignment","marginHorizontal","parentBlockAlignment","hasParents","blockName","parentBlockName","parentWidth","blockWidth","props","isFullWidth","isWideWidth","isWider","isContainerRelated","screenWidth","Math","floor","get","width","isScreenWidthEqual","getContentStyles","readableContentViewStyle","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","blockClientIds","insertionPoint","blockInsertionPointIsVisible","index","readOnly","attributes","name","align","parents","parentBlock"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,mBAAT,EAA8BC,gBAA9B,QAAsD,uBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,SAA3B;AACA,OAAOC,mBAAP,MAAgC,mBAAhC;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,OAAOC,MAAP,MAAmB,+BAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,IAAI,EAAE;AADc,CAArB;AAIA,OAAO,MAAMC,aAAN,SAA4Bb,SAA5B,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,QAKFvB,gBALJ;;AAOA,QAAKoB,WAAW,CAAET,cAAF,CAAhB,EAAqC;AACpC,UAAK,CAAEG,UAAP,EAAoB;AACnB,eAAO,CAAP;AACA;;AACD,aAAOF,g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c,CAACT,YAAf,KAAgCA,YAFhC,IAGA;AACAQ,EAAAA,cAAc,CAACX,MAAf,KAA0BY,cAAc,CAACE,KAJzC,IAKA;AACAH,EAAAA,cAAc,CAAEC,cAAc,CAACE,KAAf,GAAuB,CAAzB,CAAd,KAA+C1B,QAPhD;AASA,QAAMC,UAAU,GAAGmB,WAAW,GAAGO,QAAjC;AAEA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAuBP,QAAQ,CAAEtB,QAAF,CAAR,IAAwB,EAArD;AACA,QAAM;AAAE8B,IAAAA;AAAF,MAAYF,UAAU,IAAI,EAAhC;AACA,QAAMG,OAAO,GAAGV,eAAe,CAAErB,QAAF,EAAY,IAAZ,CAA/B;AACA,QAAMvB,UAAU,GAAG,CAAC,CAAEsD,OAAO,CAACnB,MAA9B;AACA,QAAMoB,WAAW,GAAGvD,UAAU,GAAG6C,QAAQ,CAAES,OAAO,CAAE,CAAF,CAAT,CAAX,GAA8B,EAA5D;AACA,QAAM;AAAED,IAAAA,KAAK,EAAEtD;AAAT,MACL,CAAAwD,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEJ,UAAb,KAA2B,EAD5B;AAEA,QAAM;AAAEC,IAAAA,IAAI,EAAElD;AAAR,MAA4BqD,WAAW,IAAI,EAAjD;AAEA,SAAO;AACN9B,IAAAA,8BADM;AAENC,IAAAA,6BAFM;AAGNF,IAAAA,UAHM;AAINxB,IAAAA,UAJM;AAKNH,IAAAA,cAAc,EAAEwD,KALV;AAMNtD,IAAAA,oBANM;AAONE,IAAAA,SAAS,EAAEmD,IAPL;AAQNlD,IAAAA;AARM,GAAP;AAUA,CArDQ,CADa,CAAF,CAAP,CAwDVP,aAxDU,CAAf","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":["View","Dimensions","Component","withSelect","compose","ReadableContentView","alignmentHelpers","BlockListBlock","BlockInsertionPoint","Grid","styles","store","blockEditorStore","stretchStyle","flex","BlockListItem","getMarginHorizontal","blockAlignment","marginHorizontal","parentBlockAlignment","hasParents","blockName","parentBlockName","parentWidth","blockWidth","props","isFullWidth","isWideWidth","isWider","isContainerRelated","screenWidth","Math","floor","get","width","isScreenWidthEqual","getContentStyles","readableContentViewStyle","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","blockClientIds","insertionPoint","blockInsertionPointIsVisible","length","index","readOnly","attributes","name","align","parents","parentBlock"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,mBAAT,EAA8BC,gBAA9B,QAAsD,uBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,SAA3B;AACA,OAAOC,mBAAP,MAAgC,mBAAhC;AACA,OAAOC,IAAP,MAAiB,aAAjB;AAEA,OAAOC,MAAP,MAAmB,+BAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,IAAI,EAAE;AADc,CAArB;AAIA,OAAO,MAAMC,aAAN,SAA4Bb,SAA5B,CAAsC;AAC5Cc,EAAAA,mBAAmB,GAAG;AACrB,UAAM;AACLC,MAAAA,cADK;AAELC,MAAAA,gBAFK;AAGLC,MAAAA,oBAH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AAA,6BAFM;AAGNF,IAAAA,UAHM;AAINxB,IAAAA,UAJM;AAKNH,IAAAA,cAAc,EAAEwD,KALV;AAMNtD,IAAAA,oBANM;AAONE,IAAAA,SAAS,EAAEmD,IAPL;AAQNlD,IAAAA;AARM,GAAP;AAUA,CArDQ,CADa,CAAF,CAAP,CAwDVP,aAxDU,CAAf","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 { isFullWidth, isWideWidth, isWider, isContainerRelated } =\n\t\t\talignmentHelpers;\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 { blockAlignment, blockName, hasParents, parentBlockName } =\n\t\t\tthis.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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-selection-button.native.js"],"names":["Icon","withSelect","compose","getBlockType","BlockIcon","View","Text","TouchableOpacity","BlockTitle","useBlockDisplayInformation","SubdirectorSVG","store","blockEditorStore","styles","BlockSelectionButton","clientId","rootClientId","rootBlockIcon","isRTL","blockInformation","selectionButtonContainer","densedPaddingLeft","button","src","icon","color","arrow","selectionButtonTitle","select","getBlockRootClientId","getBlockName","getSettings","rootBlockName","rootBlockType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,uBAArB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,SAAT,QAA0B,yBAA1B;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,gBAArB,QAA6C,cAA7C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,MAAP,MAAmB,+BAAnB;;AAEA,MAAMC,oBAAoB,GAAG,QAKtB;AAAA,MALwB;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA,aAH8B;AAI9BC,IAAAA;AAJ8B,GAKxB;AACN,QAAMC,gBAAgB,GAAGV,0BAA0B,CAAEM,QAAF,CAAnD;AACA,SACC,cAAC,IAAD;AACC,IAAA,KAAK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AF,YAA4B;AAAA,MAAlB;AAAEb,IAAAA;AAAF,GAAkB;AACvC,QAAM;AAAEc,IAAAA,oBAAF;AAAwBC,IAAAA,YAAxB;AAAsCC,IAAAA;AAAtC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-selection-button.native.js"],"names":["Icon","withSelect","compose","getBlockType","BlockIcon","View","Text","TouchableOpacity","BlockTitle","useBlockDisplayInformation","SubdirectorSVG","store","blockEditorStore","styles","BlockSelectionButton","clientId","rootClientId","rootBlockIcon","isRTL","blockInformation","selectionButtonContainer","densedPaddingLeft","button","src","icon","color","arrow","selectionButtonTitle","select","getBlockRootClientId","getBlockName","getSettings","rootBlockName","rootBlockType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,uBAArB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,SAAT,QAA0B,yBAA1B;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,gBAArB,QAA6C,cAA7C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,MAAP,MAAmB,+BAAnB;;AAEA,MAAMC,oBAAoB,GAAG,QAKtB;AAAA,MALwB;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA,aAH8B;AAI9BC,IAAAA;AAJ8B,GAKxB;AACN,QAAMC,gBAAgB,GAAGV,0BAA0B,CAAEM,QAAF,CAAnD;AACA,SACC,cAAC,IAAD;AACC,IAAA,KAAK,EAAG,CACPF,MAAM,CAACO,wBADA,EAEPJ,YAAY,IAAIH,MAAM,CAACQ,iBAFhB;AADT,KAMC,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AAAwBC,IAAAA,YAAxB;AAAsCC,IAAAA;AAAtC,MACLH,MAAM,CAAEhB,gBAAF,CADP;AAEA,QAAMI,YAAY,GAAGa,oBAAoB,CAAEd,QAAF,CAAzC;;AAEA,MAAK,CAAEC,YAAP,EAAsB;AACrB,WAAO;AAAED,MAAAA;AAAF,KAAP;AACA;;AACD,QAAMiB,aAAa,GAAGF,YAAY,CAAEd,YAAF,CAAlC;AACA,QAAMiB,aAAa,GAAG9B,YAAY,CAAE6B,aAAF,CAAlC;AACA,QAAMf,aAAa,GAAGgB,aAAa,GAAGA,aAAa,CAACT,IAAjB,GAAwB,EAA3D;AAEA,SAAO;AACNT,IAAAA,QADM;AAENC,IAAAA,YAFM;AAGNC,IAAAA,aAHM;AAINC,IAAAA,KAAK,EAAEa,WAAW,GAAGb;AAJf,GAAP;AAMA,CAlBS,CADa,CAAF,CAAP,CAoBVJ,oBApBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { getBlockType } from '@wordpress/blocks';\nimport { BlockIcon } from '@wordpress/block-editor';\n\n/**\n * External dependencies\n */\nimport { View, Text, TouchableOpacity } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport BlockTitle from '../block-title';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport SubdirectorSVG from './subdirectory-icon';\nimport { store as blockEditorStore } from '../../store';\nimport styles from './block-selection-button.scss';\n\nconst BlockSelectionButton = ( {\n\tclientId,\n\trootClientId,\n\trootBlockIcon,\n\tisRTL,\n} ) => {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\treturn (\n\t\t<View\n\t\t\tstyle={ [\n\t\t\t\tstyles.selectionButtonContainer,\n\t\t\t\trootClientId && styles.densedPaddingLeft,\n\t\t\t] }\n\t\t>\n\t\t\t<TouchableOpacity\n\t\t\t\tstyle={ styles.button }\n\t\t\t\tonPress={ () => {\n\t\t\t\t\t/* Open BottomSheet with markup. */\n\t\t\t\t} }\n\t\t\t\tdisabled={\n\t\t\t\t\ttrue\n\t\t\t\t} /* Disable temporarily since onPress function is empty. */\n\t\t\t>\n\t\t\t\t{ rootClientId &&\n\t\t\t\t\trootBlockIcon && [\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tkey=\"parent-icon\"\n\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\ticon={ rootBlockIcon.src }\n\t\t\t\t\t\t\tfill={ styles.icon.color }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\t<View key=\"subdirectory-icon\" style={ styles.arrow }>\n\t\t\t\t\t\t\t<SubdirectorSVG\n\t\t\t\t\t\t\t\tfill={ styles.arrow.color }\n\t\t\t\t\t\t\t\tisRTL={ isRTL }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>,\n\t\t\t\t\t] }\n\t\t\t\t{ blockInformation?.icon && (\n\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\ticon={ blockInformation.icon }\n\t\t\t\t\t\tfill={ styles.icon.color }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<Text\n\t\t\t\t\tmaxFontSizeMultiplier={ 1.25 }\n\t\t\t\t\tellipsizeMode=\"tail\"\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tstyle={ styles.selectionButtonTitle }\n\t\t\t\t>\n\t\t\t\t\t<BlockTitle clientId={ clientId } maximumLength={ 35 } />\n\t\t\t\t</Text>\n\t\t\t</TouchableOpacity>\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getBlockRootClientId, getBlockName, getSettings } =\n\t\t\tselect( blockEditorStore );\n\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\tif ( ! rootClientId ) {\n\t\t\treturn { clientId };\n\t\t}\n\t\tconst rootBlockName = getBlockName( rootClientId );\n\t\tconst rootBlockType = getBlockType( rootBlockName );\n\t\tconst rootBlockIcon = rootBlockType ? rootBlockType.icon : {};\n\n\t\treturn {\n\t\t\tclientId,\n\t\t\trootClientId,\n\t\t\trootBlockIcon,\n\t\t\tisRTL: getSettings().isRTL,\n\t\t};\n\t} ),\n] )( BlockSelectionButton );\n"]}
|