@wordpress/block-editor 14.5.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +0 -8
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-canvas/index.js +10 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-full-height-alignment-control/index.js +1 -1
- package/build/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build/components/block-list/block.js +15 -29
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +5 -5
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-patterns-list/index.js +23 -26
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +1 -1
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +3 -46
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/async.js +51 -0
- package/build/components/block-preview/async.js.map +1 -0
- package/build/components/block-preview/index.js +6 -3
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -3
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +119 -0
- package/build/components/block-toolbar/change-design.js.map +1 -0
- package/build/components/block-toolbar/index.js +19 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +16 -19
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +7 -10
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +2 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +6 -10
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +7 -10
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/collab/block-comment-icon-slot.js +18 -0
- package/build/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -4
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +26 -14
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +4 -4
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/iframe/index.js +33 -22
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +61 -20
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -2
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -3
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +5 -1
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +15 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
- package/build/components/inserter/menu.js +4 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +0 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter-button/index.native.js +1 -1
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +0 -2
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +3 -6
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/link-control/link-preview.js +12 -9
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/list-view/appender.js +4 -3
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/branch.js +6 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +1 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/index.js +3 -1
- package/build/components/rich-text/event-listeners/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -6
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +2 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +1 -5
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +1 -1
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/tool-selector/index.js +1 -4
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +6 -7
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +5 -5
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +0 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -3
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +1 -3
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +5 -3
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +2 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/block-bindings.js +19 -8
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/contrast-checker.js +0 -1
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +2 -2
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/style.js +4 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +6 -6
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +5 -5
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-zoom-out.js +13 -22
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +2 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +6 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -33
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +57 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +10 -22
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +16 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +53 -15
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +5 -4
- package/build/store/utils.js.map +1 -1
- package/build/utils/dom.js +37 -17
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +1 -1
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/transform-styles/index.js +4 -3
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +14 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-canvas/index.js +11 -1
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +3 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build-module/components/block-list/block.js +16 -28
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +5 -5
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +23 -26
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +1 -1
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -47
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/async.js +44 -0
- package/build-module/components/block-preview/async.js.map +1 -0
- package/build-module/components/block-preview/index.js +6 -3
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +5 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +111 -0
- package/build-module/components/block-toolbar/change-design.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +19 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +17 -20
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +7 -10
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +2 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +8 -11
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +2 -5
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +26 -14
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +4 -4
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/iframe/index.js +33 -22
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +62 -21
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +6 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +15 -2
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
- package/build-module/components/inserter/menu.js +5 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +0 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +1 -1
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +0 -2
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +3 -6
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +13 -10
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/list-view/appender.js +4 -3
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/branch.js +7 -6
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +1 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +4 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/index.js +4 -2
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +2 -6
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +3 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -1
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +1 -4
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +5 -5
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +5 -5
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +0 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -3
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +1 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +2 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/block-bindings.js +20 -9
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +0 -1
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +2 -2
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/style.js +4 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +6 -6
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +5 -5
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +15 -23
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +2 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +7 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -33
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +54 -7
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +10 -21
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +16 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +54 -16
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -3
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/dom.js +35 -16
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +2 -2
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +3 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +16 -10
- package/build-style/content.css +16 -10
- package/build-style/style-rtl.css +47 -25
- package/build-style/style.css +47 -25
- package/build-types/utils/dom.d.ts +7 -9
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -32
- package/src/autocompleters/block.js +16 -7
- package/src/components/block-canvas/index.js +17 -1
- package/src/components/block-canvas/style.scss +3 -1
- package/src/components/block-card/index.js +3 -3
- package/src/components/block-full-height-alignment-control/index.js +1 -1
- package/src/components/block-inspector/style.scss +2 -7
- package/src/components/block-list/block.js +29 -50
- package/src/components/block-list/block.native.js +0 -4
- package/src/components/block-list/content.scss +1 -1
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/use-block-props/index.js +0 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-patterns-list/README.md +8 -8
- package/src/components/block-patterns-list/index.js +35 -51
- package/src/components/block-patterns-list/stories/fixtures.js +834 -0
- package/src/components/block-patterns-list/stories/index.story.js +64 -0
- package/src/components/block-patterns-list/style.scss +2 -0
- package/src/components/block-patterns-paging/index.js +1 -1
- package/src/components/block-popover/index.js +4 -66
- package/src/components/block-preview/async.js +43 -0
- package/src/components/block-preview/index.js +8 -3
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu/index.js +3 -0
- package/src/components/block-toolbar/change-design.js +127 -0
- package/src/components/block-toolbar/index.js +25 -8
- package/src/components/block-toolbar/style.scss +16 -0
- package/src/components/block-tools/index.js +30 -27
- package/src/components/block-tools/insertion-point.js +4 -3
- package/src/components/block-tools/style.scss +12 -20
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/src/components/block-tools/use-show-block-tools.js +3 -14
- package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-vertical-alignment-control/ui.js +11 -15
- package/src/components/border-radius-control/linked-button.js +9 -11
- package/src/components/collab/block-comment-icon-slot.js +12 -0
- package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/src/components/convert-to-group-buttons/toolbar.js +4 -4
- package/src/components/default-block-appender/content.scss +13 -19
- package/src/components/global-styles/color-panel.js +2 -10
- package/src/components/global-styles/dimensions-panel.js +22 -16
- package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
- package/src/components/global-styles/use-global-styles-context.native.js +6 -0
- package/src/components/iframe/content.scss +4 -9
- package/src/components/iframe/get-compatibility-styles.js +4 -9
- package/src/components/iframe/index.js +48 -34
- package/src/components/iframe/style.scss +2 -3
- package/src/components/image-size-control/index.js +74 -43
- package/src/components/image-size-control/test/index.js +5 -63
- package/src/components/inner-blocks/index.js +12 -6
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
- package/src/components/inserter/block-patterns-tab/index.js +0 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -4
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
- package/src/components/inserter/block-patterns-tab/utils.js +5 -0
- package/src/components/inserter/category-tabs/index.js +16 -2
- package/src/components/inserter/hooks/use-block-types-state.js +6 -1
- package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
- package/src/components/inserter/menu.js +6 -4
- package/src/components/inserter/search-results.js +0 -6
- package/src/components/inserter/style.scss +13 -0
- package/src/components/inserter-button/index.native.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +1 -6
- package/src/components/inspector-controls-tabs/utils.js +0 -3
- package/src/components/link-control/link-preview.js +15 -8
- package/src/components/link-control/test/index.js +63 -24
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/branch.js +8 -6
- package/src/components/list-view/index.js +1 -2
- package/src/components/media-placeholder/index.js +4 -4
- package/src/components/provider/index.js +1 -3
- package/src/components/provider/test/experimental-provider.js +43 -1
- package/src/components/rich-text/event-listeners/index.js +4 -2
- package/src/components/rich-text/index.js +8 -1
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/spacing-sizes-control/index.js +3 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/spacing-sizes-control/linked-button.js +2 -12
- package/src/components/tabbed-sidebar/index.js +1 -1
- package/src/components/tabbed-sidebar/style.scss +1 -1
- package/src/components/tool-selector/index.js +1 -5
- package/src/components/url-input/index.js +4 -5
- package/src/components/use-block-commands/index.js +245 -234
- package/src/components/use-block-drop-zone/index.js +5 -5
- package/src/components/use-block-drop-zone/index.native.js +0 -1
- package/src/components/use-moving-animation/index.js +0 -1
- package/src/components/use-settings/index.js +0 -1
- package/src/components/writing-flow/index.js +5 -3
- package/src/components/writing-flow/use-tab-nav.js +1 -2
- package/src/hooks/block-bindings.js +48 -31
- package/src/hooks/contrast-checker.js +0 -1
- package/src/hooks/duotone.js +2 -2
- package/src/hooks/font-family.js +1 -1
- package/src/hooks/style.js +7 -3
- package/src/hooks/supports.js +6 -6
- package/src/hooks/typography.js +5 -5
- package/src/hooks/use-zoom-out.js +14 -34
- package/src/hooks/utils.js +7 -2
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -3
- package/src/store/actions.js +3 -52
- package/src/store/defaults.js +2 -1
- package/src/store/private-actions.js +71 -8
- package/src/store/private-selectors.js +14 -25
- package/src/store/reducer.js +25 -11
- package/src/store/selectors.js +116 -53
- package/src/store/test/actions.js +41 -0
- package/src/store/test/private-selectors.js +5 -0
- package/src/store/test/reducer.js +23 -0
- package/src/store/utils.js +12 -11
- package/src/utils/dom.js +42 -17
- package/src/utils/get-font-styles-and-weights.js +2 -2
- package/src/utils/test/dom.js +224 -0
- package/src/utils/transform-styles/index.js +3 -2
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build/components/block-toolbar/shuffle.js +0 -110
- package/build/components/block-toolbar/shuffle.js.map +0 -1
- package/build/components/block-tools/zoom-out-popover.js +0 -58
- package/build/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -132
- package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build/components/block-vertical-alignment-control/icons.js +0 -48
- package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build-module/components/block-toolbar/shuffle.js +0 -103
- package/build-module/components/block-toolbar/shuffle.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-popover.js +0 -49
- package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
- package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
- package/src/components/block-toolbar/shuffle.js +0 -111
- package/src/components/block-tools/zoom-out-popover.js +0 -47
- package/src/components/block-tools/zoom-out-toolbar.js +0 -135
- package/src/components/block-vertical-alignment-control/icons.js +0 -34
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getParentSectionBlock","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar && isDefaultEditingMode && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar && <BlockGroupToolbar /> }\n\t\t\t\t{ shouldShowVisualToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;A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AA,CAAAwE,GAAA,EAACpF,cAAA,CAAAqF,OAAa,CAACY,IAAI;UAClBC,KAAK,EAAC,OAAO;UACbX,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAA3E,WAAA,CAAAwE,GAAA,EAAC5E,iBAAA,CAAA6E,OAA0B,CAACc,QAAQ;UACnCC,KAAK,EAAG9E,SAAS,EAAE+E,IAAM;UAAAX,QAAA,eAEzB,IAAA9E,WAAA,CAAAwE,GAAA,EAACnF,qBAAA,CAAAoF,OAA8B,CAACY,IAAI,IAAE;QAAC,CACH,CAAC;MAAA,CACrC,CACF,eACD,IAAArF,WAAA,CAAAwE,GAAA,EAAC/E,wBAAA,CAAAgF,OAAuB;QAACQ,SAAS,EAAGzE;MAAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAAwE,GAAA,EAAClF,kBAAA,CAAAmF,OAAiB;QAACQ,SAAS,EAAGzE;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GAzDAG,UA0DW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS+E,YAAYA,CAAE;EAAExF,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAwE,GAAA,EAACvE,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAG0E,SAAW;IAC1BzE,0BAA0B,EAAGyE,SAAW;IACxCxE,2BAA2B,EAAGwE;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_changeDesign","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","showShuffleButton","showSlots","showGroupButtons","showLockButtons","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getParentSectionBlock","isZoomOut","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! isZoomOut() &&\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: isZoomOut(),\n\t\t\tshowSlots: ! isZoomOut(),\n\t\t\tshowGroupButtons: ! isZoomOut(),\n\t\t\tshowLockButtons: ! isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,sBAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,iBAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,mBAAA,GAAApB,OAAA;AACA,IAAAqB,aAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,WAAA,GAAAtB,OAAA;AAA2C,IAAAuB,W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F,WAAA,CAAA6E,GAAA,EAACrF,wBAAA,CAAAsF,OAAuB;QAACQ,SAAS,EAAG9E;MAAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAA6E,GAAA,EAACxF,kBAAA,CAAAyF,OAAiB;QAACQ,SAAS,EAAG9E;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GA/DAG,UAgEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASoF,YAAYA,CAAE;EAAE7F,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAA6E,GAAA,EAAC5E,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAG+E,SAAW;IAC1B9E,0BAA0B,EAAG8E,SAAW;IACxC7E,2BAA2B,EAAG6E;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -16,7 +16,6 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
var _emptyBlockInserter = _interopRequireDefault(require("./empty-block-inserter"));
|
|
17
17
|
var _insertionPoint = _interopRequireWildcard(require("./insertion-point"));
|
|
18
18
|
var _blockToolbarPopover = _interopRequireDefault(require("./block-toolbar-popover"));
|
|
19
|
-
var _zoomOutPopover = _interopRequireDefault(require("./zoom-out-popover"));
|
|
20
19
|
var _store = require("../../store");
|
|
21
20
|
var _usePopoverScroll = _interopRequireDefault(require("../block-popover/use-popover-scroll"));
|
|
22
21
|
var _zoomOutModeInserters = _interopRequireDefault(require("./zoom-out-mode-inserters"));
|
|
@@ -38,17 +37,16 @@ function selector(select) {
|
|
|
38
37
|
getSelectedBlockClientId,
|
|
39
38
|
getFirstMultiSelectedBlockClientId,
|
|
40
39
|
getSettings,
|
|
41
|
-
__unstableGetEditorMode,
|
|
42
40
|
isTyping,
|
|
43
|
-
isDragging
|
|
41
|
+
isDragging,
|
|
42
|
+
isZoomOut
|
|
44
43
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
45
44
|
const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
46
|
-
const editorMode = __unstableGetEditorMode();
|
|
47
45
|
return {
|
|
48
46
|
clientId,
|
|
49
47
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
50
48
|
isTyping: isTyping(),
|
|
51
|
-
isZoomOutMode:
|
|
49
|
+
isZoomOutMode: isZoomOut(),
|
|
52
50
|
isDragging: isDragging()
|
|
53
51
|
};
|
|
54
52
|
}
|
|
@@ -86,8 +84,7 @@ function BlockTools({
|
|
|
86
84
|
} = (0, _data.useSelect)(_blocks.store);
|
|
87
85
|
const {
|
|
88
86
|
showEmptyBlockSideInserter,
|
|
89
|
-
showBlockToolbarPopover
|
|
90
|
-
showZoomOutToolbar
|
|
87
|
+
showBlockToolbarPopover
|
|
91
88
|
} = (0, _useShowBlockTools.useShowBlockTools)();
|
|
92
89
|
const {
|
|
93
90
|
duplicateBlocks,
|
|
@@ -104,19 +101,22 @@ function BlockTools({
|
|
|
104
101
|
if (event.defaultPrevented) {
|
|
105
102
|
return;
|
|
106
103
|
}
|
|
107
|
-
if (isMatch('core/block-editor/move-up', event)) {
|
|
108
|
-
const clientIds = getSelectedBlockClientIds();
|
|
109
|
-
if (clientIds.length) {
|
|
110
|
-
event.preventDefault();
|
|
111
|
-
const rootClientId = getBlockRootClientId(clientIds[0]);
|
|
112
|
-
moveBlocksUp(clientIds, rootClientId);
|
|
113
|
-
}
|
|
114
|
-
} else if (isMatch('core/block-editor/move-down', event)) {
|
|
104
|
+
if (isMatch('core/block-editor/move-up', event) || isMatch('core/block-editor/move-down', event)) {
|
|
115
105
|
const clientIds = getSelectedBlockClientIds();
|
|
116
106
|
if (clientIds.length) {
|
|
117
107
|
event.preventDefault();
|
|
118
108
|
const rootClientId = getBlockRootClientId(clientIds[0]);
|
|
119
|
-
|
|
109
|
+
const direction = isMatch('core/block-editor/move-up', event) ? 'up' : 'down';
|
|
110
|
+
if (direction === 'up') {
|
|
111
|
+
moveBlocksUp(clientIds, rootClientId);
|
|
112
|
+
} else {
|
|
113
|
+
moveBlocksDown(clientIds, rootClientId);
|
|
114
|
+
}
|
|
115
|
+
const blockLength = Array.isArray(clientIds) ? clientIds.length : 1;
|
|
116
|
+
const message = (0, _i18n.sprintf)(
|
|
117
|
+
// translators: %d: the name of the block that has been moved
|
|
118
|
+
(0, _i18n._n)('%d block moved.', '%d blocks moved.', clientIds.length), blockLength);
|
|
119
|
+
(0, _a11y.speak)(message);
|
|
120
120
|
}
|
|
121
121
|
} else if (isMatch('core/block-editor/duplicate', event)) {
|
|
122
122
|
const clientIds = getSelectedBlockClientIds();
|
|
@@ -199,9 +199,6 @@ function BlockTools({
|
|
|
199
199
|
__unstableContentRef: __unstableContentRef,
|
|
200
200
|
clientId: clientId,
|
|
201
201
|
isTyping: isTyping
|
|
202
|
-
}), showZoomOutToolbar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutPopover.default, {
|
|
203
|
-
__unstableContentRef: __unstableContentRef,
|
|
204
|
-
clientId: clientId
|
|
205
202
|
}), !isZoomOutMode && !hasFixedToolbar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover.Slot, {
|
|
206
203
|
name: "block-toolbar",
|
|
207
204
|
ref: blockToolbarRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_blocks","_a11y","_i18n","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_zoomOutPopover","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","__unstableGetEditorMode","isTyping","isDragging","unlock","blockEditorStore","clientId","editorMode","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getBlocksByClientId","getSelectedBlockClientIds","getBlockRootClientId","isGroupable","getGroupingBlockName","blocksStore","showEmptyBlockSideInserter","showBlockToolbarPopover","showZoomOutToolbar","useShowBlockTools","duplicateBlocks","removeBlocks","replaceBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","isTextField","contentWindow","document","activeElement","blocks","groupingBlockName","newBlocks","switchToBlockType","speak","__","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","jsx","jsxs","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { switchToBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport ZoomOutPopover from './zoom-out-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t\tisDragging,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst editorMode = __unstableGetEditorMode();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: editorMode === 'zoom-out',\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tshowEmptyBlockSideInserter,\n\t\tshowBlockToolbarPopover,\n\t\tshowZoomOutToolbar,\n\t} = useShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showZoomOutToolbar && (\n\t\t\t\t\t<ZoomOutPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAKA,IAAAQ,mBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,eAAA,GAAAC,uBAAA,CAAAX,OAAA;AAIA,IAAAY,oBAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,eAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,qBAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,kBAAA,GAAAjB,OAAA;AACA,IAAAkB,WAAA,GAAAlB,OAAA;AAA2C,IAAAmB,WAAA,GAAAnB,OAAA;AAAA,SAAAoB,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,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A,oBAAsB;UAC7CN,QAAQ,EAAGA;QAAU,CACrB,CACD,EAGC,CAAEG,aAAa,IAAI,CAAED,eAAe,iBACrC,IAAAjC,WAAA,CAAAoF,GAAA,EAACrG,WAAA,CAAA2G,OAAO,CAACC,IAAI;UACZC,IAAI,EAAC,eAAe;UACpBC,GAAG,EAAGZ;QAAiB,CACvB,CACD,EACC7C,QAAQ,eAEV,IAAApC,WAAA,CAAAoF,GAAA,EAACrG,WAAA,CAAA2G,OAAO,CAACC,IAAI;UACZC,IAAI,EAAC,8BAA8B;UACnCC,GAAG,EAAGV;QAAsB,CAC5B,CAAC,EACAjD,aAAa,IAAI,CAAEN,UAAU,iBAC9B,IAAA5B,WAAA,CAAAoF,GAAA,EAACvF,qBAAA,CAAAU,OAAoB;UACpB8B,oBAAoB,EAAGA;QAAsB,CAC7C,CACD;MAAA,CAC8B;IAAC,CAC7B;EAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_blocks","_a11y","_i18n","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","isTyping","isDragging","isZoomOut","unlock","blockEditorStore","clientId","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getBlocksByClientId","getSelectedBlockClientIds","getBlockRootClientId","isGroupable","getGroupingBlockName","blocksStore","showEmptyBlockSideInserter","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","replaceBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","direction","blockLength","Array","isArray","message","sprintf","_n","speak","target","closest","isTextField","contentWindow","document","activeElement","blocks","groupingBlockName","newBlocks","switchToBlockType","__","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","jsx","jsxs","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { switchToBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\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,WAAA,CAAA+G,OAAO,CAACC,IAAI;UACZC,IAAI,EAAC,8BAA8B;UACnCC,GAAG,EAAGV;QAAsB,CAC5B,CAAC,EACAvD,aAAa,IAAI,CAAEN,UAAU,iBAC9B,IAAA3B,WAAA,CAAAyF,GAAA,EAAC5F,qBAAA,CAAAU,OAAoB;UACpB6B,oBAAoB,EAAGA;QAAsB,CAC7C,CACD;MAAA,CAC8B;IAAC,CAC7B;EAAC;AAER","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@ var _inserter = _interopRequireDefault(require("../inserter"));
|
|
|
15
15
|
var _store = require("../../store");
|
|
16
16
|
var _inbetween = _interopRequireDefault(require("../block-popover/inbetween"));
|
|
17
17
|
var _dropZone = _interopRequireDefault(require("../block-popover/drop-zone"));
|
|
18
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
/**
|
|
20
21
|
* External dependencies
|
|
@@ -58,8 +59,8 @@ function InbetweenInsertionPointPopover({
|
|
|
58
59
|
getPreviousBlockClientId,
|
|
59
60
|
getNextBlockClientId,
|
|
60
61
|
getSettings,
|
|
61
|
-
|
|
62
|
-
} = select(_store.store);
|
|
62
|
+
isZoomOut
|
|
63
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
63
64
|
const insertionPoint = getBlockInsertionPoint();
|
|
64
65
|
const order = getBlockOrder(insertionPoint.rootClientId);
|
|
65
66
|
if (!order.length) {
|
|
@@ -81,7 +82,7 @@ function InbetweenInsertionPointPopover({
|
|
|
81
82
|
rootClientId: insertionPoint.rootClientId,
|
|
82
83
|
isDistractionFree: settings.isDistractionFree,
|
|
83
84
|
isInserterShown: insertionPoint?.__unstableWithInserter,
|
|
84
|
-
isZoomOutMode:
|
|
85
|
+
isZoomOutMode: isZoomOut()
|
|
85
86
|
};
|
|
86
87
|
}, []);
|
|
87
88
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_components","_compose","_inserter","_store","_inbetween","_dropZone","_jsxRuntime","InsertionPointOpenRef","exports","createContext","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","useDispatch","blockEditorStore","openRef","useContext","ref","useRef","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","useSelect","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","__unstableGetEditorMode","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","useReducedMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","clsx","jsx","default","children","jsxs","__unstableMotion","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif (\n\t\t\tevent.target === ref.current &&\n\t\t\tnextClientId &&\n\t\t\tgetBlockEditingMode( nextClientId ) !== 'disabled'\n\t\t) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree ) {\n\t\treturn null;\n\t}\n\n\t// Zoom out mode should only show the insertion point for the insert operation.\n\t// Other operations such as \"group\" are when the editor tries to create a row\n\t// block by grouping the block being dragged with the block it's being dropped\n\t// onto.\n\tif ( isZoomOutMode && operation !== 'insert' ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = clsx(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ clsx( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,G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CACD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_components","_compose","_inserter","_store","_inbetween","_dropZone","_lockUnlock","_jsxRuntime","InsertionPointOpenRef","exports","createContext","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","useDispatch","blockEditorStore","openRef","useContext","ref","useRef","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isZoomOutMode","useSelect","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","isZoomOut","unlock","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","useReducedMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","clsx","jsx","default","children","jsxs","__unstableMotion","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisZoomOutMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\tisZoomOut,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t\tisZoomOutMode: isZoomOut(),\n\t\t};\n\t}, [] );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif (\n\t\t\tevent.target === ref.current &&\n\t\t\tnextClientId &&\n\t\t\tgetBlockEditingMode( nextClientId ) !== 'disabled'\n\t\t) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree ) {\n\t\treturn null;\n\t}\n\n\t// Zoom out mode should only show the insertion point for the insert operation.\n\t// Other operations such as \"group\" are when the editor tries to create a row\n\t// block by grouping the block being dragged with the block it's being dropped\n\t// onto.\n\tif ( isZoomOutMode && operation !== 'insert' ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = clsx(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ clsx( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC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C9BG,SAAS,EAAG4B,cAAc,CAAC5B,SAAW;IACtCC,WAAW,EAAG2B,cAAc,CAAC3B,WAAa;IAAA,GACrC+E;EAAK,CACV,CACD;AACF","ignoreList":[]}
|
|
@@ -62,7 +62,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
|
|
|
62
62
|
|
|
63
63
|
// Get how far the content area has been scrolled.
|
|
64
64
|
const scrollTop = scrollContainer?.scrollTop || 0;
|
|
65
|
-
const blockRect = (0, _dom2.
|
|
65
|
+
const blockRect = (0, _dom2.getElementBounds)(selectedBlockElement);
|
|
66
66
|
const contentRect = contentElement.getBoundingClientRect();
|
|
67
67
|
|
|
68
68
|
// Get the vertical position of top of the visible content area.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getVisibleElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getVisibleElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getVisibleElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,O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AAG,CAAC;EAEP,MAAMC,WAAW,GAAG,IAAAC,oBAAW,EAC9B,MACCN,QAAQ,CACPpC,QAAQ,CACPC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACbC,QACD,CACD,CAAC,EACF,CAAEJ,cAAc,EAAEC,oBAAoB,EAAEC,eAAe,EAAEC,aAAa,CACvE,CAAC;;EAED;EACA;EACA;EACA,IAAAuC,wBAAe,EAAEF,WAAW,EAAE,CAAEf,UAAU,EAAEe,WAAW,CAAG,CAAC;;EAE3D;EACA,IAAAE,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAE1C,cAAc,IAAI,CAAEC,oBAAoB,EAAG;MACjD;IACD;;IAEA;IACA,MAAM0C,WAAW,GAAG3C,cAAc,EAAEa,aAAa,EAAE+B,WAAW;IAC9DD,WAAW,EAAEE,eAAe,GAAI,QAAQ,EAAEL,WAAY,CAAC;;IAEvD;IACA,IAAIM,cAAc;IAClB,MAAMC,SAAS,GAAG9C,oBAAoB,EAAEY,aAAa,EAAE+B,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAER,WAAY,CAAC;MAC5DM,cAAc,CAACG,OAAO,CAAEhD,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ0C,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,GAAGL,YAAY;EACfG,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQA,CAChBC,cAAc,EACdC,oBAA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ClB,MAAMC,SAAS,GAAG9C,oBAAoB,EAAEY,aAAa,EAAE+B,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAER,WAAY,CAAC;MAC5DM,cAAc,CAACG,OAAO,CAAEhD,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ0C,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
|
|
@@ -30,24 +30,21 @@ function useShowBlockTools() {
|
|
|
30
30
|
getBlockMode,
|
|
31
31
|
getSettings,
|
|
32
32
|
__unstableGetEditorMode,
|
|
33
|
-
isTyping
|
|
34
|
-
getBlockOrder,
|
|
35
|
-
getSectionRootClientId
|
|
33
|
+
isTyping
|
|
36
34
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
37
35
|
const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
38
36
|
const block = getBlock(clientId);
|
|
39
37
|
const editorMode = __unstableGetEditorMode();
|
|
40
38
|
const hasSelectedBlock = !!clientId && !!block;
|
|
41
39
|
const isEmptyDefaultBlock = hasSelectedBlock && (0, _blocks.isUnmodifiedDefaultBlock)(block) && getBlockMode(clientId) !== 'html';
|
|
42
|
-
const _showEmptyBlockSideInserter = clientId && !isTyping() &&
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const _showBlockToolbarPopover = !
|
|
40
|
+
const _showEmptyBlockSideInserter = clientId && !isTyping() &&
|
|
41
|
+
// Hide the block inserter on the navigation mode.
|
|
42
|
+
// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.
|
|
43
|
+
editorMode !== 'navigation' && isEmptyDefaultBlock;
|
|
44
|
+
const _showBlockToolbarPopover = !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock;
|
|
47
45
|
return {
|
|
48
46
|
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
49
|
-
showBlockToolbarPopover: _showBlockToolbarPopover
|
|
50
|
-
showZoomOutToolbar: _showZoomOutToolbar
|
|
47
|
+
showBlockToolbarPopover: _showBlockToolbarPopover
|
|
51
48
|
};
|
|
52
49
|
}, []);
|
|
53
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","_lockUnlock","useShowBlockTools","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","_lockUnlock","useShowBlockTools","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getBlockMode","getSettings","__unstableGetEditorMode","isTyping","unlock","blockEditorStore","clientId","block","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","_showBlockToolbarPopover","hasFixedToolbar","showEmptyBlockSideInserter","showBlockToolbarPopover"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetBlockMode,\n\t\t\tgetSettings,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId );\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = !! clientId && !! block;\n\t\tconst isEmptyDefaultBlock =\n\t\t\thasSelectedBlock &&\n\t\t\tisUnmodifiedDefaultBlock( block ) &&\n\t\t\tgetBlockMode( clientId ) !== 'html';\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t// Hide the block inserter on the navigation mode.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/66636#discussion_r1824728483.\n\t\t\teditorMode !== 'navigation' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst _showBlockToolbarPopover =\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock;\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBlockToolbarPopover: _showBlockToolbarPopover,\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAAA,EAAG;EACnC,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,YAAY;MACZC,WAAW;MACXC,uBAAuB;MACvBC;IACD,CAAC,GAAG,IAAAC,kBAAM,EAAER,MAAM,CAAES,YAAiB,CAAE,CAAC;IAExC,MAAMC,QAAQ,GACbT,wBAAwB,CAAC,CAAC,IAAIC,kCAAkC,CAAC,CAAC;IAEnE,MAAMS,KAAK,GAAGR,QAAQ,CAAEO,QAAS,CAAC;IAClC,MAAME,UAAU,GAAGN,uBAAuB,CAAC,CAAC;IAC5C,MAAMO,gBAAgB,GAAG,CAAC,CAAEH,QAAQ,IAAI,CAAC,CAAEC,KAAK;IAChD,MAAMG,mBAAmB,GACxBD,gBAAgB,IAChB,IAAAE,gCAAwB,EAAEJ,KAAM,CAAC,IACjCP,YAAY,CAAEM,QAAS,CAAC,KAAK,MAAM;IACpC,MAAMM,2BAA2B,GAChCN,QAAQ,IACR,CAAEH,QAAQ,CAAC,CAAC;IACZ;IACA;IACAK,UAAU,KAAK,YAAY,IAC3BE,mBAAmB;IACpB,MAAMG,wBAAwB,GAC7B,CAAEZ,WAAW,CAAC,CAAC,CAACa,eAAe,IAC/B,CAAEF,2BAA2B,IAC7BH,gBAAgB,IAChB,CAAEC,mBAAmB;IAEtB,OAAO;MACNK,0BAA0B,EAAEH,2BAA2B;MACvDI,uBAAuB,EAAEH;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -24,28 +24,22 @@ function ZoomOutModeInserters() {
|
|
|
24
24
|
const [isReady, setIsReady] = (0, _element.useState)(false);
|
|
25
25
|
const {
|
|
26
26
|
hasSelection,
|
|
27
|
-
insertionPoint,
|
|
28
27
|
blockOrder,
|
|
29
|
-
blockInsertionPointVisible,
|
|
30
28
|
setInserterIsOpened,
|
|
31
29
|
sectionRootClientId,
|
|
32
30
|
selectedBlockClientId
|
|
33
31
|
} = (0, _data.useSelect)(select => {
|
|
34
32
|
const {
|
|
35
33
|
getSettings,
|
|
36
|
-
getInsertionPoint,
|
|
37
34
|
getBlockOrder,
|
|
38
35
|
getSelectionStart,
|
|
39
36
|
getSelectedBlockClientId,
|
|
40
|
-
getSectionRootClientId
|
|
41
|
-
isBlockInsertionPointVisible
|
|
37
|
+
getSectionRootClientId
|
|
42
38
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
43
39
|
const root = getSectionRootClientId();
|
|
44
40
|
return {
|
|
45
41
|
hasSelection: !!getSelectionStart().clientId,
|
|
46
|
-
insertionPoint: getInsertionPoint(),
|
|
47
42
|
blockOrder: getBlockOrder(root),
|
|
48
|
-
blockInsertionPointVisible: isBlockInsertionPointVisible(),
|
|
49
43
|
sectionRootClientId: root,
|
|
50
44
|
setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
|
|
51
45
|
selectedBlockClientId: getSelectedBlockClientId()
|
|
@@ -69,28 +63,25 @@ function ZoomOutModeInserters() {
|
|
|
69
63
|
if (!isReady || !hasSelection) {
|
|
70
64
|
return null;
|
|
71
65
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}, index);
|
|
66
|
+
const previousClientId = selectedBlockClientId;
|
|
67
|
+
const index = blockOrder.findIndex(clientId => selectedBlockClientId === clientId);
|
|
68
|
+
const nextClientId = blockOrder[index + 1];
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_inbetween.default, {
|
|
70
|
+
previousClientId: previousClientId,
|
|
71
|
+
nextClientId: nextClientId,
|
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutModeInserterButton.default, {
|
|
73
|
+
onClick: () => {
|
|
74
|
+
setInserterIsOpened({
|
|
75
|
+
rootClientId: sectionRootClientId,
|
|
76
|
+
insertionIndex: index + 1,
|
|
77
|
+
tab: 'patterns',
|
|
78
|
+
category: 'all'
|
|
79
|
+
});
|
|
80
|
+
showInsertionPoint(sectionRootClientId, index + 1, {
|
|
81
|
+
operation: 'insert'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
})
|
|
94
85
|
});
|
|
95
86
|
}
|
|
96
87
|
var _default = exports.default = ZoomOutModeInserters;
|