@wordpress/block-editor 12.0.0 → 12.2.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 +6 -0
- package/README.md +1 -1
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +6 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-editing-mode/index.js +84 -0
- package/build/components/block-editing-mode/index.js.map +1 -0
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-block-context.js +15 -0
- package/build/components/block-list/block-list-block-context.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.js +29 -37
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +347 -311
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +260 -357
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +15 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +1 -2
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +8 -0
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +125 -0
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build/components/block-switcher/index.js +34 -12
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +7 -2
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.native.js +87 -3
- package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +9 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +14 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +7 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +19 -6
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/appender.js +6 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +9 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +25 -29
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -3
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +43 -22
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +27 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +0 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +25 -15
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +8 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +13 -7
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/align.js +4 -8
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/behaviors.js +115 -0
- package/build/hooks/behaviors.js.map +1 -0
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +0 -30
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +5 -9
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -11
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/private-apis.js +4 -7
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +46 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +88 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +36 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +28 -18
- package/build/store/selectors.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +41 -0
- package/build/utils/order-inserter-block-items.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/autocompleters/block.js +12 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +5 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +72 -0
- package/build-module/components/block-editing-mode/index.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-block-context.js +6 -0
- package/build-module/components/block-list/block-list-block-context.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.js +26 -34
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +345 -310
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +263 -355
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +6 -5
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +15 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +1 -2
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build-module/components/block-switcher/index.js +33 -12
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -2
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
- package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -8
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +7 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +16 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -2
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +9 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +24 -29
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +44 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +0 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +25 -16
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +8 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/align.js +4 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/behaviors.js +97 -0
- package/build-module/hooks/behaviors.js.map +1 -0
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -28
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -7
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -11
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/private-apis.js +3 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +42 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +79 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +26 -17
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +32 -0
- package/build-module/utils/order-inserter-block-items.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +32 -14
- package/build-style/content.css +32 -14
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +56 -77
- package/build-style/style.css +57 -77
- package/package.json +32 -31
- package/src/autocompleters/block.js +15 -7
- package/src/components/block-breadcrumb/index.js +11 -3
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-editing-mode/index.js +71 -0
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-block-context.js +6 -0
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.js +38 -56
- package/src/components/block-list/block.native.js +531 -501
- package/src/components/block-list/content.scss +5 -6
- package/src/components/block-list/index.native.js +324 -382
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +7 -3
- package/src/components/block-list-appender/index.js +22 -4
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +26 -1
- package/src/components/block-mover/style.scss +1 -0
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/preview-panel.js +1 -3
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-switcher/block-transformations-menu.js +12 -0
- package/src/components/block-switcher/block-variation-transformations.js +115 -0
- package/src/components/block-switcher/index.js +38 -5
- package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
- package/src/components/block-switcher/style.scss +6 -5
- package/src/components/block-toolbar/index.js +10 -11
- package/src/components/block-tools/block-contextual-toolbar.js +32 -67
- package/src/components/block-tools/insertion-point.js +23 -9
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/button-block-appender/content.scss +22 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/convert-to-group-buttons/index.js +9 -2
- package/src/components/convert-to-group-buttons/index.native.js +79 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +9 -8
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +17 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/iframe/index.js +22 -12
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inner-blocks/README.md +5 -0
- package/src/components/inner-blocks/index.js +2 -0
- package/src/components/inner-blocks/index.native.js +16 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
- package/src/components/inserter/index.js +1 -9
- package/src/components/inserter/quick-inserter.js +0 -2
- package/src/components/inserter/search-results.js +32 -6
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/appender.js +3 -2
- package/src/components/list-view/block-contents.js +32 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +34 -37
- package/src/components/list-view/branch.js +1 -7
- package/src/components/list-view/index.js +42 -17
- package/src/components/list-view/style.scss +7 -7
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-client-ids.js +21 -4
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/preview-options/index.js +9 -2
- package/src/components/publish-date-time-picker/index.js +0 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/README.md +6 -0
- package/src/components/url-input/index.js +2 -2
- package/src/components/use-block-drop-zone/index.js +31 -17
- package/src/components/use-resize-canvas/index.js +9 -1
- package/src/components/writing-flow/test/index.js +15 -0
- package/src/components/writing-flow/use-arrow-nav.js +17 -4
- package/src/hooks/align.js +5 -12
- package/src/hooks/behaviors.js +104 -0
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/dimensions.js +0 -40
- package/src/hooks/duotone.js +4 -11
- package/src/hooks/index.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +14 -20
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/private-apis.js +2 -4
- package/src/store/private-actions.js +39 -0
- package/src/store/private-selectors.js +95 -0
- package/src/store/reducer.js +27 -0
- package/src/store/selectors.js +25 -15
- package/src/store/test/private-actions.js +32 -1
- package/src/store/test/private-selectors.js +158 -0
- package/src/store/test/reducer.js +48 -0
- package/src/style.scss +0 -3
- package/src/utils/order-inserter-block-items.js +26 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/block-list-compact.native.js +0 -75
- package/build/components/block-list/block-list-compact.native.js.map +0 -1
- package/build/components/off-canvas-editor/appender.js +0 -125
- package/build/components/off-canvas-editor/appender.js.map +0 -1
- package/build/components/off-canvas-editor/block-contents.js +0 -141
- package/build/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build/components/off-canvas-editor/block-select-button.js +0 -126
- package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build/components/off-canvas-editor/block.js +0 -297
- package/build/components/off-canvas-editor/block.js.map +0 -1
- package/build/components/off-canvas-editor/branch.js +0 -197
- package/build/components/off-canvas-editor/branch.js.map +0 -1
- package/build/components/off-canvas-editor/context.js +0 -19
- package/build/components/off-canvas-editor/context.js.map +0 -1
- package/build/components/off-canvas-editor/drop-indicator.js +0 -118
- package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build/components/off-canvas-editor/expander.js +0 -41
- package/build/components/off-canvas-editor/expander.js.map +0 -1
- package/build/components/off-canvas-editor/index.js +0 -236
- package/build/components/off-canvas-editor/index.js.map +0 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +0 -146
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build/components/off-canvas-editor/leaf.js +0 -60
- package/build/components/off-canvas-editor/leaf.js.map +0 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -186
- package/build/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build/components/off-canvas-editor/update-attributes.js +0 -108
- package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build/components/off-canvas-editor/use-block-selection.js +0 -139
- package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
- package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build/components/off-canvas-editor/utils.js +0 -60
- package/build/components/off-canvas-editor/utils.js.map +0 -1
- package/build-module/components/block-list/block-list-compact.native.js +0 -60
- package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
- package/build-module/components/off-canvas-editor/appender.js +0 -108
- package/build-module/components/off-canvas-editor/appender.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-contents.js +0 -121
- package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
- package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build-module/components/off-canvas-editor/block.js +0 -273
- package/build-module/components/off-canvas-editor/block.js.map +0 -1
- package/build-module/components/off-canvas-editor/branch.js +0 -179
- package/build-module/components/off-canvas-editor/branch.js.map +0 -1
- package/build-module/components/off-canvas-editor/context.js +0 -7
- package/build-module/components/off-canvas-editor/context.js.map +0 -1
- package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build-module/components/off-canvas-editor/expander.js +0 -32
- package/build-module/components/off-canvas-editor/expander.js.map +0 -1
- package/build-module/components/off-canvas-editor/index.js +0 -213
- package/build-module/components/off-canvas-editor/index.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -128
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf.js +0 -45
- package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -166
- package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
- package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build-module/components/off-canvas-editor/utils.js +0 -44
- package/build-module/components/off-canvas-editor/utils.js.map +0 -1
- package/src/components/block-list/block-list-compact.native.js +0 -63
- package/src/components/off-canvas-editor/README.md +0 -5
- package/src/components/off-canvas-editor/appender.js +0 -124
- package/src/components/off-canvas-editor/block-contents.js +0 -156
- package/src/components/off-canvas-editor/block-select-button.js +0 -128
- package/src/components/off-canvas-editor/block.js +0 -347
- package/src/components/off-canvas-editor/branch.js +0 -238
- package/src/components/off-canvas-editor/context.js +0 -8
- package/src/components/off-canvas-editor/drop-indicator.js +0 -126
- package/src/components/off-canvas-editor/expander.js +0 -26
- package/src/components/off-canvas-editor/index.js +0 -271
- package/src/components/off-canvas-editor/leaf-more-menu.js +0 -157
- package/src/components/off-canvas-editor/leaf.js +0 -52
- package/src/components/off-canvas-editor/link-ui.js +0 -167
- package/src/components/off-canvas-editor/style.scss +0 -34
- package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
- package/src/components/off-canvas-editor/test/utils.js +0 -50
- package/src/components/off-canvas-editor/update-attributes.js +0 -99
- package/src/components/off-canvas-editor/use-block-selection.js +0 -169
- package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
- package/src/components/off-canvas-editor/utils.js +0 -58
|
@@ -6,13 +6,11 @@ import { View, Platform, TouchableWithoutFeedback } from 'react-native';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
9
|
+
import { useRef, useState } from '@wordpress/element';
|
|
10
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
11
|
import { createBlock } from '@wordpress/blocks';
|
|
13
12
|
import {
|
|
14
13
|
KeyboardAwareFlatList,
|
|
15
|
-
ReadableContentView,
|
|
16
14
|
WIDE_ALIGNMENTS,
|
|
17
15
|
alignmentHelpers,
|
|
18
16
|
} from '@wordpress/components';
|
|
@@ -27,23 +25,16 @@ import BlockListItem from './block-list-item';
|
|
|
27
25
|
import BlockListItemCell from './block-list-item-cell';
|
|
28
26
|
import {
|
|
29
27
|
BlockListProvider,
|
|
30
|
-
BlockListConsumer,
|
|
31
28
|
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
32
29
|
} from './block-list-context';
|
|
33
30
|
import { BlockDraggableWrapper } from '../block-draggable';
|
|
31
|
+
import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';
|
|
34
32
|
import { store as blockEditorStore } from '../../store';
|
|
35
33
|
|
|
36
34
|
const identity = ( x ) => x;
|
|
37
35
|
|
|
38
36
|
const stylesMemo = {};
|
|
39
|
-
const getStyles = (
|
|
40
|
-
isRootList,
|
|
41
|
-
isStackedHorizontally,
|
|
42
|
-
horizontalAlignment
|
|
43
|
-
) => {
|
|
44
|
-
if ( isRootList ) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
37
|
+
const getStyles = ( isStackedHorizontally, horizontalAlignment ) => {
|
|
47
38
|
const styleName = `${ isStackedHorizontally }-${ horizontalAlignment }`;
|
|
48
39
|
if ( stylesMemo[ styleName ] ) {
|
|
49
40
|
return stylesMemo[ styleName ];
|
|
@@ -57,83 +48,116 @@ const getStyles = (
|
|
|
57
48
|
return computedStyles;
|
|
58
49
|
};
|
|
59
50
|
|
|
60
|
-
export
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
51
|
+
export default function BlockList( {
|
|
52
|
+
blockWidth: initialBlockWidth,
|
|
53
|
+
contentResizeMode,
|
|
54
|
+
contentStyle,
|
|
55
|
+
filterInnerBlocks,
|
|
56
|
+
gridProperties,
|
|
57
|
+
header,
|
|
58
|
+
horizontal,
|
|
59
|
+
horizontalAlignment,
|
|
60
|
+
marginHorizontal = styles.defaultBlock.marginLeft,
|
|
61
|
+
marginVertical = styles.defaultBlock.marginTop,
|
|
62
|
+
onAddBlock,
|
|
63
|
+
onDeleteBlock,
|
|
64
|
+
orientation,
|
|
65
|
+
parentWidth,
|
|
66
|
+
renderAppender,
|
|
67
|
+
renderFooterAppender,
|
|
68
|
+
rootClientId,
|
|
69
|
+
withFooter = true,
|
|
70
|
+
} ) {
|
|
71
|
+
const {
|
|
72
|
+
blockClientIds,
|
|
73
|
+
blockCount,
|
|
74
|
+
blockInsertionPointIsVisible,
|
|
75
|
+
isReadOnly,
|
|
76
|
+
isRootList,
|
|
77
|
+
isFloatingToolbarVisible,
|
|
78
|
+
isStackedHorizontally,
|
|
79
|
+
maxWidth,
|
|
80
|
+
isRTL,
|
|
81
|
+
} = useSelect(
|
|
82
|
+
( select ) => {
|
|
83
|
+
const {
|
|
84
|
+
getBlockCount,
|
|
85
|
+
getBlockHierarchyRootClientId,
|
|
86
|
+
getBlockOrder,
|
|
87
|
+
getSelectedBlockClientId,
|
|
88
|
+
isBlockInsertionPointVisible,
|
|
89
|
+
getSettings,
|
|
90
|
+
} = select( blockEditorStore );
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
93
|
+
const rootBlockId = getBlockHierarchyRootClientId(
|
|
94
|
+
selectedBlockClientId
|
|
95
|
+
);
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
let blockOrder = getBlockOrder( rootClientId );
|
|
98
|
+
// Display only block which fulfill the condition in passed `filterInnerBlocks` function.
|
|
99
|
+
if ( filterInnerBlocks ) {
|
|
100
|
+
blockOrder = filterInnerBlocks( blockOrder );
|
|
101
|
+
}
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
const {
|
|
104
|
+
isRTL: isRTLSetting,
|
|
105
|
+
maxWidth: maxWidthSetting,
|
|
106
|
+
readOnly,
|
|
107
|
+
} = getSettings();
|
|
101
108
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
return {
|
|
110
|
+
blockClientIds: blockOrder,
|
|
111
|
+
blockCount: getBlockCount(),
|
|
112
|
+
blockInsertionPointIsVisible:
|
|
113
|
+
Platform.OS === 'ios' && isBlockInsertionPointVisible(),
|
|
114
|
+
isReadOnly: readOnly,
|
|
115
|
+
isRootList: rootClientId === undefined,
|
|
116
|
+
isFloatingToolbarVisible:
|
|
117
|
+
!! selectedBlockClientId && !! getBlockCount( rootBlockId ),
|
|
118
|
+
isStackedHorizontally: orientation === 'horizontal',
|
|
119
|
+
maxWidth: maxWidthSetting,
|
|
120
|
+
isRTL: isRTLSetting,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
[ filterInnerBlocks, orientation, rootClientId ]
|
|
124
|
+
);
|
|
106
125
|
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<EmptyListComponentCompose
|
|
110
|
-
rootClientId={ this.props.rootClientId }
|
|
111
|
-
renderAppender={ this.props.renderAppender }
|
|
112
|
-
renderFooterAppender={ this.props.renderFooterAppender }
|
|
113
|
-
/>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
126
|
+
const { insertBlock, clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
116
127
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
const extraData = useRef( {
|
|
129
|
+
parentWidth,
|
|
130
|
+
renderFooterAppender,
|
|
131
|
+
renderAppender,
|
|
132
|
+
onDeleteBlock,
|
|
133
|
+
contentStyle,
|
|
134
|
+
} );
|
|
135
|
+
|
|
136
|
+
const [ blockWidth, setBlockWidth ] = useState( initialBlockWidth || 0 );
|
|
137
|
+
|
|
138
|
+
const addBlockToEndOfPost = ( newBlock ) => {
|
|
139
|
+
insertBlock( newBlock, blockCount );
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const scrollViewRef = useRef( null );
|
|
143
|
+
|
|
144
|
+
const shouldFlatListPreventAutomaticScroll = () =>
|
|
145
|
+
blockInsertionPointIsVisible;
|
|
146
|
+
|
|
147
|
+
const shouldShowInnerBlockAppender = () =>
|
|
148
|
+
renderAppender && blockClientIds.length > 0;
|
|
149
|
+
|
|
150
|
+
const getExtraData = () => {
|
|
127
151
|
if (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
extraData.current.parentWidth !== parentWidth ||
|
|
153
|
+
extraData.current.renderFooterAppender !== renderFooterAppender ||
|
|
154
|
+
extraData.current.onDeleteBlock !== onDeleteBlock ||
|
|
155
|
+
extraData.current.contentStyle !== contentStyle ||
|
|
156
|
+
extraData.current.renderAppender !== renderAppender ||
|
|
157
|
+
extraData.current.blockWidth !== blockWidth ||
|
|
158
|
+
extraData.current.gridProperties !== gridProperties
|
|
135
159
|
) {
|
|
136
|
-
|
|
160
|
+
extraData.current = {
|
|
137
161
|
parentWidth,
|
|
138
162
|
renderFooterAppender,
|
|
139
163
|
onDeleteBlock,
|
|
@@ -143,184 +167,21 @@ export class BlockList extends Component {
|
|
|
143
167
|
gridProperties,
|
|
144
168
|
};
|
|
145
169
|
}
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
getCellRendererComponent( { children, item, onLayout } ) {
|
|
150
|
-
const { rootClientId } = this.props;
|
|
151
|
-
return (
|
|
152
|
-
<BlockListItemCell
|
|
153
|
-
children={ children }
|
|
154
|
-
clientId={ item }
|
|
155
|
-
onLayout={ onLayout }
|
|
156
|
-
rootClientId={ rootClientId }
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
170
|
+
return extraData.current;
|
|
171
|
+
};
|
|
160
172
|
|
|
161
|
-
onLayout( { nativeEvent } ) {
|
|
173
|
+
const onLayout = ( { nativeEvent } ) => {
|
|
162
174
|
const { layout } = nativeEvent;
|
|
163
|
-
const { blockWidth } = this.state;
|
|
164
|
-
const { isRootList, maxWidth } = this.props;
|
|
165
175
|
|
|
166
176
|
const layoutWidth = Math.floor( layout.width );
|
|
167
177
|
if ( isRootList && blockWidth !== layoutWidth ) {
|
|
168
|
-
|
|
169
|
-
blockWidth: Math.min( layoutWidth, maxWidth ),
|
|
170
|
-
} );
|
|
178
|
+
setBlockWidth( Math.min( layoutWidth, maxWidth ) );
|
|
171
179
|
} else if ( ! isRootList && ! blockWidth ) {
|
|
172
|
-
|
|
180
|
+
setBlockWidth( Math.min( layoutWidth, maxWidth ) );
|
|
173
181
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
render() {
|
|
177
|
-
const { isRootList, isRTL } = this.props;
|
|
178
|
-
// Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
|
|
179
|
-
const blockList = isRootList ? (
|
|
180
|
-
<BlockListProvider
|
|
181
|
-
value={ {
|
|
182
|
-
...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
183
|
-
scrollRef: this.scrollViewRef,
|
|
184
|
-
} }
|
|
185
|
-
>
|
|
186
|
-
<BlockDraggableWrapper isRTL={ isRTL }>
|
|
187
|
-
{ ( { onScroll } ) => this.renderList( { onScroll } ) }
|
|
188
|
-
</BlockDraggableWrapper>
|
|
189
|
-
</BlockListProvider>
|
|
190
|
-
) : (
|
|
191
|
-
<BlockListConsumer>
|
|
192
|
-
{ ( { scrollRef } ) =>
|
|
193
|
-
this.renderList( {
|
|
194
|
-
parentScrollRef: scrollRef,
|
|
195
|
-
} )
|
|
196
|
-
}
|
|
197
|
-
</BlockListConsumer>
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
return blockList;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
renderList( extraProps = {} ) {
|
|
204
|
-
const {
|
|
205
|
-
clearSelectedBlock,
|
|
206
|
-
blockClientIds,
|
|
207
|
-
title,
|
|
208
|
-
header,
|
|
209
|
-
isReadOnly,
|
|
210
|
-
isRootList,
|
|
211
|
-
horizontal,
|
|
212
|
-
marginVertical = styles.defaultBlock.marginTop,
|
|
213
|
-
marginHorizontal = styles.defaultBlock.marginLeft,
|
|
214
|
-
isFloatingToolbarVisible,
|
|
215
|
-
isStackedHorizontally,
|
|
216
|
-
horizontalAlignment,
|
|
217
|
-
contentResizeMode,
|
|
218
|
-
blockWidth,
|
|
219
|
-
} = this.props;
|
|
220
|
-
const { parentScrollRef, onScroll } = extraProps;
|
|
221
|
-
|
|
222
|
-
const { blockToolbar, headerToolbar, floatingToolbar } = styles;
|
|
223
|
-
|
|
224
|
-
const containerStyle = {
|
|
225
|
-
flex: isRootList ? 1 : 0,
|
|
226
|
-
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
227
|
-
marginVertical: isRootList ? 0 : -marginVertical,
|
|
228
|
-
marginHorizontal: isRootList ? 0 : -marginHorizontal,
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const isContentStretch = contentResizeMode === 'stretch';
|
|
232
|
-
const isMultiBlocks = blockClientIds.length > 1;
|
|
233
|
-
const { isWider } = alignmentHelpers;
|
|
234
|
-
const extraScrollHeight =
|
|
235
|
-
headerToolbar.height +
|
|
236
|
-
blockToolbar.height +
|
|
237
|
-
( isFloatingToolbarVisible ? floatingToolbar.height : 0 );
|
|
238
|
-
|
|
239
|
-
const scrollViewStyle = [
|
|
240
|
-
{ flex: isRootList ? 1 : 0 },
|
|
241
|
-
! isRootList && styles.overflowVisible,
|
|
242
|
-
];
|
|
243
|
-
|
|
244
|
-
return (
|
|
245
|
-
<View
|
|
246
|
-
style={ containerStyle }
|
|
247
|
-
onAccessibilityEscape={ clearSelectedBlock }
|
|
248
|
-
onLayout={ this.onLayout }
|
|
249
|
-
testID="block-list-wrapper"
|
|
250
|
-
>
|
|
251
|
-
<KeyboardAwareFlatList
|
|
252
|
-
{ ...( Platform.OS === 'android'
|
|
253
|
-
? { removeClippedSubviews: false }
|
|
254
|
-
: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
255
|
-
accessibilityLabel="block-list"
|
|
256
|
-
innerRef={ ( ref ) => {
|
|
257
|
-
this.scrollViewInnerRef( parentScrollRef || ref );
|
|
258
|
-
} }
|
|
259
|
-
extraScrollHeight={ extraScrollHeight }
|
|
260
|
-
keyboardShouldPersistTaps="always"
|
|
261
|
-
scrollViewStyle={ scrollViewStyle }
|
|
262
|
-
extraData={ this.getExtraData() }
|
|
263
|
-
scrollEnabled={ isRootList }
|
|
264
|
-
contentContainerStyle={ [
|
|
265
|
-
horizontal && styles.horizontalContentContainer,
|
|
266
|
-
isWider( blockWidth, 'medium' ) &&
|
|
267
|
-
( isContentStretch && isMultiBlocks
|
|
268
|
-
? styles.horizontalContentContainerStretch
|
|
269
|
-
: styles.horizontalContentContainerCenter ),
|
|
270
|
-
] }
|
|
271
|
-
style={ getStyles(
|
|
272
|
-
isRootList,
|
|
273
|
-
isStackedHorizontally,
|
|
274
|
-
horizontalAlignment
|
|
275
|
-
) }
|
|
276
|
-
data={ blockClientIds }
|
|
277
|
-
keyExtractor={ identity }
|
|
278
|
-
renderItem={ this.renderItem }
|
|
279
|
-
CellRendererComponent={ this.getCellRendererComponent }
|
|
280
|
-
shouldPreventAutomaticScroll={
|
|
281
|
-
this.shouldFlatListPreventAutomaticScroll
|
|
282
|
-
}
|
|
283
|
-
title={ title }
|
|
284
|
-
ListHeaderComponent={ header }
|
|
285
|
-
ListEmptyComponent={ ! isReadOnly && this.renderEmptyList }
|
|
286
|
-
ListFooterComponent={ this.renderBlockListFooter }
|
|
287
|
-
onScroll={ onScroll }
|
|
288
|
-
/>
|
|
289
|
-
{ this.shouldShowInnerBlockAppender() && (
|
|
290
|
-
<View
|
|
291
|
-
style={ {
|
|
292
|
-
marginHorizontal:
|
|
293
|
-
marginHorizontal -
|
|
294
|
-
styles.innerAppender.marginLeft,
|
|
295
|
-
} }
|
|
296
|
-
>
|
|
297
|
-
<BlockListAppender
|
|
298
|
-
rootClientId={ this.props.rootClientId }
|
|
299
|
-
renderAppender={ this.props.renderAppender }
|
|
300
|
-
showSeparator
|
|
301
|
-
/>
|
|
302
|
-
</View>
|
|
303
|
-
) }
|
|
304
|
-
</View>
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
renderItem( { item: clientId } ) {
|
|
309
|
-
const {
|
|
310
|
-
contentResizeMode,
|
|
311
|
-
contentStyle,
|
|
312
|
-
onAddBlock,
|
|
313
|
-
onDeleteBlock,
|
|
314
|
-
rootClientId,
|
|
315
|
-
isStackedHorizontally,
|
|
316
|
-
blockClientIds,
|
|
317
|
-
parentWidth,
|
|
318
|
-
marginVertical = styles.defaultBlock.marginTop,
|
|
319
|
-
marginHorizontal = styles.defaultBlock.marginLeft,
|
|
320
|
-
gridProperties,
|
|
321
|
-
} = this.props;
|
|
322
|
-
const { blockWidth } = this.state;
|
|
182
|
+
};
|
|
323
183
|
|
|
184
|
+
const renderItem = ( { item: clientId, index } ) => {
|
|
324
185
|
// Extracting the grid item properties here to avoid
|
|
325
186
|
// re-renders in the blockListItem component.
|
|
326
187
|
const isGridItem = !! gridProperties;
|
|
@@ -331,6 +192,7 @@ export class BlockList extends Component {
|
|
|
331
192
|
};
|
|
332
193
|
return (
|
|
333
194
|
<BlockListItem
|
|
195
|
+
index={ index }
|
|
334
196
|
isStackedHorizontally={ isStackedHorizontally }
|
|
335
197
|
rootClientId={ rootClientId }
|
|
336
198
|
clientId={ clientId }
|
|
@@ -341,141 +203,204 @@ export class BlockList extends Component {
|
|
|
341
203
|
marginVertical={ marginVertical }
|
|
342
204
|
marginHorizontal={ marginHorizontal }
|
|
343
205
|
onDeleteBlock={ onDeleteBlock }
|
|
344
|
-
shouldShowInnerBlockAppender={
|
|
345
|
-
this.shouldShowInnerBlockAppender
|
|
346
|
-
}
|
|
206
|
+
shouldShowInnerBlockAppender={ shouldShowInnerBlockAppender }
|
|
347
207
|
blockWidth={ blockWidth }
|
|
348
208
|
isGridItem={ isGridItem }
|
|
349
209
|
{ ...gridItemProps }
|
|
350
210
|
/>
|
|
351
211
|
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const { blockToolbar, headerToolbar, floatingToolbar } = styles;
|
|
215
|
+
|
|
216
|
+
const containerStyle = {
|
|
217
|
+
flex: isRootList ? 1 : 0,
|
|
218
|
+
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
219
|
+
marginVertical: isRootList ? 0 : -marginVertical,
|
|
220
|
+
marginHorizontal: isRootList ? 0 : -marginHorizontal,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const isContentStretch = contentResizeMode === 'stretch';
|
|
224
|
+
const isMultiBlocks = blockClientIds.length > 1;
|
|
225
|
+
const { isWider } = alignmentHelpers;
|
|
226
|
+
const extraScrollHeight =
|
|
227
|
+
headerToolbar.height +
|
|
228
|
+
blockToolbar.height +
|
|
229
|
+
( isFloatingToolbarVisible ? floatingToolbar.height : 0 );
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<View
|
|
233
|
+
style={ containerStyle }
|
|
234
|
+
onAccessibilityEscape={ clearSelectedBlock }
|
|
235
|
+
onLayout={ onLayout }
|
|
236
|
+
testID="block-list-wrapper"
|
|
237
|
+
>
|
|
238
|
+
{ isRootList ? (
|
|
239
|
+
<BlockListProvider
|
|
240
|
+
value={ {
|
|
241
|
+
...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
242
|
+
scrollRef: scrollViewRef.current,
|
|
243
|
+
} }
|
|
244
|
+
>
|
|
245
|
+
<BlockDraggableWrapper isRTL={ isRTL }>
|
|
246
|
+
{ ( { onScroll } ) => (
|
|
247
|
+
<KeyboardAwareFlatList
|
|
248
|
+
{ ...( Platform.OS === 'android'
|
|
249
|
+
? { removeClippedSubviews: false }
|
|
250
|
+
: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
251
|
+
accessibilityLabel="block-list"
|
|
252
|
+
innerRef={ ( ref ) => {
|
|
253
|
+
scrollViewRef.current = ref;
|
|
254
|
+
} }
|
|
255
|
+
extraScrollHeight={ extraScrollHeight }
|
|
256
|
+
keyboardShouldPersistTaps="always"
|
|
257
|
+
scrollViewStyle={ { flex: 1 } }
|
|
258
|
+
extraData={ getExtraData() }
|
|
259
|
+
scrollEnabled={ isRootList }
|
|
260
|
+
contentContainerStyle={ [
|
|
261
|
+
horizontal &&
|
|
262
|
+
styles.horizontalContentContainer,
|
|
263
|
+
isWider( blockWidth, 'medium' ) &&
|
|
264
|
+
( isContentStretch && isMultiBlocks
|
|
265
|
+
? styles.horizontalContentContainerStretch
|
|
266
|
+
: styles.horizontalContentContainerCenter ),
|
|
267
|
+
] }
|
|
268
|
+
data={ blockClientIds }
|
|
269
|
+
keyExtractor={ identity }
|
|
270
|
+
renderItem={ renderItem }
|
|
271
|
+
CellRendererComponent={ BlockListItemCell }
|
|
272
|
+
shouldPreventAutomaticScroll={
|
|
273
|
+
shouldFlatListPreventAutomaticScroll
|
|
274
|
+
}
|
|
275
|
+
ListHeaderComponent={ header }
|
|
276
|
+
ListEmptyComponent={
|
|
277
|
+
! isReadOnly && (
|
|
278
|
+
<EmptyList
|
|
279
|
+
orientation={ orientation }
|
|
280
|
+
rootClientId={ rootClientId }
|
|
281
|
+
renderAppender={ renderAppender }
|
|
282
|
+
renderFooterAppender={
|
|
283
|
+
renderFooterAppender
|
|
284
|
+
}
|
|
285
|
+
/>
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
ListFooterComponent={
|
|
289
|
+
<Footer
|
|
290
|
+
addBlockToEndOfPost={
|
|
291
|
+
addBlockToEndOfPost
|
|
292
|
+
}
|
|
293
|
+
isReadOnly={ isReadOnly }
|
|
294
|
+
renderFooterAppender={
|
|
295
|
+
renderFooterAppender
|
|
296
|
+
}
|
|
297
|
+
withFooter={ withFooter }
|
|
298
|
+
/>
|
|
299
|
+
}
|
|
300
|
+
onScroll={ onScroll }
|
|
301
|
+
/>
|
|
302
|
+
) }
|
|
303
|
+
</BlockDraggableWrapper>
|
|
304
|
+
</BlockListProvider>
|
|
305
|
+
) : (
|
|
364
306
|
<>
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
307
|
+
{ blockClientIds.length > 0 ? (
|
|
308
|
+
<View style={ [ { flex: 0 }, styles.overflowVisible ] }>
|
|
309
|
+
<View
|
|
310
|
+
style={ [
|
|
311
|
+
...getStyles(
|
|
312
|
+
isStackedHorizontally,
|
|
313
|
+
horizontalAlignment
|
|
314
|
+
),
|
|
315
|
+
horizontal &&
|
|
316
|
+
styles.horizontalContentContainer,
|
|
317
|
+
] }
|
|
318
|
+
>
|
|
319
|
+
{ blockClientIds.map(
|
|
320
|
+
( currentClientId, index ) => {
|
|
321
|
+
return (
|
|
322
|
+
<View key={ currentClientId }>
|
|
323
|
+
{ renderItem( {
|
|
324
|
+
item: currentClientId,
|
|
325
|
+
index,
|
|
326
|
+
} ) }
|
|
327
|
+
</View>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
) }
|
|
331
|
+
<Footer
|
|
332
|
+
addBlockToEndOfPost={ addBlockToEndOfPost }
|
|
333
|
+
isReadOnly={ isReadOnly }
|
|
334
|
+
renderFooterAppender={
|
|
335
|
+
renderFooterAppender
|
|
336
|
+
}
|
|
337
|
+
withFooter={ withFooter }
|
|
338
|
+
/>
|
|
339
|
+
</View>
|
|
340
|
+
</View>
|
|
341
|
+
) : (
|
|
342
|
+
<EmptyList
|
|
343
|
+
orientation={ orientation }
|
|
344
|
+
rootClientId={ rootClientId }
|
|
345
|
+
renderAppender={ renderAppender }
|
|
346
|
+
renderFooterAppender={ renderFooterAppender }
|
|
347
|
+
/>
|
|
348
|
+
) }
|
|
374
349
|
</>
|
|
375
|
-
)
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
export default compose( [
|
|
384
|
-
withSelect(
|
|
385
|
-
( select, { rootClientId, orientation, filterInnerBlocks } ) => {
|
|
386
|
-
const {
|
|
387
|
-
getBlockCount,
|
|
388
|
-
getBlockHierarchyRootClientId,
|
|
389
|
-
getBlockOrder,
|
|
390
|
-
getSelectedBlockClientId,
|
|
391
|
-
isBlockInsertionPointVisible,
|
|
392
|
-
getSettings,
|
|
393
|
-
} = select( blockEditorStore );
|
|
394
|
-
|
|
395
|
-
const isStackedHorizontally = orientation === 'horizontal';
|
|
396
|
-
|
|
397
|
-
const selectedBlockClientId = getSelectedBlockClientId();
|
|
398
|
-
|
|
399
|
-
let blockClientIds = getBlockOrder( rootClientId );
|
|
400
|
-
// Display only block which fulfill the condition in passed `filterInnerBlocks` function.
|
|
401
|
-
if ( filterInnerBlocks ) {
|
|
402
|
-
blockClientIds = filterInnerBlocks( blockClientIds );
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const { maxWidth } = getSettings();
|
|
406
|
-
const isReadOnly = getSettings().readOnly;
|
|
407
|
-
|
|
408
|
-
const blockCount = getBlockCount();
|
|
409
|
-
const rootBlockId = getBlockHierarchyRootClientId(
|
|
410
|
-
selectedBlockClientId
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
const isFloatingToolbarVisible =
|
|
414
|
-
!! selectedBlockClientId && !! getBlockCount( rootBlockId );
|
|
415
|
-
const isRTL = getSettings().isRTL;
|
|
416
|
-
|
|
417
|
-
return {
|
|
418
|
-
blockClientIds,
|
|
419
|
-
blockCount,
|
|
420
|
-
isBlockInsertionPointVisible:
|
|
421
|
-
Platform.OS === 'ios' && isBlockInsertionPointVisible(),
|
|
422
|
-
isReadOnly,
|
|
423
|
-
isRootList: rootClientId === undefined,
|
|
424
|
-
isFloatingToolbarVisible,
|
|
425
|
-
isStackedHorizontally,
|
|
426
|
-
maxWidth,
|
|
427
|
-
isRTL,
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
withDispatch( ( dispatch ) => {
|
|
432
|
-
const { insertBlock, replaceBlock, clearSelectedBlock } =
|
|
433
|
-
dispatch( blockEditorStore );
|
|
434
|
-
|
|
435
|
-
return {
|
|
436
|
-
clearSelectedBlock,
|
|
437
|
-
insertBlock,
|
|
438
|
-
replaceBlock,
|
|
439
|
-
};
|
|
440
|
-
} ),
|
|
441
|
-
withPreferredColorScheme,
|
|
442
|
-
] )( BlockList );
|
|
443
|
-
|
|
444
|
-
class EmptyListComponent extends Component {
|
|
445
|
-
render() {
|
|
446
|
-
const {
|
|
447
|
-
shouldShowInsertionPoint,
|
|
448
|
-
rootClientId,
|
|
449
|
-
renderAppender,
|
|
450
|
-
renderFooterAppender,
|
|
451
|
-
} = this.props;
|
|
452
|
-
|
|
453
|
-
if ( renderFooterAppender || renderAppender === false ) {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
return (
|
|
458
|
-
<View style={ styles.defaultAppender }>
|
|
459
|
-
<ReadableContentView
|
|
460
|
-
align={
|
|
461
|
-
renderAppender
|
|
462
|
-
? WIDE_ALIGNMENTS.alignments.full
|
|
463
|
-
: undefined
|
|
464
|
-
}
|
|
350
|
+
) }
|
|
351
|
+
{ shouldShowInnerBlockAppender() && (
|
|
352
|
+
<View
|
|
353
|
+
style={ {
|
|
354
|
+
marginHorizontal:
|
|
355
|
+
marginHorizontal - styles.innerAppender.marginLeft,
|
|
356
|
+
} }
|
|
465
357
|
>
|
|
466
358
|
<BlockListAppender
|
|
467
359
|
rootClientId={ rootClientId }
|
|
468
360
|
renderAppender={ renderAppender }
|
|
469
|
-
showSeparator
|
|
361
|
+
showSeparator
|
|
470
362
|
/>
|
|
471
|
-
</
|
|
472
|
-
|
|
363
|
+
</View>
|
|
364
|
+
) }
|
|
365
|
+
</View>
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function Footer( {
|
|
370
|
+
addBlockToEndOfPost,
|
|
371
|
+
isReadOnly,
|
|
372
|
+
renderFooterAppender,
|
|
373
|
+
withFooter,
|
|
374
|
+
} ) {
|
|
375
|
+
if ( ! isReadOnly && withFooter ) {
|
|
376
|
+
return (
|
|
377
|
+
<>
|
|
378
|
+
<TouchableWithoutFeedback
|
|
379
|
+
accessibilityLabel={ __( 'Add paragraph block' ) }
|
|
380
|
+
testID={ __( 'Add paragraph block' ) }
|
|
381
|
+
onPress={ () => {
|
|
382
|
+
const paragraphBlock = createBlock( 'core/paragraph' );
|
|
383
|
+
addBlockToEndOfPost( paragraphBlock );
|
|
384
|
+
} }
|
|
385
|
+
>
|
|
386
|
+
<View style={ styles.blockListFooter } />
|
|
387
|
+
</TouchableWithoutFeedback>
|
|
388
|
+
</>
|
|
473
389
|
);
|
|
390
|
+
} else if ( renderFooterAppender ) {
|
|
391
|
+
return <View>{ renderFooterAppender() }</View>;
|
|
474
392
|
}
|
|
393
|
+
|
|
394
|
+
return null;
|
|
475
395
|
}
|
|
476
396
|
|
|
477
|
-
|
|
478
|
-
|
|
397
|
+
function EmptyList( {
|
|
398
|
+
orientation,
|
|
399
|
+
renderAppender,
|
|
400
|
+
renderFooterAppender,
|
|
401
|
+
rootClientId,
|
|
402
|
+
} ) {
|
|
403
|
+
const { shouldShowInsertionPoint } = useSelect( ( select ) => {
|
|
479
404
|
const {
|
|
480
405
|
getBlockOrder,
|
|
481
406
|
getBlockInsertionPoint,
|
|
@@ -486,17 +411,34 @@ const EmptyListComponentCompose = compose( [
|
|
|
486
411
|
const blockClientIds = getBlockOrder( rootClientId );
|
|
487
412
|
const insertionPoint = getBlockInsertionPoint();
|
|
488
413
|
const blockInsertionPointIsVisible = isBlockInsertionPointVisible();
|
|
489
|
-
const shouldShowInsertionPoint =
|
|
490
|
-
! isStackedHorizontally &&
|
|
491
|
-
blockInsertionPointIsVisible &&
|
|
492
|
-
insertionPoint.rootClientId === rootClientId &&
|
|
493
|
-
// If list is empty, show the insertion point (via the default appender)
|
|
494
|
-
( blockClientIds.length === 0 ||
|
|
495
|
-
// Or if the insertion point is right before the denoted block.
|
|
496
|
-
! blockClientIds[ insertionPoint.index ] );
|
|
497
414
|
|
|
498
415
|
return {
|
|
499
|
-
shouldShowInsertionPoint
|
|
416
|
+
shouldShowInsertionPoint:
|
|
417
|
+
! isStackedHorizontally &&
|
|
418
|
+
blockInsertionPointIsVisible &&
|
|
419
|
+
insertionPoint.rootClientId === rootClientId &&
|
|
420
|
+
// If list is empty, show the insertion point (via the default appender)
|
|
421
|
+
( blockClientIds.length === 0 ||
|
|
422
|
+
// Or if the insertion point is right before the denoted block.
|
|
423
|
+
! blockClientIds[ insertionPoint.index ] ),
|
|
500
424
|
};
|
|
501
|
-
} )
|
|
502
|
-
|
|
425
|
+
} );
|
|
426
|
+
const align = renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined;
|
|
427
|
+
const [ wrapperStyles ] = useEditorWrapperStyles( { align } );
|
|
428
|
+
|
|
429
|
+
if ( renderFooterAppender || renderAppender === false ) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const containerStyles = [ styles.defaultAppender, wrapperStyles ];
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
<View style={ containerStyles }>
|
|
437
|
+
<BlockListAppender
|
|
438
|
+
rootClientId={ rootClientId }
|
|
439
|
+
renderAppender={ renderAppender }
|
|
440
|
+
showSeparator={ shouldShowInsertionPoint }
|
|
441
|
+
/>
|
|
442
|
+
</View>
|
|
443
|
+
);
|
|
444
|
+
}
|