@wordpress/block-editor 12.16.0 → 12.17.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 +2 -0
- package/LICENSE.md +1 -1
- package/README.md +3 -6
- package/build/components/block-canvas/index.js +0 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +245 -102
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +46 -20
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +33 -96
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +15 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +1 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +0 -2
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -4
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +14 -28
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +1 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +9 -14
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +17 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +16 -24
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +2 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +51 -22
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +8 -11
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +185 -20
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +5 -10
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +13 -11
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +4 -9
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +7 -3
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +1 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +4 -3
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +5 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +44 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +51 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +12 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -13
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +1 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +0 -38
- package/build/utils/object.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +0 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +249 -106
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +48 -22
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +34 -97
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +16 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +1 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.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/pattern-category-previews.js +11 -10
- 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 +11 -11
- 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 +11 -11
- 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 +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -28
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +2 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +9 -14
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -7
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +16 -23
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +51 -23
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +8 -11
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +181 -19
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +2 -8
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +11 -9
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +1 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -7
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +6 -2
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +5 -4
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +6 -4
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +1 -7
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +43 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +49 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +2 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +0 -37
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +51 -8
- package/build-style/style.css +51 -8
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +0 -2
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +0 -5
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +1 -1
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +290 -119
- package/src/components/block-list/block.native.js +55 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +32 -128
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +15 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +8 -5
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +1 -2
- package/src/components/block-tools/block-toolbar-popover.js +4 -10
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +2 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +3 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +2 -1
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/menu.js +13 -31
- package/src/components/inserter/style.scss +6 -4
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-draggable-blocks/index.js +2 -2
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/index.js +13 -11
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/index.js +18 -6
- package/src/components/rich-text/native/index.native.js +16 -24
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +2 -2
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +85 -34
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +7 -23
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +0 -4
- package/src/components/use-settings/README.md +0 -4
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +1 -5
- package/src/hooks/anchor.js +1 -5
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +253 -21
- package/src/hooks/border.js +2 -13
- package/src/hooks/color.js +19 -14
- package/src/hooks/custom-class-name.js +1 -5
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +1 -7
- package/src/hooks/font-family.js +4 -7
- package/src/hooks/font-size.js +1 -6
- package/src/hooks/index.js +19 -3
- package/src/hooks/index.native.js +17 -4
- package/src/hooks/layout.js +5 -2
- package/src/hooks/style.js +1 -6
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +1 -7
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +60 -2
- package/src/private-apis.js +2 -4
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +44 -4
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +16 -5
- package/src/store/selectors.js +5 -13
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +0 -35
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_element","_data","_blocks","_components","_i18n","_style","_interopRequireDefault","_blockListAppender","_blockListItem","_blockListItemCell","_blockListContext","_blockDraggable","_useEditorWrapperStyles","_store","identity","x","stylesMemo","getStyles","isStackedHorizontally","horizontalAlignment","styleName","computedStyles","styles","horizontal","overflowVisible","BlockList","blockWidth","initialBlockWidth","contentResizeMode","contentStyle","filterInnerBlocks","gridProperties","header","marginHorizontal","defaultBlock","marginLeft","marginVertical","marginTop","onAddBlock","onDeleteBlock","orientation","parentWidth","renderAppender","renderFooterAppender","rootClientId","withFooter","blockClientIds","blockCount","blockInsertionPointIsVisible","isReadOnly","isRootList","isFloatingToolbarVisible","maxWidth","isRTL","useSelect","select","getBlockCount","getBlockHierarchyRootClientId","getBlockOrder","getSelectedBlockClientId","isBlockInsertionPointVisible","getSettings","blockEditorStore","selectedBlockClientId","rootBlockId","blockOrder","isRTLSetting","maxWidthSetting","readOnly","Platform","OS","undefined","insertBlock","clearSelectedBlock","useDispatch","extraData","useRef","setBlockWidth","useState","addBlockToEndOfPost","newBlock","scrollViewRef","shouldFlatListPreventAutomaticScroll","shouldShowInnerBlockAppender","length","getExtraData","current","onLayout","nativeEvent","layout","layoutWidth","Math","floor","width","min","renderItem","item","clientId","index","isGridItem","gridItemProps","numOfColumns","numColumns","tileCount","tileIndex","indexOf","_react","createElement","default","blockToolbar","headerToolbar","floatingToolbar","containerStyle","flex","isContentStretch","isMultiBlocks","isWider","alignmentHelpers","extraScrollHeight","height","View","style","onAccessibilityEscape","testID","BlockListProvider","value","DEFAULT_BLOCK_LIST_CONTEXT","scrollRef","BlockDraggableWrapper","onScroll","KeyboardAwareFlatList","removeClippedSubviews","accessibilityLabel","innerRef","ref","keyboardShouldPersistTaps","scrollViewStyle","scrollEnabled","contentContainerStyle","horizontalContentContainer","horizontalContentContainerStretch","horizontalContentContainerCenter","data","keyExtractor","CellRendererComponent","BlockListItemCell","shouldPreventAutomaticScroll","ListHeaderComponent","ListEmptyComponent","EmptyList","ListFooterComponent","Footer","Fragment","map","currentClientId","key","innerAppender","showSeparator","onAddParagraphBlock","useCallback","paragraphBlock","createBlock","Pressable","__","onPress","blockListFooter","shouldShowInsertionPoint","getBlockInsertionPoint","insertionPoint","align","WIDE_ALIGNMENTS","alignments","full","wrapperStyles","useEditorWrapperStyles","containerStyles","defaultAppender"],"sources":["@wordpress/block-editor/src/components/block-list/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Platform, Pressable } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useState, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tKeyboardAwareFlatList,\n\tWIDE_ALIGNMENTS,\n\talignmentHelpers,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport BlockListAppender from '../block-list-appender';\nimport BlockListItem from './block-list-item';\nimport BlockListItemCell from './block-list-item-cell';\nimport {\n\tBlockListProvider,\n\tDEFAULT_BLOCK_LIST_CONTEXT,\n} from './block-list-context';\nimport { BlockDraggableWrapper } from '../block-draggable';\nimport { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';\nimport { store as blockEditorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nconst stylesMemo = {};\nconst getStyles = ( isStackedHorizontally, horizontalAlignment ) => {\n\tconst styleName = `${ isStackedHorizontally }-${ horizontalAlignment }`;\n\tif ( stylesMemo[ styleName ] ) {\n\t\treturn stylesMemo[ styleName ];\n\t}\n\tconst computedStyles = [\n\t\tisStackedHorizontally && styles.horizontal,\n\t\thorizontalAlignment && styles[ `is-aligned-${ horizontalAlignment }` ],\n\t\tstyles.overflowVisible,\n\t];\n\tstylesMemo[ styleName ] = computedStyles;\n\treturn computedStyles;\n};\n\nexport default function BlockList( {\n\tblockWidth: initialBlockWidth,\n\tcontentResizeMode,\n\tcontentStyle,\n\tfilterInnerBlocks,\n\tgridProperties,\n\theader,\n\thorizontal,\n\thorizontalAlignment,\n\tmarginHorizontal = styles.defaultBlock.marginLeft,\n\tmarginVertical = styles.defaultBlock.marginTop,\n\tonAddBlock,\n\tonDeleteBlock,\n\torientation,\n\tparentWidth,\n\trenderAppender,\n\trenderFooterAppender,\n\trootClientId,\n\twithFooter = true,\n} ) {\n\tconst {\n\t\tblockClientIds,\n\t\tblockCount,\n\t\tblockInsertionPointIsVisible,\n\t\tisReadOnly,\n\t\tisRootList,\n\t\tisFloatingToolbarVisible,\n\t\tisStackedHorizontally,\n\t\tmaxWidth,\n\t\tisRTL,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockHierarchyRootClientId,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootBlockId = getBlockHierarchyRootClientId(\n\t\t\t\tselectedBlockClientId\n\t\t\t);\n\n\t\t\tlet blockOrder = getBlockOrder( rootClientId );\n\t\t\t// Display only block which fulfill the condition in passed `filterInnerBlocks` function.\n\t\t\tif ( filterInnerBlocks ) {\n\t\t\t\tblockOrder = filterInnerBlocks( blockOrder );\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tisRTL: isRTLSetting,\n\t\t\t\tmaxWidth: maxWidthSetting,\n\t\t\t\treadOnly,\n\t\t\t} = getSettings();\n\n\t\t\treturn {\n\t\t\t\tblockClientIds: blockOrder,\n\t\t\t\tblockCount: getBlockCount(),\n\t\t\t\tblockInsertionPointIsVisible:\n\t\t\t\t\tPlatform.OS === 'ios' && isBlockInsertionPointVisible(),\n\t\t\t\tisReadOnly: readOnly,\n\t\t\t\tisRootList: rootClientId === undefined,\n\t\t\t\tisFloatingToolbarVisible:\n\t\t\t\t\t!! selectedBlockClientId && !! getBlockCount( rootBlockId ),\n\t\t\t\tisStackedHorizontally: orientation === 'horizontal',\n\t\t\t\tmaxWidth: maxWidthSetting,\n\t\t\t\tisRTL: isRTLSetting,\n\t\t\t};\n\t\t},\n\t\t[ filterInnerBlocks, orientation, rootClientId ]\n\t);\n\n\tconst { insertBlock, clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst extraData = useRef( {\n\t\tparentWidth,\n\t\trenderFooterAppender,\n\t\trenderAppender,\n\t\tonDeleteBlock,\n\t\tcontentStyle,\n\t} );\n\n\tconst [ blockWidth, setBlockWidth ] = useState( initialBlockWidth || 0 );\n\n\tconst addBlockToEndOfPost = ( newBlock ) => {\n\t\tinsertBlock( newBlock, blockCount );\n\t};\n\n\tconst scrollViewRef = useRef( null );\n\n\tconst shouldFlatListPreventAutomaticScroll = () =>\n\t\tblockInsertionPointIsVisible;\n\n\tconst shouldShowInnerBlockAppender = () =>\n\t\trenderAppender && blockClientIds.length > 0;\n\n\tconst getExtraData = () => {\n\t\tif (\n\t\t\textraData.current.parentWidth !== parentWidth ||\n\t\t\textraData.current.renderFooterAppender !== renderFooterAppender ||\n\t\t\textraData.current.onDeleteBlock !== onDeleteBlock ||\n\t\t\textraData.current.contentStyle !== contentStyle ||\n\t\t\textraData.current.renderAppender !== renderAppender ||\n\t\t\textraData.current.blockWidth !== blockWidth ||\n\t\t\textraData.current.gridProperties !== gridProperties\n\t\t) {\n\t\t\textraData.current = {\n\t\t\t\tparentWidth,\n\t\t\t\trenderFooterAppender,\n\t\t\t\tonDeleteBlock,\n\t\t\t\tcontentStyle,\n\t\t\t\trenderAppender,\n\t\t\t\tblockWidth,\n\t\t\t\tgridProperties,\n\t\t\t};\n\t\t}\n\t\treturn extraData.current;\n\t};\n\n\tconst onLayout = ( { nativeEvent } ) => {\n\t\tconst { layout } = nativeEvent;\n\n\t\tconst layoutWidth = Math.floor( layout.width );\n\t\tif ( isRootList && blockWidth !== layoutWidth ) {\n\t\t\tsetBlockWidth( Math.min( layoutWidth, maxWidth ) );\n\t\t} else if ( ! isRootList && ! blockWidth ) {\n\t\t\tsetBlockWidth( Math.min( layoutWidth, maxWidth ) );\n\t\t}\n\t};\n\n\tconst renderItem = ( { item: clientId, index } ) => {\n\t\t// Extracting the grid item properties here to avoid\n\t\t// re-renders in the blockListItem component.\n\t\tconst isGridItem = !! gridProperties;\n\t\tconst gridItemProps = gridProperties && {\n\t\t\tnumOfColumns: gridProperties.numColumns,\n\t\t\ttileCount: blockClientIds.length,\n\t\t\ttileIndex: blockClientIds.indexOf( clientId ),\n\t\t};\n\t\treturn (\n\t\t\t<BlockListItem\n\t\t\t\tindex={ index }\n\t\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tshouldShowInnerBlockAppender={ shouldShowInnerBlockAppender }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tisGridItem={ isGridItem }\n\t\t\t\t{ ...gridItemProps }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst { blockToolbar, headerToolbar, floatingToolbar } = styles;\n\n\tconst containerStyle = {\n\t\tflex: isRootList ? 1 : 0,\n\t\t// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.\n\t\tmarginVertical: isRootList ? 0 : -marginVertical,\n\t\tmarginHorizontal: isRootList ? 0 : -marginHorizontal,\n\t};\n\n\tconst isContentStretch = contentResizeMode === 'stretch';\n\tconst isMultiBlocks = blockClientIds.length > 1;\n\tconst { isWider } = alignmentHelpers;\n\tconst extraScrollHeight =\n\t\theaderToolbar.height +\n\t\tblockToolbar.height +\n\t\t( isFloatingToolbarVisible ? floatingToolbar.height : 0 );\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ containerStyle }\n\t\t\tonAccessibilityEscape={ clearSelectedBlock }\n\t\t\tonLayout={ onLayout }\n\t\t\ttestID=\"block-list-wrapper\"\n\t\t>\n\t\t\t{ isRootList ? (\n\t\t\t\t<BlockListProvider\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t...DEFAULT_BLOCK_LIST_CONTEXT,\n\t\t\t\t\t\tscrollRef: scrollViewRef.current,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<BlockDraggableWrapper isRTL={ isRTL }>\n\t\t\t\t\t\t{ ( { onScroll } ) => (\n\t\t\t\t\t\t\t<KeyboardAwareFlatList\n\t\t\t\t\t\t\t\t{ ...( Platform.OS === 'android'\n\t\t\t\t\t\t\t\t\t? { removeClippedSubviews: false }\n\t\t\t\t\t\t\t\t\t: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541\n\t\t\t\t\t\t\t\taccessibilityLabel=\"block-list\"\n\t\t\t\t\t\t\t\tinnerRef={ ( ref ) => {\n\t\t\t\t\t\t\t\t\tscrollViewRef.current = ref;\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\textraScrollHeight={ extraScrollHeight }\n\t\t\t\t\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\t\t\t\t\tscrollViewStyle={ { flex: 1 } }\n\t\t\t\t\t\t\t\textraData={ getExtraData() }\n\t\t\t\t\t\t\t\tscrollEnabled={ isRootList }\n\t\t\t\t\t\t\t\tcontentContainerStyle={ [\n\t\t\t\t\t\t\t\t\thorizontal &&\n\t\t\t\t\t\t\t\t\t\tstyles.horizontalContentContainer,\n\t\t\t\t\t\t\t\t\tisWider( blockWidth, 'medium' ) &&\n\t\t\t\t\t\t\t\t\t\t( isContentStretch && isMultiBlocks\n\t\t\t\t\t\t\t\t\t\t\t? styles.horizontalContentContainerStretch\n\t\t\t\t\t\t\t\t\t\t\t: styles.horizontalContentContainerCenter ),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\tdata={ blockClientIds }\n\t\t\t\t\t\t\t\tkeyExtractor={ identity }\n\t\t\t\t\t\t\t\trenderItem={ renderItem }\n\t\t\t\t\t\t\t\tCellRendererComponent={ BlockListItemCell }\n\t\t\t\t\t\t\t\tshouldPreventAutomaticScroll={\n\t\t\t\t\t\t\t\t\tshouldFlatListPreventAutomaticScroll\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tListHeaderComponent={ header }\n\t\t\t\t\t\t\t\tListEmptyComponent={\n\t\t\t\t\t\t\t\t\t! isReadOnly && (\n\t\t\t\t\t\t\t\t\t\t<EmptyList\n\t\t\t\t\t\t\t\t\t\t\torientation={ orientation }\n\t\t\t\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t\t\t}\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}\n\t\t\t\t\t\t\t\tListFooterComponent={\n\t\t\t\t\t\t\t\t\t<Footer\n\t\t\t\t\t\t\t\t\t\taddBlockToEndOfPost={\n\t\t\t\t\t\t\t\t\t\t\taddBlockToEndOfPost\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisReadOnly={ isReadOnly }\n\t\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\twithFooter={ withFooter }\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\tonScroll={ onScroll }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockDraggableWrapper>\n\t\t\t\t</BlockListProvider>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{ blockClientIds.length > 0 ? (\n\t\t\t\t\t\t<View style={ [ { flex: 0 }, styles.overflowVisible ] }>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t...getStyles(\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally,\n\t\t\t\t\t\t\t\t\t\thorizontalAlignment\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\thorizontal &&\n\t\t\t\t\t\t\t\t\t\tstyles.horizontalContentContainer,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockClientIds.map(\n\t\t\t\t\t\t\t\t\t( currentClientId, index ) => {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<View key={ currentClientId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ renderItem( {\n\t\t\t\t\t\t\t\t\t\t\t\t\titem: currentClientId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</View>\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) }\n\t\t\t\t\t\t\t\t<Footer\n\t\t\t\t\t\t\t\t\taddBlockToEndOfPost={ addBlockToEndOfPost }\n\t\t\t\t\t\t\t\t\tisReadOnly={ isReadOnly }\n\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twithFooter={ withFooter }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EmptyList\n\t\t\t\t\t\t\torientation={ orientation }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ shouldShowInnerBlockAppender() && (\n\t\t\t\t<View\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginHorizontal:\n\t\t\t\t\t\t\tmarginHorizontal - styles.innerAppender.marginLeft,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<BlockListAppender\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\tshowSeparator\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nfunction Footer( {\n\taddBlockToEndOfPost,\n\tisReadOnly,\n\trenderFooterAppender,\n\twithFooter,\n} ) {\n\tconst onAddParagraphBlock = useCallback( () => {\n\t\tconst paragraphBlock = createBlock( 'core/paragraph' );\n\t\taddBlockToEndOfPost( paragraphBlock );\n\t}, [ addBlockToEndOfPost ] );\n\n\tif ( ! isReadOnly && withFooter ) {\n\t\treturn (\n\t\t\t<Pressable\n\t\t\t\taccessibilityLabel={ __( 'Add paragraph block' ) }\n\t\t\t\ttestID={ __( 'Add paragraph block' ) }\n\t\t\t\tonPress={ onAddParagraphBlock }\n\t\t\t>\n\t\t\t\t<View style={ styles.blockListFooter } />\n\t\t\t</Pressable>\n\t\t);\n\t} else if ( renderFooterAppender ) {\n\t\treturn <View>{ renderFooterAppender() }</View>;\n\t}\n\n\treturn null;\n}\n\nfunction EmptyList( {\n\torientation,\n\trenderAppender,\n\trenderFooterAppender,\n\trootClientId,\n} ) {\n\tconst { shouldShowInsertionPoint } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockInsertionPointVisible,\n\t\t} = select( blockEditorStore );\n\n\t\tconst isStackedHorizontally = orientation === 'horizontal';\n\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst blockInsertionPointIsVisible = isBlockInsertionPointVisible();\n\n\t\treturn {\n\t\t\tshouldShowInsertionPoint:\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If list is empty, show the insertion point (via the default appender)\n\t\t\t\t( blockClientIds.length === 0 ||\n\t\t\t\t\t// Or if the insertion point is right before the denoted block.\n\t\t\t\t\t! blockClientIds[ insertionPoint.index ] ),\n\t\t};\n\t} );\n\tconst align = renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined;\n\tconst [ wrapperStyles ] = useEditorWrapperStyles( { align } );\n\n\tif ( renderFooterAppender || renderAppender === false ) {\n\t\treturn null;\n\t}\n\n\tconst containerStyles = [ styles.defaultAppender, wrapperStyles ];\n\n\treturn (\n\t\t<View style={ containerStyles }>\n\t\t\t<BlockListAppender\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\tshowSeparator={ shouldShowInsertionPoint }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AA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GAAGL,MAAM,CAAEO,YAAiB,CAAC;IAE9B,MAAM5C,qBAAqB,GAAGsB,WAAW,KAAK,YAAY;IAC1D,MAAMM,cAAc,GAAGY,aAAa,CAAEd,YAAa,CAAC;IACpD,MAAM4H,cAAc,GAAGD,sBAAsB,CAAC,CAAC;IAC/C,MAAMvH,4BAA4B,GAAGY,4BAA4B,CAAC,CAAC;IAEnE,OAAO;MACN0G,wBAAwB,EACvB,CAAEpJ,qBAAqB,IACvB8B,4BAA4B,IAC5BwH,cAAc,CAAC5H,YAAY,KAAKA,YAAY;MAC5C;MACEE,cAAc,CAACsC,MAAM,KAAK,CAAC;MAC5B;MACA,CAAEtC,cAAc,CAAE0H,cAAc,CAACtE,KAAK,CAAE;IAC3C,CAAC;EACF,CAAE,CAAC;EACH,MAAMuE,KAAK,GAAG/H,cAAc,GAAGgI,2BAAe,CAACC,UAAU,CAACC,IAAI,GAAGrG,SAAS;EAC1E,MAAM,CAAEsG,aAAa,CAAE,GAAG,IAAAC,8CAAsB,EAAE;IAAEL;EAAM,CAAE,CAAC;EAE7D,IAAK9H,oBAAoB,IAAID,cAAc,KAAK,KAAK,EAAG;IACvD,OAAO,IAAI;EACZ;EAEA,MAAMqI,eAAe,GAAG,CAAEzJ,cAAM,CAAC0J,eAAe,EAAEH,aAAa,CAAE;EAEjE,OACC,IAAAnE,MAAA,CAAAC,aAAA,EAAC7G,YAAA,CAAA0H,IAAI;IAACC,KAAK,EAAGsD;EAAiB,GAC9B,IAAArE,MAAA,CAAAC,aAAA,EAACpG,kBAAA,CAAAqG,OAAiB;IACjBhE,YAAY,EAAGA,YAAc;IAC7BF,cAAc,EAAGA,cAAgB;IACjCmH,aAAa,EAAGS;EAA0B,CAC1C,CACI,CAAC;AAET"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_element","_data","_blocks","_components","_i18n","_style","_interopRequireDefault","_blockListAppender","_blockListItem","_blockListItemCell","_blockListContext","_blockDraggable","_useEditorWrapperStyles","_store","identity","x","stylesMemo","getStyles","isStackedHorizontally","horizontalAlignment","styleName","computedStyles","styles","horizontal","overflowVisible","BlockList","blockWidth","initialBlockWidth","contentResizeMode","contentStyle","filterInnerBlocks","gridProperties","header","marginHorizontal","defaultBlock","marginLeft","marginVertical","marginTop","onAddBlock","onDeleteBlock","orientation","parentWidth","renderAppender","renderFooterAppender","rootClientId","withFooter","blockClientIds","blockCount","blockInsertionPointIsVisible","isReadOnly","isRootList","isFloatingToolbarVisible","maxWidth","isRTL","useSelect","select","getBlockCount","getBlockHierarchyRootClientId","getBlockOrder","getSelectedBlockClientId","isBlockInsertionPointVisible","getSettings","blockEditorStore","selectedBlockClientId","rootBlockId","blockOrder","isRTLSetting","maxWidthSetting","readOnly","Platform","OS","undefined","insertBlock","clearSelectedBlock","useDispatch","extraData","useRef","setBlockWidth","useState","addBlockToEndOfPost","newBlock","scrollRef","shouldFlatListPreventAutomaticScroll","shouldShowInnerBlockAppender","length","getExtraData","current","onLayout","nativeEvent","layout","layoutWidth","Math","floor","width","min","renderItem","item","clientId","index","isGridItem","gridItemProps","numOfColumns","numColumns","tileCount","tileIndex","indexOf","_react","createElement","default","blockToolbar","headerToolbar","floatingToolbar","containerStyle","flex","isContentStretch","isMultiBlocks","isWider","alignmentHelpers","extraScrollHeight","height","View","style","onAccessibilityEscape","testID","BlockListProvider","value","DEFAULT_BLOCK_LIST_CONTEXT","BlockDraggableWrapper","onScroll","KeyboardAwareFlatList","removeClippedSubviews","accessibilityLabel","ref","keyboardShouldPersistTaps","scrollViewStyle","scrollEnabled","contentContainerStyle","horizontalContentContainer","horizontalContentContainerStretch","horizontalContentContainerCenter","data","keyExtractor","CellRendererComponent","BlockListItemCell","shouldPreventAutomaticScroll","ListHeaderComponent","ListEmptyComponent","EmptyList","ListFooterComponent","Footer","Fragment","map","currentClientId","key","innerAppender","showSeparator","onAddParagraphBlock","useCallback","paragraphBlock","createBlock","Pressable","__","onPress","blockListFooter","shouldShowInsertionPoint","getBlockInsertionPoint","insertionPoint","align","WIDE_ALIGNMENTS","alignments","full","wrapperStyles","useEditorWrapperStyles","containerStyles","defaultAppender"],"sources":["@wordpress/block-editor/src/components/block-list/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Platform, Pressable } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useState, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tKeyboardAwareFlatList,\n\tWIDE_ALIGNMENTS,\n\talignmentHelpers,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport BlockListAppender from '../block-list-appender';\nimport BlockListItem from './block-list-item';\nimport BlockListItemCell from './block-list-item-cell';\nimport {\n\tBlockListProvider,\n\tDEFAULT_BLOCK_LIST_CONTEXT,\n} from './block-list-context';\nimport { BlockDraggableWrapper } from '../block-draggable';\nimport { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';\nimport { store as blockEditorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nconst stylesMemo = {};\nconst getStyles = ( isStackedHorizontally, horizontalAlignment ) => {\n\tconst styleName = `${ isStackedHorizontally }-${ horizontalAlignment }`;\n\tif ( stylesMemo[ styleName ] ) {\n\t\treturn stylesMemo[ styleName ];\n\t}\n\tconst computedStyles = [\n\t\tisStackedHorizontally && styles.horizontal,\n\t\thorizontalAlignment && styles[ `is-aligned-${ horizontalAlignment }` ],\n\t\tstyles.overflowVisible,\n\t];\n\tstylesMemo[ styleName ] = computedStyles;\n\treturn computedStyles;\n};\n\nexport default function BlockList( {\n\tblockWidth: initialBlockWidth,\n\tcontentResizeMode,\n\tcontentStyle,\n\tfilterInnerBlocks,\n\tgridProperties,\n\theader,\n\thorizontal,\n\thorizontalAlignment,\n\tmarginHorizontal = styles.defaultBlock.marginLeft,\n\tmarginVertical = styles.defaultBlock.marginTop,\n\tonAddBlock,\n\tonDeleteBlock,\n\torientation,\n\tparentWidth,\n\trenderAppender,\n\trenderFooterAppender,\n\trootClientId,\n\twithFooter = true,\n} ) {\n\tconst {\n\t\tblockClientIds,\n\t\tblockCount,\n\t\tblockInsertionPointIsVisible,\n\t\tisReadOnly,\n\t\tisRootList,\n\t\tisFloatingToolbarVisible,\n\t\tisStackedHorizontally,\n\t\tmaxWidth,\n\t\tisRTL,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockHierarchyRootClientId,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst rootBlockId = getBlockHierarchyRootClientId(\n\t\t\t\tselectedBlockClientId\n\t\t\t);\n\n\t\t\tlet blockOrder = getBlockOrder( rootClientId );\n\t\t\t// Display only block which fulfill the condition in passed `filterInnerBlocks` function.\n\t\t\tif ( filterInnerBlocks ) {\n\t\t\t\tblockOrder = filterInnerBlocks( blockOrder );\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tisRTL: isRTLSetting,\n\t\t\t\tmaxWidth: maxWidthSetting,\n\t\t\t\treadOnly,\n\t\t\t} = getSettings();\n\n\t\t\treturn {\n\t\t\t\tblockClientIds: blockOrder,\n\t\t\t\tblockCount: getBlockCount(),\n\t\t\t\tblockInsertionPointIsVisible:\n\t\t\t\t\tPlatform.OS === 'ios' && isBlockInsertionPointVisible(),\n\t\t\t\tisReadOnly: readOnly,\n\t\t\t\tisRootList: rootClientId === undefined,\n\t\t\t\tisFloatingToolbarVisible:\n\t\t\t\t\t!! selectedBlockClientId && !! getBlockCount( rootBlockId ),\n\t\t\t\tisStackedHorizontally: orientation === 'horizontal',\n\t\t\t\tmaxWidth: maxWidthSetting,\n\t\t\t\tisRTL: isRTLSetting,\n\t\t\t};\n\t\t},\n\t\t[ filterInnerBlocks, orientation, rootClientId ]\n\t);\n\n\tconst { insertBlock, clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst extraData = useRef( {\n\t\tparentWidth,\n\t\trenderFooterAppender,\n\t\trenderAppender,\n\t\tonDeleteBlock,\n\t\tcontentStyle,\n\t} );\n\n\tconst [ blockWidth, setBlockWidth ] = useState( initialBlockWidth || 0 );\n\n\tconst addBlockToEndOfPost = ( newBlock ) => {\n\t\tinsertBlock( newBlock, blockCount );\n\t};\n\n\tconst scrollRef = useRef( null );\n\n\tconst shouldFlatListPreventAutomaticScroll = () =>\n\t\tblockInsertionPointIsVisible;\n\n\tconst shouldShowInnerBlockAppender = () =>\n\t\trenderAppender && blockClientIds.length > 0;\n\n\tconst getExtraData = () => {\n\t\tif (\n\t\t\textraData.current.parentWidth !== parentWidth ||\n\t\t\textraData.current.renderFooterAppender !== renderFooterAppender ||\n\t\t\textraData.current.onDeleteBlock !== onDeleteBlock ||\n\t\t\textraData.current.contentStyle !== contentStyle ||\n\t\t\textraData.current.renderAppender !== renderAppender ||\n\t\t\textraData.current.blockWidth !== blockWidth ||\n\t\t\textraData.current.gridProperties !== gridProperties\n\t\t) {\n\t\t\textraData.current = {\n\t\t\t\tparentWidth,\n\t\t\t\trenderFooterAppender,\n\t\t\t\tonDeleteBlock,\n\t\t\t\tcontentStyle,\n\t\t\t\trenderAppender,\n\t\t\t\tblockWidth,\n\t\t\t\tgridProperties,\n\t\t\t};\n\t\t}\n\t\treturn extraData.current;\n\t};\n\n\tconst onLayout = ( { nativeEvent } ) => {\n\t\tconst { layout } = nativeEvent;\n\n\t\tconst layoutWidth = Math.floor( layout.width );\n\t\tif ( isRootList && blockWidth !== layoutWidth ) {\n\t\t\tsetBlockWidth( Math.min( layoutWidth, maxWidth ) );\n\t\t} else if ( ! isRootList && ! blockWidth ) {\n\t\t\tsetBlockWidth( Math.min( layoutWidth, maxWidth ) );\n\t\t}\n\t};\n\n\tconst renderItem = ( { item: clientId, index } ) => {\n\t\t// Extracting the grid item properties here to avoid\n\t\t// re-renders in the blockListItem component.\n\t\tconst isGridItem = !! gridProperties;\n\t\tconst gridItemProps = gridProperties && {\n\t\t\tnumOfColumns: gridProperties.numColumns,\n\t\t\ttileCount: blockClientIds.length,\n\t\t\ttileIndex: blockClientIds.indexOf( clientId ),\n\t\t};\n\t\treturn (\n\t\t\t<BlockListItem\n\t\t\t\tindex={ index }\n\t\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tshouldShowInnerBlockAppender={ shouldShowInnerBlockAppender }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tisGridItem={ isGridItem }\n\t\t\t\t{ ...gridItemProps }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst { blockToolbar, headerToolbar, floatingToolbar } = styles;\n\n\tconst containerStyle = {\n\t\tflex: isRootList ? 1 : 0,\n\t\t// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.\n\t\tmarginVertical: isRootList ? 0 : -marginVertical,\n\t\tmarginHorizontal: isRootList ? 0 : -marginHorizontal,\n\t};\n\n\tconst isContentStretch = contentResizeMode === 'stretch';\n\tconst isMultiBlocks = blockClientIds.length > 1;\n\tconst { isWider } = alignmentHelpers;\n\tconst extraScrollHeight =\n\t\theaderToolbar.height +\n\t\tblockToolbar.height +\n\t\t( isFloatingToolbarVisible ? floatingToolbar.height : 0 );\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ containerStyle }\n\t\t\tonAccessibilityEscape={ clearSelectedBlock }\n\t\t\tonLayout={ onLayout }\n\t\t\ttestID=\"block-list-wrapper\"\n\t\t>\n\t\t\t{ isRootList ? (\n\t\t\t\t<BlockListProvider\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t...DEFAULT_BLOCK_LIST_CONTEXT,\n\t\t\t\t\t\tscrollRef: scrollRef.current,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<BlockDraggableWrapper isRTL={ isRTL }>\n\t\t\t\t\t\t{ ( { onScroll } ) => (\n\t\t\t\t\t\t\t<KeyboardAwareFlatList\n\t\t\t\t\t\t\t\t{ ...( Platform.OS === 'android'\n\t\t\t\t\t\t\t\t\t? { removeClippedSubviews: false }\n\t\t\t\t\t\t\t\t\t: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541\n\t\t\t\t\t\t\t\taccessibilityLabel=\"block-list\"\n\t\t\t\t\t\t\t\tref={ scrollRef }\n\t\t\t\t\t\t\t\textraScrollHeight={ extraScrollHeight }\n\t\t\t\t\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\t\t\t\t\tscrollViewStyle={ { flex: 1 } }\n\t\t\t\t\t\t\t\textraData={ getExtraData() }\n\t\t\t\t\t\t\t\tscrollEnabled={ isRootList }\n\t\t\t\t\t\t\t\tcontentContainerStyle={ [\n\t\t\t\t\t\t\t\t\thorizontal &&\n\t\t\t\t\t\t\t\t\t\tstyles.horizontalContentContainer,\n\t\t\t\t\t\t\t\t\tisWider( blockWidth, 'medium' ) &&\n\t\t\t\t\t\t\t\t\t\t( isContentStretch && isMultiBlocks\n\t\t\t\t\t\t\t\t\t\t\t? styles.horizontalContentContainerStretch\n\t\t\t\t\t\t\t\t\t\t\t: styles.horizontalContentContainerCenter ),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\tdata={ blockClientIds }\n\t\t\t\t\t\t\t\tkeyExtractor={ identity }\n\t\t\t\t\t\t\t\trenderItem={ renderItem }\n\t\t\t\t\t\t\t\tCellRendererComponent={ BlockListItemCell }\n\t\t\t\t\t\t\t\tshouldPreventAutomaticScroll={\n\t\t\t\t\t\t\t\t\tshouldFlatListPreventAutomaticScroll\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tListHeaderComponent={ header }\n\t\t\t\t\t\t\t\tListEmptyComponent={\n\t\t\t\t\t\t\t\t\t! isReadOnly && (\n\t\t\t\t\t\t\t\t\t\t<EmptyList\n\t\t\t\t\t\t\t\t\t\t\torientation={ orientation }\n\t\t\t\t\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t\t\t}\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}\n\t\t\t\t\t\t\t\tListFooterComponent={\n\t\t\t\t\t\t\t\t\t<Footer\n\t\t\t\t\t\t\t\t\t\taddBlockToEndOfPost={\n\t\t\t\t\t\t\t\t\t\t\taddBlockToEndOfPost\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisReadOnly={ isReadOnly }\n\t\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\twithFooter={ withFooter }\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\tonScroll={ onScroll }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockDraggableWrapper>\n\t\t\t\t</BlockListProvider>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{ blockClientIds.length > 0 ? (\n\t\t\t\t\t\t<View style={ [ { flex: 0 }, styles.overflowVisible ] }>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t...getStyles(\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally,\n\t\t\t\t\t\t\t\t\t\thorizontalAlignment\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\thorizontal &&\n\t\t\t\t\t\t\t\t\t\tstyles.horizontalContentContainer,\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockClientIds.map(\n\t\t\t\t\t\t\t\t\t( currentClientId, index ) => {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<View key={ currentClientId }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ renderItem( {\n\t\t\t\t\t\t\t\t\t\t\t\t\titem: currentClientId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t</View>\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) }\n\t\t\t\t\t\t\t\t<Footer\n\t\t\t\t\t\t\t\t\taddBlockToEndOfPost={ addBlockToEndOfPost }\n\t\t\t\t\t\t\t\t\tisReadOnly={ isReadOnly }\n\t\t\t\t\t\t\t\t\trenderFooterAppender={\n\t\t\t\t\t\t\t\t\t\trenderFooterAppender\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twithFooter={ withFooter }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EmptyList\n\t\t\t\t\t\t\torientation={ orientation }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ shouldShowInnerBlockAppender() && (\n\t\t\t\t<View\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginHorizontal:\n\t\t\t\t\t\t\tmarginHorizontal - styles.innerAppender.marginLeft,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<BlockListAppender\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\t\tshowSeparator\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nfunction Footer( {\n\taddBlockToEndOfPost,\n\tisReadOnly,\n\trenderFooterAppender,\n\twithFooter,\n} ) {\n\tconst onAddParagraphBlock = useCallback( () => {\n\t\tconst paragraphBlock = createBlock( 'core/paragraph' );\n\t\taddBlockToEndOfPost( paragraphBlock );\n\t}, [ addBlockToEndOfPost ] );\n\n\tif ( ! isReadOnly && withFooter ) {\n\t\treturn (\n\t\t\t<Pressable\n\t\t\t\taccessibilityLabel={ __( 'Add paragraph block' ) }\n\t\t\t\ttestID={ __( 'Add paragraph block' ) }\n\t\t\t\tonPress={ onAddParagraphBlock }\n\t\t\t>\n\t\t\t\t<View style={ styles.blockListFooter } />\n\t\t\t</Pressable>\n\t\t);\n\t} else if ( renderFooterAppender ) {\n\t\treturn <View>{ renderFooterAppender() }</View>;\n\t}\n\n\treturn null;\n}\n\nfunction EmptyList( {\n\torientation,\n\trenderAppender,\n\trenderFooterAppender,\n\trootClientId,\n} ) {\n\tconst { shouldShowInsertionPoint } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockInsertionPointVisible,\n\t\t} = select( blockEditorStore );\n\n\t\tconst isStackedHorizontally = orientation === 'horizontal';\n\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst blockInsertionPointIsVisible = isBlockInsertionPointVisible();\n\n\t\treturn {\n\t\t\tshouldShowInsertionPoint:\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If list is empty, show the insertion point (via the default appender)\n\t\t\t\t( blockClientIds.length === 0 ||\n\t\t\t\t\t// Or if the insertion point is right before the denoted block.\n\t\t\t\t\t! blockClientIds[ insertionPoint.index ] ),\n\t\t};\n\t} );\n\tconst align = renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined;\n\tconst [ wrapperStyles ] = useEditorWrapperStyles( { align } );\n\n\tif ( renderFooterAppender || renderAppender === false ) {\n\t\treturn null;\n\t}\n\n\tconst containerStyles = [ styles.defaultAppender, wrapperStyles ];\n\n\treturn (\n\t\t<View style={ containerStyles }>\n\t\t\t<BlockListAppender\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\tshowSeparator={ shouldShowInsertionPoint }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,cAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,kBAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AAIA,IAAAY,eAAA,GAAAZ,OAAA;AACA,IAAAa,uBAAA,GAAAb,OAAA;AACA,IAAA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EE,cAAc,CAACsC,MAAM,KAAK,CAAC;MAC5B;MACA,CAAEtC,cAAc,CAAEwH,cAAc,CAACpE,KAAK,CAAE;IAC3C,CAAC;EACF,CAAE,CAAC;EACH,MAAMqE,KAAK,GAAG7H,cAAc,GAAG8H,2BAAe,CAACC,UAAU,CAACC,IAAI,GAAGnG,SAAS;EAC1E,MAAM,CAAEoG,aAAa,CAAE,GAAG,IAAAC,8CAAsB,EAAE;IAAEL;EAAM,CAAE,CAAC;EAE7D,IAAK5H,oBAAoB,IAAID,cAAc,KAAK,KAAK,EAAG;IACvD,OAAO,IAAI;EACZ;EAEA,MAAMmI,eAAe,GAAG,CAAEvJ,cAAM,CAACwJ,eAAe,EAAEH,aAAa,CAAE;EAEjE,OACC,IAAAjE,MAAA,CAAAC,aAAA,EAAC7G,YAAA,CAAA0H,IAAI;IAACC,KAAK,EAAGoD;EAAiB,GAC9B,IAAAnE,MAAA,CAAAC,aAAA,EAACpG,kBAAA,CAAAqG,OAAiB;IACjBhE,YAAY,EAAGA,YAAc;IAC7BF,cAAc,EAAGA,cAAgB;IACjCiH,aAAa,EAAGS;EAA0B,CAC1C,CACI,CAAC;AAET"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PrivateBlockContext = void 0;
|
|
7
|
+
var _element = require("@wordpress/element");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const PrivateBlockContext = (0, _element.createContext)(null);
|
|
13
|
+
exports.PrivateBlockContext = PrivateBlockContext;
|
|
14
|
+
//# sourceMappingURL=private-block-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","PrivateBlockContext","createContext","exports"],"sources":["@wordpress/block-editor/src/components/block-list/private-block-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const PrivateBlockContext = createContext( null );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,mBAAmB,GAAG,IAAAC,sBAAa,EAAE,IAAK,CAAC;AAACC,OAAA,CAAAF,mBAAA,GAAAA,mBAAA"}
|
|
@@ -10,10 +10,9 @@ var _element = require("@wordpress/element");
|
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
11
|
var _blocks = require("@wordpress/blocks");
|
|
12
12
|
var _compose = require("@wordpress/compose");
|
|
13
|
-
var _data = require("@wordpress/data");
|
|
14
13
|
var _warning = _interopRequireDefault(require("@wordpress/warning"));
|
|
15
14
|
var _useMovingAnimation = _interopRequireDefault(require("../../use-moving-animation"));
|
|
16
|
-
var
|
|
15
|
+
var _privateBlockContext = require("../private-block-context");
|
|
17
16
|
var _useFocusFirstElement = require("./use-focus-first-element");
|
|
18
17
|
var _useIsHovered = require("./use-is-hovered");
|
|
19
18
|
var _context = require("../../block-edit/context");
|
|
@@ -22,8 +21,6 @@ var _useSelectedBlockEventHandlers = require("./use-selected-block-event-handler
|
|
|
22
21
|
var _useNavModeExit = require("./use-nav-mode-exit");
|
|
23
22
|
var _useBlockRefs = require("./use-block-refs");
|
|
24
23
|
var _useIntersectionObserver = require("./use-intersection-observer");
|
|
25
|
-
var _store = require("../../../store");
|
|
26
|
-
var _lockUnlock = require("../../../lock-unlock");
|
|
27
24
|
/**
|
|
28
25
|
* External dependencies
|
|
29
26
|
*/
|
|
@@ -36,12 +33,6 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
36
33
|
* Internal dependencies
|
|
37
34
|
*/
|
|
38
35
|
|
|
39
|
-
/**
|
|
40
|
-
* If the block count exceeds the threshold, we disable the reordering animation
|
|
41
|
-
* to avoid laginess.
|
|
42
|
-
*/
|
|
43
|
-
const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
44
|
-
|
|
45
36
|
/**
|
|
46
37
|
* This hook is used to lightly mark an element as a block element. The element
|
|
47
38
|
* should be the outermost element of a block. Call this hook and pass the
|
|
@@ -91,95 +82,31 @@ function useBlockProps(props = {}, {
|
|
|
91
82
|
clientId,
|
|
92
83
|
className,
|
|
93
84
|
wrapperProps = {},
|
|
94
|
-
isAligned
|
|
95
|
-
} = (0, _element.useContext)(_blockListBlockContext.BlockListBlockContext);
|
|
96
|
-
const {
|
|
85
|
+
isAligned,
|
|
97
86
|
index,
|
|
98
87
|
mode,
|
|
99
88
|
name,
|
|
100
89
|
blockApiVersion,
|
|
101
90
|
blockTitle,
|
|
102
91
|
isSelected,
|
|
103
|
-
isPartOfSelection,
|
|
104
|
-
adjustScrolling,
|
|
105
|
-
enableAnimation,
|
|
106
92
|
isSubtreeDisabled,
|
|
107
93
|
isOutlineEnabled,
|
|
108
94
|
hasOverlay,
|
|
109
95
|
initialPosition,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
getSettings,
|
|
125
|
-
isBlockHighlighted,
|
|
126
|
-
__unstableIsFullySelected,
|
|
127
|
-
__unstableSelectionHasUnmergeableBlock,
|
|
128
|
-
isBlockBeingDragged,
|
|
129
|
-
hasSelectedInnerBlock,
|
|
130
|
-
hasBlockMovingClientId,
|
|
131
|
-
canInsertBlockType,
|
|
132
|
-
getBlockRootClientId,
|
|
133
|
-
__unstableHasActiveBlockOverlayActive,
|
|
134
|
-
__unstableGetEditorMode,
|
|
135
|
-
getSelectedBlocksInitialCaretPosition
|
|
136
|
-
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
137
|
-
const {
|
|
138
|
-
getActiveBlockVariation
|
|
139
|
-
} = select(_blocks.store);
|
|
140
|
-
const _isSelected = isBlockSelected(clientId);
|
|
141
|
-
const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
|
|
142
|
-
const blockName = getBlockName(clientId);
|
|
143
|
-
const blockType = (0, _blocks.getBlockType)(blockName);
|
|
144
|
-
const attributes = getBlockAttributes(clientId);
|
|
145
|
-
const match = getActiveBlockVariation(blockName, attributes);
|
|
146
|
-
const {
|
|
147
|
-
outlineMode
|
|
148
|
-
} = getSettings();
|
|
149
|
-
const isMultiSelected = isBlockMultiSelected(clientId);
|
|
150
|
-
const checkDeep = true;
|
|
151
|
-
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
152
|
-
const typing = isTyping();
|
|
153
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
154
|
-
const movingClientId = hasBlockMovingClientId();
|
|
155
|
-
return {
|
|
156
|
-
index: getBlockIndex(clientId),
|
|
157
|
-
mode: getBlockMode(clientId),
|
|
158
|
-
name: blockName,
|
|
159
|
-
blockApiVersion: blockType?.apiVersion || 1,
|
|
160
|
-
blockTitle: match?.title || blockType?.title,
|
|
161
|
-
isSelected: _isSelected,
|
|
162
|
-
isPartOfSelection: _isSelected || isPartOfMultiSelection,
|
|
163
|
-
adjustScrolling: _isSelected || isFirstMultiSelectedBlock(clientId),
|
|
164
|
-
enableAnimation: !typing && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
|
|
165
|
-
isSubtreeDisabled: isBlockSubtreeDisabled(clientId),
|
|
166
|
-
isOutlineEnabled: outlineMode,
|
|
167
|
-
hasOverlay: __unstableHasActiveBlockOverlayActive(clientId),
|
|
168
|
-
initialPosition: _isSelected && __unstableGetEditorMode() === 'edit' ? getSelectedBlocksInitialCaretPosition() : undefined,
|
|
169
|
-
classNames: (0, _classnames.default)({
|
|
170
|
-
'is-selected': _isSelected,
|
|
171
|
-
'is-highlighted': isBlockHighlighted(clientId),
|
|
172
|
-
'is-multi-selected': isMultiSelected,
|
|
173
|
-
'is-partially-selected': isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
|
|
174
|
-
'is-reusable': (0, _blocks.isReusableBlock)(blockType),
|
|
175
|
-
'is-dragging': isBlockBeingDragged(clientId),
|
|
176
|
-
'has-child-selected': isAncestorOfSelectedBlock,
|
|
177
|
-
'remove-outline': _isSelected && outlineMode && typing,
|
|
178
|
-
'is-block-moving-mode': !!movingClientId,
|
|
179
|
-
'can-insert-moving-block': movingClientId && canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId))
|
|
180
|
-
}, hasLightBlockWrapper ? attributes.className : undefined, hasLightBlockWrapper ? (0, _blocks.getBlockDefaultClassName)(blockName) : undefined)
|
|
181
|
-
};
|
|
182
|
-
}, [clientId]);
|
|
96
|
+
blockEditingMode,
|
|
97
|
+
isHighlighted,
|
|
98
|
+
isMultiSelected,
|
|
99
|
+
isPartiallySelected,
|
|
100
|
+
isReusable,
|
|
101
|
+
isDragging,
|
|
102
|
+
hasChildSelected,
|
|
103
|
+
removeOutline,
|
|
104
|
+
isBlockMovingMode,
|
|
105
|
+
canInsertMovingBlock,
|
|
106
|
+
isEditingDisabled,
|
|
107
|
+
isTemporarilyEditingAsBlocks,
|
|
108
|
+
defaultClassName
|
|
109
|
+
} = (0, _element.useContext)(_privateBlockContext.PrivateBlockContext);
|
|
183
110
|
|
|
184
111
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
185
112
|
const blockLabel = (0, _i18n.sprintf)((0, _i18n.__)('Block: %s'), blockTitle);
|
|
@@ -193,10 +120,8 @@ function useBlockProps(props = {}, {
|
|
|
193
120
|
}), (0, _useNavModeExit.useNavModeExit)(clientId), (0, _useIsHovered.useIsHovered)({
|
|
194
121
|
isEnabled: isOutlineEnabled
|
|
195
122
|
}), (0, _useIntersectionObserver.useIntersectionObserver)(), (0, _useMovingAnimation.default)({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
enableAnimation,
|
|
199
|
-
triggerAnimationOnChange: index
|
|
123
|
+
triggerAnimationOnChange: index,
|
|
124
|
+
clientId
|
|
200
125
|
}), (0, _compose.useDisabled)({
|
|
201
126
|
isDisabled: !hasOverlay
|
|
202
127
|
})]);
|
|
@@ -206,7 +131,7 @@ function useBlockProps(props = {}, {
|
|
|
206
131
|
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
|
|
207
132
|
}
|
|
208
133
|
return {
|
|
209
|
-
tabIndex: 0,
|
|
134
|
+
tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
|
|
210
135
|
...wrapperProps,
|
|
211
136
|
...props,
|
|
212
137
|
ref: mergedRefs,
|
|
@@ -220,8 +145,20 @@ function useBlockProps(props = {}, {
|
|
|
220
145
|
className: (0, _classnames.default)('block-editor-block-list__block', {
|
|
221
146
|
// The wp-block className is important for editor styles.
|
|
222
147
|
'wp-block': !isAligned,
|
|
223
|
-
'has-block-overlay': hasOverlay
|
|
224
|
-
|
|
148
|
+
'has-block-overlay': hasOverlay,
|
|
149
|
+
'is-selected': isSelected,
|
|
150
|
+
'is-highlighted': isHighlighted,
|
|
151
|
+
'is-multi-selected': isMultiSelected,
|
|
152
|
+
'is-partially-selected': isPartiallySelected,
|
|
153
|
+
'is-reusable': isReusable,
|
|
154
|
+
'is-dragging': isDragging,
|
|
155
|
+
'has-child-selected': hasChildSelected,
|
|
156
|
+
'remove-outline': removeOutline,
|
|
157
|
+
'is-block-moving-mode': isBlockMovingMode,
|
|
158
|
+
'can-insert-moving-block': canInsertMovingBlock,
|
|
159
|
+
'is-editing-disabled': isEditingDisabled,
|
|
160
|
+
'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
|
|
161
|
+
}, className, props.className, wrapperProps.className, defaultClassName),
|
|
225
162
|
style: {
|
|
226
163
|
...wrapperProps.style,
|
|
227
164
|
...props.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_data","_warning","_useMovingAnimation","_blockListBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","_store","_lockUnlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","useContext","BlockListBlockContext","index","mode","name","blockApiVersion","blockTitle","isSelected","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","classNames","useSelect","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","getSettings","isBlockHighlighted","__unstableIsFullySelected","__unstableSelectionHasUnmergeableBlock","isBlockBeingDragged","hasSelectedInnerBlock","hasBlockMovingClientId","canInsertBlockType","getBlockRootClientId","__unstableHasActiveBlockOverlayActive","__unstableGetEditorMode","getSelectedBlocksInitialCaretPosition","unlock","blockEditorStore","getActiveBlockVariation","blocksStore","_isSelected","isPartOfMultiSelection","blockName","blockType","getBlockType","attributes","match","outlineMode","isMultiSelected","checkDeep","isAncestorOfSelectedBlock","typing","hasLightBlockWrapper","apiVersion","movingClientId","title","undefined","classnames","isReusableBlock","getBlockDefaultClassName","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","isEnabled","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","SCRIPT_DEBUG","warning","tabIndex","id","role","inert","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tisReusableBlock,\n\tgetBlockDefaultClassName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tclassNames,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t\tgetSettings,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__unstableHasActiveBlockOverlayActive,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst _isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst typing = isTyping();\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\t\t\tconst movingClientId = hasBlockMovingClientId();\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisSelected: _isSelected,\n\t\t\t\tisPartOfSelection: _isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\t_isSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! typing &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t\tisOutlineEnabled: outlineMode,\n\t\t\t\thasOverlay: __unstableHasActiveBlockOverlayActive( clientId ),\n\t\t\t\tinitialPosition:\n\t\t\t\t\t_isSelected && __unstableGetEditorMode() === 'edit'\n\t\t\t\t\t\t? getSelectedBlocksInitialCaretPosition()\n\t\t\t\t\t\t: undefined,\n\t\t\t\tclassNames: classnames(\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-selected': _isSelected,\n\t\t\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t\t\t'is-partially-selected':\n\t\t\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\t\t\t'is-reusable': isReusableBlock( blockType ),\n\t\t\t\t\t\t'is-dragging': isBlockBeingDragged( clientId ),\n\t\t\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t\t\t'remove-outline': _isSelected && outlineMode && typing,\n\t\t\t\t\t\t'is-block-moving-mode': !! movingClientId,\n\t\t\t\t\t\t'can-insert-moving-block':\n\t\t\t\t\t\t\tmovingClientId &&\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( movingClientId ),\n\t\t\t\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\thasLightBlockWrapper ? attributes.className : undefined,\n\t\t\t\t\thasLightBlockWrapper\n\t\t\t\t\t\t? getBlockDefaultClassName( blockName )\n\t\t\t\t\t\t: undefined\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tclassNames\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AAKA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AAC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AAG1F,YAAY;IACf,GAAGJ,KAAK;IACR6E,GAAG,EAAEF,UAAU;IACfoB,EAAE,EAAG,SAAS7F,QAAU,GAAGwE,UAAY,EAAC;IACxCsB,IAAI,EAAE,UAAU;IAChB,YAAY,EAAEzB,UAAU;IACxB,YAAY,EAAErE,QAAQ;IACtB,WAAW,EAAEQ,IAAI;IACjB,YAAY,EAAEE,UAAU;IACxBqF,KAAK,EAAEhF,iBAAiB,GAAG,MAAM,GAAGkD,SAAS;IAC7ChE,SAAS,EAAE,IAAAiE,mBAAU,EACpB,gCAAgC,EAChC;MACC;MACA,UAAU,EAAE,CAAE/D,SAAS;MACvB,mBAAmB,EAAEc;IACtB,CAAC,EACDhB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtBkB,UACD,CAAC;IACD6E,KAAK,EAAE;MAAE,GAAG9F,YAAY,CAAC8F,KAAK;MAAE,GAAGlG,KAAK,CAACkG;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACAnG,aAAa,CAACoG,IAAI,GAAGC,+BAAa"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_warning","_useMovingAnimation","_privateBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","removeOutline","isBlockMovingMode","canInsertMovingBlock","isEditingDisabled","isTemporarilyEditingAsBlocks","defaultClassName","useContext","PrivateBlockContext","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","isEnabled","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","SCRIPT_DEBUG","warning","tabIndex","id","role","inert","undefined","classnames","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tremoveOutline,\n\t\tisBlockMovingMode,\n\t\tcanInsertMovingBlock,\n\t\tisEditingDisabled,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'remove-outline': removeOutline,\n\t\t\t\t'is-block-moving-mode': isBlockMovingMode,\n\t\t\t\t'can-insert-moving-block': canInsertMovingBlock,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAA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EzB,UAAU;IACxB,YAAY,EAAE7B,QAAQ;IACtB,WAAW,EAAEM,IAAI;IACjB,YAAY,EAAEE,UAAU;IACxB+C,KAAK,EAAE7C,iBAAiB,GAAG,MAAM,GAAG8C,SAAS;IAC7CvD,SAAS,EAAE,IAAAwD,mBAAU,EACpB,gCAAgC,EAChC;MACC;MACA,UAAU,EAAE,CAAEtD,SAAS;MACvB,mBAAmB,EAAES,UAAU;MAC/B,aAAa,EAAEH,UAAU;MACzB,gBAAgB,EAAEM,aAAa;MAC/B,mBAAmB,EAAEC,eAAe;MACpC,uBAAuB,EAAEC,mBAAmB;MAC5C,aAAa,EAAEC,UAAU;MACzB,aAAa,EAAEC,UAAU;MACzB,oBAAoB,EAAEC,gBAAgB;MACtC,gBAAgB,EAAEC,aAAa;MAC/B,sBAAsB,EAAEC,iBAAiB;MACzC,yBAAyB,EAAEC,oBAAoB;MAC/C,qBAAqB,EAAEC,iBAAiB;MACxC,iDAAiD,EAChDC;IACF,CAAC,EACDxB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtByB,gBACD,CAAC;IACDgC,KAAK,EAAE;MAAE,GAAGxD,YAAY,CAACwD,KAAK;MAAE,GAAG5D,KAAK,CAAC4D;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA7D,aAAa,CAAC8D,IAAI,GAAGC,+BAAa"}
|
|
@@ -28,7 +28,8 @@ function useInBetweenInserter() {
|
|
|
28
28
|
getSelectedBlockClientIds,
|
|
29
29
|
getTemplateLock,
|
|
30
30
|
__unstableIsWithinBlockOverlay,
|
|
31
|
-
getBlockEditingMode
|
|
31
|
+
getBlockEditingMode,
|
|
32
|
+
getBlockName
|
|
32
33
|
} = (0, _data.useSelect)(_store.store);
|
|
33
34
|
const {
|
|
34
35
|
showInsertionPoint,
|
|
@@ -59,7 +60,7 @@ function useInBetweenInserter() {
|
|
|
59
60
|
const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
|
|
60
61
|
rootClientId = blockElement.getAttribute('data-block');
|
|
61
62
|
}
|
|
62
|
-
if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled') {
|
|
63
|
+
if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block' && window.__experimentalPatternPartialSyncing) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
const orientation = getBlockListSettings(rootClientId)?.orientation || 'vertical';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_element","_i18n","_store","_insertionPoint","useInBetweenInserter","openRef","useContext","InsertionPointOpenRef","isInBetweenInserterDisabled","useSelect","select","blockEditorStore","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","showInsertionPoint","hideInsertionPoint","useDispatch","useRefEffect","node","onMouseMove","event","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","orientation","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","isRTL","right","left","id","firstElementChild","clientId","slice","length","includes","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\tif ( openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled'\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orientation =\n\t\t\t\t\tgetBlockListSettings( rootClientId )?.orientation ||\n\t\t\t\t\t'vertical';\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter when hovering above (conflicts with\n\t\t\t\t// block toolbar) or inside selected block(s).\n\t\t\t\tif ( getSelectedBlockClientIds().includes( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GA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names":["_compose","require","_data","_element","_i18n","_store","_insertionPoint","useInBetweenInserter","openRef","useContext","InsertionPointOpenRef","isInBetweenInserterDisabled","useSelect","select","blockEditorStore","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","getBlockName","showInsertionPoint","hideInsertionPoint","useDispatch","useRefEffect","node","onMouseMove","event","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","window","__experimentalPatternPartialSyncing","orientation","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","isRTL","right","left","id","firstElementChild","clientId","slice","length","includes","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\tif ( openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t\t( getBlockName( rootClientId ) === 'core/block' &&\n\t\t\t\t\t\twindow.__experimentalPatternPartialSyncing )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orientation =\n\t\t\t\t\tgetBlockListSettings( rootClientId )?.orientation ||\n\t\t\t\t\t'vertical';\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter when hovering above (conflicts with\n\t\t\t\t// block toolbar) or inside selected block(s).\n\t\t\t\tif ( getSelectedBlockClientIds().includes( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASM,oBAAoBA,CAAA,EAAG;EACtC,MAAMC,OAAO,GAAG,IAAAC,mBAAU,EAAEC,qCAAsB,CAAC;EACnD,MAAMC,2BAA2B,GAAG,IAAAC,eAAS,EAC1CC,MAAM,IACPA,MAAM,CAAEC,YAAiB,CAAC,CAACC,WA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8BAA8B,CAAEyC,QAAS,CAAC,EACzC;QACD;MACD;;MAEA;MACA;MACA,IAAK3C,yBAAyB,CAAC,CAAC,CAAC8C,QAAQ,CAAEH,QAAS,CAAC,EAAG;QACvD;MACD;MACA,MAAMI,WAAW,GAAGf,OAAO,CAACI,qBAAqB,CAAC,CAAC;MAEnD,IACGZ,WAAW,KAAK,YAAY,KAC3Bb,KAAK,CAACe,OAAO,GAAGqB,WAAW,CAACC,MAAM,IACnCrC,KAAK,CAACe,OAAO,GAAGqB,WAAW,CAACV,GAAG,CAAE,IACjCb,WAAW,KAAK,UAAU,KACzBb,KAAK,CAACiB,OAAO,GAAGmB,WAAW,CAACR,KAAK,IAClC5B,KAAK,CAACiB,OAAO,GAAGmB,WAAW,CAACP,IAAI,CAAI,EACrC;QACDlC,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEA,MAAM2C,KAAK,GAAGnD,aAAa,CAAE6C,QAAS,CAAC;;MAEvC;MACA;MACA,IAAKM,KAAK,KAAK,CAAC,EAAG;QAClB3C,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEAD,kBAAkB,CAAEa,YAAY,EAAE+B,KAAK,EAAE;QACxCC,sBAAsB,EAAE;MACzB,CAAE,CAAC;IACJ;IAEAzC,IAAI,CAAC0C,gBAAgB,CAAE,WAAW,EAAEzC,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAAC2C,mBAAmB,CAAE,WAAW,EAAE1C,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACCvB,OAAO,EACPU,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBM,kBAAkB,EAClBC,kBAAkB,EAClBN,yBAAyB,EACzBV,2BAA2B,CAE7B,CAAC;AACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _element = require("@wordpress/element");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _blockListContext = require("./block-list-context");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const useScrollUponInsertion = ({
|
|
20
|
+
clientId,
|
|
21
|
+
isSelected,
|
|
22
|
+
isLayoutCalculated,
|
|
23
|
+
elementRef
|
|
24
|
+
}) => {
|
|
25
|
+
const {
|
|
26
|
+
scrollRef
|
|
27
|
+
} = (0, _blockListContext.useBlockListContext)();
|
|
28
|
+
const wasBlockJustInserted = (0, _data.useSelect)(select => !!select(_store.store).wasBlockJustInserted(clientId, 'inserter_menu'), [clientId]);
|
|
29
|
+
(0, _element.useEffect)(() => {
|
|
30
|
+
const lastScrollTo = scrollRef?.lastScrollTo.current;
|
|
31
|
+
const alreadyScrolledTo = lastScrollTo?.clientId === clientId;
|
|
32
|
+
if (alreadyScrolledTo || !isSelected || !scrollRef || !wasBlockJustInserted || !isLayoutCalculated) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
scrollRef.scrollToElement(elementRef);
|
|
36
|
+
lastScrollTo.clientId = clientId;
|
|
37
|
+
}, [isSelected, scrollRef, wasBlockJustInserted, elementRef, isLayoutCalculated, clientId]);
|
|
38
|
+
};
|
|
39
|
+
var _default = useScrollUponInsertion;
|
|
40
|
+
exports.default = _default;
|
|
41
|
+
//# sourceMappingURL=use-scroll-upon-insertion.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_blockListContext","_store","useScrollUponInsertion","clientId","isSelected","isLayoutCalculated","elementRef","scrollRef","useBlockListContext","wasBlockJustInserted","useSelect","select","blockEditorStore","useEffect","lastScrollTo","current","alreadyScrolledTo","scrollToElement","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/block-list/use-scroll-upon-insertion.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockListContext } from './block-list-context';\nimport { store as blockEditorStore } from '../../store';\n\nconst useScrollUponInsertion = ( {\n\tclientId,\n\tisSelected,\n\tisLayoutCalculated,\n\telementRef,\n} ) => {\n\tconst { scrollRef } = useBlockListContext();\n\tconst wasBlockJustInserted = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).wasBlockJustInserted(\n\t\t\t\tclientId,\n\t\t\t\t'inserter_menu'\n\t\t\t),\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tconst lastScrollTo = scrollRef?.lastScrollTo.current;\n\t\tconst alreadyScrolledTo = lastScrollTo?.clientId === clientId;\n\t\tif (\n\t\t\talreadyScrolledTo ||\n\t\t\t! isSelected ||\n\t\t\t! scrollRef ||\n\t\t\t! wasBlockJustInserted ||\n\t\t\t! isLayoutCalculated\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tscrollRef.scrollToElement( elementRef );\n\t\tlastScrollTo.clientId = clientId;\n\t}, [\n\t\tisSelected,\n\t\tscrollRef,\n\t\twasBlockJustInserted,\n\t\telementRef,\n\t\tisLayoutCalculated,\n\t\tclientId,\n\t] );\n};\n\nexport default useScrollUponInsertion;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMI,sBAAsB,GAAGA,CAAE;EAChCC,QAAQ;EACRC,UAAU;EACVC,kBAAkB;EAClBC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,qCAAmB,EAAC,CAAC;EAC3C,MAAMC,oBAAoB,GAAG,IAAAC,eAAS,EACnCC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEC,YAAiB,CAAC,CAACH,oBAAoB,CACjDN,QAAQ,EACR,eACD,CAAC,EACF,CAAEA,QAAQ,CACX,CAAC;EACD,IAAAU,kBAAS,EAAE,MAAM;IAChB,MAAMC,YAAY,GAAGP,SAAS,EAAEO,YAAY,CAACC,OAAO;IACpD,MAAMC,iBAAiB,GAAGF,YAAY,EAAEX,QAAQ,KAAKA,QAAQ;IAC7D,IACCa,iBAAiB,IACjB,CAAEZ,UAAU,IACZ,CAAEG,SAAS,IACX,CAAEE,oBAAoB,IACtB,CAAEJ,kBAAkB,EACnB;MACD;IACD;IACAE,SAAS,CAACU,eAAe,CAAEX,UAAW,CAAC;IACvCQ,YAAY,CAACX,QAAQ,GAAGA,QAAQ;EACjC,CAAC,EAAE,CACFC,UAAU,EACVG,SAAS,EACTE,oBAAoB,EACpBH,UAAU,EACVD,kBAAkB,EAClBF,QAAQ,CACP,CAAC;AACJ,CAAC;AAAC,IAAAe,QAAA,GAEahB,sBAAsB;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -8,7 +8,6 @@ exports.default = BlockLockToolbar;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
|
-
var _dom = require("@wordpress/dom");
|
|
12
11
|
var _element = require("@wordpress/element");
|
|
13
12
|
var _icons = require("@wordpress/icons");
|
|
14
13
|
var _modal = _interopRequireDefault(require("./modal"));
|
|
@@ -22,44 +21,33 @@ var _useBlockLock = _interopRequireDefault(require("./use-block-lock"));
|
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
23
|
function BlockLockToolbar({
|
|
25
|
-
clientId
|
|
26
|
-
wrapperRef
|
|
24
|
+
clientId
|
|
27
25
|
}) {
|
|
28
26
|
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
canRemove,
|
|
32
|
-
canLock
|
|
27
|
+
canLock,
|
|
28
|
+
isLocked
|
|
33
29
|
} = (0, _useBlockLock.default)(clientId);
|
|
34
30
|
const [isModalOpen, toggleModal] = (0, _element.useReducer)(isActive => !isActive, false);
|
|
35
|
-
const
|
|
36
|
-
const isFirstRender = (0, _element.useRef)(true);
|
|
37
|
-
const shouldHideBlockLockUI = !canLock || canEdit && canMove && canRemove;
|
|
31
|
+
const hasLockButtonShown = (0, _element.useRef)(false);
|
|
38
32
|
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
33
|
+
// If the block lock button has been shown, we don't want to remove it
|
|
34
|
+
// from the toolbar until the toolbar is rendered again without it.
|
|
35
|
+
// Removing it beforehand can cause focus loss issues, such as when
|
|
36
|
+
// unlocking the block from the modal. It needs to return focus from
|
|
37
|
+
// whence it came, and to do that, we need to leave the button in the toolbar.
|
|
42
38
|
(0, _element.useEffect)(() => {
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
return;
|
|
39
|
+
if (isLocked) {
|
|
40
|
+
hasLockButtonShown.current = true;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
sequential: false
|
|
50
|
-
}).find(element => element.tagName === 'BUTTON' && element !== lockButtonRef.current)?.focus();
|
|
51
|
-
}
|
|
52
|
-
// wrapperRef is a reference object and should be stable
|
|
53
|
-
}, [isModalOpen, shouldHideBlockLockUI, wrapperRef]);
|
|
54
|
-
if (shouldHideBlockLockUI) {
|
|
42
|
+
}, [isLocked]);
|
|
43
|
+
if (!canLock || !isLocked && !hasLockButtonShown.current) {
|
|
55
44
|
return null;
|
|
56
45
|
}
|
|
57
46
|
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarGroup, {
|
|
58
47
|
className: "block-editor-block-lock-toolbar"
|
|
59
48
|
}, (0, _react.createElement)(_components.ToolbarButton, {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
label: (0, _i18n.__)('Unlock'),
|
|
49
|
+
icon: isLocked ? _icons.lock : _icons.unlock,
|
|
50
|
+
label: isLocked ? (0, _i18n.__)('Unlock') : (0, _i18n.__)('Lock'),
|
|
63
51
|
onClick: toggleModal,
|
|
64
52
|
"aria-expanded": isModalOpen,
|
|
65
53
|
"aria-haspopup": "dialog"
|