@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 +12 -10
- package/build/components/block-canvas/index.js +21 -7
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.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-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.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-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/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 +257 -95
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +58 -23
- 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 +49 -69
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +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 +21 -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 +5 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.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 +90 -29
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +84 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.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/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.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 +24 -21
- 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 +6 -3
- 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 +3 -2
- 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 +43 -36
- 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-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- 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 +14 -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/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -33
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.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-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- 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/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.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 +11 -16
- 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/preview-options/index.js +6 -62
- package/build/components/preview-options/index.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/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +19 -37
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +22 -57
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +7 -3
- 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/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- 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 +108 -17
- 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 +9 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/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 +21 -69
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +14 -30
- 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 +198 -36
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +53 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +79 -90
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +13 -30
- 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 +13 -14
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +23 -28
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +52 -120
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +27 -16
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +15 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +25 -104
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +52 -89
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +25 -10
- 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 +200 -10
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -6
- 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 +54 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +46 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -73
- 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 +66 -0
- package/build/store/utils.js.map +1 -0
- 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 +38 -99
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.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 +22 -8
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.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-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.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-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/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 +261 -99
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +60 -25
- 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 +50 -70
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +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 +22 -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 +6 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.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 +89 -27
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.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/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.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 +26 -23
- 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 +8 -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 +3 -2
- 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 +45 -38
- 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-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- 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 +3 -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/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -33
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.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-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- 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/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.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 +11 -16
- 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/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.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/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +21 -39
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +22 -56
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +7 -3
- 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/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- 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 +107 -18
- 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 +9 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/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 +20 -67
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +12 -27
- 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 +197 -37
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +52 -79
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +78 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +12 -28
- 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 +15 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +20 -25
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +50 -120
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +20 -16
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +10 -6
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +21 -100
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +52 -85
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +26 -11
- 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 +194 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -6
- 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 +52 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -65
- 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 +56 -0
- package/build-module/store/utils.js.map +1 -0
- 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 +37 -97
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.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 +164 -301
- package/build-style/style.css +164 -301
- 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 +29 -17
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +2 -7
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +6 -4
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- 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-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +309 -104
- package/src/components/block-list/block.native.js +69 -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 +43 -86
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- 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 +23 -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 +9 -6
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +179 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +84 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-picker/index.native.js +1 -1
- 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/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- 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 +36 -26
- 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 +6 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +5 -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 +60 -47
- 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-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +3 -2
- package/src/components/inner-blocks/README.md +13 -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/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +26 -36
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +21 -21
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- 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/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- 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/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- 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/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +15 -13
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/preview-options/index.js +6 -86
- 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/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +23 -52
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +22 -71
- 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 +8 -3
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/rich-text/with-deprecations.js +51 -0
- 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 +181 -30
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +9 -24
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +3 -7
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/README.md +0 -4
- package/src/components/use-settings/index.js +15 -1
- 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 +16 -81
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +14 -38
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +269 -32
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +62 -124
- package/src/hooks/color.js +111 -138
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +9 -45
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +14 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +14 -36
- package/src/hooks/font-size.js +67 -168
- package/src/hooks/index.js +58 -16
- package/src/hooks/index.native.js +22 -6
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +17 -103
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +118 -193
- package/src/hooks/test/align.js +1 -178
- 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 +14 -16
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +261 -10
- package/src/private-apis.js +2 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +48 -0
- package/src/store/private-selectors.js +56 -0
- package/src/store/reducer.js +20 -1
- package/src/store/selectors.js +10 -82
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -2
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +34 -104
- package/src/utils/selection.js +9 -2
- 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/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -120
- package/build/hooks/custom-fields.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/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -118
- package/build-module/hooks/custom-fields.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/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/custom-fields.js +0 -142
- package/src/hooks/test/color.js +0 -112
- 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,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { isReusableBlock, getBlockType } from '@wordpress/blocks';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as blockEditorStore } from '../../../store';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Returns the class names used for the different states of the block.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} clientId The block client ID.
|
|
21
|
-
*
|
|
22
|
-
* @return {string} The class names.
|
|
23
|
-
*/
|
|
24
|
-
export function useBlockClassNames(clientId) {
|
|
25
|
-
return useSelect(select => {
|
|
26
|
-
const {
|
|
27
|
-
isBlockBeingDragged,
|
|
28
|
-
isBlockHighlighted,
|
|
29
|
-
isBlockSelected,
|
|
30
|
-
isBlockMultiSelected,
|
|
31
|
-
getBlockName,
|
|
32
|
-
getSettings,
|
|
33
|
-
hasSelectedInnerBlock,
|
|
34
|
-
isTyping,
|
|
35
|
-
__unstableIsFullySelected,
|
|
36
|
-
__unstableSelectionHasUnmergeableBlock
|
|
37
|
-
} = select(blockEditorStore);
|
|
38
|
-
const {
|
|
39
|
-
outlineMode
|
|
40
|
-
} = getSettings();
|
|
41
|
-
const isDragging = isBlockBeingDragged(clientId);
|
|
42
|
-
const isSelected = isBlockSelected(clientId);
|
|
43
|
-
const name = getBlockName(clientId);
|
|
44
|
-
const checkDeep = true;
|
|
45
|
-
// "ancestor" is the more appropriate label due to "deep" check.
|
|
46
|
-
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
47
|
-
const isMultiSelected = isBlockMultiSelected(clientId);
|
|
48
|
-
return classnames({
|
|
49
|
-
'is-selected': isSelected,
|
|
50
|
-
'is-highlighted': isBlockHighlighted(clientId),
|
|
51
|
-
'is-multi-selected': isMultiSelected,
|
|
52
|
-
'is-partially-selected': isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
|
|
53
|
-
'is-reusable': isReusableBlock(getBlockType(name)),
|
|
54
|
-
'is-dragging': isDragging,
|
|
55
|
-
'has-child-selected': isAncestorOfSelectedBlock,
|
|
56
|
-
'remove-outline': isSelected && outlineMode && isTyping()
|
|
57
|
-
});
|
|
58
|
-
}, [clientId]);
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=use-block-class-names.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","isReusableBlock","getBlockType","store","blockEditorStore","useBlockClassNames","clientId","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","__unstableIsFullySelected","__unstableSelectionHasUnmergeableBlock","outlineMode","isDragging","isSelected","name","checkDeep","isAncestorOfSelectedBlock","isMultiSelected"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the class names used for the different states of the block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class names.\n */\nexport function useBlockClassNames( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisTyping,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isDragging = isBlockBeingDragged( clientId );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst name = getBlockName( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\t// \"ancestor\" is the more appropriate label due to \"deep\" check.\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\treturn classnames( {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected':\n\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\t'is-reusable': isReusableBlock( getBlockType( name ) ),\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t'remove-outline': isSelected && outlineMode && isTyping(),\n\t\t\t} );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,EAAEC,YAAY,QAAQ,mBAAmB;;AAEjE;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAEC,QAAQ,EAAG;EAC9C,OAAON,SAAS,CACbO,MAAM,IAAM;IACb,MAAM;MACLC,mBAAmB;MACnBC,kBAAkB;MAClBC,eAAe;MACfC,oBAAoB;MACpBC,YAAY;MACZC,WAAW;MACXC,qBAAqB;MACrBC,QAAQ;MACRC,yBAAyB;MACzBC;IACD,CAAC,GAAGV,MAAM,CAAEH,gBAAiB,CAAC;IAC9B,MAAM;MAAEc;IAAY,CAAC,GAAGL,WAAW,CAAC,CAAC;IACrC,MAAMM,UAAU,GAAGX,mBAAmB,CAAEF,QAAS,CAAC;IAClD,MAAMc,UAAU,GAAGV,eAAe,CAAEJ,QAAS,CAAC;IAC9C,MAAMe,IAAI,GAAGT,YAAY,CAAEN,QAAS,CAAC;IACrC,MAAMgB,SAAS,GAAG,IAAI;IACtB;IACA,MAAMC,yBAAyB,GAAGT,qBAAqB,CACtDR,QAAQ,EACRgB,SACD,CAAC;IACD,MAAME,eAAe,GAAGb,oBAAoB,CAAEL,QAAS,CAAC;IACxD,OAAOP,UAAU,CAAE;MAClB,aAAa,EAAEqB,UAAU;MACzB,gBAAgB,EAAEX,kBAAkB,CAAEH,QAAS,CAAC;MAChD,mBAAmB,EAAEkB,eAAe;MACpC,uBAAuB,EACtBA,eAAe,IACf,CAAER,yBAAyB,CAAC,CAAC,IAC7B,CAAEC,sCAAsC,CAAC,CAAC;MAC3C,aAAa,EAAEhB,eAAe,CAAEC,YAAY,CAAEmB,IAAK,CAAE,CAAC;MACtD,aAAa,EAAEF,UAAU;MACzB,oBAAoB,EAAEI,yBAAyB;MAC/C,gBAAgB,EAAEH,UAAU,IAAIF,WAAW,IAAIH,QAAQ,CAAC;IACzD,CAAE,CAAC;EACJ,CAAC,EACD,CAAET,QAAQ,CACX,CAAC;AACF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { getBlockType } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as blockEditorStore } from '../../../store';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns the custom class name if the block is a light block.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} clientId The block client ID.
|
|
16
|
-
*
|
|
17
|
-
* @return {string} The custom class name.
|
|
18
|
-
*/
|
|
19
|
-
export function useBlockCustomClassName(clientId) {
|
|
20
|
-
// It's good for this to be a separate selector because it will be executed
|
|
21
|
-
// on every attribute change, while the other selectors are not re-evaluated
|
|
22
|
-
// as much.
|
|
23
|
-
return useSelect(select => {
|
|
24
|
-
const {
|
|
25
|
-
getBlockName,
|
|
26
|
-
getBlockAttributes
|
|
27
|
-
} = select(blockEditorStore);
|
|
28
|
-
const attributes = getBlockAttributes(clientId);
|
|
29
|
-
if (!attributes?.className) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const blockType = getBlockType(getBlockName(clientId));
|
|
33
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
34
|
-
if (!hasLightBlockWrapper) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
return attributes.className;
|
|
38
|
-
}, [clientId]);
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=use-block-custom-class-name.js.map
|
package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","getBlockType","store","blockEditorStore","useBlockCustomClassName","clientId","select","getBlockName","getBlockAttributes","attributes","className","blockType","hasLightBlockWrapper","apiVersion"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the custom class name if the block is a light block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The custom class name.\n */\nexport function useBlockCustomClassName( clientId ) {\n\t// It's good for this to be a separate selector because it will be executed\n\t// on every attribute change, while the other selectors are not re-evaluated\n\t// as much.\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\n\t\t\tif ( ! attributes?.className ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst blockType = getBlockType( getBlockName( clientId ) );\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\n\t\t\tif ( ! hasLightBlockWrapper ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn attributes.className;\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,mBAAmB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAEC,QAAQ,EAAG;EACnD;EACA;EACA;EACA,OAAOL,SAAS,CACbM,MAAM,IAAM;IACb,MAAM;MAAEC,YAAY;MAAEC;IAAmB,CAAC,GACzCF,MAAM,CAAEH,gBAAiB,CAAC;IAC3B,MAAMM,UAAU,GAAGD,kBAAkB,CAAEH,QAAS,CAAC;IAEjD,IAAK,CAAEI,UAAU,EAAEC,SAAS,EAAG;MAC9B;IACD;IAEA,MAAMC,SAAS,GAAGV,YAAY,CAAEM,YAAY,CAAEF,QAAS,CAAE,CAAC;IAC1D,MAAMO,oBAAoB,GAAGD,SAAS,EAAEE,UAAU,GAAG,CAAC;IAEtD,IAAK,CAAED,oBAAoB,EAAG;MAC7B;IACD;IAEA,OAAOH,UAAU,CAACC,SAAS;EAC5B,CAAC,EACD,CAAEL,QAAQ,CACX,CAAC;AACF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { getBlockType, getBlockDefaultClassName } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as blockEditorStore } from '../../../store';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns the default class name if the block is a light block and it supports
|
|
14
|
-
* `className`.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} clientId The block client ID.
|
|
17
|
-
*
|
|
18
|
-
* @return {string} The class name, e.g. `wp-block-paragraph`.
|
|
19
|
-
*/
|
|
20
|
-
export function useBlockDefaultClassName(clientId) {
|
|
21
|
-
return useSelect(select => {
|
|
22
|
-
const name = select(blockEditorStore).getBlockName(clientId);
|
|
23
|
-
const blockType = getBlockType(name);
|
|
24
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
25
|
-
if (!hasLightBlockWrapper) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
return getBlockDefaultClassName(name);
|
|
29
|
-
}, [clientId]);
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=use-block-default-class-name.js.map
|
package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","getBlockType","getBlockDefaultClassName","store","blockEditorStore","useBlockDefaultClassName","clientId","select","name","getBlockName","blockType","hasLightBlockWrapper","apiVersion"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType, getBlockDefaultClassName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the default class name if the block is a light block and it supports\n * `className`.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class name, e.g. `wp-block-paragraph`.\n */\nexport function useBlockDefaultClassName( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst name = select( blockEditorStore ).getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\n\t\t\tif ( ! hasLightBlockWrapper ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn getBlockDefaultClassName( name );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,EAAEC,wBAAwB,QAAQ,mBAAmB;;AAE1E;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAEC,QAAQ,EAAG;EACpD,OAAON,SAAS,CACbO,MAAM,IAAM;IACb,MAAMC,IAAI,GAAGD,MAAM,CAAEH,gBAAiB,CAAC,CAACK,YAAY,CAAEH,QAAS,CAAC;IAChE,MAAMI,SAAS,GAAGT,YAAY,CAAEO,IAAK,CAAC;IACtC,MAAMG,oBAAoB,GAAGD,SAAS,EAAEE,UAAU,GAAG,CAAC;IAEtD,IAAK,CAAED,oBAAoB,EAAG;MAC7B;IACD;IAEA,OAAOT,wBAAwB,CAAEM,IAAK,CAAC;EACxC,CAAC,EACD,CAAEF,QAAQ,CACX,CAAC;AACF"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useContext } from '@wordpress/element';
|
|
6
|
-
import { Disabled } from '@wordpress/components';
|
|
7
|
-
import deprecated from '@wordpress/deprecated';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import InsertionPoint, { InsertionPointOpenRef } from './insertion-point';
|
|
13
|
-
import BlockPopover from './selected-block-tools';
|
|
14
|
-
export default function BlockToolsBackCompat({
|
|
15
|
-
children
|
|
16
|
-
}) {
|
|
17
|
-
const openRef = useContext(InsertionPointOpenRef);
|
|
18
|
-
const isDisabled = useContext(Disabled.Context);
|
|
19
|
-
|
|
20
|
-
// If context is set, `BlockTools` is a parent component.
|
|
21
|
-
if (openRef || isDisabled) {
|
|
22
|
-
return children;
|
|
23
|
-
}
|
|
24
|
-
deprecated('wp.components.Popover.Slot name="block-toolbar"', {
|
|
25
|
-
alternative: 'wp.blockEditor.BlockTools',
|
|
26
|
-
since: '5.8',
|
|
27
|
-
version: '6.3'
|
|
28
|
-
});
|
|
29
|
-
return createElement(InsertionPoint, {
|
|
30
|
-
__unstablePopoverSlot: "block-toolbar"
|
|
31
|
-
}, createElement(BlockPopover, {
|
|
32
|
-
__unstablePopoverSlot: "block-toolbar"
|
|
33
|
-
}), children);
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=back-compat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","Disabled","deprecated","InsertionPoint","InsertionPointOpenRef","BlockPopover","BlockToolsBackCompat","children","openRef","isDisabled","Context","alternative","since","version","createElement","__unstablePopoverSlot"],"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InsertionPoint, { InsertionPointOpenRef } from './insertion-point';\nimport BlockPopover from './selected-block-tools';\n\nexport default function BlockToolsBackCompat( { children } ) {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// If context is set, `BlockTools` is a parent component.\n\tif ( openRef || isDisabled ) {\n\t\treturn children;\n\t}\n\n\tdeprecated( 'wp.components.Popover.Slot name=\"block-toolbar\"', {\n\t\talternative: 'wp.blockEditor.BlockTools',\n\t\tsince: '5.8',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<InsertionPoint __unstablePopoverSlot=\"block-toolbar\">\n\t\t\t<BlockPopover __unstablePopoverSlot=\"block-toolbar\" />\n\t\t\t{ children }\n\t\t</InsertionPoint>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,cAAc,IAAIC,qBAAqB,QAAQ,mBAAmB;AACzE,OAAOC,YAAY,MAAM,wBAAwB;AAEjD,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,OAAO,GAAGR,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMK,UAAU,GAAGT,UAAU,CAAEC,QAAQ,CAACS,OAAQ,CAAC;;EAEjD;EACA,IAAKF,OAAO,IAAIC,UAAU,EAAG;IAC5B,OAAOF,QAAQ;EAChB;EAEAL,UAAU,CAAE,iDAAiD,EAAE;IAC9DS,WAAW,EAAE,2BAA2B;IACxCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,OACCC,aAAA,CAACX,cAAc;IAACY,qBAAqB,EAAC;EAAe,GACpDD,aAAA,CAACT,YAAY;IAACU,qBAAqB,EAAC;EAAe,CAAE,CAAC,EACpDR,QACa,CAAC;AAEnB"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
|
|
12
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import NavigableToolbar from '../navigable-toolbar';
|
|
18
|
-
import BlockToolbar from '../block-toolbar';
|
|
19
|
-
import { store as blockEditorStore } from '../../store';
|
|
20
|
-
import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
|
|
21
|
-
export default function BlockContextualToolbar({
|
|
22
|
-
focusOnMount,
|
|
23
|
-
isFixed,
|
|
24
|
-
...props
|
|
25
|
-
}) {
|
|
26
|
-
const {
|
|
27
|
-
blockType,
|
|
28
|
-
blockEditingMode,
|
|
29
|
-
hasParents,
|
|
30
|
-
showParentSelector,
|
|
31
|
-
selectedBlockClientId
|
|
32
|
-
} = useSelect(select => {
|
|
33
|
-
const {
|
|
34
|
-
getBlockName,
|
|
35
|
-
getBlockParents,
|
|
36
|
-
getSelectedBlockClientIds,
|
|
37
|
-
getBlockEditingMode
|
|
38
|
-
} = select(blockEditorStore);
|
|
39
|
-
const {
|
|
40
|
-
getBlockType
|
|
41
|
-
} = select(blocksStore);
|
|
42
|
-
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
43
|
-
const _selectedBlockClientId = selectedBlockClientIds[0];
|
|
44
|
-
const parents = getBlockParents(_selectedBlockClientId);
|
|
45
|
-
const firstParentClientId = parents[parents.length - 1];
|
|
46
|
-
const parentBlockName = getBlockName(firstParentClientId);
|
|
47
|
-
const parentBlockType = getBlockType(parentBlockName);
|
|
48
|
-
return {
|
|
49
|
-
selectedBlockClientId: _selectedBlockClientId,
|
|
50
|
-
blockType: _selectedBlockClientId && getBlockType(getBlockName(_selectedBlockClientId)),
|
|
51
|
-
blockEditingMode: getBlockEditingMode(_selectedBlockClientId),
|
|
52
|
-
hasParents: parents.length,
|
|
53
|
-
showParentSelector: parentBlockType && getBlockEditingMode(firstParentClientId) === 'default' && hasBlockSupport(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length <= 1 && getBlockEditingMode(_selectedBlockClientId) === 'default'
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
56
|
-
const isToolbarEnabled = blockType && hasBlockSupport(blockType, '__experimentalToolbar', true);
|
|
57
|
-
const hasAnyBlockControls = useHasAnyBlockControls();
|
|
58
|
-
if (!isToolbarEnabled || blockEditingMode !== 'default' && !hasAnyBlockControls) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Shifts the toolbar to make room for the parent block selector.
|
|
63
|
-
const classes = classnames('block-editor-block-contextual-toolbar', {
|
|
64
|
-
'has-parent': hasParents && showParentSelector,
|
|
65
|
-
'is-fixed': isFixed
|
|
66
|
-
});
|
|
67
|
-
return createElement(NavigableToolbar, {
|
|
68
|
-
focusOnMount: focusOnMount,
|
|
69
|
-
focusEditorOnEscape: true,
|
|
70
|
-
className: classes
|
|
71
|
-
/* translators: accessibility text for the block toolbar */,
|
|
72
|
-
"aria-label": __('Block tools'),
|
|
73
|
-
variant: isFixed ? 'unstyled' : undefined
|
|
74
|
-
// Resets the index whenever the active block changes so
|
|
75
|
-
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
76
|
-
,
|
|
77
|
-
key: selectedBlockClientId,
|
|
78
|
-
...props
|
|
79
|
-
}, createElement(BlockToolbar, {
|
|
80
|
-
hideDragHandle: isFixed
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=block-contextual-toolbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","__","hasBlockSupport","store","blocksStore","useSelect","NavigableToolbar","BlockToolbar","blockEditorStore","useHasAnyBlockControls","BlockContextualToolbar","focusOnMount","isFixed","props","blockType","blockEditingMode","hasParents","showParentSelector","selectedBlockClientId","select","getBlockName","getBlockParents","getSelectedBlockClientIds","getBlockEditingMode","getBlockType","selectedBlockClientIds","_selectedBlockClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","isToolbarEnabled","hasAnyBlockControls","classes","createElement","focusEditorOnEscape","className","variant","undefined","key","hideDragHandle"],"sources":["@wordpress/block-editor/src/components/block-tools/block-contextual-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport NavigableToolbar from '../navigable-toolbar';\nimport BlockToolbar from '../block-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\nexport default function BlockContextualToolbar( {\n\tfocusOnMount,\n\tisFixed,\n\t...props\n} ) {\n\tconst {\n\t\tblockType,\n\t\tblockEditingMode,\n\t\thasParents,\n\t\tshowParentSelector,\n\t\tselectedBlockClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlockEditingMode,\n\t\t} = select( blockEditorStore );\n\t\tconst { getBlockType } = select( blocksStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( _selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\n\t\treturn {\n\t\t\tselectedBlockClientId: _selectedBlockClientId,\n\t\t\tblockType:\n\t\t\t\t_selectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( _selectedBlockClientId ) ),\n\t\t\tblockEditingMode: getBlockEditingMode( _selectedBlockClientId ),\n\t\t\thasParents: parents.length,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length <= 1 &&\n\t\t\t\tgetBlockEditingMode( _selectedBlockClientId ) === 'default',\n\t\t};\n\t}, [] );\n\n\tconst isToolbarEnabled =\n\t\tblockType &&\n\t\thasBlockSupport( blockType, '__experimentalToolbar', true );\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( blockEditingMode !== 'default' && ! hasAnyBlockControls )\n\t) {\n\t\treturn null;\n\t}\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = classnames( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': hasParents && showParentSelector,\n\t\t'is-fixed': isFixed,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\tvariant={ isFixed ? 'unstyled' : undefined }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ selectedBlockClientId }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<BlockToolbar hideDragHandle={ isFixed } />\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,aAAa;AACvD,SAASC,sBAAsB,QAAQ,0CAA0C;AAEjF,eAAe,SAASC,sBAAsBA,CAAE;EAC/CC,YAAY;EACZC,OAAO;EACP,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IACLC,SAAS;IACTC,gBAAgB;IAChBC,UAAU;IACVC,kBAAkB;IAClBC;EACD,CAAC,GAAGb,SAAS,CAAIc,MAAM,IAAM;IAC5B,MAAM;MACLC,YAAY;MACZC,eAAe;MACfC,yBAAyB;MACzBC;IACD,CAAC,GAAGJ,MAAM,CAAEX,gBAAiB,CAAC;IAC9B,MAAM;MAAEgB;IAAa,CAAC,GAAGL,MAAM,CAAEf,WAAY,CAAC;IAC9C,MAAMqB,sBAAsB,GAAGH,yBAAyB,CAAC,CAAC;IAC1D,MAAMI,sBAAsB,GAAGD,sBAAsB,CAAE,CAAC,CAAE;IAC1D,MAAME,OAAO,GAAGN,eAAe,CAAEK,sBAAuB,CAAC;IACzD,MAAME,mBAAmB,GAAGD,OAAO,CAAEA,OAAO,CAACE,MAAM,GAAG,CAAC,CAAE;IACzD,MAAMC,eAAe,GAAGV,YAAY,CAAEQ,mBAAoB,CAAC;IAC3D,MAAMG,eAAe,GAAGP,YAAY,CAAEM,eAAgB,CAAC;IAEvD,OAAO;MACNZ,qBAAqB,EAAEQ,sBAAsB;MAC7CZ,SAAS,EACRY,sBAAsB,IACtBF,YAAY,CAAEJ,YAAY,CAAEM,sBAAuB,CAAE,CAAC;MACvDX,gBAAgB,EAAEQ,mBAAmB,CAAEG,sBAAuB,CAAC;MAC/DV,UAAU,EAAEW,OAAO,CAACE,MAAM;MAC1BZ,kBAAkB,EACjBc,eAAe,IACfR,mBAAmB,CAAEK,mBAAoB,CAAC,KAAK,SAAS,IACxD1B,eAAe,CACd6B,eAAe,EACf,8BAA8B,EAC9B,IACD,CAAC,IACDN,sBAAsB,CAACI,MAAM,IAAI,CAAC,IAClCN,mBAAmB,CAAEG,sBAAuB,CAAC,KAAK;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMM,gBAAgB,GACrBlB,SAAS,IACTZ,eAAe,CAAEY,SAAS,EAAE,uBAAuB,EAAE,IAAK,CAAC;EAC5D,MAAMmB,mBAAmB,GAAGxB,sBAAsB,CAAC,CAAC;EACpD,IACC,CAAEuB,gBAAgB,IAChBjB,gBAAgB,KAAK,SAAS,IAAI,CAAEkB,mBAAqB,EAC1D;IACD,OAAO,IAAI;EACZ;;EAEA;EACA,MAAMC,OAAO,GAAGlC,UAAU,CAAE,uCAAuC,EAAE;IACpE,YAAY,EAAEgB,UAAU,IAAIC,kBAAkB;IAC9C,UAAU,EAAEL;EACb,CAAE,CAAC;EAEH,OACCuB,aAAA,CAAC7B,gBAAgB;IAChBK,YAAY,EAAGA,YAAc;IAC7ByB,mBAAmB;IACnBC,SAAS,EAAGH;IACZ;IACA,cAAajC,EAAE,CAAE,aAAc,CAAG;IAClCqC,OAAO,EAAG1B,OAAO,GAAG,UAAU,GAAG2B;IACjC;IACA;IAAA;IACAC,GAAG,EAAGtB,qBAAuB;IAAA,GACxBL;EAAK,GAEVsB,aAAA,CAAC5B,YAAY;IAACkC,cAAc,EAAG7B;EAAS,CAAE,CACzB,CAAC;AAErB"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { useRef, useEffect } from '@wordpress/element';
|
|
11
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
-
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import BlockSelectionButton from './block-selection-button';
|
|
18
|
-
import BlockContextualToolbar from './block-contextual-toolbar';
|
|
19
|
-
import { store as blockEditorStore } from '../../store';
|
|
20
|
-
import BlockPopover from '../block-popover';
|
|
21
|
-
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
22
|
-
import useSelectedBlockToolProps from './use-selected-block-tool-props';
|
|
23
|
-
import { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';
|
|
24
|
-
export default function SelectedBlockTools({
|
|
25
|
-
clientId,
|
|
26
|
-
showEmptyBlockSideInserter,
|
|
27
|
-
__unstableContentRef
|
|
28
|
-
}) {
|
|
29
|
-
const {
|
|
30
|
-
capturingClientId,
|
|
31
|
-
isInsertionPointVisible,
|
|
32
|
-
lastClientId,
|
|
33
|
-
rootClientId
|
|
34
|
-
} = useSelectedBlockToolProps(clientId);
|
|
35
|
-
const {
|
|
36
|
-
shouldShowBreadcrumb
|
|
37
|
-
} = useSelect(select => {
|
|
38
|
-
const {
|
|
39
|
-
hasMultiSelection,
|
|
40
|
-
__unstableGetEditorMode
|
|
41
|
-
} = select(blockEditorStore);
|
|
42
|
-
const editorMode = __unstableGetEditorMode();
|
|
43
|
-
return {
|
|
44
|
-
shouldShowBreadcrumb: !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out')
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
const isToolbarForced = useRef(false);
|
|
48
|
-
const {
|
|
49
|
-
shouldShowContextualToolbar,
|
|
50
|
-
canFocusHiddenToolbar
|
|
51
|
-
} = useShouldContextualToolbarShow();
|
|
52
|
-
const {
|
|
53
|
-
stopTyping
|
|
54
|
-
} = useDispatch(blockEditorStore);
|
|
55
|
-
useShortcut('core/block-editor/focus-toolbar', () => {
|
|
56
|
-
isToolbarForced.current = true;
|
|
57
|
-
stopTyping(true);
|
|
58
|
-
}, {
|
|
59
|
-
isDisabled: !canFocusHiddenToolbar
|
|
60
|
-
});
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
isToolbarForced.current = false;
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Stores the active toolbar item index so the block toolbar can return focus
|
|
66
|
-
// to it when re-mounting.
|
|
67
|
-
const initialToolbarItemIndexRef = useRef();
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
// Resets the index whenever the active block changes so this is not
|
|
70
|
-
// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
71
|
-
initialToolbarItemIndexRef.current = undefined;
|
|
72
|
-
}, [clientId]);
|
|
73
|
-
const popoverProps = useBlockToolbarPopoverProps({
|
|
74
|
-
contentElement: __unstableContentRef?.current,
|
|
75
|
-
clientId
|
|
76
|
-
});
|
|
77
|
-
if (showEmptyBlockSideInserter) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
if (shouldShowBreadcrumb || shouldShowContextualToolbar) {
|
|
81
|
-
return createElement(BlockPopover, {
|
|
82
|
-
clientId: capturingClientId || clientId,
|
|
83
|
-
bottomClientId: lastClientId,
|
|
84
|
-
className: classnames('block-editor-block-list__block-popover', {
|
|
85
|
-
'is-insertion-point-visible': isInsertionPointVisible
|
|
86
|
-
}),
|
|
87
|
-
resize: false,
|
|
88
|
-
...popoverProps
|
|
89
|
-
}, shouldShowContextualToolbar && createElement(BlockContextualToolbar
|
|
90
|
-
// If the toolbar is being shown because of being forced
|
|
91
|
-
// it should focus the toolbar right after the mount.
|
|
92
|
-
, {
|
|
93
|
-
focusOnMount: isToolbarForced.current,
|
|
94
|
-
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
95
|
-
__experimentalOnIndexChange: index => {
|
|
96
|
-
initialToolbarItemIndexRef.current = index;
|
|
97
|
-
}
|
|
98
|
-
}), shouldShowBreadcrumb && createElement(BlockSelectionButton, {
|
|
99
|
-
clientId: clientId,
|
|
100
|
-
rootClientId: rootClientId
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=selected-block-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useRef","useEffect","useDispatch","useSelect","useShortcut","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","useSelectedBlockToolProps","useShouldContextualToolbarShow","SelectedBlockTools","clientId","showEmptyBlockSideInserter","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","shouldShowBreadcrumb","select","hasMultiSelection","__unstableGetEditorMode","editorMode","isToolbarForced","shouldShowContextualToolbar","canFocusHiddenToolbar","stopTyping","current","isDisabled","initialToolbarItemIndexRef","undefined","popoverProps","contentElement","createElement","bottomClientId","className","resize","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index"],"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-tools.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';\n\nexport default function SelectedBlockTools( {\n\tclientId,\n\tshowEmptyBlockSideInserter,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst { shouldShowBreadcrumb } = useSelect( ( select ) => {\n\t\tconst { hasMultiSelection, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst editorMode = __unstableGetEditorMode();\n\n\t\treturn {\n\t\t\tshouldShowBreadcrumb:\n\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' ),\n\t\t};\n\t}, [] );\n\n\tconst isToolbarForced = useRef( false );\n\tconst { shouldShowContextualToolbar, canFocusHiddenToolbar } =\n\t\tuseShouldContextualToolbarShow();\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif ( showEmptyBlockSideInserter ) {\n\t\treturn null;\n\t}\n\n\tif ( shouldShowBreadcrumb || shouldShowContextualToolbar ) {\n\t\treturn (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t{ shouldShowContextualToolbar && (\n\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPopover>\n\t\t);\n\t}\n\n\treturn null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,WAAW,QAAQ,+BAA+B;;AAE3D;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,sBAAsB,MAAM,4BAA4B;AAC/D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,8BAA8B,QAAQ,gDAAgD;AAE/F,eAAe,SAASC,kBAAkBA,CAAE;EAC3CC,QAAQ;EACRC,0BAA0B;EAC1BC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAGT,yBAAyB,CAAEG,QAAS,CAAC;EAEzC,MAAM;IAAEO;EAAqB,CAAC,GAAGlB,SAAS,CAAImB,MAAM,IAAM;IACzD,MAAM;MAAEC,iBAAiB;MAAEC;IAAwB,CAAC,GACnDF,MAAM,CAAEd,gBAAiB,CAAC;IAE3B,MAAMiB,UAAU,GAAGD,uBAAuB,CAAC,CAAC;IAE5C,OAAO;MACNH,oBAAoB,EACnB,CAAEE,iBAAiB,CAAC,CAAC,KACnBE,UAAU,KAAK,YAAY,IAAIA,UAAU,KAAK,UAAU;IAC5D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,eAAe,GAAG1B,MAAM,CAAE,KAAM,CAAC;EACvC,MAAM;IAAE2B,2BAA2B;IAAEC;EAAsB,CAAC,GAC3DhB,8BAA8B,CAAC,CAAC;EAEjC,MAAM;IAAEiB;EAAW,CAAC,GAAG3B,WAAW,CAAEM,gBAAiB,CAAC;EAEtDJ,WAAW,CACV,iCAAiC,EACjC,MAAM;IACLsB,eAAe,CAACI,OAAO,GAAG,IAAI;IAC9BD,UAAU,CAAE,IAAK,CAAC;EACnB,CAAC,EACD;IACCE,UAAU,EAAE,CAAEH;EACf,CACD,CAAC;EAED3B,SAAS,CAAE,MAAM;IAChByB,eAAe,CAACI,OAAO,GAAG,KAAK;EAChC,CAAE,CAAC;;EAEH;EACA;EACA,MAAME,0BAA0B,GAAGhC,MAAM,CAAC,CAAC;EAE3CC,SAAS,CAAE,MAAM;IAChB;IACA;IACA+B,0BAA0B,CAACF,OAAO,GAAGG,SAAS;EAC/C,CAAC,EAAE,CAAEnB,QAAQ,CAAG,CAAC;EAEjB,MAAMoB,YAAY,GAAGxB,2BAA2B,CAAE;IACjDyB,cAAc,EAAEnB,oBAAoB,EAAEc,OAAO;IAC7ChB;EACD,CAAE,CAAC;EAEH,IAAKC,0BAA0B,EAAG;IACjC,OAAO,IAAI;EACZ;EAEA,IAAKM,oBAAoB,IAAIM,2BAA2B,EAAG;IAC1D,OACCS,aAAA,CAAC3B,YAAY;MACZK,QAAQ,EAAGG,iBAAiB,IAAIH,QAAU;MAC1CuB,cAAc,EAAGlB,YAAc;MAC/BmB,SAAS,EAAGvC,UAAU,CACrB,wCAAwC,EACxC;QACC,4BAA4B,EAAEmB;MAC/B,CACD,CAAG;MACHqB,MAAM,EAAG,KAAO;MAAA,GACXL;IAAY,GAEfP,2BAA2B,IAC5BS,aAAA,CAAC9B;IACA;IACA;IAAA;MACAkC,YAAY,EAAGd,eAAe,CAACI,OAAS;MACxCW,0BAA0B,EACzBT,0BAA0B,CAACF,OAC3B;MACDY,2BAA2B,EAAKC,KAAK,IAAM;QAC1CX,0BAA0B,CAACF,OAAO,GAAGa,KAAK;MAC3C;IAAG,CACH,CACD,EACCtB,oBAAoB,IACrBe,aAAA,CAAC/B,oBAAoB;MACpBS,QAAQ,EAAGA,QAAU;MACrBM,YAAY,EAAGA;IAAc,CAC7B,CAEW,CAAC;EAEjB;EAEA,OAAO,IAAI;AACZ"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useState } from '@wordpress/element';
|
|
5
|
-
import { useDebounce } from '@wordpress/compose';
|
|
6
|
-
export default function useDebouncedInput(defaultValue = '') {
|
|
7
|
-
const [input, setInput] = useState(defaultValue);
|
|
8
|
-
const [debouncedInput, setDebouncedState] = useState(defaultValue);
|
|
9
|
-
const setDebouncedInput = useDebounce(setDebouncedState, 250);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
setDebouncedInput(input);
|
|
12
|
-
}, [input]);
|
|
13
|
-
return [input, setInput, debouncedInput];
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=use-debounced-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","useDebounce","useDebouncedInput","defaultValue","input","setInput","debouncedInput","setDebouncedState","setDebouncedInput"],"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-debounced-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\nexport default function useDebouncedInput( defaultValue = '' ) {\n\tconst [ input, setInput ] = useState( defaultValue );\n\tconst [ debouncedInput, setDebouncedState ] = useState( defaultValue );\n\n\tconst setDebouncedInput = useDebounce( setDebouncedState, 250 );\n\n\tuseEffect( () => {\n\t\tsetDebouncedInput( input );\n\t}, [ input ] );\n\n\treturn [ input, setInput, debouncedInput ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,eAAe,SAASC,iBAAiBA,CAAEC,YAAY,GAAG,EAAE,EAAG;EAC9D,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAGL,QAAQ,CAAEG,YAAa,CAAC;EACpD,MAAM,CAAEG,cAAc,EAAEC,iBAAiB,CAAE,GAAGP,QAAQ,CAAEG,YAAa,CAAC;EAEtE,MAAMK,iBAAiB,GAAGP,WAAW,CAAEM,iBAAiB,EAAE,GAAI,CAAC;EAE/DR,SAAS,CAAE,MAAM;IAChBS,iBAAiB,CAAEJ,KAAM,CAAC;EAC3B,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;EAEd,OAAO,CAAEA,KAAK,EAAEC,QAAQ,EAAEC,cAAc,CAAE;AAC3C"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useBlockEditContext } from '../block-edit/context';
|
|
10
|
-
import { store as blockEditorStore } from '../../store';
|
|
11
|
-
export default function useDisplayBlockControls() {
|
|
12
|
-
const {
|
|
13
|
-
isSelected,
|
|
14
|
-
clientId,
|
|
15
|
-
name
|
|
16
|
-
} = useBlockEditContext();
|
|
17
|
-
return useSelect(select => {
|
|
18
|
-
if (isSelected) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
const {
|
|
22
|
-
getBlockName,
|
|
23
|
-
isFirstMultiSelectedBlock,
|
|
24
|
-
getMultiSelectedBlockClientIds
|
|
25
|
-
} = select(blockEditorStore);
|
|
26
|
-
if (isFirstMultiSelectedBlock(clientId)) {
|
|
27
|
-
return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name);
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
}, [clientId, isSelected, name]);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useBlockEditContext","store","blockEditorStore","useDisplayBlockControls","isSelected","clientId","name","select","getBlockName","isFirstMultiSelectedBlock","getMultiSelectedBlockClientIds","every","id"],"sources":["@wordpress/block-editor/src/components/use-display-block-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useDisplayBlockControls() {\n\tconst { isSelected, clientId, name } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tgetMultiSelectedBlockClientIds,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( isFirstMultiSelectedBlock( clientId ) ) {\n\t\t\t\treturn getMultiSelectedBlockClientIds().every(\n\t\t\t\t\t( id ) => getBlockName( id ) === name\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t\t[ clientId, isSelected, name ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,uBAAuBA,CAAA,EAAG;EACjD,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAC5D,OAAOD,SAAS,CACbQ,MAAM,IAAM;IACb,IAAKH,UAAU,EAAG;MACjB,OAAO,IAAI;IACZ;IAEA,MAAM;MACLI,YAAY;MACZC,yBAAyB;MACzBC;IACD,CAAC,GAAGH,MAAM,CAAEL,gBAAiB,CAAC;IAE9B,IAAKO,yBAAyB,CAAEJ,QAAS,CAAC,EAAG;MAC5C,OAAOK,8BAA8B,CAAC,CAAC,CAACC,KAAK,CAC1CC,EAAE,IAAMJ,YAAY,CAAEI,EAAG,CAAC,KAAKN,IAClC,CAAC;IACF;IAEA,OAAO,KAAK;EACb,CAAC,EACD,CAAED,QAAQ,EAAED,UAAU,EAAEE,IAAI,CAC7B,CAAC;AACF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { useBlockEditContext } from '../block-edit/context';
|
|
11
|
-
import { store as blockEditorStore } from '../../store';
|
|
12
|
-
export default function useDisplayBlockControls() {
|
|
13
|
-
const {
|
|
14
|
-
isSelected,
|
|
15
|
-
clientId,
|
|
16
|
-
name
|
|
17
|
-
} = useBlockEditContext();
|
|
18
|
-
return useSelect(select => {
|
|
19
|
-
const {
|
|
20
|
-
getBlockName,
|
|
21
|
-
getBlockRootClientId
|
|
22
|
-
} = select(blockEditorStore);
|
|
23
|
-
const parentId = getBlockRootClientId(clientId);
|
|
24
|
-
const parentBlockName = getBlockName(parentId);
|
|
25
|
-
const hideControls = hasBlockSupport(parentBlockName, '__experimentalHideChildBlockControls', false);
|
|
26
|
-
if (!hideControls && isSelected) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
}, [clientId, isSelected, name]);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","hasBlockSupport","useBlockEditContext","store","blockEditorStore","useDisplayBlockControls","isSelected","clientId","name","select","getBlockName","getBlockRootClientId","parentId","parentBlockName","hideControls"],"sources":["@wordpress/block-editor/src/components/use-display-block-controls/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useDisplayBlockControls() {\n\tconst { isSelected, clientId, name } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockName = getBlockName( parentId );\n\n\t\t\tconst hideControls = hasBlockSupport(\n\t\t\t\tparentBlockName,\n\t\t\t\t'__experimentalHideChildBlockControls',\n\t\t\t\tfalse\n\t\t\t);\n\n\t\t\tif ( ! hideControls && isSelected ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t\t[ clientId, isSelected, name ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,QAAQ,mBAAmB;;AAEnD;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,uBAAuBA,CAAA,EAAG;EACjD,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAC5D,OAAOF,SAAS,CACbS,MAAM,IAAM;IACb,MAAM;MAAEC,YAAY;MAAEC;IAAqB,CAAC,GAC3CF,MAAM,CAAEL,gBAAiB,CAAC;IAE3B,MAAMQ,QAAQ,GAAGD,oBAAoB,CAAEJ,QAAS,CAAC;IACjD,MAAMM,eAAe,GAAGH,YAAY,CAAEE,QAAS,CAAC;IAEhD,MAAME,YAAY,GAAGb,eAAe,CACnCY,eAAe,EACf,sCAAsC,EACtC,KACD,CAAC;IAED,IAAK,CAAEC,YAAY,IAAIR,UAAU,EAAG;MACnC,OAAO,IAAI;IACZ;IAEA,OAAO,KAAK;EACb,CAAC,EACD,CAAEC,QAAQ,EAAED,UAAU,EAAEE,IAAI,CAC7B,CAAC;AACF"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { addFilter } from '@wordpress/hooks';
|
|
6
|
-
import { PanelBody, TextControl } from '@wordpress/components';
|
|
7
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
9
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { InspectorControls } from '../components';
|
|
15
|
-
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Filters registered block settings, extending attributes to include `connections`.
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} settings Original block settings.
|
|
21
|
-
*
|
|
22
|
-
* @return {Object} Filtered block settings.
|
|
23
|
-
*/
|
|
24
|
-
function addAttribute(settings) {
|
|
25
|
-
if (hasBlockSupport(settings, '__experimentalConnections', true)) {
|
|
26
|
-
// Gracefully handle if settings.attributes.connections is undefined.
|
|
27
|
-
settings.attributes = {
|
|
28
|
-
...settings.attributes,
|
|
29
|
-
connections: {
|
|
30
|
-
type: 'object'
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return settings;
|
|
35
|
-
}
|
|
36
|
-
function CustomFieldsControl(props) {
|
|
37
|
-
const blockEditingMode = useBlockEditingMode();
|
|
38
|
-
if (blockEditingMode !== 'default') {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// If the block is a paragraph or image block, we need to know which
|
|
43
|
-
// attribute to use for the connection. Only the `content` attribute
|
|
44
|
-
// of the paragraph block and the `url` attribute of the image block are supported.
|
|
45
|
-
let attributeName;
|
|
46
|
-
if (props.name === 'core/paragraph') attributeName = 'content';
|
|
47
|
-
if (props.name === 'core/image') attributeName = 'url';
|
|
48
|
-
return createElement(InspectorControls, null, createElement(PanelBody, {
|
|
49
|
-
title: __('Connections'),
|
|
50
|
-
initialOpen: true
|
|
51
|
-
}, createElement(TextControl, {
|
|
52
|
-
__nextHasNoMarginBottom: true,
|
|
53
|
-
autoComplete: "off",
|
|
54
|
-
label: __('Custom field meta_key'),
|
|
55
|
-
value: props.attributes?.connections?.attributes?.[attributeName]?.value || '',
|
|
56
|
-
onChange: nextValue => {
|
|
57
|
-
if (nextValue === '') {
|
|
58
|
-
props.setAttributes({
|
|
59
|
-
connections: undefined,
|
|
60
|
-
[attributeName]: undefined,
|
|
61
|
-
placeholder: undefined
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
props.setAttributes({
|
|
65
|
-
connections: {
|
|
66
|
-
attributes: {
|
|
67
|
-
// The attributeName will be either `content` or `url`.
|
|
68
|
-
[attributeName]: {
|
|
69
|
-
// Source will be variable, could be post_meta, user_meta, term_meta, etc.
|
|
70
|
-
// Could even be a custom source like a social media attribute.
|
|
71
|
-
source: 'meta_fields',
|
|
72
|
-
value: nextValue
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
[attributeName]: undefined,
|
|
77
|
-
placeholder: sprintf('This content will be replaced on the frontend by the value of "%s" custom field.', nextValue)
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Override the default edit UI to include a new block inspector control for
|
|
86
|
-
* assigning a connection to blocks that has support for connections.
|
|
87
|
-
* Currently, only the `core/paragraph` block is supported and there is only a relation
|
|
88
|
-
* between paragraph content and a custom field.
|
|
89
|
-
*
|
|
90
|
-
* @param {Component} BlockEdit Original component.
|
|
91
|
-
*
|
|
92
|
-
* @return {Component} Wrapped component.
|
|
93
|
-
*/
|
|
94
|
-
const withCustomFieldsControls = createHigherOrderComponent(BlockEdit => {
|
|
95
|
-
return props => {
|
|
96
|
-
const hasCustomFieldsSupport = hasBlockSupport(props.name, '__experimentalConnections', false);
|
|
97
|
-
|
|
98
|
-
// Check if the current block is a paragraph or image block.
|
|
99
|
-
// Currently, only these two blocks are supported.
|
|
100
|
-
if (!['core/paragraph', 'core/image'].includes(props.name)) {
|
|
101
|
-
return createElement(BlockEdit, {
|
|
102
|
-
key: "edit",
|
|
103
|
-
...props
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return createElement(Fragment, null, createElement(BlockEdit, {
|
|
107
|
-
key: "edit",
|
|
108
|
-
...props
|
|
109
|
-
}), hasCustomFieldsSupport && props.isSelected && createElement(CustomFieldsControl, {
|
|
110
|
-
...props
|
|
111
|
-
}));
|
|
112
|
-
};
|
|
113
|
-
}, 'withCustomFieldsControls');
|
|
114
|
-
if (window.__experimentalConnections) {
|
|
115
|
-
addFilter('blocks.registerBlockType', 'core/editor/connections/attribute', addAttribute);
|
|
116
|
-
addFilter('editor.BlockEdit', 'core/editor/connections/with-inspector-controls', withCustomFieldsControls);
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=custom-fields.js.map
|