@wordpress/block-editor 12.3.0 → 12.3.1
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 +12 -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-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 +4 -5
- 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/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/constants.js +1 -2
- package/build/components/image-editor/constants.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 +3 -9
- 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 +3 -1
- 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/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/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/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 +8 -8
- 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 +17 -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/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-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 +4 -4
- 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/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/constants.js +1 -2
- package/build-module/components/image-editor/constants.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 +3 -9
- 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 +3 -1
- 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/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/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/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 +8 -7
- 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 +12 -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/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 +16 -21
- package/build-style/style.css +16 -21
- package/package.json +31 -31
- package/src/autocompleters/block.js +4 -2
- 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/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-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/style.scss +0 -4
- package/src/components/block-tools/index.js +10 -1
- 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/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/constants.js +0 -1
- 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 +2 -9
- package/src/components/link-control/search-input.js +1 -0
- package/src/components/link-control/test/index.js +40 -51
- 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/preview-options/index.js +3 -2
- package/src/components/provider/test/experimental-provider.js +9 -6
- 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-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 +11 -0
- package/src/store/actions.js +7 -56
- 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
|
@@ -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,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,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,cAAMX,KAAK,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;A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D,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;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MC,IAAA,WAAW,EAAGJ,SANf;AAOC,IAAA,UAAU,EAAGK,QAPd;AAQC,IAAA,oBAAoB,EAAG,cAAI,4BAAJ,CARxB,CASC;AATD;AAUC,wBAAmBlD;AAVpB,KAYC,4BAAC,wBAAD,CAAiB,QAAjB;AAA0B,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,EAAA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,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,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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"names":["AnimatedTreeGridRow","TreeGridRow","ListViewLeaf","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","adjustScrolling","enableAnimation","triggerAnimationOnChange","mergedRef","undefined"],"mappings":";;;;;;;;;AAWA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"names":["AnimatedTreeGridRow","TreeGridRow","ListViewLeaf","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","adjustScrolling","enableAnimation","triggerAnimationOnChange","mergedRef","undefined"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG,mBAAUC,qCAAV,CAA5B;AAEA,MAAMC,YAAY,GAAG,yBACpB,CACC;AACCC,EAAAA,UADD;AAECC,EAAAA,QAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,QAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,SAND;AAOCC,EAAAA,IAPD;AAQC,KAAGC;AARJ,CADD,EAWCC,GAXD,KAYK;AACJ,QAAMC,YAAY,GAAG,iCAAoB;AACxCT,IAAAA,UADwC;AAExCU,IAAAA,eAAe,EAAE,KAFuB;AAGxCC,IAAAA,eAAe,EAAE,IAHuB;AAIxCC,IAAAA,wBAAwB,EAAEN;AAJc,GAApB,CAArB;AAOA,QAAMO,SAAS,GAAG,2BAAc,CAAEL,GAAF,EAAOC,YAAP,CAAd,CAAlB;AAEA,SACC,4BAAC,mBAAD;AACC,IAAA,GAAG,EAAGI,SADP;AAEC,IAAA,SAAS,EAAG,yBACX,6BADW,EAEXR,SAFW,CAFb;AAMC,IAAA,KAAK,EAAGH,KANT;AAOC,IAAA,aAAa,EAAGD,QAPjB;AAQC,IAAA,OAAO,EAAGE,QARX;AASC,IAAA,UAAU,EAAGW,SATd;AAAA,OAUMP;AAVN,KAYGH,QAZH,CADD;AAgBA,CAvCmB,CAArB;eA0CeL,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tisSelected,\n\t\t\tadjustScrolling: false,\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-leaf',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"]}
|
|
@@ -26,32 +26,12 @@ function useListViewClientIds({
|
|
|
26
26
|
const {
|
|
27
27
|
getDraggedBlockClientIds,
|
|
28
28
|
getSelectedBlockClientIds,
|
|
29
|
-
|
|
30
|
-
getBlockEditingMode
|
|
29
|
+
getListViewClientIdsTree
|
|
31
30
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
32
|
-
|
|
33
|
-
const removeDisabledBlocks = tree => {
|
|
34
|
-
return tree.flatMap(({
|
|
35
|
-
clientId,
|
|
36
|
-
innerBlocks,
|
|
37
|
-
...rest
|
|
38
|
-
}) => {
|
|
39
|
-
if (getBlockEditingMode(clientId) === 'disabled') {
|
|
40
|
-
return removeDisabledBlocks(innerBlocks);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return [{
|
|
44
|
-
clientId,
|
|
45
|
-
innerBlocks: removeDisabledBlocks(innerBlocks),
|
|
46
|
-
...rest
|
|
47
|
-
}];
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
31
|
return {
|
|
52
32
|
selectedClientIds: getSelectedBlockClientIds(),
|
|
53
33
|
draggedClientIds: getDraggedBlockClientIds(),
|
|
54
|
-
clientIdsTree:
|
|
34
|
+
clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getListViewClientIdsTree(rootClientId)
|
|
55
35
|
};
|
|
56
36
|
}, [blocks, rootClientId]);
|
|
57
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getListViewClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,wBAAwB,CAAEJ,YAAF;AAJ7B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetListViewClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getListViewClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
|
|
@@ -15,6 +15,8 @@ var _element = require("@wordpress/element");
|
|
|
15
15
|
|
|
16
16
|
var _compose = require("@wordpress/compose");
|
|
17
17
|
|
|
18
|
+
var _i18n = require("@wordpress/i18n");
|
|
19
|
+
|
|
18
20
|
var _math = require("../../utils/math");
|
|
19
21
|
|
|
20
22
|
var _useOnBlockDrop = _interopRequireDefault(require("../use-on-block-drop"));
|
|
@@ -80,16 +82,17 @@ const NESTING_LEVEL_INDENTATION = 28;
|
|
|
80
82
|
* @param {WPPoint} point The point representing the cursor position when dragging.
|
|
81
83
|
* @param {DOMRect} rect The rectangle.
|
|
82
84
|
* @param {number} nestingLevel The nesting level of the block.
|
|
85
|
+
* @param {boolean} rtl Whether the editor is in RTL mode.
|
|
83
86
|
* @return {boolean} Whether the gesture is an upward gesture.
|
|
84
87
|
*/
|
|
85
88
|
|
|
86
89
|
exports.NESTING_LEVEL_INDENTATION = NESTING_LEVEL_INDENTATION;
|
|
87
90
|
|
|
88
|
-
function isUpGesture(point, rect, nestingLevel = 1) {
|
|
91
|
+
function isUpGesture(point, rect, nestingLevel = 1, rtl = false) {
|
|
89
92
|
// If the block is nested, and the user is dragging to the bottom
|
|
90
|
-
// left of the block, then it is an upward gesture.
|
|
91
|
-
const blockIndentPosition = rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
|
|
92
|
-
return point.x < blockIndentPosition;
|
|
93
|
+
// left of the block (or bottom right in RTL languages), then it is an upward gesture.
|
|
94
|
+
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
|
|
95
|
+
return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
95
98
|
* Returns how many nesting levels up the user is attempting to drag to.
|
|
@@ -106,13 +109,17 @@ function isUpGesture(point, rect, nestingLevel = 1) {
|
|
|
106
109
|
* @param {WPPoint} point The point representing the cursor position when dragging.
|
|
107
110
|
* @param {DOMRect} rect The rectangle.
|
|
108
111
|
* @param {number} nestingLevel The nesting level of the block.
|
|
112
|
+
* @param {boolean} rtl Whether the editor is in RTL mode.
|
|
109
113
|
* @return {number} The desired relative parent level.
|
|
110
114
|
*/
|
|
111
115
|
|
|
112
116
|
|
|
113
|
-
function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1) {
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) {
|
|
118
|
+
// In RTL languages, the block indent position is from the right edge of the block.
|
|
119
|
+
// In LTR languages, the block indent position is from the left edge of the block.
|
|
120
|
+
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
|
|
121
|
+
const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition;
|
|
122
|
+
const desiredParentLevel = Math.round(distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION);
|
|
116
123
|
return Math.abs(desiredParentLevel);
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
@@ -167,12 +174,14 @@ function getNextNonDraggedBlock(blocksData, index) {
|
|
|
167
174
|
* @param {WPPoint} point The point representing the cursor position when dragging.
|
|
168
175
|
* @param {DOMRect} rect The rectangle.
|
|
169
176
|
* @param {number} nestingLevel The nesting level of the block.
|
|
177
|
+
* @param {boolean} rtl Whether the editor is in RTL mode.
|
|
170
178
|
*/
|
|
171
179
|
|
|
172
180
|
|
|
173
|
-
function isNestingGesture(point, rect, nestingLevel = 1) {
|
|
174
|
-
const blockIndentPosition = rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
|
|
175
|
-
|
|
181
|
+
function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) {
|
|
182
|
+
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
|
|
183
|
+
const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;
|
|
184
|
+
return isNestingHorizontalGesture && point.y < rect.bottom;
|
|
176
185
|
} // Block navigation is always a vertical list, so only allow dropping
|
|
177
186
|
// to the above or below a block.
|
|
178
187
|
|
|
@@ -183,11 +192,12 @@ const ALLOWED_DROP_EDGES = ['top', 'bottom'];
|
|
|
183
192
|
*
|
|
184
193
|
* @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
|
|
185
194
|
* @param {WPPoint} position The point representing the cursor position when dragging.
|
|
195
|
+
* @param {boolean} rtl Whether the editor is in RTL mode.
|
|
186
196
|
*
|
|
187
197
|
* @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.
|
|
188
198
|
*/
|
|
189
199
|
|
|
190
|
-
function getListViewDropTarget(blocksData, position) {
|
|
200
|
+
function getListViewDropTarget(blocksData, position, rtl = false) {
|
|
191
201
|
let candidateEdge;
|
|
192
202
|
let candidateBlockData;
|
|
193
203
|
let candidateDistance;
|
|
@@ -242,16 +252,33 @@ function getListViewDropTarget(blocksData, position) {
|
|
|
242
252
|
|
|
243
253
|
const candidateBlockParents = getCandidateBlockParents(candidateBlockData, blocksData);
|
|
244
254
|
const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether
|
|
255
|
+
// they might be trying to nest the block as a child.
|
|
256
|
+
// If the block already has inner blocks, and is expanded, this should be treated
|
|
257
|
+
// as nesting since the next block in the tree will be the first child.
|
|
258
|
+
// However, if the block is collapsed, dragging beneath the block should
|
|
259
|
+
// still be allowed, as the next visible block in the tree will be a sibling.
|
|
260
|
+
|
|
261
|
+
if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length, rtl))) {
|
|
262
|
+
// If the block is expanded, insert the block as the first child.
|
|
263
|
+
// Otherwise, for collapsed blocks, insert the block as the last child.
|
|
264
|
+
const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
|
|
265
|
+
return {
|
|
266
|
+
rootClientId: candidateBlockData.clientId,
|
|
267
|
+
blockIndex: newBlockIndex,
|
|
268
|
+
dropPosition: 'inside'
|
|
269
|
+
};
|
|
270
|
+
} // If the user is dragging towards the bottom of the block check whether
|
|
245
271
|
// they might be trying to move the block to be at a parent level.
|
|
246
272
|
|
|
247
|
-
|
|
273
|
+
|
|
274
|
+
if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(position, candidateRect, candidateBlockParents.length, rtl)) {
|
|
248
275
|
const nextBlock = getNextNonDraggedBlock(blocksData, candidateBlockIndex);
|
|
249
276
|
const currentLevel = candidateBlockData.nestingLevel;
|
|
250
277
|
const nextLevel = nextBlock ? nextBlock.nestingLevel : 1;
|
|
251
278
|
|
|
252
279
|
if (currentLevel && nextLevel) {
|
|
253
280
|
// Determine the desired relative level of the block to be dropped.
|
|
254
|
-
const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length);
|
|
281
|
+
const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length, rtl);
|
|
255
282
|
const targetParentIndex = Math.max(Math.min(desiredRelativeLevel, currentLevel - nextLevel), 0);
|
|
256
283
|
|
|
257
284
|
if (candidateBlockParents[targetParentIndex]) {
|
|
@@ -283,23 +310,6 @@ function getListViewDropTarget(blocksData, position) {
|
|
|
283
310
|
};
|
|
284
311
|
}
|
|
285
312
|
}
|
|
286
|
-
} // If the user is dragging towards the bottom of the block check whether
|
|
287
|
-
// they might be trying to nest the block as a child.
|
|
288
|
-
// If the block already has inner blocks, and is expanded, this should be treated
|
|
289
|
-
// as nesting since the next block in the tree will be the first child.
|
|
290
|
-
// However, if the block is collapsed, dragging beneath the block should
|
|
291
|
-
// still be allowed, as the next visible block in the tree will be a sibling.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length))) {
|
|
295
|
-
// If the block is expanded, insert the block as the first child.
|
|
296
|
-
// Otherwise, for collapsed blocks, insert the block as the last child.
|
|
297
|
-
const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
|
|
298
|
-
return {
|
|
299
|
-
rootClientId: candidateBlockData.clientId,
|
|
300
|
-
blockIndex: newBlockIndex,
|
|
301
|
-
dropPosition: 'inside'
|
|
302
|
-
};
|
|
303
313
|
} // If dropping as a sibling, but block cannot be inserted in
|
|
304
314
|
// this context, return early.
|
|
305
315
|
|
|
@@ -342,6 +352,7 @@ function useListViewDropZone({
|
|
|
342
352
|
blockIndex: targetBlockIndex
|
|
343
353
|
} = target || {};
|
|
344
354
|
const onBlockDrop = (0, _useOnBlockDrop.default)(targetRootClientId, targetBlockIndex);
|
|
355
|
+
const rtl = (0, _i18n.isRTL)();
|
|
345
356
|
const draggedBlockClientIds = getDraggedBlockClientIds();
|
|
346
357
|
const throttled = (0, _compose.useThrottle)((0, _element.useCallback)((event, currentTarget) => {
|
|
347
358
|
const position = {
|
|
@@ -352,7 +363,8 @@ function useListViewDropZone({
|
|
|
352
363
|
const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]'));
|
|
353
364
|
const blocksData = blockElements.map(blockElement => {
|
|
354
365
|
const clientId = blockElement.dataset.block;
|
|
355
|
-
const isExpanded = blockElement.dataset.expanded === 'true';
|
|
366
|
+
const isExpanded = blockElement.dataset.expanded === 'true';
|
|
367
|
+
const isDraggedBlock = blockElement.classList.contains('is-dragging'); // Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.
|
|
356
368
|
|
|
357
369
|
const nestingLevel = parseInt(blockElement.getAttribute('aria-level'), 10);
|
|
358
370
|
const rootClientId = getBlockRootClientId(clientId);
|
|
@@ -363,18 +375,18 @@ function useListViewDropZone({
|
|
|
363
375
|
blockIndex: getBlockIndex(clientId),
|
|
364
376
|
element: blockElement,
|
|
365
377
|
nestingLevel: nestingLevel || undefined,
|
|
366
|
-
isDraggedBlock: isBlockDrag ?
|
|
378
|
+
isDraggedBlock: isBlockDrag ? isDraggedBlock : false,
|
|
367
379
|
innerBlockCount: getBlockCount(clientId),
|
|
368
380
|
canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true,
|
|
369
381
|
canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true
|
|
370
382
|
};
|
|
371
383
|
});
|
|
372
|
-
const newTarget = getListViewDropTarget(blocksData, position);
|
|
384
|
+
const newTarget = getListViewDropTarget(blocksData, position, rtl);
|
|
373
385
|
|
|
374
386
|
if (newTarget) {
|
|
375
387
|
setTarget(newTarget);
|
|
376
388
|
}
|
|
377
|
-
}, [draggedBlockClientIds]), 200);
|
|
389
|
+
}, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 200);
|
|
378
390
|
const ref = (0, _compose.__experimentalUseDropZone)({
|
|
379
391
|
dropZoneElement,
|
|
380
392
|
onDrop: onBlockDrop,
|