@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
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _blocks = require("@wordpress/blocks");
|
|
15
|
-
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
var _compose = require("@wordpress/compose");
|
|
19
|
-
|
|
20
|
-
var _icons = require("@wordpress/icons");
|
|
21
|
-
|
|
22
|
-
var _data = require("@wordpress/data");
|
|
23
|
-
|
|
24
|
-
var _i18n = require("@wordpress/i18n");
|
|
25
|
-
|
|
26
|
-
var _leaf = _interopRequireDefault(require("./leaf"));
|
|
27
|
-
|
|
28
|
-
var _button = require("../block-mover/button");
|
|
29
|
-
|
|
30
|
-
var _blockContents = _interopRequireDefault(require("./block-contents"));
|
|
31
|
-
|
|
32
|
-
var _blockSettingsDropdown = _interopRequireDefault(require("../block-settings-menu/block-settings-dropdown"));
|
|
33
|
-
|
|
34
|
-
var _context = require("./context");
|
|
35
|
-
|
|
36
|
-
var _utils = require("./utils");
|
|
37
|
-
|
|
38
|
-
var _store = require("../../store");
|
|
39
|
-
|
|
40
|
-
var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
|
|
41
|
-
|
|
42
|
-
var _blockLock = require("../block-lock");
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* External dependencies
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* WordPress dependencies
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Internal dependencies
|
|
54
|
-
*/
|
|
55
|
-
function ListViewBlock(_ref) {
|
|
56
|
-
let {
|
|
57
|
-
block: {
|
|
58
|
-
clientId
|
|
59
|
-
},
|
|
60
|
-
isDragged,
|
|
61
|
-
isSelected,
|
|
62
|
-
isBranchSelected,
|
|
63
|
-
selectBlock,
|
|
64
|
-
position,
|
|
65
|
-
level,
|
|
66
|
-
rowCount,
|
|
67
|
-
siblingBlockCount,
|
|
68
|
-
showBlockMovers,
|
|
69
|
-
path,
|
|
70
|
-
isExpanded,
|
|
71
|
-
selectedClientIds,
|
|
72
|
-
preventAnnouncement
|
|
73
|
-
} = _ref;
|
|
74
|
-
const cellRef = (0, _element.useRef)(null);
|
|
75
|
-
const [isHovered, setIsHovered] = (0, _element.useState)(false);
|
|
76
|
-
const {
|
|
77
|
-
isLocked,
|
|
78
|
-
isContentLocked
|
|
79
|
-
} = (0, _blockLock.useBlockLock)(clientId);
|
|
80
|
-
const forceSelectionContentLock = (0, _data.useSelect)(select => {
|
|
81
|
-
if (isSelected) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!isContentLocked) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return select(_store.store).hasSelectedInnerBlock(clientId, true);
|
|
90
|
-
}, [isContentLocked, clientId, isSelected]);
|
|
91
|
-
const isFirstSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[0] === clientId;
|
|
92
|
-
const isLastSelectedBlock = forceSelectionContentLock || isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId;
|
|
93
|
-
const {
|
|
94
|
-
toggleBlockHighlight
|
|
95
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
96
|
-
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
97
|
-
const block = (0, _data.useSelect)(select => select(_store.store).getBlock(clientId), [clientId]); // If ListView has experimental features related to the Persistent List View,
|
|
98
|
-
// only focus the selected list item on mount; otherwise the list would always
|
|
99
|
-
// try to steal the focus from the editor canvas.
|
|
100
|
-
|
|
101
|
-
(0, _element.useEffect)(() => {
|
|
102
|
-
if (!isTreeGridMounted && isSelected) {
|
|
103
|
-
cellRef.current.focus();
|
|
104
|
-
}
|
|
105
|
-
}, []);
|
|
106
|
-
const onMouseEnter = (0, _element.useCallback)(() => {
|
|
107
|
-
setIsHovered(true);
|
|
108
|
-
toggleBlockHighlight(clientId, true);
|
|
109
|
-
}, [clientId, setIsHovered, toggleBlockHighlight]);
|
|
110
|
-
const onMouseLeave = (0, _element.useCallback)(() => {
|
|
111
|
-
setIsHovered(false);
|
|
112
|
-
toggleBlockHighlight(clientId, false);
|
|
113
|
-
}, [clientId, setIsHovered, toggleBlockHighlight]);
|
|
114
|
-
const selectEditorBlock = (0, _element.useCallback)(event => {
|
|
115
|
-
selectBlock(event, clientId);
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
}, [clientId, selectBlock]);
|
|
118
|
-
const updateSelection = (0, _element.useCallback)(newClientId => {
|
|
119
|
-
selectBlock(undefined, newClientId);
|
|
120
|
-
}, [selectBlock]);
|
|
121
|
-
const {
|
|
122
|
-
isTreeGridMounted,
|
|
123
|
-
expand,
|
|
124
|
-
collapse,
|
|
125
|
-
LeafMoreMenu
|
|
126
|
-
} = (0, _context.useListViewContext)();
|
|
127
|
-
const toggleExpanded = (0, _element.useCallback)(event => {
|
|
128
|
-
// Prevent shift+click from opening link in a new window when toggling.
|
|
129
|
-
event.preventDefault();
|
|
130
|
-
event.stopPropagation();
|
|
131
|
-
|
|
132
|
-
if (isExpanded === true) {
|
|
133
|
-
collapse(clientId);
|
|
134
|
-
} else if (isExpanded === false) {
|
|
135
|
-
expand(clientId);
|
|
136
|
-
}
|
|
137
|
-
}, [clientId, expand, collapse, isExpanded]);
|
|
138
|
-
const instanceId = (0, _compose.useInstanceId)(ListViewBlock);
|
|
139
|
-
|
|
140
|
-
if (!block) {
|
|
141
|
-
return null;
|
|
142
|
-
} // When a block hides its toolbar it also hides the block settings menu,
|
|
143
|
-
// since that menu is part of the toolbar in the editor canvas.
|
|
144
|
-
// List View respects this by also hiding the block settings menu.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const showBlockActions = !!block && (0, _blocks.hasBlockSupport)(block.name, '__experimentalToolbar', true);
|
|
148
|
-
const descriptionId = `list-view-block-select-button__${instanceId}`;
|
|
149
|
-
const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
|
|
150
|
-
let blockAriaLabel = (0, _i18n.__)('Link');
|
|
151
|
-
|
|
152
|
-
if (blockInformation) {
|
|
153
|
-
blockAriaLabel = isLocked ? (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
154
|
-
(0, _i18n.__)('%s link (locked)'), blockInformation.title) : (0, _i18n.sprintf)( // translators: %s: The title of the block. This string indicates a link to select the block.
|
|
155
|
-
(0, _i18n.__)('%s link'), blockInformation.title);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const settingsAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
|
|
159
|
-
(0, _i18n.__)('Options for %s block'), blockInformation.title) : (0, _i18n.__)('Options');
|
|
160
|
-
const hasSiblings = siblingBlockCount > 0;
|
|
161
|
-
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
162
|
-
const moverCellClassName = (0, _classnames.default)('block-editor-list-view-block__mover-cell', {
|
|
163
|
-
'is-visible': isHovered || isSelected
|
|
164
|
-
});
|
|
165
|
-
const listViewBlockSettingsClassName = (0, _classnames.default)('block-editor-list-view-block__menu-cell', {
|
|
166
|
-
'is-visible': isHovered || isFirstSelectedBlock
|
|
167
|
-
});
|
|
168
|
-
let colSpan;
|
|
169
|
-
|
|
170
|
-
if (hasRenderedMovers) {
|
|
171
|
-
colSpan = 1;
|
|
172
|
-
} else if (!showBlockActions) {
|
|
173
|
-
colSpan = 2;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const classes = (0, _classnames.default)({
|
|
177
|
-
'is-selected': isSelected || forceSelectionContentLock,
|
|
178
|
-
'is-first-selected': isFirstSelectedBlock,
|
|
179
|
-
'is-last-selected': isLastSelectedBlock,
|
|
180
|
-
'is-branch-selected': isBranchSelected,
|
|
181
|
-
'is-dragging': isDragged,
|
|
182
|
-
'has-single-cell': !showBlockActions
|
|
183
|
-
}); // Only include all selected blocks if the currently clicked on block
|
|
184
|
-
// is one of the selected blocks. This ensures that if a user attempts
|
|
185
|
-
// to alter a block that isn't part of the selection, they're still able
|
|
186
|
-
// to do so.
|
|
187
|
-
|
|
188
|
-
const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
|
|
189
|
-
const MoreMenuComponent = LeafMoreMenu ? LeafMoreMenu : _blockSettingsDropdown.default;
|
|
190
|
-
return (0, _element.createElement)(_leaf.default, {
|
|
191
|
-
className: classes,
|
|
192
|
-
onMouseEnter: onMouseEnter,
|
|
193
|
-
onMouseLeave: onMouseLeave,
|
|
194
|
-
onFocus: onMouseEnter,
|
|
195
|
-
onBlur: onMouseLeave,
|
|
196
|
-
level: level,
|
|
197
|
-
position: position,
|
|
198
|
-
rowCount: rowCount,
|
|
199
|
-
path: path,
|
|
200
|
-
id: `list-view-block-${clientId}`,
|
|
201
|
-
"data-block": clientId,
|
|
202
|
-
isExpanded: isContentLocked ? undefined : isExpanded,
|
|
203
|
-
"aria-selected": !!isSelected || forceSelectionContentLock
|
|
204
|
-
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
205
|
-
className: "block-editor-list-view-block__contents-cell",
|
|
206
|
-
colSpan: colSpan,
|
|
207
|
-
ref: cellRef,
|
|
208
|
-
"aria-label": blockAriaLabel,
|
|
209
|
-
"aria-selected": !!isSelected || forceSelectionContentLock,
|
|
210
|
-
"aria-expanded": isContentLocked ? undefined : isExpanded,
|
|
211
|
-
"aria-describedby": descriptionId
|
|
212
|
-
}, _ref2 => {
|
|
213
|
-
let {
|
|
214
|
-
ref,
|
|
215
|
-
tabIndex,
|
|
216
|
-
onFocus
|
|
217
|
-
} = _ref2;
|
|
218
|
-
return (0, _element.createElement)("div", {
|
|
219
|
-
className: "block-editor-list-view-block__contents-container"
|
|
220
|
-
}, (0, _element.createElement)(_blockContents.default, {
|
|
221
|
-
block: block,
|
|
222
|
-
onClick: selectEditorBlock,
|
|
223
|
-
onToggleExpanded: toggleExpanded,
|
|
224
|
-
isSelected: isSelected,
|
|
225
|
-
position: position,
|
|
226
|
-
siblingBlockCount: siblingBlockCount,
|
|
227
|
-
level: level,
|
|
228
|
-
ref: ref,
|
|
229
|
-
tabIndex: tabIndex,
|
|
230
|
-
onFocus: onFocus,
|
|
231
|
-
isExpanded: isExpanded,
|
|
232
|
-
selectedClientIds: selectedClientIds,
|
|
233
|
-
preventAnnouncement: preventAnnouncement
|
|
234
|
-
}), (0, _element.createElement)("div", {
|
|
235
|
-
className: "block-editor-list-view-block-select-button__description",
|
|
236
|
-
id: descriptionId
|
|
237
|
-
}, blockPositionDescription));
|
|
238
|
-
}), hasRenderedMovers && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
239
|
-
className: moverCellClassName,
|
|
240
|
-
withoutGridItem: true
|
|
241
|
-
}, (0, _element.createElement)(_components.__experimentalTreeGridItem, null, _ref3 => {
|
|
242
|
-
let {
|
|
243
|
-
ref,
|
|
244
|
-
tabIndex,
|
|
245
|
-
onFocus
|
|
246
|
-
} = _ref3;
|
|
247
|
-
return (0, _element.createElement)(_button.BlockMoverUpButton, {
|
|
248
|
-
orientation: "vertical",
|
|
249
|
-
clientIds: [clientId],
|
|
250
|
-
ref: ref,
|
|
251
|
-
tabIndex: tabIndex,
|
|
252
|
-
onFocus: onFocus
|
|
253
|
-
});
|
|
254
|
-
}), (0, _element.createElement)(_components.__experimentalTreeGridItem, null, _ref4 => {
|
|
255
|
-
let {
|
|
256
|
-
ref,
|
|
257
|
-
tabIndex,
|
|
258
|
-
onFocus
|
|
259
|
-
} = _ref4;
|
|
260
|
-
return (0, _element.createElement)(_button.BlockMoverDownButton, {
|
|
261
|
-
orientation: "vertical",
|
|
262
|
-
clientIds: [clientId],
|
|
263
|
-
ref: ref,
|
|
264
|
-
tabIndex: tabIndex,
|
|
265
|
-
onFocus: onFocus
|
|
266
|
-
});
|
|
267
|
-
}))), showBlockActions && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
268
|
-
className: listViewBlockSettingsClassName,
|
|
269
|
-
"aria-selected": !!isSelected || forceSelectionContentLock
|
|
270
|
-
}, _ref5 => {
|
|
271
|
-
let {
|
|
272
|
-
ref,
|
|
273
|
-
tabIndex,
|
|
274
|
-
onFocus
|
|
275
|
-
} = _ref5;
|
|
276
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(MoreMenuComponent, {
|
|
277
|
-
clientIds: dropdownClientIds,
|
|
278
|
-
block: block,
|
|
279
|
-
clientId: clientId,
|
|
280
|
-
icon: _icons.moreVertical,
|
|
281
|
-
label: settingsAriaLabel,
|
|
282
|
-
toggleProps: {
|
|
283
|
-
ref,
|
|
284
|
-
className: 'block-editor-list-view-block__menu',
|
|
285
|
-
tabIndex,
|
|
286
|
-
onFocus
|
|
287
|
-
},
|
|
288
|
-
disableOpenOnArrowDown: true,
|
|
289
|
-
__experimentalSelectBlock: updateSelection
|
|
290
|
-
}));
|
|
291
|
-
})));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
var _default = (0, _element.memo)(ListViewBlock);
|
|
295
|
-
|
|
296
|
-
exports.default = _default;
|
|
297
|
-
//# sourceMappingURL=block.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/block.js"],"names":["ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","cellRef","isHovered","setIsHovered","isLocked","isContentLocked","forceSelectionContentLock","select","blockEditorStore","hasSelectedInnerBlock","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","getBlock","isTreeGridMounted","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","expand","collapse","LeafMoreMenu","toggleExpanded","stopPropagation","instanceId","showBlockActions","name","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","colSpan","classes","dropdownClientIds","includes","MoreMenuComponent","BlockSettingsDropdown","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AAIA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAcA,SAASA,aAAT,OAeI;AAAA,MAfoB;AACvBC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KADgB;AAEvBC,IAAAA,SAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,WALuB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,KAPuB;AAQvBC,IAAAA,QARuB;AASvBC,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AAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,4BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAEjE,QAAF,CAFb;AAGC,MAAA,GAAG,EAAG+D,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAnDF,EAkFGnB,gBAAgB,IACjB,qDACC,4BAAC,sCAAD;AACC,IAAA,SAAS,EAAGU,8BADb;AAEC,qBACC,CAAC,CAAEtD,UAAH,IAAiBiB;AAHnB,KAMG;AAAA,QAAE;AAAE4C,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,qDACC,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAGN,iBADb;AAEC,MAAA,KAAK,EAAG5D,KAFT;AAGC,MAAA,QAAQ,EAAGC,QAHZ;AAIC,MAAA,IAAI,EAAGkE,mBAJR;AAKC,MAAA,KAAK,EAAGd,iBALT;AAMC,MAAA,WAAW,EAAG;AACbW,QAAAA,GADa;AAEbI,QAAAA,SAAS,EACR,oCAHY;AAIbH,QAAAA,QAJa;AAKbC,QAAAA;AALa,OANf;AAaC,MAAA,sBAAsB,MAbvB;AAcC,MAAA,yBAAyB,EACxB5B;AAfF,MADD,CADC;AAAA,GANH,CADD,CAnFF,CADD;AAsHA;;eAEc,mBAAMvC,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock: { clientId },\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst { isLocked, isContentLocked } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst block = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst { isTreeGridMounted, expand, collapse, LeafMoreMenu } =\n\t\tuseListViewContext();\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tconst instanceId = useInstanceId( ListViewBlock );\n\n\tif ( ! block ) {\n\t\treturn null;\n\t}\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions =\n\t\t!! block &&\n\t\thasBlockSupport( block.name, '__experimentalToolbar', true );\n\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 1;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 2;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\tconst MoreMenuComponent = LeafMoreMenu\n\t\t? LeafMoreMenu\n\t\t: BlockSettingsDropdown;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ isContentLocked ? undefined : isExpanded }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ isContentLocked ? undefined : isExpanded }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\t!! isSelected || forceSelectionContentLock\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<MoreMenuComponent\n\t\t\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\t\t\tupdateSelection\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _components = require("@wordpress/components");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _appender = require("./appender");
|
|
19
|
-
|
|
20
|
-
var _block = _interopRequireDefault(require("./block"));
|
|
21
|
-
|
|
22
|
-
var _context = require("./context");
|
|
23
|
-
|
|
24
|
-
var _utils = require("./utils");
|
|
25
|
-
|
|
26
|
-
var _store = require("../../store");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Given a block, returns the total number of blocks in that subtree. This is used to help determine
|
|
38
|
-
* the list position of a block.
|
|
39
|
-
*
|
|
40
|
-
* When a block is collapsed, we do not count their children as part of that total. In the current drag
|
|
41
|
-
* implementation dragged blocks and their children are not counted.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} block block tree
|
|
44
|
-
* @param {Object} expandedState state that notes which branches are collapsed
|
|
45
|
-
* @param {Array} draggedClientIds a list of dragged client ids
|
|
46
|
-
* @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state.
|
|
47
|
-
* @return {number} block count
|
|
48
|
-
*/
|
|
49
|
-
function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) {
|
|
50
|
-
var _expandedState$block$;
|
|
51
|
-
|
|
52
|
-
const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
|
|
53
|
-
|
|
54
|
-
if (isDragged) {
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : isExpandedByDefault;
|
|
59
|
-
|
|
60
|
-
if (isExpanded) {
|
|
61
|
-
return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds, isExpandedByDefault), 0);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return 1;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const countReducer = (expandedState, draggedClientIds, isExpandedByDefault) => (count, block) => {
|
|
68
|
-
var _expandedState$block$2;
|
|
69
|
-
|
|
70
|
-
const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
|
|
71
|
-
|
|
72
|
-
if (isDragged) {
|
|
73
|
-
return count;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : isExpandedByDefault;
|
|
77
|
-
|
|
78
|
-
if (isExpanded && block.innerBlocks.length > 0) {
|
|
79
|
-
return count + countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return count + 1;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const noop = () => {};
|
|
86
|
-
|
|
87
|
-
function ListViewBranch(props) {
|
|
88
|
-
const {
|
|
89
|
-
blocks,
|
|
90
|
-
selectBlock = noop,
|
|
91
|
-
showBlockMovers,
|
|
92
|
-
selectedClientIds,
|
|
93
|
-
level = 1,
|
|
94
|
-
path = '',
|
|
95
|
-
isBranchSelected = false,
|
|
96
|
-
listPosition = 0,
|
|
97
|
-
fixedListWindow,
|
|
98
|
-
isExpanded,
|
|
99
|
-
parentId,
|
|
100
|
-
shouldShowInnerBlocks = true,
|
|
101
|
-
showAppender: showAppenderProp = true
|
|
102
|
-
} = props;
|
|
103
|
-
const isContentLocked = (0, _data.useSelect)(select => {
|
|
104
|
-
return !!(parentId && select(_store.store).getTemplateLock(parentId) === 'contentOnly');
|
|
105
|
-
}, [parentId]);
|
|
106
|
-
const {
|
|
107
|
-
expandedState,
|
|
108
|
-
draggedClientIds
|
|
109
|
-
} = (0, _context.useListViewContext)();
|
|
110
|
-
|
|
111
|
-
if (isContentLocked) {
|
|
112
|
-
return null;
|
|
113
|
-
} // Only show the appender at the first level.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const showAppender = showAppenderProp && level === 1;
|
|
117
|
-
const filteredBlocks = blocks.filter(Boolean);
|
|
118
|
-
const blockCount = filteredBlocks.length; // The appender means an extra row in List View, so add 1 to the row count.
|
|
119
|
-
|
|
120
|
-
const rowCount = showAppender ? blockCount + 1 : blockCount;
|
|
121
|
-
let nextPosition = listPosition;
|
|
122
|
-
return (0, _element.createElement)(_element.Fragment, null, filteredBlocks.map((block, index) => {
|
|
123
|
-
var _expandedState$client;
|
|
124
|
-
|
|
125
|
-
const {
|
|
126
|
-
clientId,
|
|
127
|
-
innerBlocks
|
|
128
|
-
} = block;
|
|
129
|
-
|
|
130
|
-
if (index > 0) {
|
|
131
|
-
nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const {
|
|
135
|
-
itemInView
|
|
136
|
-
} = fixedListWindow;
|
|
137
|
-
const blockInView = itemInView(nextPosition);
|
|
138
|
-
const position = index + 1;
|
|
139
|
-
const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
|
|
140
|
-
const hasNestedBlocks = !!(innerBlocks !== null && innerBlocks !== void 0 && innerBlocks.length);
|
|
141
|
-
const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined;
|
|
142
|
-
const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId));
|
|
143
|
-
const showBlock = isDragged || blockInView; // Make updates to the selected or dragged blocks synchronous,
|
|
144
|
-
// but asynchronous for any other block.
|
|
145
|
-
|
|
146
|
-
const isSelected = (0, _utils.isClientIdSelected)(clientId, selectedClientIds);
|
|
147
|
-
const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
|
|
148
|
-
return (0, _element.createElement)(_data.AsyncModeProvider, {
|
|
149
|
-
key: clientId,
|
|
150
|
-
value: !isSelected
|
|
151
|
-
}, showBlock && (0, _element.createElement)(_block.default, {
|
|
152
|
-
block: block,
|
|
153
|
-
selectBlock: selectBlock,
|
|
154
|
-
isSelected: isSelected,
|
|
155
|
-
isBranchSelected: isSelectedBranch,
|
|
156
|
-
isDragged: isDragged,
|
|
157
|
-
level: level,
|
|
158
|
-
position: position,
|
|
159
|
-
rowCount: rowCount,
|
|
160
|
-
siblingBlockCount: blockCount,
|
|
161
|
-
showBlockMovers: showBlockMovers,
|
|
162
|
-
path: updatedPath,
|
|
163
|
-
isExpanded: shouldExpand,
|
|
164
|
-
listPosition: nextPosition,
|
|
165
|
-
selectedClientIds: selectedClientIds
|
|
166
|
-
}), !showBlock && (0, _element.createElement)("tr", null, (0, _element.createElement)("td", {
|
|
167
|
-
className: "block-editor-list-view-placeholder"
|
|
168
|
-
})), hasNestedBlocks && shouldExpand && !isDragged && (0, _element.createElement)(ListViewBranch, {
|
|
169
|
-
parentId: clientId,
|
|
170
|
-
blocks: innerBlocks,
|
|
171
|
-
selectBlock: selectBlock,
|
|
172
|
-
showBlockMovers: showBlockMovers,
|
|
173
|
-
level: level + 1,
|
|
174
|
-
path: updatedPath,
|
|
175
|
-
listPosition: nextPosition + 1,
|
|
176
|
-
fixedListWindow: fixedListWindow,
|
|
177
|
-
isBranchSelected: isSelectedBranch,
|
|
178
|
-
selectedClientIds: selectedClientIds,
|
|
179
|
-
isExpanded: isExpanded,
|
|
180
|
-
showAppender: showAppenderProp
|
|
181
|
-
}));
|
|
182
|
-
}), showAppender && (0, _element.createElement)(_components.__experimentalTreeGridRow, {
|
|
183
|
-
level: level,
|
|
184
|
-
setSize: rowCount,
|
|
185
|
-
positionInSet: rowCount,
|
|
186
|
-
isExpanded: true
|
|
187
|
-
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, null, treeGridCellProps => (0, _element.createElement)(_appender.Appender, (0, _extends2.default)({
|
|
188
|
-
clientId: parentId,
|
|
189
|
-
nestingLevel: level,
|
|
190
|
-
blockCount: blockCount
|
|
191
|
-
}, treeGridCellProps)))));
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
var _default = (0, _element.memo)(ListViewBranch);
|
|
195
|
-
|
|
196
|
-
exports.default = _default;
|
|
197
|
-
//# sourceMappingURL=branch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/branch.js"],"names":["countBlocks","block","expandedState","draggedClientIds","isExpandedByDefault","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","noop","ListViewBranch","props","blocks","selectBlock","showBlockMovers","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","showAppender","showAppenderProp","isContentLocked","select","blockEditorStore","getTemplateLock","filteredBlocks","filter","Boolean","blockCount","rowCount","nextPosition","map","index","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","showBlock","isSelected","isSelectedBranch","treeGridCellProps"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAIA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAT,CACCC,KADD,EAECC,aAFD,EAGCC,gBAHD,EAICC,mBAJD,EAKE;AAAA;;AACD,QAAMC,SAAS,GAAGF,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB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,WAXR;AAYC,MAAA,UAAU,EAAGE,YAZd;AAaC,MAAA,YAAY,EAAGR,YAbhB;AAcC,MAAA,iBAAiB,EAAGnB;AAdrB,MAFF,EAmBG,CAAE6B,SAAF,IACD,wCACC;AAAI,MAAA,SAAS,EAAC;AAAd,MADD,CApBF,EAwBGH,eAAe,IAAIC,YAAnB,IAAmC,CAAE1C,SAArC,IACD,4BAAC,cAAD;AACC,MAAA,QAAQ,EAAGE,QADZ;AAEC,MAAA,MAAM,EAAGE,WAFV;AAGC,MAAA,WAAW,EAAGS,WAHf;AAIC,MAAA,eAAe,EAAGC,eAJnB;AAKC,MAAA,KAAK,EAAGE,KAAK,GAAG,CALjB;AAMC,MAAA,IAAI,EAAGwB,WANR;AAOC,MAAA,YAAY,EAAGN,YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGd,eARnB;AASC,MAAA,gBAAgB,EAAG0B,gBATpB;AAUC,MAAA,iBAAiB,EAAG/B,iBAVrB;AAWC,MAAA,UAAU,EAAGZ,UAXd;AAYC,MAAA,YAAY,EAAGqB;AAZhB,MAzBF,CADD;AA2CA,GAlFC,CADH,EAoFGD,YAAY,IACb,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAGP,KADT;AAEC,IAAA,OAAO,EAAGiB,QAFX;AAGC,IAAA,aAAa,EAAGA,QAHjB;AAIC,IAAA,UAAU,EAAG;AAJd,KAMC,4BAAC,sCAAD,QACKc,iBAAF,IACD,4BAAC,kBAAD;AACC,IAAA,QAAQ,EAAG1B,QADZ;AAEC,IAAA,YAAY,EAAGL,KAFhB;AAGC,IAAA,UAAU,EAAGgB;AAHd,KAIMe,iBAJN,EAFF,CAND,CArFF,CADD;AA0GA;;eAEc,mBAAMrC,cAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridRow as TreeGridRow,\n\t__experimentalTreeGridCell as TreeGridCell,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport { memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { Appender } from './appender';\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Given a block, returns the total number of blocks in that subtree. This is used to help determine\n * the list position of a block.\n *\n * When a block is collapsed, we do not count their children as part of that total. In the current drag\n * implementation dragged blocks and their children are not counted.\n *\n * @param {Object} block block tree\n * @param {Object} expandedState state that notes which branches are collapsed\n * @param {Array} draggedClientIds a list of dragged client ids\n * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state.\n * @return {number} block count\n */\nfunction countBlocks(\n\tblock,\n\texpandedState,\n\tdraggedClientIds,\n\tisExpandedByDefault\n) {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn 0;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? isExpandedByDefault;\n\n\tif ( isExpanded ) {\n\t\treturn (\n\t\t\t1 +\n\t\t\tblock.innerBlocks.reduce(\n\t\t\t\tcountReducer(\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t),\n\t\t\t\t0\n\t\t\t)\n\t\t);\n\t}\n\treturn 1;\n}\nconst countReducer =\n\t( expandedState, draggedClientIds, isExpandedByDefault ) =>\n\t( count, block ) => {\n\t\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\t\tif ( isDragged ) {\n\t\t\treturn count;\n\t\t}\n\t\tconst isExpanded =\n\t\t\texpandedState[ block.clientId ] ?? isExpandedByDefault;\n\t\tif ( isExpanded && block.innerBlocks.length > 0 ) {\n\t\t\treturn (\n\t\t\t\tcount +\n\t\t\t\tcountBlocks(\n\t\t\t\t\tblock,\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn count + 1;\n\t};\n\nconst noop = () => {};\n\nfunction ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock = noop,\n\t\tshowBlockMovers,\n\t\tselectedClientIds,\n\t\tlevel = 1,\n\t\tpath = '',\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t\tisExpanded,\n\t\tparentId,\n\t\tshouldShowInnerBlocks = true,\n\t\tshowAppender: showAppenderProp = true,\n\t} = props;\n\n\tconst isContentLocked = useSelect(\n\t\t( select ) => {\n\t\t\treturn !! (\n\t\t\t\tparentId &&\n\t\t\t\tselect( blockEditorStore ).getTemplateLock( parentId ) ===\n\t\t\t\t\t'contentOnly'\n\t\t\t);\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst { expandedState, draggedClientIds } = useListViewContext();\n\n\tif ( isContentLocked ) {\n\t\treturn null;\n\t}\n\n\t// Only show the appender at the first level.\n\tconst showAppender = showAppenderProp && level === 1;\n\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\n\n\t// The appender means an extra row in List View, so add 1 to the row count.\n\tconst rowCount = showAppender ? blockCount + 1 : blockCount;\n\tlet nextPosition = listPosition;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredBlocks.map( ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\n\t\t\t\tif ( index > 0 ) {\n\t\t\t\t\tnextPosition += countBlocks(\n\t\t\t\t\t\tfilteredBlocks[ index - 1 ],\n\t\t\t\t\t\texpandedState,\n\t\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\t\tisExpanded\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst { itemInView } = fixedListWindow;\n\t\t\t\tconst blockInView = itemInView( nextPosition );\n\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst updatedPath =\n\t\t\t\t\tpath.length > 0\n\t\t\t\t\t\t? `${ path }_${ position }`\n\t\t\t\t\t\t: `${ position }`;\n\t\t\t\tconst hasNestedBlocks = !! innerBlocks?.length;\n\n\t\t\t\tconst shouldExpand =\n\t\t\t\t\thasNestedBlocks && shouldShowInnerBlocks\n\t\t\t\t\t\t? expandedState[ clientId ] ?? isExpanded\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tconst isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\tconst showBlock = isDragged || blockInView;\n\n\t\t\t\t// Make updates to the selected or dragged blocks synchronous,\n\t\t\t\t// but asynchronous for any other block.\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBlocks );\n\t\t\t\treturn (\n\t\t\t\t\t<AsyncModeProvider key={ clientId } value={ ! isSelected }>\n\t\t\t\t\t\t{ showBlock && (\n\t\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisDragged={ isDragged }\n\t\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\t\trowCount={ rowCount }\n\t\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tisExpanded={ shouldExpand }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! showBlock && (\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td className=\"block-editor-list-view-placeholder\" />\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ hasNestedBlocks && shouldExpand && ! isDragged && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tparentId={ clientId }\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition + 1 }\n\t\t\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tshowAppender={ showAppenderProp }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AsyncModeProvider>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ showAppender && (\n\t\t\t\t<TreeGridRow\n\t\t\t\t\tlevel={ level }\n\t\t\t\t\tsetSize={ rowCount }\n\t\t\t\t\tpositionInSet={ rowCount }\n\t\t\t\t\tisExpanded={ true }\n\t\t\t\t>\n\t\t\t\t\t<TreeGridCell>\n\t\t\t\t\t\t{ ( treeGridCellProps ) => (\n\t\t\t\t\t\t\t<Appender\n\t\t\t\t\t\t\t\tclientId={ parentId }\n\t\t\t\t\t\t\t\tnestingLevel={ level }\n\t\t\t\t\t\t\t\tblockCount={ blockCount }\n\t\t\t\t\t\t\t\t{ ...treeGridCellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</TreeGridRow>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( ListViewBranch );\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useListViewContext = exports.ListViewContext = void 0;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
const ListViewContext = (0, _element.createContext)({});
|
|
14
|
-
exports.ListViewContext = ListViewContext;
|
|
15
|
-
|
|
16
|
-
const useListViewContext = () => (0, _element.useContext)(ListViewContext);
|
|
17
|
-
|
|
18
|
-
exports.useListViewContext = useListViewContext;
|
|
19
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/off-canvas-editor/context.js"],"names":["ListViewContext","useListViewContext"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,eAAe,GAAG,4BAAe,EAAf,CAAxB;;;AAEA,MAAMC,kBAAkB,GAAG,MAAM,yBAAYD,eAAZ,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nexport const ListViewContext = createContext( {} );\n\nexport const useListViewContext = () => useContext( ListViewContext );\n"]}
|