@wordpress/block-editor 12.3.0 → 12.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +13 -0
- package/build/autocompleters/block.js +5 -3
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/alignment-control/index.js +4 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/alignment-control/ui.js +5 -9
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/autocomplete/index.js +2 -4
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +4 -0
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/constants.js +1 -5
- package/build/components/block-alignment-control/constants.js.map +1 -1
- package/build/components/block-alignment-control/index.js +4 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +3 -4
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +3 -3
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +0 -1
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +2 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -1
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/index.js +8 -8
- package/build/components/block-controls/index.js.map +1 -1
- package/build/components/block-controls/slot.js +2 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +4 -2
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -6
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +2 -4
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-edit/index.js +3 -2
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +47 -0
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
- package/build/components/block-heading-level-dropdown/index.js +83 -0
- package/build/components/block-heading-level-dropdown/index.js.map +1 -0
- package/build/components/block-heading-level-dropdown/index.native.js +72 -0
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -0
- package/build/components/block-icon/index.native.js +6 -7
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +4 -2
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +20 -87
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +4 -2
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.js +6 -4
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +7 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +8 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/subdirectory-icon.js +4 -7
- package/build/components/block-list/subdirectory-icon.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -3
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +21 -19
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +12 -12
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +11 -10
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +4 -6
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-parent-selector/index.js +4 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +6 -8
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +6 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -6
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +4 -6
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +7 -7
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +83 -0
- package/build/components/block-quick-navigation/index.js.map +1 -0
- package/build/components/block-removal-warning-modal/index.js +90 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -0
- package/build/components/block-selection-clearer/index.js +4 -7
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -1
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -6
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +10 -11
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -5
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -5
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -2
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +6 -8
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +10 -8
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +4 -5
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -5
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +13 -6
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +5 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +8 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -6
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +4 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +5 -12
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/all-input-control.js +2 -6
- package/build/components/border-radius-control/all-input-control.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +2 -6
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -6
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/color-palette/control.js +2 -4
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +2 -4
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/colors/utils.js +7 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +11 -16
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +7 -5
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +12 -11
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +7 -5
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/copy-handler/index.js +5 -6
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/duotone-control/index.js +1 -2
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editable-text/index.js +6 -7
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -6
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +4 -5
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/font-size-picker.js +2 -4
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/font-sizes/utils.js +3 -3
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +7 -7
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/color-panel.js +15 -16
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -7
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -16
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/gradients/with-gradient.js +2 -6
- package/build/components/gradients/with-gradient.js.map +1 -1
- package/build/components/iframe/index.js +5 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/constants.js +1 -2
- package/build/components/image-editor/constants.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +9 -9
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -8
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +8 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -30
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inner-blocks/with-client-id.js +2 -6
- package/build/components/inner-blocks/with-client-id.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +2 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +33 -5
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -3
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +8 -8
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +4 -5
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +1 -1
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +2 -6
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +4 -6
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.js +3 -3
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/tabs.js +3 -3
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -5
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/group.js +4 -7
- package/build/components/inserter-listbox/group.js.map +1 -1
- package/build/components/inserter-listbox/item.js +8 -7
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +4 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -6
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +2 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/index.js +4 -6
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +4 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +2 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/justify-content-control/index.js +4 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/justify-content-control/ui.js +4 -7
- package/build/components/justify-content-control/ui.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +2 -4
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +2 -4
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +20 -24
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +2 -4
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +7 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +2 -4
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -4
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +4 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/aria-referenced-text.js +4 -8
- package/build/components/list-view/aria-referenced-text.js.map +1 -1
- package/build/components/list-view/block-contents.js +4 -5
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +13 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js +9 -8
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +62 -11
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +4 -6
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +4 -5
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -22
- 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 +46 -34
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +38 -13
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +1 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +8 -8
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js +4 -5
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/plain-text/index.js +8 -8
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +7 -6
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +5 -4
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +2 -4
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +8 -10
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +4 -5
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +5 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/rich-text/content.js +99 -0
- package/build/components/rich-text/content.js.map +1 -0
- package/build/components/rich-text/format-toolbar/index.js +1 -2
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +8 -42
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +6 -34
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js +2 -6
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +8 -8
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +2 -6
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/unit-control/index.js +4 -5
- package/build/components/unit-control/index.js.map +1 -1
- package/build/components/url-input/index.js +12 -10
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-input/index.native.js +4 -7
- package/build/components/url-input/index.native.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +21 -14
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +4 -5
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +4 -5
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/url-popover/link-viewer.js +4 -5
- package/build/components/url-popover/link-viewer.js.map +1 -1
- package/build/components/use-block-display-information/index.js +30 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/video-player/index.native.js +2 -4
- package/build/components/video-player/index.native.js.map +1 -1
- package/build/components/warning/index.native.js +4 -5
- package/build/components/warning/index.native.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -4
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +1 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +32 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +8 -8
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +4 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/behaviors.js +75 -37
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/border.js +4 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +4 -5
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -10
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +4 -2
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +7 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +5 -5
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -6
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +10 -8
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +30 -28
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +24 -16
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +8 -5
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +1 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.native.js +3 -1
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -17
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.js +0 -14
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +3 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/definitions.js +154 -0
- package/build/layouts/definitions.js.map +1 -0
- package/build/layouts/flex.js +8 -5
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +3 -1
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/grid.js +3 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js +8 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +23 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -62
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +200 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +72 -4
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +52 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +42 -42
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +39 -0
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +5 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/alignment-control/index.js +4 -5
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +5 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -3
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +4 -0
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +0 -3
- package/build-module/components/block-alignment-control/constants.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +4 -5
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +4 -4
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +3 -2
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +0 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +2 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -1
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/index.js +8 -7
- package/build-module/components/block-controls/index.js.map +1 -1
- package/build-module/components/block-controls/slot.js +2 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +4 -2
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -5
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +2 -3
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +3 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +39 -0
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
- package/build-module/components/block-heading-level-dropdown/index.js +71 -0
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -0
- package/build-module/components/block-heading-level-dropdown/index.native.js +60 -0
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -0
- package/build-module/components/block-icon/index.native.js +6 -6
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +4 -2
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +20 -88
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +4 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -4
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +8 -8
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/subdirectory-icon.js +4 -4
- package/build-module/components/block-list/subdirectory-icon.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -3
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +21 -19
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +12 -11
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +11 -9
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +4 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +4 -4
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +6 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +6 -7
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -5
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -5
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +7 -7
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +69 -0
- package/build-module/components/block-quick-navigation/index.js.map +1 -0
- package/build-module/components/block-removal-warning-modal/index.js +76 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -0
- package/build-module/components/block-selection-clearer/index.js +4 -4
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +2 -1
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -5
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +10 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +4 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -4
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +6 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +10 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -4
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +4 -4
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +13 -5
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +5 -4
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +8 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +4 -5
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +4 -5
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +5 -9
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/all-input-control.js +2 -3
- package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +2 -3
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -3
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/color-palette/control.js +2 -3
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/color-palette/with-color-context.js +2 -3
- package/build-module/components/color-palette/with-color-context.js.map +1 -1
- package/build-module/components/colors/utils.js +5 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +10 -14
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +7 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +12 -10
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +7 -4
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/copy-handler/index.js +5 -6
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/duotone-control/index.js +1 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editable-text/index.js +6 -6
- package/build-module/components/editable-text/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -3
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +4 -4
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/font-size-picker.js +2 -3
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +2 -2
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +7 -6
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +15 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +2 -1
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -1
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +7 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +11 -10
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/gradients/with-gradient.js +2 -3
- package/build-module/components/gradients/with-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +5 -6
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/constants.js +1 -2
- package/build-module/components/image-editor/constants.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -7
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +8 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -27
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/with-client-id.js +2 -3
- package/build-module/components/inner-blocks/with-client-id.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +2 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +33 -7
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +8 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +4 -4
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +1 -1
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +2 -3
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +4 -5
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +3 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +3 -3
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/tabs.js +3 -3
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +4 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/group.js +4 -4
- package/build-module/components/inserter-listbox/group.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +8 -6
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +4 -4
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -3
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +2 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/index.js +4 -5
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -5
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +2 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +4 -5
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/justify-content-control/ui.js +4 -4
- package/build-module/components/justify-content-control/ui.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +2 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +2 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +20 -24
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +2 -3
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +7 -5
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +2 -3
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +4 -5
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/aria-referenced-text.js +4 -5
- package/build-module/components/list-view/aria-referenced-text.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +4 -4
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +14 -4
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -7
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +61 -11
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +4 -5
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +4 -4
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -22
- 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 +45 -34
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +38 -13
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +8 -7
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +4 -4
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +8 -7
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +7 -5
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +5 -4
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +2 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +8 -7
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +4 -4
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +5 -4
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/rich-text/content.js +85 -0
- package/build-module/components/rich-text/content.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar/index.js +1 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +8 -42
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +6 -34
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js +2 -3
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +8 -7
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +2 -3
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/unit-control/index.js +4 -4
- package/build-module/components/unit-control/index.js.map +1 -1
- package/build-module/components/url-input/index.js +12 -9
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-input/index.native.js +4 -4
- package/build-module/components/url-input/index.native.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +22 -15
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +4 -4
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +4 -4
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +4 -4
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +29 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +2 -3
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.native.js +4 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +32 -5
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +8 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +4 -2
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/behaviors.js +76 -34
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/border.js +4 -4
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +4 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -7
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +4 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +7 -6
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +5 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +10 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +26 -24
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +23 -15
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +8 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +1 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.native.js +3 -1
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +8 -15
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +2 -1
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/definitions.js +147 -0
- package/build-module/layouts/definitions.js.map +1 -0
- package/build-module/layouts/flex.js +8 -6
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +2 -1
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/grid.js +2 -1
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js +7 -2
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +16 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -62
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +186 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +63 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +52 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +42 -42
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +37 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-style/style-rtl.css +58 -67
- package/build-style/style.css +58 -67
- package/package.json +32 -31
- package/src/autocompleters/block.js +4 -2
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/alignment-control/ui.js +1 -2
- package/src/components/block-actions/index.js +10 -0
- package/src/components/block-alignment-control/constants.js +0 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-alignment-control/ui.js +1 -6
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +2 -6
- package/src/components/block-edit/index.js +3 -5
- package/src/components/block-heading-level-dropdown/README.md +52 -0
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +43 -0
- package/src/components/block-heading-level-dropdown/index.js +77 -0
- package/src/components/block-heading-level-dropdown/index.native.js +63 -0
- package/src/components/block-inspector/index.js +18 -92
- package/src/components/block-inspector/style.scss +0 -5
- package/src/components/block-list/block.native.js +1 -0
- package/src/components/block-list/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +0 -4
- package/src/components/block-list-appender/index.js +29 -22
- package/src/components/block-lock/style.scss +11 -4
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +2 -2
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/block-mover/test/index.native.js +1 -20
- package/src/components/block-preview/index.js +7 -14
- package/src/components/block-quick-navigation/index.js +81 -0
- package/src/components/block-removal-warning-modal/index.js +94 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +15 -13
- package/src/components/block-switcher/index.js +1 -2
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-toolbar/style.scss +0 -4
- package/src/components/block-tools/index.js +10 -1
- package/src/components/block-tools/style.scss +4 -0
- package/src/components/block-vertical-alignment-control/ui.js +1 -3
- package/src/components/colors/utils.js +5 -1
- package/src/components/colors/with-colors.js +1 -5
- package/src/components/copy-handler/index.js +5 -5
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/duotone-control/index.js +0 -1
- package/src/components/font-sizes/test/fluid-utils.js +97 -76
- package/src/components/font-sizes/utils.js +2 -2
- package/src/components/global-styles/color-panel.js +3 -3
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/use-global-styles-output.js +14 -9
- package/src/components/global-styles/typography-panel.js +19 -16
- package/src/components/global-styles/use-global-styles-output.js +12 -12
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/constants.js +0 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inner-blocks/index.native.js +1 -1
- package/src/components/inner-blocks/use-nested-settings-update.js +31 -36
- package/src/components/inserter/block-patterns-tab.js +63 -8
- package/src/components/inserter/hooks/use-block-types-state.js +4 -3
- package/src/components/inserter/hooks/use-insertion-point.js +1 -0
- package/src/components/inserter/library.js +2 -1
- package/src/components/inserter/media-tab/media-tab.js +9 -3
- package/src/components/inserter/reusable-blocks-tab.js +3 -3
- package/src/components/inserter/tabs.js +3 -3
- package/src/components/link-control/index.js +34 -37
- package/src/components/link-control/search-input.js +5 -3
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +33 -55
- package/src/components/link-control/test/index.js +161 -159
- package/src/components/list-view/block-select-button.js +19 -1
- package/src/components/list-view/branch.js +6 -3
- package/src/components/list-view/drop-indicator.js +94 -9
- package/src/components/list-view/style.scss +13 -12
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -93
- package/src/components/list-view/use-list-view-client-ids.js +3 -20
- package/src/components/list-view/use-list-view-drop-zone.js +97 -54
- package/src/components/media-placeholder/index.js +54 -20
- package/src/components/media-replace-flow/index.js +1 -3
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/preview-options/index.js +3 -2
- package/src/components/provider/test/experimental-provider.js +9 -6
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/rich-text/content.js +85 -0
- package/src/components/rich-text/format-toolbar/index.js +1 -2
- package/src/components/rich-text/index.js +2 -35
- package/src/components/rich-text/index.native.js +3 -33
- package/src/components/url-input/index.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +15 -15
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/components/use-block-display-information/index.js +26 -0
- package/src/components/writing-flow/use-drag-selection.js +1 -1
- package/src/components/writing-flow/use-tab-nav.js +42 -6
- package/src/hooks/behaviors.js +82 -39
- package/src/hooks/font-family.js +1 -5
- package/src/hooks/font-size.js +12 -17
- package/src/hooks/layout.js +17 -25
- package/src/hooks/position.js +24 -12
- package/src/hooks/supports.js +1 -1
- package/src/hooks/use-typography-props.js +14 -19
- package/src/index.js +0 -2
- package/src/layouts/constrained.js +2 -1
- package/src/layouts/definitions.js +174 -0
- package/src/layouts/flex.js +7 -5
- package/src/layouts/flow.js +2 -1
- package/src/layouts/grid.js +2 -1
- package/src/layouts/test/utils.js +2 -7
- package/src/layouts/utils.js +7 -2
- package/src/private-apis.js +15 -0
- package/src/store/actions.js +7 -56
- package/src/store/defaults.js +1 -0
- package/src/store/private-actions.js +193 -0
- package/src/store/private-selectors.js +108 -35
- package/src/store/reducer.js +44 -0
- package/src/store/selectors.js +61 -39
- package/src/store/test/private-selectors.js +269 -1
- package/src/store/test/selectors.js +18 -17
- package/src/utils/object.js +35 -0
- package/src/utils/test/object.js +96 -1
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
16
14
|
var _data = require("@wordpress/data");
|
|
@@ -86,7 +84,7 @@ const ListViewBlockContents = (0, _element.forwardRef)(({
|
|
|
86
84
|
draggable,
|
|
87
85
|
onDragStart,
|
|
88
86
|
onDragEnd
|
|
89
|
-
}) => (0, _element.createElement)(_blockSelectButton.default,
|
|
87
|
+
}) => (0, _element.createElement)(_blockSelectButton.default, {
|
|
90
88
|
ref: ref,
|
|
91
89
|
className: className,
|
|
92
90
|
block: block,
|
|
@@ -99,8 +97,9 @@ const ListViewBlockContents = (0, _element.forwardRef)(({
|
|
|
99
97
|
draggable: draggable,
|
|
100
98
|
onDragStart: onDragStart,
|
|
101
99
|
onDragEnd: onDragEnd,
|
|
102
|
-
isExpanded: isExpanded
|
|
103
|
-
|
|
100
|
+
isExpanded: isExpanded,
|
|
101
|
+
...props
|
|
102
|
+
})));
|
|
104
103
|
});
|
|
105
104
|
var _default = ListViewBlockContents;
|
|
106
105
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","ref","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","AdditionalBlockContent","insertedBlock","setInsertedBlock","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","ref","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","AdditionalBlockContent","insertedBlock","setInsertedBlock","isBlockMoveTarget","className","draggableClientIds","includes","draggable","onDragStart","onDragEnd"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,qBAAqB,GAAG,yBAC7B,CACC;AACCC,EAAAA,OADD;AAECC,EAAAA,gBAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,UAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,iBAND;AAOCC,EAAAA,KAPD;AAQCC,EAAAA,UARD;AASCC,EAAAA,iBATD;AAUC,KAAGC;AAVJ,CADD,EAaCC,GAbD,KAcK;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAeT,KAArB;AAEA,QAAM;AAAEU,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsD,qBACzDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,sBAAF;AAA0BC,MAAAA;AAA1B,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,WAAO;AACNL,MAAAA,mBAAmB,EAAEG,sBAAsB,EADrC;AAENF,MAAAA,0BAA0B,EAAEG,wBAAwB;AAF9C,KAAP;AAIA,GAR0D,EAS3D,EAT2D,CAA5D;AAYA,QAAM;AAAEE,IAAAA,sBAAF;AAA0BC,IAAAA,aAA1B;AAAyCC,IAAAA;AAAzC,MACL,kCADD;AAGA,QAAMC,iBAAiB,GACtBT,mBAAmB,IAAIC,0BAA0B,KAAKF,QADvD;AAGA,QAAMW,SAAS,GAAG,yBAAY,uCAAZ,EAAqD;AACtE,0BAAsBD;AADgD,GAArD,CAAlB,CArBI,CAyBJ;AACA;AACA;AACA;;AACA,QAAME,kBAAkB,GAAGf,iBAAiB,CAACgB,QAAlB,CAA4Bb,QAA5B,IACxBH,iBADwB,GAExB,CAAEG,QAAF,CAFH;AAIA,SACC,qDACGO,sBAAsB,IACvB,4BAAC,sBAAD;AACC,IAAA,KAAK,EAAGhB,KADT;AAEC,IAAA,aAAa,EAAGiB,aAFjB;AAGC,IAAA,gBAAgB,EAAGC;AAHpB,IAFF,EAQC,4BAAC,uBAAD;AAAgB,IAAA,SAAS,EAAGG;AAA5B,KACG,CAAE;AAAEE,IAAAA,SAAF;AAAaC,IAAAA,WAAb;AAA0BC,IAAAA;AAA1B,GAAF,KACD,4BAAC,0BAAD;AACC,IAAA,GAAG,EAAGjB,GADP;AAEC,IAAA,SAAS,EAAGY,SAFb;AAGC,IAAA,KAAK,EAAGpB,KAHT;AAIC,IAAA,OAAO,EAAGF,OAJX;AAKC,IAAA,gBAAgB,EAAGC,gBALpB;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,QAAQ,EAAGC,QAPZ;AAQC,IAAA,iBAAiB,EAAGC,iBARrB;AASC,IAAA,KAAK,EAAGC,KATT;AAUC,IAAA,SAAS,EAAGmB,SAVb;AAWC,IAAA,WAAW,EAAGC,WAXf;AAYC,IAAA,SAAS,EAAGC,SAZb;AAaC,IAAA,UAAU,EAAGpB,UAbd;AAAA,OAcME;AAdN,IAFF,CARD,CADD;AA+BA,CA/E4B,CAA9B;eAkFeV,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\nimport { useListViewContext } from './context';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { hasBlockMovingClientId, getSelectedBlockClientId } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\n\t\tconst { AdditionalBlockContent, insertedBlock, setInsertedBlock } =\n\t\t\tuseListViewContext();\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ AdditionalBlockContent && (\n\t\t\t\t\t<AdditionalBlockContent\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tinsertedBlock={ insertedBlock }\n\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\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\tdraggable={ draggable }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t</>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
|
|
@@ -21,6 +21,8 @@ var _data = require("@wordpress/data");
|
|
|
21
21
|
|
|
22
22
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
23
23
|
|
|
24
|
+
var _i18n = require("@wordpress/i18n");
|
|
25
|
+
|
|
24
26
|
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
25
27
|
|
|
26
28
|
var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
|
|
@@ -79,7 +81,10 @@ function ListViewBlockSelectButton({
|
|
|
79
81
|
const {
|
|
80
82
|
removeBlocks
|
|
81
83
|
} = (0, _data.useDispatch)(_store.store);
|
|
82
|
-
const isMatch = (0, _keyboardShortcuts.__unstableUseShortcutEventMatch)();
|
|
84
|
+
const isMatch = (0, _keyboardShortcuts.__unstableUseShortcutEventMatch)();
|
|
85
|
+
const isSticky = blockInformation?.positionType === 'sticky';
|
|
86
|
+
const positionLabel = blockInformation?.positionLabel ? (0, _i18n.sprintf)( // translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
|
|
87
|
+
(0, _i18n.__)('Position: %1$s'), blockInformation.positionLabel) : ''; // The `href` attribute triggers the browser's native HTML drag operations.
|
|
83
88
|
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
|
|
84
89
|
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
|
|
85
90
|
// inside the `useOnBlockDrop` hook.
|
|
@@ -158,7 +163,13 @@ function ListViewBlockSelectButton({
|
|
|
158
163
|
}, (0, _element.createElement)(_components.__experimentalTruncate, {
|
|
159
164
|
className: "block-editor-list-view-block-select-button__anchor",
|
|
160
165
|
ellipsizeMode: "auto"
|
|
161
|
-
}, blockInformation.anchor)),
|
|
166
|
+
}, blockInformation.anchor)), positionLabel && isSticky && (0, _element.createElement)(_components.Tooltip, {
|
|
167
|
+
text: positionLabel
|
|
168
|
+
}, (0, _element.createElement)("span", {
|
|
169
|
+
className: "block-editor-list-view-block-select-button__sticky"
|
|
170
|
+
}, (0, _element.createElement)(_icons.Icon, {
|
|
171
|
+
icon: _icons.pinSmall
|
|
172
|
+
}))), isLocked && (0, _element.createElement)("span", {
|
|
162
173
|
className: "block-editor-list-view-block-select-button__lock"
|
|
163
174
|
}, (0, _element.createElement)(_icons.Icon, {
|
|
164
175
|
icon: _icons.lockSmall
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","canRemoveBlocks","blockEditorStore","removeBlocks","isMatch","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","BACKSPACE","DELETE","selectedBlockClientIds","isDeletingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToDelete","blockToFocus","shouldUpdateSelection","length","icon","anchor","lock"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AAQA,SAASA,yBAAT,CACC;AACCC,EAAAA,SADD;AAECC,EAAAA,KAAK,EAAE;AAAEC,IAAAA;AAAF,GAFR;AAGCC,EAAAA,OAHD;AAICC,EAAAA,gBAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,OAND;AAOCC,EAAAA,WAPD;AAQCC,EAAAA,SARD;AASCC,EAAAA,SATD;AAUCC,EAAAA,UAVD;AAWCC,EAAAA,SAXD;AAYCC,EAAAA,eAZD;AAaCC,EAAAA;AAbD,CADD,EAgBCC,GAhBD,EAiBE;AACD,QAAMC,gBAAgB,GAAG,yCAA4Bb,QAA5B,CAAzB;AACA,QAAMc,UAAU,GAAG,mCAAsB;AACxCd,IAAAA,QADwC;AAExCe,IAAAA,OAAO,EAAE;AAF+B,GAAtB,CAAnB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAe,6BAAchB,QAAd,CAArB;AACA,QAAM;AACLiB,IAAAA,yBADK;AAELC,IAAAA,wBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA;AALK,MAMF,qBAAWC,YAAX,CANJ;AAOA,QAAM;AAAEC,IAAAA;AAAF,MAAmB,uBAAaD,YAAb,CAAzB;AACA,QAAME,OAAO,GAAG,yDAAhB,CAfC,CAiBD;AACA;AACA;AACA;;AACA,QAAMC,kBAAkB,GAAKC,KAAF,IAAa;AACvCA,IAAAA,KAAK,CAACC,YAAN,CAAmBC,SAAnB;AACAvB,IAAAA,WAAW,GAAIqB,KAAJ,CAAX;AACA,GAHD;AAKA;A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AAsDA;;eAEc,yBAAYjD,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst {\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { removeBlocks } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst isDeletingSelectedBlocks =\n\t\t\t\tselectedBlockClientIds.includes( clientId );\n\t\t\tconst firstBlockClientId = isDeletingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t\t: clientId;\n\t\t\tconst firstBlockRootClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\t\tconst blocksToDelete = isDeletingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","className","block","clientId","onClick","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaLabel","ariaDescribedBy","updateFocusAndSelection","ref","blockInformation","blockTitle","context","isLocked","getSelectedBlockClientIds","getPreviousBlockClientId","getBlockRootClientId","getBlockOrder","canRemoveBlocks","blockEditorStore","removeBlocks","isMatch","isSticky","positionType","positionLabel","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","BACKSPACE","DELETE","selectedBlockClientIds","isDeletingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToDelete","blockToFocus","shouldUpdateSelection","length","icon","anchor","pinSmall","lock"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAQA,SAASA,yBAAT,CACC;AACCC,EAAAA,SADD;AAECC,EAAAA,KAAK,EAAE;AAAEC,IAAAA;AAAF,GAFR;AAGCC,EAAAA,OAHD;AAICC,EAAAA,gBAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,OAND;AAOCC,EAAAA,WAPD;AAQCC,EAAAA,SARD;AASCC,EAAAA,SATD;AAUCC,EAAAA,UAVD;AAWCC,EAAAA,SAXD;AAYCC,EAAAA,eAZD;AA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AI,EAAI,UAAUP,QAAU,EAb7B;AAcC,kBAAaS,SAdd;AAeC,wBAAmBC,eAfpB;AAgBC,qBAAgBF;AAhBjB,KAkBC,4BAAC,iBAAD;AAAkB,IAAA,OAAO,EAAGN;AAA5B,IAlBD,EAmBC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAGW,gBAAgB,EAAEkC,IAD1B;AAEC,IAAA,UAAU,MAFX;AAGC,IAAA,OAAO,EAAC;AAHT,IAnBD,EAwBC,4BAAC,gCAAD;AACC,IAAA,SAAS,EAAC,QADX;AAEC,IAAA,SAAS,EAAC,2DAFX;AAGC,IAAA,OAAO,EAAC,YAHT;AAIC,IAAA,OAAO,EAAG;AAJX,KAMC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AAAU,IAAA,aAAa,EAAC;AAAxB,KAAiCjC,UAAjC,CADD,CAND,EASGD,gBAAgB,EAAEmC,MAAlB,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,kCAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,aAAa,EAAC;AAFf,KAIGnC,gBAAgB,CAACmC,MAJpB,CADD,CAVF,EAmBGrB,aAAa,IAAIF,QAAjB,IACD,4BAAC,mBAAD;AAAS,IAAA,IAAI,EAAGE;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGsB;AAAb,IADD,CADD,CApBF,EA0BGjC,QAAQ,IACT;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGkC;AAAb,IADD,CA3BF,CAxBD,CADD,CADD;AA6DA;;eAEc,yBAAYrD,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaLabel,\n\t\tariaDescribedBy,\n\t\tupdateFocusAndSelection,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst {\n\t\tgetSelectedBlockClientIds,\n\t\tgetPreviousBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlockOrder,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { removeBlocks } = useDispatch( blockEditorStore );\n\tconst isMatch = useShortcutEventMatch();\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\n\tconst positionLabel = blockInformation?.positionLabel\n\t\t? sprintf(\n\t\t\t\t// translators: 1: Position of selected block, e.g. \"Sticky\" or \"Fixed\".\n\t\t\t\t__( 'Position: %1$s' ),\n\t\t\t\tblockInformation.positionLabel\n\t\t )\n\t\t: '';\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t} else if (\n\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\tevent.keyCode === DELETE ||\n\t\t\tisMatch( 'core/block-editor/remove', event )\n\t\t) {\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst isDeletingSelectedBlocks =\n\t\t\t\tselectedBlockClientIds.includes( clientId );\n\t\t\tconst firstBlockClientId = isDeletingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t\t: clientId;\n\t\t\tconst firstBlockRootClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\t\tconst blocksToDelete = isDeletingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\tif ( ! canRemoveBlocks( blocksToDelete, firstBlockRootClientId ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet blockToFocus =\n\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t// fallback to focus the parent block.\n\t\t\t\tfirstBlockRootClientId;\n\n\t\t\tremoveBlocks( blocksToDelete, false );\n\n\t\t\t// Update the selection if the original selection has been removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\tshowColors\n\t\t\t\t\tcontext=\"list-view\"\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 1 }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__anchor\"\n\t\t\t\t\t\t\t\tellipsizeMode=\"auto\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ positionLabel && isSticky && (\n\t\t\t\t\t\t<Tooltip text={ positionLabel }>\n\t\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__sticky\">\n\t\t\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isLocked && (\n\t\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
15
13
|
|
|
16
14
|
var _data = require("@wordpress/data");
|
|
@@ -94,6 +92,7 @@ function ListViewBranch(props) {
|
|
|
94
92
|
selectedClientIds,
|
|
95
93
|
level = 1,
|
|
96
94
|
path = '',
|
|
95
|
+
isBranchDragged = false,
|
|
97
96
|
isBranchSelected = false,
|
|
98
97
|
listPosition = 0,
|
|
99
98
|
fixedListWindow,
|
|
@@ -153,7 +152,7 @@ function ListViewBranch(props) {
|
|
|
153
152
|
|
|
154
153
|
const isSelected = (0, _utils.isClientIdSelected)(clientId, selectedClientIds);
|
|
155
154
|
const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
|
|
156
|
-
const showBlock = isDragged || blockInView || isSelected;
|
|
155
|
+
const showBlock = isDragged || blockInView || isSelected || isBranchDragged;
|
|
157
156
|
return (0, _element.createElement)(_data.AsyncModeProvider, {
|
|
158
157
|
key: clientId,
|
|
159
158
|
value: !isSelected
|
|
@@ -162,7 +161,7 @@ function ListViewBranch(props) {
|
|
|
162
161
|
selectBlock: selectBlock,
|
|
163
162
|
isSelected: isSelected,
|
|
164
163
|
isBranchSelected: isSelectedBranch,
|
|
165
|
-
isDragged: isDragged,
|
|
164
|
+
isDragged: isDragged || isBranchDragged,
|
|
166
165
|
level: level,
|
|
167
166
|
position: position,
|
|
168
167
|
rowCount: rowCount,
|
|
@@ -175,7 +174,7 @@ function ListViewBranch(props) {
|
|
|
175
174
|
isSyncedBranch: syncedBranch
|
|
176
175
|
}), !showBlock && (0, _element.createElement)("tr", null, (0, _element.createElement)("td", {
|
|
177
176
|
className: "block-editor-list-view-placeholder"
|
|
178
|
-
})), hasNestedBlocks && shouldExpand &&
|
|
177
|
+
})), hasNestedBlocks && shouldExpand && (0, _element.createElement)(ListViewBranch, {
|
|
179
178
|
parentId: clientId,
|
|
180
179
|
blocks: innerBlocks,
|
|
181
180
|
selectBlock: selectBlock,
|
|
@@ -185,6 +184,7 @@ function ListViewBranch(props) {
|
|
|
185
184
|
listPosition: nextPosition + 1,
|
|
186
185
|
fixedListWindow: fixedListWindow,
|
|
187
186
|
isBranchSelected: isSelectedBranch,
|
|
187
|
+
isBranchDragged: isDragged || isBranchDragged,
|
|
188
188
|
selectedClientIds: selectedClientIds,
|
|
189
189
|
isExpanded: isExpanded,
|
|
190
190
|
isSyncedBranch: syncedBranch
|
|
@@ -194,11 +194,12 @@ function ListViewBranch(props) {
|
|
|
194
194
|
setSize: rowCount,
|
|
195
195
|
positionInSet: rowCount,
|
|
196
196
|
isExpanded: true
|
|
197
|
-
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, null, treeGridCellProps => (0, _element.createElement)(_appender.Appender,
|
|
197
|
+
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, null, treeGridCellProps => (0, _element.createElement)(_appender.Appender, {
|
|
198
198
|
clientId: parentId,
|
|
199
199
|
nestingLevel: level,
|
|
200
|
-
blockCount: blockCount
|
|
201
|
-
|
|
200
|
+
blockCount: blockCount,
|
|
201
|
+
...treeGridCellProps
|
|
202
|
+
}))));
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
var _default = (0, _element.memo)(ListViewBranch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/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","isSyncedBranch","showAppender","showAppenderProp","parentBlockInformation","syncedBranch","isSynced","canParentExpand","select","blockEditorStore","canEditBlock","filteredBlocks","filter","Boolean","blockCount","rowCount","nextPosition","map","index","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","isSelected","isSelectedBranch","showBlock","treeGridCellProps"],"mappings":";;;;;;;;;AAOA;;;;AAJA;;AAKA;;AAKA;;AACA;;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,gBAAgB,EAAEG,QAAlB,CAA4BL,KAAK,CAACM,QAAlC,CAAlB;;AACA,MAAKF,SAAL,EAAiB;AAChB,WAAO,CAAP;AACA;;AACD,QAAMG,UAAU,4BAAGN,aAAa,CAAED,KAAK,CAACM,QAAR,CAAhB,yEAAsCH,mBAAtD;;AAEA,MAAKI,UAAL,EAAkB;AACjB,WACC,IACAP,KAAK,C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;AAflB,MAFF,EAoBG,CAAEuB,SAAF,IACD,wCACC;AAAI,MAAA,SAAS,EAAC;AAAd,MADD,CArBF,EAyBGL,eAAe,IAAIC,YAAnB,IAAmC,CAAE9C,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,EAAG4B,WANR;AAOC,MAAA,YAAY,EAAGN,YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGlB,eARnB;AASC,MAAA,gBAAgB,EAAG6B,gBATpB;AAUC,MAAA,iBAAiB,EAAGlC,iBAVrB;AAWC,MAAA,UAAU,EAAGZ,UAXd;AAYC,MAAA,cAAc,EAAGwB;AAZlB,MA1BF,CADD;AA4CA,GAlFC,CADH,EAoFGH,YAAY,IACb,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAGR,KADT;AAEC,IAAA,OAAO,EAAGqB,QAFX;AAGC,IAAA,aAAa,EAAGA,QAHjB;AAIC,IAAA,UAAU,EAAG;AAJd,KAMC,4BAAC,sCAAD,QACKc,iBAAF,IACD,4BAAC,kBAAD;AACC,IAAA,QAAQ,EAAG9B,QADZ;AAEC,IAAA,YAAY,EAAGL,KAFhB;AAGC,IAAA,UAAU,EAAGoB;AAHd,KAIMe,iBAJN,EAFF,CAND,CArFF,CADD;AA0GA;;eAEc,mBAAMzC,cAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridRow as TreeGridRow,\n\t__experimentalTreeGridCell as TreeGridCell,\n} from '@wordpress/components';\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { Appender } from './appender';\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\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\tisSyncedBranch = false,\n\t\tshowAppender: showAppenderProp = true,\n\t} = props;\n\n\tconst parentBlockInformation = useBlockDisplayInformation( parentId );\n\tconst syncedBranch = isSyncedBranch || !! parentBlockInformation?.isSynced;\n\n\tconst canParentExpand = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parentId ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).canEditBlock( parentId );\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst { expandedState, draggedClientIds } = useListViewContext();\n\n\tif ( ! canParentExpand ) {\n\t\treturn null;\n\t}\n\n\t// Only show the appender at the first level.\n\tconst showAppender = showAppenderProp && level === 1;\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\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\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\tconst showBlock = isDragged || blockInView || isSelected;\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\tisSyncedBranch={ syncedBranch }\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\tisSyncedBranch={ syncedBranch }\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
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/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","isBranchDragged","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","isSyncedBranch","showAppender","showAppenderProp","parentBlockInformation","syncedBranch","isSynced","canParentExpand","select","blockEditorStore","canEditBlock","filteredBlocks","filter","Boolean","blockCount","rowCount","nextPosition","map","index","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","isSelected","isSelectedBranch","showBlock","treeGridCellProps"],"mappings":";;;;;;;;;AAOA;;AAJA;;AAKA;;AAKA;;AACA;;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,gBAAgB,EAAEG,QAAlB,CAA4BL,KAAK,CAACM,QAAlC,CAAlB;;AACA,MAAKF,SAAL,EAAiB;AAChB,WAAO,CAAP;AACA;;AACD,QAAMG,UAAU,4BAAGN,aAAa,CAAED,KAAK,CAACM,QAAR,CAAhB,yEAAsCH,mBAAtD;;AAEA,MAAKI,UAAL,EAAkB;AACjB,WACC,IACAP,KAAK,CAACQ,WAAN,CAAkBC,MAAlB,CACCC,YAAY,CACXT,aADW,EAEXC,gBAFW,EAGXC,mBAHW,CADb,EAMC,CAND,CAFD;AAWA;;AACD,SAAO,CAAP;AACA;;AACD,MAAMO,YAAY,GACjB,CAAET,aAAF,EAAiBC,gBAAjB,EAAmCC,mBAAnC,KACA,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ACC,MAAA,QAAQ,EAAG7C,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,EAAG6B,WANR;AAOC,MAAA,YAAY,EAAGN,YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGlB,eARnB;AASC,MAAA,gBAAgB,EAAG6B,gBATpB;AAUC,MAAA,eAAe,EAAGlD,SAAS,IAAIkB,eAVhC;AAWC,MAAA,iBAAiB,EAAGH,iBAXrB;AAYC,MAAA,UAAU,EAAGZ,UAZd;AAaC,MAAA,cAAc,EAAGyB;AAblB,MA1BF,CADD;AA6CA,GApFC,CADH,EAsFGH,YAAY,IACb,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAGT,KADT;AAEC,IAAA,OAAO,EAAGsB,QAFX;AAGC,IAAA,aAAa,EAAGA,QAHjB;AAIC,IAAA,UAAU,EAAG;AAJd,KAMC,4BAAC,sCAAD,QACKc,iBAAF,IACD,4BAAC,kBAAD;AACC,IAAA,QAAQ,EAAG9B,QADZ;AAEC,IAAA,YAAY,EAAGN,KAFhB;AAGC,IAAA,UAAU,EAAGqB,UAHd;AAAA,OAIMe;AAJN,IAFF,CAND,CAvFF,CADD;AA4GA;;eAEc,mBAAM1C,cAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridRow as TreeGridRow,\n\t__experimentalTreeGridCell as TreeGridCell,\n} from '@wordpress/components';\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { Appender } from './appender';\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\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\tisBranchDragged = false,\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t\tisExpanded,\n\t\tparentId,\n\t\tshouldShowInnerBlocks = true,\n\t\tisSyncedBranch = false,\n\t\tshowAppender: showAppenderProp = true,\n\t} = props;\n\n\tconst parentBlockInformation = useBlockDisplayInformation( parentId );\n\tconst syncedBranch = isSyncedBranch || !! parentBlockInformation?.isSynced;\n\n\tconst canParentExpand = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parentId ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).canEditBlock( parentId );\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst { expandedState, draggedClientIds } = useListViewContext();\n\n\tif ( ! canParentExpand ) {\n\t\treturn null;\n\t}\n\n\t// Only show the appender at the first level.\n\tconst showAppender = showAppenderProp && level === 1;\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\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\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\tconst showBlock =\n\t\t\t\t\tisDragged || blockInView || isSelected || isBranchDragged;\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 || isBranchDragged }\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\tisSyncedBranch={ syncedBranch }\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 && (\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\tisBranchDragged={ isDragged || isBranchDragged }\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\tisSyncedBranch={ syncedBranch }\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"]}
|
|
@@ -11,6 +11,8 @@ var _components = require("@wordpress/components");
|
|
|
11
11
|
|
|
12
12
|
var _dom = require("@wordpress/dom");
|
|
13
13
|
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* WordPress dependencies
|
|
16
18
|
*/
|
|
@@ -43,6 +45,7 @@ function ListViewDropIndicator({
|
|
|
43
45
|
// is undefined, so the indicator will appear after the rootBlockElement.
|
|
44
46
|
|
|
45
47
|
const targetElement = blockElement || rootBlockElement;
|
|
48
|
+
const rtl = (0, _i18n.isRTL)();
|
|
46
49
|
const getDropIndicatorIndent = (0, _element.useCallback)(targetElementRect => {
|
|
47
50
|
if (!rootBlockElement) {
|
|
48
51
|
return 0;
|
|
@@ -53,8 +56,8 @@ function ListViewDropIndicator({
|
|
|
53
56
|
|
|
54
57
|
const rootBlockIconElement = rootBlockElement.querySelector('.block-editor-block-icon');
|
|
55
58
|
const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect();
|
|
56
|
-
return rootBlockIconRect.right - targetElementRect.left;
|
|
57
|
-
}, [rootBlockElement]);
|
|
59
|
+
return rtl ? targetElementRect.right - rootBlockIconRect.left : rootBlockIconRect.right - targetElementRect.left;
|
|
60
|
+
}, [rootBlockElement, rtl]);
|
|
58
61
|
const getDropIndicatorWidth = (0, _element.useCallback)((targetElementRect, indent) => {
|
|
59
62
|
if (!targetElement) {
|
|
60
63
|
return 0;
|
|
@@ -69,18 +72,36 @@ function ListViewDropIndicator({
|
|
|
69
72
|
// target element.
|
|
70
73
|
|
|
71
74
|
const scrollContainer = (0, _dom.getScrollContainer)(targetElement, 'horizontal');
|
|
75
|
+
const ownerDocument = targetElement.ownerDocument;
|
|
76
|
+
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
|
|
72
77
|
|
|
73
|
-
if (scrollContainer) {
|
|
78
|
+
if (scrollContainer && !windowScroll) {
|
|
74
79
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
80
|
+
const distanceBetweenContainerAndTarget = (0, _i18n.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left;
|
|
81
|
+
const scrollContainerWidth = scrollContainer.clientWidth;
|
|
82
|
+
|
|
83
|
+
if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) {
|
|
84
|
+
width = scrollContainerWidth - distanceBetweenContainerAndTarget;
|
|
85
|
+
} // LTR logic for ensuring the drop indicator does not extend
|
|
86
|
+
// beyond the right edge of the scroll container.
|
|
87
|
+
|
|
75
88
|
|
|
76
|
-
if (
|
|
77
|
-
width
|
|
89
|
+
if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) {
|
|
90
|
+
width -= scrollContainerRect.left - targetElementRect.left;
|
|
91
|
+
return width;
|
|
92
|
+
} // RTL logic for ensuring the drop indicator does not extend
|
|
93
|
+
// beyond the right edge of the scroll container.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if (rtl && targetElementRect.right - indent > scrollContainerRect.right) {
|
|
97
|
+
width -= targetElementRect.right - scrollContainerRect.right;
|
|
98
|
+
return width;
|
|
78
99
|
}
|
|
79
100
|
} // Subtract the indent from the final width of the indicator.
|
|
80
101
|
|
|
81
102
|
|
|
82
103
|
return width - indent;
|
|
83
|
-
}, [targetElement]);
|
|
104
|
+
}, [rtl, targetElement]);
|
|
84
105
|
const style = (0, _element.useMemo)(() => {
|
|
85
106
|
if (!targetElement) {
|
|
86
107
|
return {};
|
|
@@ -99,15 +120,45 @@ function ListViewDropIndicator({
|
|
|
99
120
|
return undefined;
|
|
100
121
|
}
|
|
101
122
|
|
|
123
|
+
const ownerDocument = targetElement.ownerDocument;
|
|
102
124
|
return {
|
|
103
|
-
ownerDocument
|
|
125
|
+
ownerDocument,
|
|
104
126
|
|
|
105
127
|
getBoundingClientRect() {
|
|
106
128
|
const rect = targetElement.getBoundingClientRect();
|
|
107
|
-
const indent = getDropIndicatorIndent(rect);
|
|
108
|
-
|
|
129
|
+
const indent = getDropIndicatorIndent(rect); // In RTL languages, the drop indicator should be positioned
|
|
130
|
+
// to the left of the target element, with the width of the
|
|
131
|
+
// indicator determining the indent at the right edge of the
|
|
132
|
+
// target element. In LTR languages, the drop indicator should
|
|
133
|
+
// end at the right edge of the target element, with the indent
|
|
134
|
+
// added to the position of the left edge of the target element.
|
|
135
|
+
|
|
136
|
+
let left = rtl ? rect.left : rect.left + indent;
|
|
109
137
|
let top = 0;
|
|
110
|
-
let bottom = 0;
|
|
138
|
+
let bottom = 0; // In deeply nested lists, where a scrollbar is present,
|
|
139
|
+
// the width of the drop indicator should be the width of
|
|
140
|
+
// the visible area of the scroll container. Additionally,
|
|
141
|
+
// the left edge of the drop indicator line needs to be
|
|
142
|
+
// offset by the distance the left edge of the target element
|
|
143
|
+
// and the left edge of the scroll container. The ensures
|
|
144
|
+
// that the drop indicator position never breaks out of the
|
|
145
|
+
// visible area of the scroll container.
|
|
146
|
+
|
|
147
|
+
const scrollContainer = (0, _dom.getScrollContainer)(targetElement, 'horizontal');
|
|
148
|
+
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement; // If the scroll container is not the window, offset the left position, if need be.
|
|
149
|
+
|
|
150
|
+
if (scrollContainer && !windowScroll) {
|
|
151
|
+
const scrollContainerRect = scrollContainer.getBoundingClientRect(); // In RTL languages, a vertical scrollbar is present on the
|
|
152
|
+
// left edge of the scroll container. The width of the
|
|
153
|
+
// scrollbar needs to be accounted for when positioning the
|
|
154
|
+
// drop indicator.
|
|
155
|
+
|
|
156
|
+
const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0;
|
|
157
|
+
|
|
158
|
+
if (left < scrollContainerRect.left + scrollbarWidth) {
|
|
159
|
+
left = scrollContainerRect.left + scrollbarWidth;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
111
162
|
|
|
112
163
|
if (dropPosition === 'top') {
|
|
113
164
|
top = rect.top;
|
|
@@ -124,7 +175,7 @@ function ListViewDropIndicator({
|
|
|
124
175
|
}
|
|
125
176
|
|
|
126
177
|
};
|
|
127
|
-
}, [targetElement, dropPosition, getDropIndicatorIndent, getDropIndicatorWidth]);
|
|
178
|
+
}, [targetElement, dropPosition, getDropIndicatorIndent, getDropIndicatorWidth, rtl]);
|
|
128
179
|
|
|
129
180
|
if (!targetElement) {
|
|
130
181
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/drop-indicator.js"],"names":["ListViewDropIndicator","listViewRef","blockDropTarget","rootClientId","clientId","dropPosition","rootBlockElement","blockElement","current","_rootBlockElement","querySelector","undefined","_blockElement","targetElement","getDropIndicatorIndent","targetElementRect","rootBlockIconElement","rootBlockIconRect","getBoundingClientRect","right","left","getDropIndicatorWidth","indent","width","offsetWidth","scrollContainer","scrollContainerRect","clientWidth","style","popoverAnchor","isValidDropPosition","ownerDocument","rect","top","bottom","height","window","DOMRect"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAJA;AACA;AACA;AAKe,SAASA,qBAAT,CAAgC;AAC9CC,EAAAA,WAD8C;AAE9CC,EAAAA;AAF8C,CAAhC,EAGX;AACH,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,QAAhB;AAA0BC,IAAAA;AAA1B,MAA2CH,eAAe,IAAI,EAApE;AAEA,QAAM,CAAEI,gBAAF,EAAoBC,YAApB,IAAqC,sBAAS,MAAM;AACzD,QAAK,CAAEN,WAAW,CAACO,OAAnB,EAA6B;AAC5B,aAAO,EAAP;AACA,KAHwD,CAKzD;AACA;;;AACA,UAAMC,iBAAiB,GAAGN,YAAY,GACnCF,WAAW,CAACO,OAAZ,CAAoBE,aAApB,CACC,gBAAgBP,YAAc,IAD/B,CADmC,GAInCQ,SAJH,CAPyD,CAazD;AACA;AACA;;;AACA,UAAMC,aAAa,GAAGR,QAAQ,GAC3BH,WAAW,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AK,GAAGF,qBAAqB,CAAEW,IAAF,EAAQV,MAAR,CAAnC;AACA,cAAMa,MAAM,GAAGD,MAAM,GAAGD,GAAxB;AAEA,eAAO,IAAIG,MAAM,CAACC,OAAX,CAAoBjB,IAApB,EAA0Ba,GAA1B,EAA+BV,KAA/B,EAAsCY,MAAtC,CAAP;AACA;;AAtBK,KAAP;AAwBA,GAjCqB,EAiCnB,CACFtB,aADE,EAEFR,YAFE,EAGFS,sBAHE,EAIFO,qBAJE,CAjCmB,CAAtB;;AAwCA,MAAK,CAAER,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,mBAAD;AACC,IAAA,OAAO,EAAG,KADX;AAEC,IAAA,MAAM,EAAGgB,aAFV;AAGC,IAAA,YAAY,EAAG,KAHhB;AAIC,IAAA,SAAS,EAAC,uCAJX;AAKC,IAAA,OAAO,EAAC;AALT,KAOC;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,SAAS,EAAC;AAFX,IAPD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Popover } from '@wordpress/components';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useCallback, useMemo } from '@wordpress/element';\n\nexport default function ListViewDropIndicator( {\n\tlistViewRef,\n\tblockDropTarget,\n} ) {\n\tconst { rootClientId, clientId, dropPosition } = blockDropTarget || {};\n\n\tconst [ rootBlockElement, blockElement ] = useMemo( () => {\n\t\tif ( ! listViewRef.current ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// The rootClientId will be defined whenever dropping into inner\n\t\t// block lists, but is undefined when dropping at the root level.\n\t\tconst _rootBlockElement = rootClientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ rootClientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\t// The clientId represents the sibling block, the dragged block will\n\t\t// usually be inserted adjacent to it. It will be undefined when\n\t\t// dropping a block into an empty block list.\n\t\tconst _blockElement = clientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ clientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn [ _rootBlockElement, _blockElement ];\n\t}, [ rootClientId, clientId ] );\n\n\t// The targetElement is the element that the drop indicator will appear\n\t// before or after. When dropping into an empty block list, blockElement\n\t// is undefined, so the indicator will appear after the rootBlockElement.\n\tconst targetElement = blockElement || rootBlockElement;\n\n\tconst getDropIndicatorIndent = useCallback(\n\t\t( targetElementRect ) => {\n\t\t\tif ( ! rootBlockElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Calculate the indent using the block icon of the root block.\n\t\t\t// Using a classname selector here might be flaky and could be\n\t\t\t// improved.\n\t\t\tconst rootBlockIconElement = rootBlockElement.querySelector(\n\t\t\t\t'.block-editor-block-icon'\n\t\t\t);\n\t\t\tconst rootBlockIconRect =\n\t\t\t\trootBlockIconElement.getBoundingClientRect();\n\t\t\treturn rootBlockIconRect.right - targetElementRect.left;\n\t\t},\n\t\t[ rootBlockElement ]\n\t);\n\n\tconst getDropIndicatorWidth = useCallback(\n\t\t( targetElementRect, indent ) => {\n\t\t\tif ( ! targetElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Default to assuming that the width of the drop indicator\n\t\t\t// should be the same as the target element.\n\t\t\tlet width = targetElement.offsetWidth;\n\n\t\t\t// In deeply nested lists, where a scrollbar is present,\n\t\t\t// the width of the drop indicator should be the width of\n\t\t\t// the scroll container, minus the distance from the left\n\t\t\t// edge of the scroll container to the left edge of the\n\t\t\t// target element.\n\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\ttargetElement,\n\t\t\t\t'horizontal'\n\t\t\t);\n\n\t\t\tif ( scrollContainer ) {\n\t\t\t\tconst scrollContainerRect =\n\t\t\t\t\tscrollContainer.getBoundingClientRect();\n\n\t\t\t\tif ( scrollContainer.clientWidth < width ) {\n\t\t\t\t\twidth =\n\t\t\t\t\t\tscrollContainer.clientWidth -\n\t\t\t\t\t\t( targetElementRect.left - scrollContainerRect.left );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Subtract the indent from the final width of the indicator.\n\t\t\treturn width - indent;\n\t\t},\n\t\t[ targetElement ]\n\t);\n\n\tconst style = useMemo( () => {\n\t\tif ( ! targetElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst targetElementRect = targetElement.getBoundingClientRect();\n\t\tconst indent = getDropIndicatorIndent( targetElementRect );\n\n\t\treturn {\n\t\t\twidth: getDropIndicatorWidth( targetElementRect, indent ),\n\t\t};\n\t}, [ getDropIndicatorIndent, getDropIndicatorWidth, targetElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tconst isValidDropPosition =\n\t\t\tdropPosition === 'top' ||\n\t\t\tdropPosition === 'bottom' ||\n\t\t\tdropPosition === 'inside';\n\t\tif ( ! targetElement || ! isValidDropPosition ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\townerDocument: targetElement.ownerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst rect = targetElement.getBoundingClientRect();\n\t\t\t\tconst indent = getDropIndicatorIndent( rect );\n\t\t\t\tconst left = rect.left + indent;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet bottom = 0;\n\n\t\t\t\tif ( dropPosition === 'top' ) {\n\t\t\t\t\ttop = rect.top;\n\t\t\t\t\tbottom = rect.top;\n\t\t\t\t} else {\n\t\t\t\t\t// `dropPosition` is either `bottom` or `inside`\n\t\t\t\t\ttop = rect.bottom;\n\t\t\t\t\tbottom = rect.bottom;\n\t\t\t\t}\n\n\t\t\t\tconst width = getDropIndicatorWidth( rect, indent );\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\ttargetElement,\n\t\tdropPosition,\n\t\tgetDropIndicatorIndent,\n\t\tgetDropIndicatorWidth,\n\t] );\n\n\tif ( ! targetElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-list-view-drop-indicator\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={ style }\n\t\t\t\tclassName=\"block-editor-list-view-drop-indicator__line\"\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/drop-indicator.js"],"names":["ListViewDropIndicator","listViewRef","blockDropTarget","rootClientId","clientId","dropPosition","rootBlockElement","blockElement","current","_rootBlockElement","querySelector","undefined","_blockElement","targetElement","rtl","getDropIndicatorIndent","targetElementRect","rootBlockIconElement","rootBlockIconRect","getBoundingClientRect","right","left","getDropIndicatorWidth","indent","width","offsetWidth","scrollContainer","ownerDocument","windowScroll","body","documentElement","scrollContainerRect","distanceBetweenContainerAndTarget","scrollContainerWidth","clientWidth","style","popoverAnchor","isValidDropPosition","rect","top","bottom","scrollbarWidth","height","window","DOMRect"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAMe,SAASA,qBAAT,CAAgC;AAC9CC,EAAAA,WAD8C;AAE9CC,EAAAA;AAF8C,CAAhC,EAGX;AACH,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,QAAhB;AAA0BC,IAAAA;AAA1B,MAA2CH,eAAe,IAAI,EAApE;AAEA,QAAM,CAAEI,gBAAF,EAAoBC,YAApB,IAAqC,sBAAS,MAAM;AACzD,QAAK,CAAEN,WAAW,CAACO,OAAnB,EAA6B;AAC5B,aAAO,EAAP;AACA,KAHwD,CAKzD;AACA;;;AACA,UAAMC,iBAAiB,GAAGN,YAAY,GACnCF,WAAW,CAACO,OAAZ,CAAoBE,aAApB,CACC,gBAAgBP,YAAc,IAD/B,CADmC,GAInCQ,SAJH,CAPyD,CAazD;AAC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AAKA,cAAKb,IAAI,GAAGU,mBAAmB,CAACV,IAApB,GAA2BoB,cAAvC,EAAwD;AACvDpB,YAAAA,IAAI,GAAGU,mBAAmB,CAACV,IAApB,GAA2BoB,cAAlC;AACA;AACD;;AAED,YAAKpC,YAAY,KAAK,KAAtB,EAA8B;AAC7BkC,UAAAA,GAAG,GAAGD,IAAI,CAACC,GAAX;AACAC,UAAAA,MAAM,GAAGF,IAAI,CAACC,GAAd;AACA,SAHD,MAGO;AACN;AACAA,UAAAA,GAAG,GAAGD,IAAI,CAACE,MAAX;AACAA,UAAAA,MAAM,GAAGF,IAAI,CAACE,MAAd;AACA;;AAED,cAAMhB,KAAK,GAAGF,qBAAqB,CAAEgB,IAAF,EAAQf,MAAR,CAAnC;AACA,cAAMmB,MAAM,GAAGF,MAAM,GAAGD,GAAxB;AAEA,eAAO,IAAII,MAAM,CAACC,OAAX,CAAoBvB,IAApB,EAA0BkB,GAA1B,EAA+Bf,KAA/B,EAAsCkB,MAAtC,CAAP;AACA;;AAhEK,KAAP;AAkEA,GA7EqB,EA6EnB,CACF7B,aADE,EAEFR,YAFE,EAGFU,sBAHE,EAIFO,qBAJE,EAKFR,GALE,CA7EmB,CAAtB;;AAqFA,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,mBAAD;AACC,IAAA,OAAO,EAAG,KADX;AAEC,IAAA,MAAM,EAAGuB,aAFV;AAGC,IAAA,YAAY,EAAG,KAHhB;AAIC,IAAA,SAAS,EAAC,uCAJX;AAKC,IAAA,OAAO,EAAC;AALT,KAOC;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,SAAS,EAAC;AAFX,IAPD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Popover } from '@wordpress/components';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\nexport default function ListViewDropIndicator( {\n\tlistViewRef,\n\tblockDropTarget,\n} ) {\n\tconst { rootClientId, clientId, dropPosition } = blockDropTarget || {};\n\n\tconst [ rootBlockElement, blockElement ] = useMemo( () => {\n\t\tif ( ! listViewRef.current ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// The rootClientId will be defined whenever dropping into inner\n\t\t// block lists, but is undefined when dropping at the root level.\n\t\tconst _rootBlockElement = rootClientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ rootClientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\t// The clientId represents the sibling block, the dragged block will\n\t\t// usually be inserted adjacent to it. It will be undefined when\n\t\t// dropping a block into an empty block list.\n\t\tconst _blockElement = clientId\n\t\t\t? listViewRef.current.querySelector(\n\t\t\t\t\t`[data-block=\"${ clientId }\"]`\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn [ _rootBlockElement, _blockElement ];\n\t}, [ rootClientId, clientId ] );\n\n\t// The targetElement is the element that the drop indicator will appear\n\t// before or after. When dropping into an empty block list, blockElement\n\t// is undefined, so the indicator will appear after the rootBlockElement.\n\tconst targetElement = blockElement || rootBlockElement;\n\n\tconst rtl = isRTL();\n\n\tconst getDropIndicatorIndent = useCallback(\n\t\t( targetElementRect ) => {\n\t\t\tif ( ! rootBlockElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Calculate the indent using the block icon of the root block.\n\t\t\t// Using a classname selector here might be flaky and could be\n\t\t\t// improved.\n\t\t\tconst rootBlockIconElement = rootBlockElement.querySelector(\n\t\t\t\t'.block-editor-block-icon'\n\t\t\t);\n\t\t\tconst rootBlockIconRect =\n\t\t\t\trootBlockIconElement.getBoundingClientRect();\n\t\t\treturn rtl\n\t\t\t\t? targetElementRect.right - rootBlockIconRect.left\n\t\t\t\t: rootBlockIconRect.right - targetElementRect.left;\n\t\t},\n\t\t[ rootBlockElement, rtl ]\n\t);\n\n\tconst getDropIndicatorWidth = useCallback(\n\t\t( targetElementRect, indent ) => {\n\t\t\tif ( ! targetElement ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\t// Default to assuming that the width of the drop indicator\n\t\t\t// should be the same as the target element.\n\t\t\tlet width = targetElement.offsetWidth;\n\n\t\t\t// In deeply nested lists, where a scrollbar is present,\n\t\t\t// the width of the drop indicator should be the width of\n\t\t\t// the scroll container, minus the distance from the left\n\t\t\t// edge of the scroll container to the left edge of the\n\t\t\t// target element.\n\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\ttargetElement,\n\t\t\t\t'horizontal'\n\t\t\t);\n\n\t\t\tconst ownerDocument = targetElement.ownerDocument;\n\t\t\tconst windowScroll =\n\t\t\t\tscrollContainer === ownerDocument.body ||\n\t\t\t\tscrollContainer === ownerDocument.documentElement;\n\n\t\t\tif ( scrollContainer && ! windowScroll ) {\n\t\t\t\tconst scrollContainerRect =\n\t\t\t\t\tscrollContainer.getBoundingClientRect();\n\n\t\t\t\tconst distanceBetweenContainerAndTarget = isRTL()\n\t\t\t\t\t? scrollContainerRect.right - targetElementRect.right\n\t\t\t\t\t: targetElementRect.left - scrollContainerRect.left;\n\n\t\t\t\tconst scrollContainerWidth = scrollContainer.clientWidth;\n\n\t\t\t\tif (\n\t\t\t\t\tscrollContainerWidth <\n\t\t\t\t\twidth + distanceBetweenContainerAndTarget\n\t\t\t\t) {\n\t\t\t\t\twidth =\n\t\t\t\t\t\tscrollContainerWidth -\n\t\t\t\t\t\tdistanceBetweenContainerAndTarget;\n\t\t\t\t}\n\n\t\t\t\t// LTR logic for ensuring the drop indicator does not extend\n\t\t\t\t// beyond the right edge of the scroll container.\n\t\t\t\tif (\n\t\t\t\t\t! rtl &&\n\t\t\t\t\ttargetElementRect.left + indent < scrollContainerRect.left\n\t\t\t\t) {\n\t\t\t\t\twidth -= scrollContainerRect.left - targetElementRect.left;\n\t\t\t\t\treturn width;\n\t\t\t\t}\n\n\t\t\t\t// RTL logic for ensuring the drop indicator does not extend\n\t\t\t\t// beyond the right edge of the scroll container.\n\t\t\t\tif (\n\t\t\t\t\trtl &&\n\t\t\t\t\ttargetElementRect.right - indent > scrollContainerRect.right\n\t\t\t\t) {\n\t\t\t\t\twidth -=\n\t\t\t\t\t\ttargetElementRect.right - scrollContainerRect.right;\n\t\t\t\t\treturn width;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Subtract the indent from the final width of the indicator.\n\t\t\treturn width - indent;\n\t\t},\n\t\t[ rtl, targetElement ]\n\t);\n\n\tconst style = useMemo( () => {\n\t\tif ( ! targetElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst targetElementRect = targetElement.getBoundingClientRect();\n\t\tconst indent = getDropIndicatorIndent( targetElementRect );\n\n\t\treturn {\n\t\t\twidth: getDropIndicatorWidth( targetElementRect, indent ),\n\t\t};\n\t}, [ getDropIndicatorIndent, getDropIndicatorWidth, targetElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tconst isValidDropPosition =\n\t\t\tdropPosition === 'top' ||\n\t\t\tdropPosition === 'bottom' ||\n\t\t\tdropPosition === 'inside';\n\t\tif ( ! targetElement || ! isValidDropPosition ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst ownerDocument = targetElement.ownerDocument;\n\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst rect = targetElement.getBoundingClientRect();\n\t\t\t\tconst indent = getDropIndicatorIndent( rect );\n\t\t\t\t// In RTL languages, the drop indicator should be positioned\n\t\t\t\t// to the left of the target element, with the width of the\n\t\t\t\t// indicator determining the indent at the right edge of the\n\t\t\t\t// target element. In LTR languages, the drop indicator should\n\t\t\t\t// end at the right edge of the target element, with the indent\n\t\t\t\t// added to the position of the left edge of the target element.\n\t\t\t\tlet left = rtl ? rect.left : rect.left + indent;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet bottom = 0;\n\n\t\t\t\t// In deeply nested lists, where a scrollbar is present,\n\t\t\t\t// the width of the drop indicator should be the width of\n\t\t\t\t// the visible area of the scroll container. Additionally,\n\t\t\t\t// the left edge of the drop indicator line needs to be\n\t\t\t\t// offset by the distance the left edge of the target element\n\t\t\t\t// and the left edge of the scroll container. The ensures\n\t\t\t\t// that the drop indicator position never breaks out of the\n\t\t\t\t// visible area of the scroll container.\n\t\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\t\ttargetElement,\n\t\t\t\t\t'horizontal'\n\t\t\t\t);\n\n\t\t\t\tconst windowScroll =\n\t\t\t\t\tscrollContainer === ownerDocument.body ||\n\t\t\t\t\tscrollContainer === ownerDocument.documentElement;\n\n\t\t\t\t// If the scroll container is not the window, offset the left position, if need be.\n\t\t\t\tif ( scrollContainer && ! windowScroll ) {\n\t\t\t\t\tconst scrollContainerRect =\n\t\t\t\t\t\tscrollContainer.getBoundingClientRect();\n\n\t\t\t\t\t// In RTL languages, a vertical scrollbar is present on the\n\t\t\t\t\t// left edge of the scroll container. The width of the\n\t\t\t\t\t// scrollbar needs to be accounted for when positioning the\n\t\t\t\t\t// drop indicator.\n\t\t\t\t\tconst scrollbarWidth = rtl\n\t\t\t\t\t\t? scrollContainer.offsetWidth -\n\t\t\t\t\t\t scrollContainer.clientWidth\n\t\t\t\t\t\t: 0;\n\n\t\t\t\t\tif ( left < scrollContainerRect.left + scrollbarWidth ) {\n\t\t\t\t\t\tleft = scrollContainerRect.left + scrollbarWidth;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( dropPosition === 'top' ) {\n\t\t\t\t\ttop = rect.top;\n\t\t\t\t\tbottom = rect.top;\n\t\t\t\t} else {\n\t\t\t\t\t// `dropPosition` is either `bottom` or `inside`\n\t\t\t\t\ttop = rect.bottom;\n\t\t\t\t\tbottom = rect.bottom;\n\t\t\t\t}\n\n\t\t\t\tconst width = getDropIndicatorWidth( rect, indent );\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\ttargetElement,\n\t\tdropPosition,\n\t\tgetDropIndicatorIndent,\n\t\tgetDropIndicatorWidth,\n\t\trtl,\n\t] );\n\n\tif ( ! targetElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-list-view-drop-indicator\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={ style }\n\t\t\t\tclassName=\"block-editor-list-view-drop-indicator__line\"\n\t\t\t/>\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = exports.PrivateListView = exports.BLOCK_LIST_ITEM_HEIGHT = voi
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _compose = require("@wordpress/compose");
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -263,15 +261,15 @@ const PrivateListView = (0, _element.forwardRef)(ListViewComponent); // This is
|
|
|
263
261
|
exports.PrivateListView = PrivateListView;
|
|
264
262
|
|
|
265
263
|
var _default = (0, _element.forwardRef)((props, ref) => {
|
|
266
|
-
return (0, _element.createElement)(PrivateListView,
|
|
267
|
-
ref: ref
|
|
268
|
-
|
|
264
|
+
return (0, _element.createElement)(PrivateListView, {
|
|
265
|
+
ref: ref,
|
|
266
|
+
...props,
|
|
269
267
|
showAppender: false,
|
|
270
268
|
rootClientId: null,
|
|
271
269
|
onSelect: null,
|
|
272
270
|
additionalBlockContent: null,
|
|
273
271
|
blockSettingsMenu: undefined
|
|
274
|
-
})
|
|
272
|
+
});
|
|
275
273
|
});
|
|
276
274
|
|
|
277
275
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"names":["expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","since","alternative","instanceId","clientIdsTree","draggedClientIds","selectedClientIds","getBlock","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","expandedState","setExpandedState","dropZoneRef","target","blockDropTarget","elementRef","treeGridRef","isMounted","insertedBlock","setInsertedBlock","setSelectedTreeId","firstSelectedBlockClientId","selectEditorBlock","event","blockClientId","focusPosition","current","fixedListWindow","useWindowing","windowOverscan","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","contextValue","isTreeGridMounted","listViewInstanceId","treeGridElementRef","PrivateListView","props","undefined"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAUA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjCA;AACA;AACA;;AAoBA;AACA;AACA;AAWA,MAAMA,QAAQ,GAAG,CAAEC,KAAF,EAASC,MAAT,KAAqB;AACrC,MAAKC,KAAK,CAACC,OAAN,CAAeF,MAAM,CAACG,SAAtB,CAAL,EAAyC;AACxC,WAAO,EACN,GAAGJ,KADG;AAEN,SAAGC,MAAM,CAACG,SAAP,CAAiBC,MAAjB,CACF,CAAEC,QAAF,EAAYC,EAAZ,MAAsB,EACrB,GAAGD,QADkB;AAErB,SAAEC,EAAF,GAAQN,MAAM,CAACO,IAAP,KAAgB;AAFH,OAAtB,CADE,EAKF,EALE;AAFG,KAAP;AAUA;;AACD,SAAOR,KAAP;AACA,CAdD;;AAgBO,MAAMS,sBAAsB,GAAG,EAA/B;AAEP;;AACA;;AAE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IAAA,KAAK,EAAGsD;AAAlC,KACC,4BAAC,eAAD;AACC,IAAA,MAAM,EAAG9C,aADV;AAEC,IAAA,QAAQ,EAAGT,YAFZ;AAGC,IAAA,WAAW,EAAGmC,iBAHf;AAIC,IAAA,eAAe,EAAGzC,eAJnB;AAKC,IAAA,eAAe,EAAG8C,eALnB;AAMC,IAAA,iBAAiB,EAAG7B,iBANrB;AAOC,IAAA,UAAU,EAAGhB,UAPd;AAQC,IAAA,qBAAqB,EAAGoB,qBARzB;AASC,IAAA,YAAY,EAAGnB;AAThB,IADD,CAZD,CALD,CADD;AAkCA,C,CAED;AACA;;;AACO,MAAM+D,eAAe,GAAG,yBAAYpE,iBAAZ,CAAxB,C,CAEP;AACA;;;;eACe,yBAAY,CAAEqE,KAAF,EAASvD,GAAT,KAAkB;AAC5C,SACC,4BAAC,eAAD;AACC,IAAA,GAAG,EAAGA;AADP,KAEMuD,KAFN;AAGC,IAAA,YAAY,EAAG,KAHhB;AAIC,IAAA,YAAY,EAAG,IAJhB;AAKC,IAAA,QAAQ,EAAG,IALZ;AAMC,IAAA,sBAAsB,EAAG,IAN1B;AAOC,IAAA,iBAAiB,EAAGC;AAPrB,KADD;AAWA,CAZc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport { __experimentalTreeGrid as TreeGrid } from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicator from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t} );\n\tconst elementRef = useRef();\n\tconst treeGridRef = useMergeRefs( [ elementRef, dropZoneRef, ref ] );\n\n\tconst isMounted = useRef( false );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\tuseEffect( () => {\n\t\tisMounted.current = true;\n\t}, [] );\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tisTreeGridMounted: isMounted.current,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t} ),\n\t\t[\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t]\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<AsyncModeProvider value={ true }>\n\t\t\t<ListViewDropIndicator\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName=\"block-editor-list-view-tree\"\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\t// eslint-disable-next-line jsx-a11y/aria-props\n\t\t\t\taria-description={ description }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"names":["expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","since","alternative","instanceId","clientIdsTree","draggedClientIds","selectedClientIds","getBlock","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","expandedState","setExpandedState","dropZoneRef","target","blockDropTarget","elementRef","treeGridRef","isMounted","insertedBlock","setInsertedBlock","setSelectedTreeId","firstSelectedBlockClientId","selectEditorBlock","event","blockClientId","focusPosition","current","fixedListWindow","useWindowing","windowOverscan","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","contextValue","isTreeGridMounted","listViewInstanceId","treeGridElementRef","PrivateListView","props","undefined"],"mappings":";;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAUA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjCA;AACA;AACA;;AAoBA;AACA;AACA;AAWA,MAAMA,QAAQ,GAAG,CAAEC,KAAF,EAASC,MAAT,KAAqB;AACrC,MAAKC,KAAK,CAACC,OAAN,CAAeF,MAAM,CAACG,SAAtB,CAAL,EAAyC;AACxC,WAAO,EACN,GAAGJ,KADG;AAEN,SAAGC,MAAM,CAACG,SAAP,CAAiBC,MAAjB,CACF,CAAEC,QAAF,EAAYC,EAAZ,MAAsB,EACrB,GAAGD,QADkB;AAErB,SAAEC,EAAF,GAAQN,MAAM,CAACO,IAAP,KAAgB;AAFH,OAAtB,CADE,EAKF,EALE;AAFG,KAAP;AAUA;;AACD,SAAOR,KAAP;AACA,CAdD;;AAgBO,MAAMS,sBAAsB,GAAG,EAA/B;AAEP;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,iBAAT,CACC;AACCH,EAAAA,EADD;AAECI,EAAAA,MAFD;AAGCC,EAAAA,eAHD;AAICC,EAAAA,eAAe,GAAG,KAJnB;AAKCC,EAAAA,UAAU,GAAG,KALd;AAMCC,EAAAA,YAAY,GAAG,KANhB;AAOCC,EAAAA,iBAAiB,EAAEC,iBAAiB,GAAGC,4CAPxC;AAQ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,IAAA,YAAY,EAAGnB;AAThB,IADD,CAZD,CALD,CADD;AAkCA,C,CAED;AACA;;;AACO,MAAM+D,eAAe,GAAG,yBAAYpE,iBAAZ,CAAxB,C,CAEP;AACA;;;;eACe,yBAAY,CAAEqE,KAAF,EAASvD,GAAT,KAAkB;AAC5C,SACC,4BAAC,eAAD;AACC,IAAA,GAAG,EAAGA,GADP;AAAA,OAEMuD,KAFN;AAGC,IAAA,YAAY,EAAG,KAHhB;AAIC,IAAA,YAAY,EAAG,IAJhB;AAKC,IAAA,QAAQ,EAAG,IALZ;AAMC,IAAA,sBAAsB,EAAG,IAN1B;AAOC,IAAA,iBAAiB,EAAGC;AAPrB,IADD;AAWA,CAZc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport { __experimentalTreeGrid as TreeGrid } from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicator from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t} );\n\tconst elementRef = useRef();\n\tconst treeGridRef = useMergeRefs( [ elementRef, dropZoneRef, ref ] );\n\n\tconst isMounted = useRef( false );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\tuseEffect( () => {\n\t\tisMounted.current = true;\n\t}, [] );\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tisTreeGridMounted: isMounted.current,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t} ),\n\t\t[\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t]\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<AsyncModeProvider value={ true }>\n\t\t\t<ListViewDropIndicator\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName=\"block-editor-list-view-tree\"\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\t// eslint-disable-next-line jsx-a11y/aria-props\n\t\t\t\taria-description={ description }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _web = require("@react-spring/web");
|
|
15
13
|
|
|
16
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -50,14 +48,15 @@ const ListViewLeaf = (0, _element.forwardRef)(({
|
|
|
50
48
|
triggerAnimationOnChange: path
|
|
51
49
|
});
|
|
52
50
|
const mergedRef = (0, _compose.useMergeRefs)([ref, animationRef]);
|
|
53
|
-
return (0, _element.createElement)(AnimatedTreeGridRow,
|
|
51
|
+
return (0, _element.createElement)(AnimatedTreeGridRow, {
|
|
54
52
|
ref: mergedRef,
|
|
55
53
|
className: (0, _classnames.default)('block-editor-list-view-leaf', className),
|
|
56
54
|
level: level,
|
|
57
55
|
positionInSet: position,
|
|
58
56
|
setSize: rowCount,
|
|
59
|
-
isExpanded: undefined
|
|
60
|
-
|
|
57
|
+
isExpanded: undefined,
|
|
58
|
+
...props
|
|
59
|
+
}, children);
|
|
61
60
|
});
|
|
62
61
|
var _default = ListViewLeaf;
|
|
63
62
|
exports.default = _default;
|