@wordpress/block-editor 11.1.0 → 11.3.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 +12 -0
- package/LICENSE.md +1 -1
- package/README.md +28 -4
- package/build/components/alignment-control/ui.js +1 -1
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/autocomplete/index.js +2 -7
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +9 -0
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +2 -2
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -4
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-edit/index.js +8 -0
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +18 -15
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +5 -0
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +0 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/mover-description.js +2 -2
- package/build/components/block-mover/mover-description.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +3 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/use-patterns-setup.js +2 -2
- package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
- package/build/components/block-patterns-list/index.js +31 -3
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -14
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +32 -8
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-selection-clearer/index.js +1 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +7 -33
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +2 -8
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +3 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +55 -47
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +43 -10
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-vertical-alignment-control/icons.js +15 -1
- package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +9 -4
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/color-style-selector/index.js +3 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -4
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +1 -0
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-family/index.js +1 -7
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +1 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +1 -1
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +5 -8
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/context.js +22 -0
- package/build/components/global-styles/context.js.map +1 -0
- package/build/components/global-styles/hooks.js +142 -0
- package/build/components/global-styles/hooks.js.map +1 -0
- package/build/components/global-styles/index.js +42 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/typography-utils.js +92 -0
- package/build/components/global-styles/typography-utils.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +974 -0
- package/build/components/global-styles/use-global-styles-output.js.map +1 -0
- package/build/components/global-styles/utils.js +340 -0
- package/build/components/global-styles/utils.js.map +1 -0
- package/build/components/height-control/index.js +13 -1
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/iframe/index.js +37 -8
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +6 -1
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/image-editor/constants.js +1 -1
- package/build/components/image-editor/constants.js.map +1 -1
- package/build/components/image-editor/context.js +1 -2
- package/build/components/image-editor/context.js.map +1 -1
- package/build/components/image-editor/cropper.js +3 -1
- package/build/components/image-editor/cropper.js.map +1 -1
- package/build/components/image-editor/index.js +13 -9
- package/build/components/image-editor/index.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +11 -35
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -7
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +8 -24
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +22 -32
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +8 -23
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-block-context.js +53 -0
- package/build/components/inner-blocks/use-block-context.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js +0 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +11 -5
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +2 -2
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -7
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +8 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +142 -56
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +74 -21
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +11 -13
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +6 -3
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/media-tab/utils.js +26 -15
- package/build/components/inserter/media-tab/utils.js.map +1 -1
- package/build/components/inserter/menu.js +12 -5
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +5 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -7
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter-list-item/index.js +1 -9
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +15 -2
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +14 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +7 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/index.js +2 -2
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +14 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +14 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +2 -2
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +6 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +20 -22
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/justify-content-control/ui.js +8 -1
- package/build/components/justify-content-control/ui.js.map +1 -1
- package/build/components/link-control/index.js +45 -17
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -0
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +1 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +49 -38
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +38 -5
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +10 -4
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +13 -52
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +25 -10
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +15 -17
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +2 -2
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
- package/build/components/provider/index.js +22 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +5 -6
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/rich-text/use-before-input-rules.js +11 -3
- package/build/components/rich-text/use-before-input-rules.js.map +1 -1
- package/build/components/rich-text/use-enter.js +4 -5
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -1
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +2 -8
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +3 -1
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/button.js +1 -0
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +15 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +7 -8
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +1 -0
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-block-display-information/index.js +1 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-paste-styles/index.js +188 -0
- package/build/components/use-paste-styles/index.js.map +1 -0
- package/build/components/writing-flow/use-arrow-nav.js +22 -29
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/experiments.js +45 -0
- package/build/experiments.js.map +1 -0
- package/build/experiments.native.js +40 -0
- package/build/experiments.native.js.map +1 -0
- package/build/hooks/anchor.js +2 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/child-layout.js +5 -1
- package/build/hooks/child-layout.js.map +1 -1
- package/build/hooks/color-panel.js +1 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +3 -3
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +7 -5
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +1 -0
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/padding.js +1 -0
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +395 -0
- package/build/hooks/position.js.map +1 -0
- package/build/hooks/supports.js +328 -0
- package/build/hooks/supports.js.map +1 -0
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-color-props.js +3 -3
- package/build/hooks/use-color-props.js.map +1 -1
- package/build/hooks/utils.js +69 -3
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +10 -1
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +3 -0
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +59 -9
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +0 -18
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +3 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +11 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +78 -0
- package/build/store/private-actions.js.map +1 -0
- package/build/store/private-selectors.js +18 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +7 -3
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +68 -40
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-variation-transforms.js +1 -1
- package/build/utils/block-variation-transforms.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/index.js +1 -7
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -1
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -6
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +6 -0
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +2 -2
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -4
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-edit/index.js +7 -0
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +17 -15
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +5 -0
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +0 -1
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mover/mover-description.js +2 -2
- package/build-module/components/block-mover/mover-description.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +3 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -1
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/use-patterns-setup.js +2 -2
- package/build-module/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +32 -3
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -14
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +31 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js +1 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -30
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +2 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +55 -48
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +42 -11
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/icons.js +12 -0
- package/build-module/components/block-vertical-alignment-control/icons.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +10 -5
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +3 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -5
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +1 -0
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-family/index.js +1 -6
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +1 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +1 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +5 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/context.js +12 -0
- package/build-module/components/global-styles/context.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +121 -0
- package/build-module/components/global-styles/hooks.js.map +1 -0
- package/build-module/components/global-styles/index.js +4 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/typography-utils.js +84 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +930 -0
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -0
- package/build-module/components/global-styles/utils.js +321 -0
- package/build-module/components/global-styles/utils.js.map +1 -0
- package/build-module/components/height-control/index.js +14 -1
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +36 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +6 -1
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/image-editor/constants.js +1 -1
- package/build-module/components/image-editor/constants.js.map +1 -1
- package/build-module/components/image-editor/context.js +1 -2
- package/build-module/components/image-editor/context.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +3 -1
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/index.js +13 -3
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +12 -37
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +2 -6
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +2 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +21 -32
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +9 -22
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-block-context.js +43 -0
- package/build-module/components/inner-blocks/use-block-context.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +0 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +11 -5
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +1 -6
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +8 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +145 -56
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +74 -24
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +14 -14
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +7 -4
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/media-tab/utils.js +27 -15
- package/build-module/components/inserter/media-tab/utils.js.map +1 -1
- package/build-module/components/inserter/menu.js +12 -5
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +5 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -9
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +14 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +13 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +7 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/index.js +2 -2
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +13 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +13 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +2 -2
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +33 -0
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +6 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +20 -22
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/justify-content-control/ui.js +9 -2
- package/build-module/components/justify-content-control/ui.js.map +1 -1
- package/build-module/components/link-control/index.js +45 -16
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -0
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +46 -36
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +37 -7
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +9 -4
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +15 -52
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +23 -11
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +15 -16
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +2 -2
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/provider/index.js +17 -8
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +4 -4
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-before-input-rules.js +10 -2
- package/build-module/components/rich-text/use-before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +4 -5
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -1
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -7
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tool-selector/index.js +3 -1
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -0
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +14 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +8 -8
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -0
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +1 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +174 -0
- package/build-module/components/use-paste-styles/index.js.map +1 -0
- package/build-module/components/writing-flow/use-arrow-nav.js +22 -29
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/experiments.js +25 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/experiments.native.js +23 -0
- package/build-module/experiments.native.js.map +1 -0
- package/build-module/hooks/anchor.js +2 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/child-layout.js +5 -1
- package/build-module/hooks/child-layout.js.map +1 -1
- package/build-module/hooks/color-panel.js +1 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +3 -3
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +6 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +1 -0
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/padding.js +1 -0
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +354 -0
- package/build-module/hooks/position.js.map +1 -0
- package/build-module/hooks/supports.js +257 -0
- package/build-module/hooks/supports.js.map +1 -0
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-color-props.js +3 -3
- package/build-module/hooks/use-color-props.js.map +1 -1
- package/build-module/hooks/utils.js +70 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +3 -0
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +60 -10
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +0 -18
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +2 -26
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +8 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +66 -0
- package/build-module/store/private-actions.js.map +1 -0
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +7 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +55 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-variation-transforms.js +1 -1
- package/build-module/utils/block-variation-transforms.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +1 -6
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +340 -3
- package/build-style/content.css +340 -3
- package/build-style/style-rtl.css +125 -272
- package/build-style/style.css +125 -272
- package/package.json +30 -29
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/alignment-control/test/index.js +5 -15
- package/src/components/alignment-control/ui.js +1 -1
- package/src/components/autocomplete/index.js +3 -6
- package/src/components/block-actions/index.js +5 -0
- package/src/components/block-alignment-control/test/index.js +3 -11
- package/src/components/block-alignment-matrix-control/index.js +1 -2
- package/src/components/block-card/index.js +1 -4
- package/src/components/block-content-overlay/content.scss +4 -4
- package/src/components/block-edit/index.js +15 -1
- package/src/components/block-icon/content.scss +31 -0
- package/src/components/block-inspector/index.js +15 -17
- package/src/components/block-list/use-in-between-inserter.js +5 -0
- package/src/components/block-lock/modal.js +0 -1
- package/src/components/block-mover/mover-description.js +2 -2
- package/src/components/block-mover/stories/index.js +3 -3
- package/src/components/block-navigation/dropdown.js +1 -1
- package/src/components/block-pattern-setup/index.js +1 -4
- package/src/components/block-pattern-setup/use-patterns-setup.js +2 -5
- package/src/components/block-patterns-list/index.js +29 -3
- package/src/components/block-preview/README.md +9 -9
- package/src/components/block-preview/auto.js +10 -14
- package/src/components/block-preview/content.scss +23 -0
- package/src/components/block-preview/index.js +40 -10
- package/src/components/block-preview/style.scss +0 -23
- package/src/components/block-selection-clearer/index.js +1 -1
- package/src/components/block-selection-clearer/test/index.js +6 -6
- package/src/components/block-settings/container.native.js +7 -26
- package/src/components/block-settings-menu/block-settings-dropdown.js +14 -2
- package/src/components/block-settings-menu-controls/index.js +2 -10
- package/src/components/block-styles/index.js +4 -1
- package/src/components/block-switcher/test/index.js +43 -44
- package/src/components/block-switcher/utils.js +1 -1
- package/src/components/block-tools/selected-block-popover.js +77 -80
- package/src/components/block-tools/style.scss +0 -1
- package/src/components/block-tools/use-block-toolbar-popover-props.js +68 -12
- package/src/components/block-variation-picker/{style.scss → content.scss} +0 -0
- package/src/components/block-vertical-alignment-control/icons.js +12 -0
- package/src/components/block-vertical-alignment-control/test/index.js +3 -11
- package/src/components/block-vertical-alignment-control/ui.js +16 -6
- package/src/components/button-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/color-style-selector/index.js +1 -1
- package/src/components/colors/test/with-colors.js +2 -8
- package/src/components/date-format-picker/index.js +23 -24
- package/src/components/date-format-picker/style.scss +0 -6
- package/src/components/default-block-appender/content.scss +18 -0
- package/src/components/default-block-appender/test/index.js +2 -8
- package/src/components/default-style-picker/index.js +1 -0
- package/src/components/font-family/index.js +1 -6
- package/src/components/font-sizes/fluid-utils.js +1 -1
- package/src/components/font-sizes/utils.js +1 -1
- package/src/components/font-sizes/with-font-sizes.js +33 -33
- package/src/components/global-styles/README.md +77 -0
- package/src/components/global-styles/context.js +15 -0
- package/src/components/global-styles/hooks.js +145 -0
- package/src/components/global-styles/index.js +7 -0
- package/src/components/global-styles/test/typography-utils.js +393 -0
- package/src/components/global-styles/test/use-global-styles-output.js +814 -0
- package/src/components/global-styles/test/utils.js +206 -0
- package/src/components/global-styles/typography-utils.js +87 -0
- package/src/components/global-styles/use-global-styles-output.js +1088 -0
- package/src/components/global-styles/utils.js +373 -0
- package/src/components/height-control/README.md +55 -0
- package/src/components/height-control/index.js +13 -1
- package/src/components/iframe/index.js +52 -19
- package/src/components/iframe/use-compatibility-styles.js +6 -0
- package/src/components/image-editor/constants.js +1 -1
- package/src/components/image-editor/context.js +5 -9
- package/src/components/image-editor/cropper.js +3 -1
- package/src/components/image-editor/index.js +13 -4
- package/src/components/image-editor/use-transform-image.js +14 -55
- package/src/components/image-size-control/index.js +2 -6
- package/src/components/index.js +2 -6
- package/src/components/inner-blocks/index.js +29 -33
- package/src/components/inner-blocks/index.native.js +27 -47
- package/src/components/inner-blocks/use-block-context.js +47 -0
- package/src/components/inserter/block-patterns-explorer/explorer.js +0 -1
- package/src/components/inserter/block-patterns-tab.js +14 -4
- package/src/components/inserter/block-types-tab.js +3 -4
- package/src/components/inserter/hooks/use-patterns-state.js +1 -6
- package/src/components/inserter/index.js +46 -42
- package/src/components/inserter/media-tab/hooks.js +167 -65
- package/src/components/inserter/media-tab/media-list.js +94 -26
- package/src/components/inserter/media-tab/media-panel.js +9 -20
- package/src/components/inserter/media-tab/media-tab.js +12 -4
- package/src/components/inserter/media-tab/utils.js +20 -10
- package/src/components/inserter/menu.js +9 -4
- package/src/components/inserter/preview-panel.js +4 -2
- package/src/components/inserter/search-results.js +2 -6
- package/src/components/inserter/stories/index.js +9 -9
- package/src/components/inserter/style.scss +58 -11
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +117 -0
- package/src/components/inserter/test/index.native.js +255 -1
- package/src/components/inserter-list-item/index.js +0 -7
- package/src/components/inspector-controls/README.md +3 -7
- package/src/components/inspector-controls/fill.js +15 -1
- package/src/components/inspector-controls/fill.native.js +14 -1
- package/src/components/inspector-controls/groups.js +5 -0
- package/src/components/inspector-controls/index.js +2 -6
- package/src/components/inspector-controls/slot.js +14 -1
- package/src/components/inspector-controls/slot.native.js +14 -1
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +2 -4
- package/src/components/inspector-controls-tabs/position-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
- package/src/components/inspector-controls-tabs/style.scss +15 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -7
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +24 -18
- package/src/components/justify-content-control/ui.js +9 -0
- package/src/components/link-control/index.js +59 -23
- package/src/components/link-control/search-input.js +1 -0
- package/src/components/link-control/style.scss +8 -24
- package/src/components/link-control/test/index.js +134 -5
- package/src/components/list-view/block.js +1 -1
- package/src/components/list-view/style.scss +13 -3
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-replace-flow/test/index.js +4 -12
- package/src/components/media-upload/index.native.js +2 -2
- package/src/components/off-canvas-editor/README.md +2 -2
- package/src/components/off-canvas-editor/appender.js +82 -76
- package/src/components/off-canvas-editor/block-contents.js +84 -23
- package/src/components/off-canvas-editor/block-select-button.js +12 -1
- package/src/components/off-canvas-editor/block.js +31 -102
- package/src/components/off-canvas-editor/branch.js +32 -5
- package/src/components/off-canvas-editor/index.js +19 -24
- package/src/components/off-canvas-editor/link-ui.js +2 -2
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
- package/src/components/provider/index.js +33 -11
- package/src/components/provider/index.native.js +4 -3
- package/src/components/provider/test/experimental-provider.js +94 -0
- package/src/components/provider/test/use-block-sync.js +10 -0
- package/src/components/responsive-block-control/test/index.js +1 -5
- package/src/components/rich-text/use-before-input-rules.js +10 -2
- package/src/components/rich-text/use-enter.js +4 -4
- package/src/components/rich-text/utils.js +1 -1
- package/src/components/spacing-sizes-control/utils.js +2 -7
- package/src/components/tool-selector/index.js +1 -1
- package/src/components/url-input/README.md +5 -0
- package/src/components/url-input/button.js +1 -0
- package/src/components/url-input/index.js +15 -1
- package/src/components/url-input/test/button.js +24 -24
- package/src/components/url-popover/image-url-input-ui.js +7 -8
- package/src/components/url-popover/link-editor.js +1 -0
- package/src/components/url-popover/style.scss +0 -10
- package/src/components/use-block-display-information/index.js +1 -1
- package/src/components/use-paste-styles/index.js +230 -0
- package/src/components/warning/{style.scss → content.scss} +0 -0
- package/src/components/warning/test/index.js +1 -5
- package/src/components/writing-flow/use-arrow-nav.js +20 -28
- package/src/content.scss +8 -0
- package/src/experiments.js +27 -0
- package/src/experiments.native.js +25 -0
- package/src/hooks/anchor.js +2 -1
- package/src/hooks/border.js +1 -1
- package/src/hooks/child-layout.js +6 -1
- package/src/hooks/color-panel.js +1 -1
- package/src/hooks/color.js +3 -3
- package/src/hooks/custom-class-name.js +2 -1
- package/src/hooks/dimensions.js +6 -6
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.scss +4 -0
- package/src/hooks/margin.js +1 -0
- package/src/hooks/metadata.js +1 -2
- package/src/hooks/padding.js +1 -0
- package/src/hooks/position.js +391 -0
- package/src/hooks/position.scss +18 -0
- package/src/hooks/supports.js +302 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +73 -0
- package/src/hooks/test/align.native.js +133 -0
- package/src/hooks/test/utils.js +104 -0
- package/src/hooks/typography.js +1 -1
- package/src/hooks/use-color-props.js +3 -3
- package/src/hooks/utils.js +68 -2
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +3 -0
- package/src/layouts/flex.js +66 -14
- package/src/layouts/flow.js +0 -9
- package/src/store/actions.js +2 -26
- package/src/store/defaults.js +7 -2
- package/src/store/index.js +8 -2
- package/src/store/private-actions.js +65 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/reducer.js +8 -3
- package/src/store/selectors.js +108 -57
- package/src/store/test/actions.js +0 -18
- package/src/store/test/private-actions.js +22 -0
- package/src/store/test/private-selectors.js +24 -0
- package/src/store/test/reducer.js +45 -3
- package/src/store/test/selectors.js +64 -39
- package/src/style.scss +5 -6
- package/src/utils/block-variation-transforms.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +3 -1
- package/src/utils/test/parse-css-unit-to-px.js +16 -24
- package/src/utils/transform-styles/index.js +1 -6
- package/build/components/inner-blocks/get-block-context.js +0 -45
- package/build/components/inner-blocks/get-block-context.js.map +0 -1
- package/build/components/off-canvas-editor/block-edit-button.js +0 -50
- package/build/components/off-canvas-editor/block-edit-button.js.map +0 -1
- package/build-module/components/inner-blocks/get-block-context.js +0 -37
- package/build-module/components/inner-blocks/get-block-context.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-edit-button.js +0 -35
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +0 -1
- package/src/components/inner-blocks/get-block-context.js +0 -39
- package/src/components/off-canvas-editor/block-edit-button.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-settings-menu-controls/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-settings-menu-controls/index.js"],"names":["createSlotFill","MenuGroup","__experimentalStyleProvider","StyleProvider","useSelect","useConvertToGroupButtonProps","ConvertToGroupButton","BlockLockMenuItem","useBlockLock","store","blockEditorStore","Fill","Slot","BlockSettingsMenuControlsSlot","fillProps","clientIds","__unstableDisplayLocation","selectedBlocks","selectedClientIds","canRemove","select","getBlockNamesByClientId","getSelectedBlockClientIds","canRemoveBlocks","ids","canLock","showLockButton","length","convertToGroupButtonProps","isGroupable","isUngroupable","showConvertToGroupButton","fills","onClose","BlockSettingsMenuControls","props","document"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,SAFD,EAGCC,2BAA2B,IAAIC,aAHhC,QAIO,uBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SACCC,4BADD,EAECC,oBAFD,QAGO,6BAHP;AAIA,SAASC,iBAAT,EAA4BC,YAA5B,QAAgD,eAAhD;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IAAiBZ,cAAc,CAAE,2BAAF,CAArC;;AAEA,MAAMa,6BAA6B,GAAG,QAI/B;AAAA,MAJiC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,SAAS,GAAG,IAF2B;AAGvCC,IAAAA;AAHuC,GAIjC;AACN,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,iBAAlB;AAAqCC,IAAAA;AAArC,MAAmDf,SAAS,CAC/DgB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,uBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEV,gBAAF,CAJV;AAKA,UAAMc,GAAG,GACRT,SAAS,KAAK,IAAd,GAAqBA,SAArB,GAAiCO,yBAAyB,EAD3D;AAEA,WAAO;AACNL,MAAAA,cAAc,EAAEI,uBAAuB,CAAEG,GAAF,CADjC;AAENN,MAAAA,iBAAiB,EAAEM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D,EAAWD,KAAX,CADD,CADD;AAKA;;AAEDD,yBAAyB,CAACtB,IAA1B,GAAiCC,6BAAjC;AAEA,eAAeqB,yBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tMenuGroup,\n\t__experimentalStyleProvider as StyleProvider,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseConvertToGroupButtonProps,\n\tConvertToGroupButton,\n} from '../convert-to-group-buttons';\nimport { BlockLockMenuItem, useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );\n\nconst BlockSettingsMenuControlsSlot = ( {\n\tfillProps,\n\tclientIds = null,\n\t__unstableDisplayLocation,\n} ) => {\n\tconst { selectedBlocks, selectedClientIds, canRemove } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst ids =\n\t\t\t\tclientIds !== null ? clientIds : getSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\tselectedBlocks: getBlockNamesByClientId( ids ),\n\t\t\t\tselectedClientIds: ids,\n\t\t\t\tcanRemove: canRemoveBlocks( ids ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst { canLock } = useBlockLock( selectedClientIds[ 0 ] );\n\tconst showLockButton = selectedClientIds.length === 1 && canLock;\n\n\t// Check if current selection of blocks is Groupable or Ungroupable\n\t// and pass this props down to ConvertToGroupButton.\n\tconst convertToGroupButtonProps = useConvertToGroupButtonProps();\n\tconst { isGroupable, isUngroupable } = convertToGroupButtonProps;\n\tconst showConvertToGroupButton =\n\t\t( isGroupable || isUngroupable ) && canRemove;\n\n\treturn (\n\t\t<Slot\n\t\t\tfillProps={ {\n\t\t\t\t...fillProps,\n\t\t\t\t__unstableDisplayLocation,\n\t\t\t\tselectedBlocks,\n\t\t\t\tselectedClientIds,\n\t\t\t} }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif (\n\t\t\t\t\t! fills?.length > 0 &&\n\t\t\t\t\t! showConvertToGroupButton &&\n\t\t\t\t\t! showLockButton\n\t\t\t\t) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ showLockButton && (\n\t\t\t\t\t\t\t<BlockLockMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t{ showConvertToGroupButton && (\n\t\t\t\t\t\t\t<ConvertToGroupButton\n\t\t\t\t\t\t\t\t{ ...convertToGroupButtonProps }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md\n *\n * @param {Object} props Fill props.\n * @return {WPElement} Element.\n */\nfunction BlockSettingsMenuControls( { ...props } ) {\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill { ...props } />\n\t\t</StyleProvider>\n\t);\n}\n\nBlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;\n\nexport default BlockSettingsMenuControls;\n"]}
|
|
@@ -12,6 +12,7 @@ import { useState } from '@wordpress/element';
|
|
|
12
12
|
import { debounce, useViewportMatch } from '@wordpress/compose';
|
|
13
13
|
import { Button, __experimentalTruncate as Truncate, Popover } from '@wordpress/components';
|
|
14
14
|
import deprecated from '@wordpress/deprecated';
|
|
15
|
+
import { __ } from '@wordpress/i18n';
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
@@ -71,7 +72,7 @@ function BlockStyles(_ref) {
|
|
|
71
72
|
}, createElement("div", {
|
|
72
73
|
className: "block-editor-block-styles__variants"
|
|
73
74
|
}, stylesToRender.map(style => {
|
|
74
|
-
const buttonText = style.label || style.name;
|
|
75
|
+
const buttonText = style.isDefault ? __('Default') : style.label || style.name;
|
|
75
76
|
return createElement(Button, {
|
|
76
77
|
className: classnames('block-editor-block-styles__item', {
|
|
77
78
|
'is-active': activeStyle.name === style.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["classnames","useState","debounce","useViewportMatch","Button","__experimentalTruncate","Truncate","Popover","deprecated","BlockStylesPreviewPanel","useStylesForBlocks","noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","Slot","version","since"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,gBAAnB,QAA2C,oBAA3C;AACA,SACCC,MADD,EAECC,sBAAsB,IAAIC,QAF3B,EAGCC,OAHD,QAIO,uBAJP;AAKA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,iBAApC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;;;AACA,SAASC,WAAT,OAA+E;AAAA,MAAzD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAQ,GAAGH,IAAvB;AAA6BI,IAAAA,gBAAgB,GAAGJ;AAAhD,GAAyD;AAC9E,QAAM;AACLK,IAAAA,QADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,SAAS,EAAEC;AALN,MAMFX,kBAAkB,CAAE;AACvBG,IAAAA,QADuB;AAEvBC,IAAAA;AAFuB,GAAF,CANtB;AAUA,QAAM,CAAEQ,YAAF,EAAgBC,eAAhB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["classnames","useState","debounce","useViewportMatch","Button","__experimentalTruncate","Truncate","Popover","deprecated","__","BlockStylesPreviewPanel","useStylesForBlocks","noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","isDefault","label","Slot","version","since"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,gBAAnB,QAA2C,oBAA3C;AACA,SACCC,MADD,EAECC,sBAAsB,IAAIC,QAF3B,EAGCC,OAHD,QAIO,uBAJP;AAKA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,iBAApC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;;;AACA,SAASC,WAAT,OAA+E;AAAA,MAAzD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAQ,GAAGH,IAAvB;AAA6BI,IAAAA,gBAAgB,GAAGJ;AAAhD,GAAyD;AAC9E,QAAM;AACLK,IAAAA,QADK;AAELC,IAAAA,cAFK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+B,IAAAA,OAAO,EAAE,KADsB;AAE/BC,IAAAA,KAAK,EAAE;AAFwB,GAAtB,CAAV;AAKA,SAAO,IAAP;AACA,CAPD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { debounce, useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tPopover,\n} from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nconst noop = () => {};\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.isDefault\n\t\t\t\t\t\t? __( 'Default' )\n\t\t\t\t\t\t: style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\taria-current={ activeStyle.name === style.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<Popover placement=\"left-start\" offset={ 20 }>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default BlockStyles;\n\nBlockStyles.Slot = () => {\n\tdeprecated( 'BlockStyles.Slot', {\n\t\tversion: '6.4',\n\t\tsince: '6.2',\n\t} );\n\n\treturn null;\n};\n"]}
|
|
@@ -12,7 +12,7 @@ import { __experimentalGetBlockAttributesNamesByRole as getBlockAttributesNamesB
|
|
|
12
12
|
* @param {string} selectedBlockName The block's name to use for matching condition.
|
|
13
13
|
* @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.
|
|
14
14
|
*
|
|
15
|
-
* @return {WPBlock
|
|
15
|
+
* @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
export const getMatchingBlockByName = function (block, selectedBlockName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"names":["__experimentalGetBlockAttributesNamesByRole","getBlockAttributesNamesByRole","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","getRetainedBlockAttributes","attributes","contentAttributes","length","reduce","_accumulator","attribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,2CAA2C,IAAIC,6BAAxD,QAA6F,mBAA7F;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,sBAAsB,GAAG,UACrCC,KADqC,EAErCC,iBAFqC,EAIjC;AAAA,MADJC,cACI,uEADa,IAAIC,GAAJ,EACb;AACJ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,WAAW,GAAG;AAAhC,MAAuCN,KAA7C,CADI,CAEJ;;AACA,MAAKE,cAAc,CAACK,GAAf,CAAoBH,QAApB,CAAL,EAAsC;AACtC,MAAKC,IAAI,KAAKJ,iBAAd,EAAkC,OAAOD,KAAP,CAJ9B,CAKJ;;AACA,OAAM,MAAMQ,UAAZ,IAA0BF,WAA1B,EAAwC;AACvC,UAAMG,KAAK,GAAGV,sBAAsB,CACnCS,UADmC,EAEnCP,iBAFmC,EAGnCC,cAHmC,CAApC;AAKA,QAAKO,KAAL,EAAa,OAAOA,KAAP;AACb;AACD,CAlBM;AAoBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GAAG,CAAEL,IAAF,EAAQM,UAAR,KAAwB;AACjE,QAAMC,iBAAiB,GAAGd,6BAA6B,CAAEO,IAAF,EAAQ,SAAR,CAAvD;AACA,MAAK,EAAEO,iBAAF,aAAEA,iBAAF,eAAEA,iBAAiB,CAAEC,MAArB,CAAL,EAAmC,OAAOF,UAAP;AAEnC,SAAOC,iBAAiB,CAACE,MAAlB,CAA0B,CAAEC,YAAF,EAAgBC,SAAhB,KAA+B;AAC/D,QAAKL,UAAU,CAAEK,SAAF,CAAf,EACCD,YAAY,CAAEC,SAAF,CAAZ,GAA4BL,UAAU,CAAEK,SAAF,CAAtC;AACD,WAAOD,YAAP;AACA,GAJM,EAIJ,EAJI,CAAP;AAKA,CATM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetBlockAttributesNamesByRole as getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"names":["__experimentalGetBlockAttributesNamesByRole","getBlockAttributesNamesByRole","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","getRetainedBlockAttributes","attributes","contentAttributes","length","reduce","_accumulator","attribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,2CAA2C,IAAIC,6BAAxD,QAA6F,mBAA7F;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,sBAAsB,GAAG,UACrCC,KADqC,EAErCC,iBAFqC,EAIjC;AAAA,MADJC,cACI,uEADa,IAAIC,GAAJ,EACb;AACJ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,WAAW,GAAG;AAAhC,MAAuCN,KAA7C,CADI,CAEJ;;AACA,MAAKE,cAAc,CAACK,GAAf,CAAoBH,QAApB,CAAL,EAAsC;AACtC,MAAKC,IAAI,KAAKJ,iBAAd,EAAkC,OAAOD,KAAP,CAJ9B,CAKJ;;AACA,OAAM,MAAMQ,UAAZ,IAA0BF,WAA1B,EAAwC;AACvC,UAAMG,KAAK,GAAGV,sBAAsB,CACnCS,UADmC,EAEnCP,iBAFmC,EAGnCC,cAHmC,CAApC;AAKA,QAAKO,KAAL,EAAa,OAAOA,KAAP;AACb;AACD,CAlBM;AAoBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GAAG,CAAEL,IAAF,EAAQM,UAAR,KAAwB;AACjE,QAAMC,iBAAiB,GAAGd,6BAA6B,CAAEO,IAAF,EAAQ,SAAR,CAAvD;AACA,MAAK,EAAEO,iBAAF,aAAEA,iBAAF,eAAEA,iBAAiB,CAAEC,MAArB,CAAL,EAAmC,OAAOF,UAAP;AAEnC,SAAOC,iBAAiB,CAACE,MAAlB,CAA0B,CAAEC,YAAF,EAAgBC,SAAhB,KAA+B;AAC/D,QAAKL,UAAU,CAAEK,SAAF,CAAf,EACCD,YAAY,CAAEC,SAAF,CAAZ,GAA4BL,UAAU,CAAEK,SAAF,CAAtC;AACD,WAAOD,YAAP;AACA,GAJM,EAIJ,EAJI,CAAP;AAKA,CATM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetBlockAttributesNamesByRole as getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).\n */\nexport const getMatchingBlockByName = (\n\tblock,\n\tselectedBlockName,\n\tconsumedBlocks = new Set()\n) => {\n\tconst { clientId, name, innerBlocks = [] } = block;\n\t// Check if block has been consumed already.\n\tif ( consumedBlocks.has( clientId ) ) return;\n\tif ( name === selectedBlockName ) return block;\n\t// Try to find a matching block from InnerBlocks recursively.\n\tfor ( const innerBlock of innerBlocks ) {\n\t\tconst match = getMatchingBlockByName(\n\t\t\tinnerBlock,\n\t\t\tselectedBlockName,\n\t\t\tconsumedBlocks\n\t\t);\n\t\tif ( match ) return match;\n\t}\n};\n\n/**\n * Find and return the block attributes to retain through\n * the transformation, based on Block Type's `role:content`\n * attributes. If no `role:content` attributes exist,\n * return selected block's attributes.\n *\n * @param {string} name Block type's namespaced name.\n * @param {Object} attributes Selected block's attributes.\n * @return {Object} The block's attributes to retain.\n */\nexport const getRetainedBlockAttributes = ( name, attributes ) => {\n\tconst contentAttributes = getBlockAttributesNamesByRole( name, 'content' );\n\tif ( ! contentAttributes?.length ) return attributes;\n\n\treturn contentAttributes.reduce( ( _accumulator, attribute ) => {\n\t\tif ( attributes[ attribute ] )\n\t\t\t_accumulator[ attribute ] = attributes[ attribute ];\n\t\treturn _accumulator;\n\t}, {} );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* External dependencies
|
|
@@ -24,6 +24,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
24
24
|
import BlockPopover from '../block-popover';
|
|
25
25
|
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
26
26
|
import Inserter from '../inserter';
|
|
27
|
+
import { unlock } from '../../experiments';
|
|
27
28
|
|
|
28
29
|
function selector(select) {
|
|
29
30
|
const {
|
|
@@ -31,12 +32,13 @@ function selector(select) {
|
|
|
31
32
|
isMultiSelecting,
|
|
32
33
|
hasMultiSelection,
|
|
33
34
|
isTyping,
|
|
34
|
-
|
|
35
|
+
isBlockInterfaceHidden,
|
|
35
36
|
getSettings,
|
|
36
37
|
getLastMultiSelectedBlockClientId
|
|
37
|
-
} = select(blockEditorStore);
|
|
38
|
+
} = unlock(select(blockEditorStore));
|
|
38
39
|
return {
|
|
39
40
|
editorMode: __unstableGetEditorMode(),
|
|
41
|
+
hasMultiSelection: hasMultiSelection(),
|
|
40
42
|
isMultiSelecting: isMultiSelecting(),
|
|
41
43
|
isTyping: isTyping(),
|
|
42
44
|
isBlockInterfaceHidden: isBlockInterfaceHidden(),
|
|
@@ -59,6 +61,7 @@ function SelectedBlockPopover(_ref) {
|
|
|
59
61
|
} = _ref;
|
|
60
62
|
const {
|
|
61
63
|
editorMode,
|
|
64
|
+
hasMultiSelection,
|
|
62
65
|
isMultiSelecting,
|
|
63
66
|
isTyping,
|
|
64
67
|
isBlockInterfaceHidden,
|
|
@@ -87,7 +90,7 @@ function SelectedBlockPopover(_ref) {
|
|
|
87
90
|
stopTyping
|
|
88
91
|
} = useDispatch(blockEditorStore);
|
|
89
92
|
const showEmptyBlockSideInserter = !isTyping && editorMode === 'edit' && isEmptyDefaultBlock;
|
|
90
|
-
const shouldShowBreadcrumb = editorMode === 'navigation' || editorMode === 'zoom-out';
|
|
93
|
+
const shouldShowBreadcrumb = !hasMultiSelection && (editorMode === 'navigation' || editorMode === 'zoom-out');
|
|
91
94
|
const shouldShowContextualToolbar = editorMode === 'edit' && !hasFixedToolbar && isLargeViewport && !isMultiSelecting && !showEmptyBlockSideInserter && !isTyping && !isBlockInterfaceHidden;
|
|
92
95
|
const canFocusHiddenToolbar = editorMode === 'edit' && !shouldShowContextualToolbar && !hasFixedToolbar && !isDistractionFree && !isEmptyDefaultBlock;
|
|
93
96
|
useShortcut('core/block-editor/focus-toolbar', () => {
|
|
@@ -107,52 +110,56 @@ function SelectedBlockPopover(_ref) {
|
|
|
107
110
|
clientId
|
|
108
111
|
});
|
|
109
112
|
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
113
|
+
if (showEmptyBlockSideInserter) {
|
|
114
|
+
return createElement(BlockPopover, _extends({
|
|
115
|
+
clientId: capturingClientId || clientId,
|
|
116
|
+
__unstableCoverTarget: true,
|
|
117
|
+
bottomClientId: lastClientId,
|
|
118
|
+
className: classnames('block-editor-block-list__block-side-inserter-popover', {
|
|
119
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
120
|
+
}),
|
|
121
|
+
__unstablePopoverSlot: __unstablePopoverSlot,
|
|
122
|
+
__unstableContentRef: __unstableContentRef,
|
|
123
|
+
resize: false,
|
|
124
|
+
shift: false
|
|
125
|
+
}, popoverProps), createElement("div", {
|
|
126
|
+
className: "block-editor-block-list__empty-block-inserter"
|
|
127
|
+
}, createElement(Inserter, {
|
|
128
|
+
position: "bottom right",
|
|
129
|
+
rootClientId: rootClientId,
|
|
130
|
+
clientId: clientId,
|
|
131
|
+
__experimentalIsQuick: true
|
|
132
|
+
})));
|
|
112
133
|
}
|
|
113
134
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// it should focus the toolbar right after the mount.
|
|
143
|
-
, {
|
|
144
|
-
focusOnMount: isToolbarForced.current,
|
|
145
|
-
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
146
|
-
__experimentalOnIndexChange: index => {
|
|
147
|
-
initialToolbarItemIndexRef.current = index;
|
|
148
|
-
} // Resets the index whenever the active block changes so
|
|
149
|
-
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
150
|
-
,
|
|
151
|
-
key: clientId
|
|
152
|
-
}), shouldShowBreadcrumb && createElement(BlockSelectionButton, {
|
|
153
|
-
clientId: clientId,
|
|
154
|
-
rootClientId: rootClientId
|
|
155
|
-
})));
|
|
135
|
+
if (shouldShowBreadcrumb || shouldShowContextualToolbar) {
|
|
136
|
+
return createElement(BlockPopover, _extends({
|
|
137
|
+
clientId: capturingClientId || clientId,
|
|
138
|
+
bottomClientId: lastClientId,
|
|
139
|
+
className: classnames('block-editor-block-list__block-popover', {
|
|
140
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
141
|
+
}),
|
|
142
|
+
__unstablePopoverSlot: __unstablePopoverSlot,
|
|
143
|
+
__unstableContentRef: __unstableContentRef,
|
|
144
|
+
resize: false
|
|
145
|
+
}, popoverProps), shouldShowContextualToolbar && showContents && createElement(BlockContextualToolbar // If the toolbar is being shown because of being forced
|
|
146
|
+
// it should focus the toolbar right after the mount.
|
|
147
|
+
, {
|
|
148
|
+
focusOnMount: isToolbarForced.current,
|
|
149
|
+
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
150
|
+
__experimentalOnIndexChange: index => {
|
|
151
|
+
initialToolbarItemIndexRef.current = index;
|
|
152
|
+
} // Resets the index whenever the active block changes so
|
|
153
|
+
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
154
|
+
,
|
|
155
|
+
key: clientId
|
|
156
|
+
}), shouldShowBreadcrumb && createElement(BlockSelectionButton, {
|
|
157
|
+
clientId: clientId,
|
|
158
|
+
rootClientId: rootClientId
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return null;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
165
|
function wrapperSelector(select) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["classnames","useRef","useEffect","isUnmodifiedDefaultBlock","useDispatch","useSelect","useShortcut","useViewportMatch","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","Inserter","selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","find","parentClientId","__experimentalC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,iBALK;AAMLP,IAAAA,iBANK;AAOLmC,IAAAA;AAPK,MAQFY,QARJ;;AAUA,MAAK,CAAET,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,QAAQ,EAAGnC,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\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 Inserter from '../inserter';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\t__experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\teditorMode === 'navigation' || editorMode === 'zoom-out';\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\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\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\t__unstableCoverTarget\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tshift={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t\t{ ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowContextualToolbar && showContents && (\n\t\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = blockParentsClientIds.find(\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["classnames","useRef","useEffect","isUnmodifiedDefaultBlock","useDispatch","useSelect","useShortcut","useViewportMatch","BlockSelectionButton","BlockContextualToolbar","store","blockEditorStore","BlockPopover","useBlockToolbarPopoverProps","Inserter","unlock","selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","find","parentClientId","__experimentalCaptureToolbars","settings","WrappedBlockPopover","selected"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAj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;;AAUA,MAAK,CAAET,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,oBAAD;AACC,IAAA,QAAQ,EAAGnC,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\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 Inserter from '../inserter';\nimport { unlock } from '../../experiments';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = unlock( select( blockEditorStore ) );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\thasMultiSelection: hasMultiSelection(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\thasMultiSelection,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\t! hasMultiSelection &&\n\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' );\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\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\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif ( showEmptyBlockSideInserter ) {\n\t\treturn (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t__unstableCoverTarget\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-side-inserter-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\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\tresize={ false }\n\t\t\t\tshift={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</BlockPopover>\n\t\t);\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\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t{ shouldShowContextualToolbar && showContents && (\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\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\tkey={ clientId }\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\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = blockParentsClientIds.find(\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useRefEffect } from '@wordpress/compose';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import {
|
|
6
|
+
import { getScrollContainer } from '@wordpress/dom';
|
|
7
|
+
import { useCallback, useLayoutEffect, useMemo, useState } from '@wordpress/element';
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import { store as blockEditorStore } from '../../store';
|
|
12
13
|
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
14
|
+
import { hasStickyOrFixedPositionValue } from '../../hooks/position';
|
|
13
15
|
const COMMON_PROPS = {
|
|
14
16
|
placement: 'top-start'
|
|
15
17
|
}; // By default the toolbar sets the `shift` prop. If the user scrolls the page
|
|
@@ -34,24 +36,34 @@ const RESTRICTED_HEIGHT_PROPS = { ...COMMON_PROPS,
|
|
|
34
36
|
*
|
|
35
37
|
* @param {Element} contentElement The DOM element that represents the editor content or canvas.
|
|
36
38
|
* @param {Element} selectedBlockElement The outer DOM element of the first selected block.
|
|
39
|
+
* @param {Element} scrollContainer The scrollable container for the contentElement.
|
|
37
40
|
* @param {number} toolbarHeight The height of the toolbar in pixels.
|
|
41
|
+
* @param {boolean} isSticky Whether or not the selected block is sticky or fixed.
|
|
38
42
|
*
|
|
39
43
|
* @return {Object} The popover props used to determine the position of the toolbar.
|
|
40
44
|
*/
|
|
41
45
|
|
|
42
|
-
function getProps(contentElement, selectedBlockElement, toolbarHeight) {
|
|
46
|
+
function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) {
|
|
43
47
|
if (!contentElement || !selectedBlockElement) {
|
|
44
48
|
return DEFAULT_PROPS;
|
|
45
|
-
}
|
|
49
|
+
} // Get how far the content area has been scrolled.
|
|
50
|
+
|
|
46
51
|
|
|
52
|
+
const scrollTop = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollTop) || 0;
|
|
47
53
|
const blockRect = selectedBlockElement.getBoundingClientRect();
|
|
48
|
-
const contentRect = contentElement.getBoundingClientRect(); //
|
|
54
|
+
const contentRect = contentElement.getBoundingClientRect(); // Get the vertical position of top of the visible content area.
|
|
55
|
+
|
|
56
|
+
const topOfContentElementInViewport = scrollTop + contentRect.top; // The document element's clientHeight represents the viewport height.
|
|
57
|
+
|
|
58
|
+
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; // The restricted height area is calculated as the sum of the
|
|
59
|
+
// vertical position of the visible content area, plus the height
|
|
60
|
+
// of the block toolbar.
|
|
49
61
|
|
|
50
|
-
const
|
|
51
|
-
const hasSpaceForToolbarAbove = blockRect.top
|
|
52
|
-
const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight;
|
|
62
|
+
const restrictedTopArea = topOfContentElementInViewport + toolbarHeight;
|
|
63
|
+
const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;
|
|
64
|
+
const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; // Sticky blocks are treated as if they will never have enough space for the toolbar above.
|
|
53
65
|
|
|
54
|
-
if (hasSpaceForToolbarAbove || isBlockTallerThanViewport) {
|
|
66
|
+
if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) {
|
|
55
67
|
return DEFAULT_PROPS;
|
|
56
68
|
}
|
|
57
69
|
|
|
@@ -75,12 +87,31 @@ export default function useBlockToolbarPopoverProps(_ref) {
|
|
|
75
87
|
} = _ref;
|
|
76
88
|
const selectedBlockElement = useBlockElement(clientId);
|
|
77
89
|
const [toolbarHeight, setToolbarHeight] = useState(0);
|
|
78
|
-
const
|
|
79
|
-
|
|
90
|
+
const {
|
|
91
|
+
blockIndex,
|
|
92
|
+
isSticky
|
|
93
|
+
} = useSelect(select => {
|
|
94
|
+
const {
|
|
95
|
+
getBlockIndex,
|
|
96
|
+
getBlockAttributes
|
|
97
|
+
} = select(blockEditorStore);
|
|
98
|
+
return {
|
|
99
|
+
blockIndex: getBlockIndex(clientId),
|
|
100
|
+
isSticky: hasStickyOrFixedPositionValue(getBlockAttributes(clientId))
|
|
101
|
+
};
|
|
102
|
+
}, [clientId]);
|
|
103
|
+
const scrollContainer = useMemo(() => {
|
|
104
|
+
if (!contentElement) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return getScrollContainer(contentElement);
|
|
109
|
+
}, [contentElement]);
|
|
110
|
+
const [props, setProps] = useState(() => getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky));
|
|
80
111
|
const popoverRef = useRefEffect(popoverNode => {
|
|
81
112
|
setToolbarHeight(popoverNode.offsetHeight);
|
|
82
113
|
}, []);
|
|
83
|
-
const updateProps = useCallback(() => setProps(getProps(contentElement, selectedBlockElement, toolbarHeight)), [contentElement, selectedBlockElement, toolbarHeight]); // Update props when the block is moved. This also ensures the props are
|
|
114
|
+
const updateProps = useCallback(() => setProps(getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky)), [contentElement, selectedBlockElement, scrollContainer, toolbarHeight]); // Update props when the block is moved. This also ensures the props are
|
|
84
115
|
// correct on initial mount, and when the selected block or content element
|
|
85
116
|
// changes (since the callback ref will update).
|
|
86
117
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"names":["useRefEffect","useSelect","useCallback","useLayoutEffect","useState","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","toolbarHeight","blockRect","getBoundingClientRect","contentRect","viewportHeight","ownerDocument","documentElement","clientHeight","hasSpaceForToolbarAbove","top","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","setToolbarHeight","props","setProps","blockIndex","select","getBlockIndex","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,WAAT,EAAsBC,eAAtB,EAAuCC,QAAvC,QAAuD,oBAAvD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,8CAA7D;AAEA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,SAAS,EAAE;AADS,CAArB,C,CAIA;AACA;AACA;;AACA,MAAMC,aAAa,GAAG,EACrB,GAAGF,YADkB;AAErBG,EAAAA,IAAI,EAAE,KAFe;AAGrBC,EAAAA,KAAK,EAAE;AAHc,CAAtB,C,CAMA;AACA;AACA;AACA;AACA;;AACA,MAAMC,uBAAuB,GAAG,EAC/B,GAAGL,YAD4B;AAE/BG,EAAAA,IAAI,EAAE,IAFyB;AAG/BC,EAAAA,KAAK,EAAE;AAHwB,CAAhC;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,QAAT,CAAmBC,cAAnB,EAAmCC,oBAAnC,EAAyDC,aAAzD,EAAyE;AACxE,MAAK,CAAEF,cAAF,IAAoB,CAAEC,oBAA3B,EAAkD;AACjD,WAAON,aAAP;AACA;;AAED,QAAMQ,SAAS,GAAGF,oBAAoB,CAACG,qBAArB,EAAlB;AACA,QAAMC,WAAW,GAAGL,cAAc,CAACI,qBAAf,EAApB,CANwE,CAQxE;;AACA,QAAME,cAAc,GACnBN,cAAc,CAACO,aAAf,CAA6BC,eAA7B,CAA6CC,YAD9C;AAGA,QAAMC,uBAAuB,GAC5BP,SAAS,CAACQ,GAAV,GAAgBN,WAAW,CAACM,GAA5B,GAAkCT,aADnC;AAEA,QAAMU,yBAAyB,GAC9BT,S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oB,CAAEC,oBAA3B,EAAkD;AACjD;AACA,KAHqB,CAKtB;;;AACA,UAAMyB,WAAW,GAAG1B,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEO,aAAnB,0DAAG,sBAA+BoB,WAAnD;AACAD,IAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,qCAAAA,WAAW,CAAEE,eAAb,qFAAAF,WAAW,EAAqB,QAArB,EAA+BD,WAA/B,CAAX,CAPsB,CAStB;;AACA,QAAII,cAAJ;AACA,UAAMC,SAAS,GAAG7B,oBAAH,aAAGA,oBAAH,gDAAGA,oBAAoB,CAAEM,aAAzB,0DAAG,sBAAqCoB,WAAvD;;AACA,QAAKG,SAAS,CAACC,cAAf,EAAgC;AAC/BF,MAAAA,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAd,CAA8BN,WAA9B,CAAjB;AACAI,MAAAA,cAAc,CAACG,OAAf,CAAwB/B,oBAAxB;AACA;;AAED,WAAO,MAAM;AAAA;;AACZyB,MAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,qCAAAA,WAAW,CAAEO,kBAAb,qFAAAP,WAAW,EAAwB,QAAxB,EAAkCD,WAAlC,CAAX;;AAEA,UAAKI,cAAL,EAAsB;AACrBA,QAAAA,cAAc,CAACK,UAAf;AACA;AACD,KAND;AAOA,GAxBc,EAwBZ,CAAET,WAAF,EAAezB,cAAf,EAA+BC,oBAA/B,CAxBY,CAAf;AA0BA,SAAO,EACN,GAAGgB,KADG;AAENkB,IAAAA,GAAG,EAAEb;AAFC,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useLayoutEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps( contentElement, selectedBlockElement, toolbarHeight ) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\tconst blockRect = selectedBlockElement.getBoundingClientRect();\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\tconst hasSpaceForToolbarAbove =\n\t\tblockRect.top - contentRect.top > toolbarHeight;\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\tif ( hasSpaceForToolbarAbove || isBlockTallerThanViewport ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps( contentElement, selectedBlockElement, toolbarHeight )\n\t);\n\tconst blockIndex = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockIndex( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps( contentElement, selectedBlockElement, toolbarHeight )\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"names":["useRefEffect","useSelect","getScrollContainer","useCallback","useLayoutEffect","useMemo","useState","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","hasStickyOrFixedPositionValue","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getBoundingClientRect","contentRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","setToolbarHeight","blockIndex","select","getBlockIndex","getBlockAttributes","props","setProps","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SACCC,WADD,EAECC,eAFD,EAGCC,OAHD,EAICC,QAJD,QAKO,oBALP;AAOA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,8CAA7D;AACA,SAASC,6BAAT,QAA8C,sBAA9C;AAEA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,SAAS,EAAE;AADS,CAArB,C,CAIA;AACA;AACA;;AACA,MAAMC,aAAa,GAAG,EACrB,GAAGF,YADkB;AAErBG,EAAAA,IAAI,EAAE,KAFe;AAGrBC,EAAAA,KAAK,EAAE;AAHc,CAAtB,C,CAMA;AACA;AACA;AACA;AACA;;AACA,MAAMC,uBAAuB,GAAG,EAC/B,GAAGL,YAD4B;AAE/BG,EAAAA,IAAI,EAAE,IAFyB;AAG/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9C,EAAAA,eAAe,CAAE,MAAM;AAAA;;AACtB,QAAK,CAAEe,cAAF,IAAoB,CAAEC,oBAA3B,EAAkD;AACjD;AACA,KAHqB,CAKtB;;;AACA,UAAM+B,WAAW,GAAGhC,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEY,aAAnB,0DAAG,sBAA+BqB,WAAnD;AACAD,IAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,qCAAAA,WAAW,CAAEE,eAAb,qFAAAF,WAAW,EAAqB,QAArB,EAA+BD,WAA/B,CAAX,CAPsB,CAStB;;AACA,QAAII,cAAJ;AACA,UAAMC,SAAS,GAAGnC,oBAAH,aAAGA,oBAAH,gDAAGA,oBAAoB,CAAEW,aAAzB,0DAAG,sBAAqCqB,WAAvD;;AACA,QAAKG,SAAS,CAACC,cAAf,EAAgC;AAC/BF,MAAAA,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAd,CAA8BN,WAA9B,CAAjB;AACAI,MAAAA,cAAc,CAACG,OAAf,CAAwBrC,oBAAxB;AACA;;AAED,WAAO,MAAM;AAAA;;AACZ+B,MAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,qCAAAA,WAAW,CAAEO,kBAAb,qFAAAP,WAAW,EAAwB,QAAxB,EAAkCD,WAAlC,CAAX;;AAEA,UAAKI,cAAL,EAAsB;AACrBA,QAAAA,cAAc,CAACK,UAAf;AACA;AACD,KAND;AAOA,GAxBc,EAwBZ,CAAET,WAAF,EAAe/B,cAAf,EAA+BC,oBAA/B,CAxBY,CAAf;AA0BA,SAAO,EACN,GAAGyB,KADG;AAENe,IAAAA,GAAG,EAAEb;AAFC,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = selectedBlockElement.getBoundingClientRect();\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"]}
|
|
@@ -22,4 +22,16 @@ export const alignTop = createElement(SVG, {
|
|
|
22
22
|
}, createElement(Path, {
|
|
23
23
|
d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z"
|
|
24
24
|
}));
|
|
25
|
+
export const alignStretch = createElement(SVG, {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
viewBox: "0 0 24 24"
|
|
28
|
+
}, createElement(Path, {
|
|
29
|
+
d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z"
|
|
30
|
+
}));
|
|
31
|
+
export const spaceBetween = createElement(SVG, {
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
viewBox: "0 0 24 24"
|
|
34
|
+
}, createElement(Path, {
|
|
35
|
+
d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z"
|
|
36
|
+
}));
|
|
25
37
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/icons.js"],"names":["Path","SVG","alignBottom","alignCenter","alignTop"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,WAAW,GACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,WAAW,GACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,QAAQ,GACpB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/components';\n\nexport const alignBottom = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z\" />\n\t</SVG>\n);\n\nexport const alignCenter = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z\" />\n\t</SVG>\n);\n\nexport const alignTop = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M9 20h6V9H9v11zM4 4v1.5h16V4H4z\" />\n\t</SVG>\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/icons.js"],"names":["Path","SVG","alignBottom","alignCenter","alignTop","alignStretch","spaceBetween"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,QAA0B,uBAA1B;AAEA,OAAO,MAAMC,WAAW,GACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,WAAW,GACvB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,QAAQ,GACpB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,YAAY,GACxB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;AAMP,OAAO,MAAMC,YAAY,GACxB,cAAC,GAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,cAAC,IAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/components';\n\nexport const alignBottom = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z\" />\n\t</SVG>\n);\n\nexport const alignCenter = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z\" />\n\t</SVG>\n);\n\nexport const alignTop = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M9 20h6V9H9v11zM4 4v1.5h16V4H4z\" />\n\t</SVG>\n);\n\nexport const alignStretch = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z\" />\n\t</SVG>\n);\n\nexport const spaceBetween = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z\" />\n\t</SVG>\n);\n"]}
|
|
@@ -10,7 +10,7 @@ import { ToolbarGroup, ToolbarDropdownMenu } from '@wordpress/components';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { alignTop, alignCenter, alignBottom } from './icons';
|
|
13
|
+
import { alignTop, alignCenter, alignBottom, alignStretch, spaceBetween } from './icons';
|
|
14
14
|
const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
15
15
|
top: {
|
|
16
16
|
icon: alignTop,
|
|
@@ -23,13 +23,18 @@ const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
|
23
23
|
bottom: {
|
|
24
24
|
icon: alignBottom,
|
|
25
25
|
title: _x('Align bottom', 'Block vertical alignment setting')
|
|
26
|
+
},
|
|
27
|
+
stretch: {
|
|
28
|
+
icon: alignStretch,
|
|
29
|
+
title: _x('Stretch to fill', 'Block vertical alignment setting')
|
|
30
|
+
},
|
|
31
|
+
'space-between': {
|
|
32
|
+
icon: spaceBetween,
|
|
33
|
+
title: _x('Space between', 'Block vertical alignment setting')
|
|
26
34
|
}
|
|
27
35
|
};
|
|
28
36
|
const DEFAULT_CONTROLS = ['top', 'center', 'bottom'];
|
|
29
37
|
const DEFAULT_CONTROL = 'top';
|
|
30
|
-
const POPOVER_PROPS = {
|
|
31
|
-
variant: 'toolbar'
|
|
32
|
-
};
|
|
33
38
|
|
|
34
39
|
function BlockVerticalAlignmentUI(_ref) {
|
|
35
40
|
let {
|
|
@@ -51,7 +56,7 @@ function BlockVerticalAlignmentUI(_ref) {
|
|
|
51
56
|
isCollapsed
|
|
52
57
|
} : {
|
|
53
58
|
popoverProps: {
|
|
54
|
-
|
|
59
|
+
variant: 'toolbar'
|
|
55
60
|
}
|
|
56
61
|
};
|
|
57
62
|
return createElement(UIComponent, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/ui.js"],"names":["_x","ToolbarGroup","ToolbarDropdownMenu","alignTop","alignCenter","alignBottom","BLOCK_ALIGNMENTS_CONTROLS","top","icon","title","center","bottom","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/ui.js"],"names":["_x","ToolbarGroup","ToolbarDropdownMenu","alignTop","alignCenter","alignBottom","alignStretch","spaceBetween","BLOCK_ALIGNMENTS_CONTROLS","top","icon","title","center","bottom","stretch","DEFAULT_CONTROLS","DEFAULT_CONTROL","BlockVerticalAlignmentUI","value","onChange","controls","isCollapsed","isToolbar","applyOrUnset","align","undefined","activeAlignment","defaultAlignmentControl","UIComponent","extraProps","popoverProps","variant","map","control","isActive","role","onClick"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,mBAAvB,QAAkD,uBAAlD;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,WAFD,EAGCC,WAHD,EAICC,YAJD,EAKCC,YALD,QAMO,SANP;AAQA,MAAMC,yBAAyB,GAAG;AACjCC,EAAAA,GAAG,EAAE;AACJC,IAAAA,IAAI,EAAEP,QADF;AAEJQ,IAAAA,KAAK,EAAEX,EAAE,CAAE,WAAF,EAAe,kCAAf;AAFL,GAD4B;AAKjCY,EAAAA,MAAM,EAAE;AACPF,IAAAA,IAAI,EAAEN,WADC;AAEPO,IAAAA,KAAK,EAAEX,EAAE,CAAE,cAAF,EAAkB,kCAAlB;AAFF,GALyB;AASjCa,EAAAA,MAAM,EAAE;AACPH,IAAAA,IAAI,EAAEL,WADC;AAEPM,IAAAA,KAAK,EAAEX,EAAE,CAAE,cAAF,EAAkB,kCAAlB;AAFF,GATyB;AAajCc,EAAAA,OAAO,EAAE;AACRJ,IAAAA,IAAI,EAAEJ,YADE;AAERK,IAAAA,KAAK,EAAEX,EAAE,CAAE,iBAAF,EAAqB,kCAArB;AAFD,GAbwB;AAiBjC,mBAAiB;AAChBU,IAAAA,IAAI,EAAEH,YADU;AAEhBI,IAAAA,KAAK,EAAEX,EAAE,CAAE,eAAF,EAAmB,kCAAnB;AAFO;AAjBgB,CAAlC;AAuBA,MAAMe,gBAAgB,GAAG,CAAE,KAAF,EAAS,QAAT,EAAmB,QAAnB,CAAzB;AACA,MAAMC,eAAe,GAAG,KAAxB;;AAEA,S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{ ToolbarGroup, ToolbarDropdownMenu } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\talignTop,\n\talignCenter,\n\talignBottom,\n\talignStretch,\n\tspaceBetween,\n} from './icons';\n\nconst BLOCK_ALIGNMENTS_CONTROLS = {\n\ttop: {\n\t\ticon: alignTop,\n\t\ttitle: _x( 'Align top', 'Block vertical alignment setting' ),\n\t},\n\tcenter: {\n\t\ticon: alignCenter,\n\t\ttitle: _x( 'Align middle', 'Block vertical alignment setting' ),\n\t},\n\tbottom: {\n\t\ticon: alignBottom,\n\t\ttitle: _x( 'Align bottom', 'Block vertical alignment setting' ),\n\t},\n\tstretch: {\n\t\ticon: alignStretch,\n\t\ttitle: _x( 'Stretch to fill', 'Block vertical alignment setting' ),\n\t},\n\t'space-between': {\n\t\ticon: spaceBetween,\n\t\ttitle: _x( 'Space between', 'Block vertical alignment setting' ),\n\t},\n};\n\nconst DEFAULT_CONTROLS = [ 'top', 'center', 'bottom' ];\nconst DEFAULT_CONTROL = 'top';\n\nfunction BlockVerticalAlignmentUI( {\n\tvalue,\n\tonChange,\n\tcontrols = DEFAULT_CONTROLS,\n\tisCollapsed = true,\n\tisToolbar,\n} ) {\n\tfunction applyOrUnset( align ) {\n\t\treturn () => onChange( value === align ? undefined : align );\n\t}\n\n\tconst activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[ value ];\n\tconst defaultAlignmentControl =\n\t\tBLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];\n\n\tconst UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst extraProps = isToolbar\n\t\t? { isCollapsed }\n\t\t: { popoverProps: { variant: 'toolbar' } };\n\n\treturn (\n\t\t<UIComponent\n\t\t\ticon={\n\t\t\t\tactiveAlignment\n\t\t\t\t\t? activeAlignment.icon\n\t\t\t\t\t: defaultAlignmentControl.icon\n\t\t\t}\n\t\t\tlabel={ _x(\n\t\t\t\t'Change vertical alignment',\n\t\t\t\t'Block vertical alignment setting label'\n\t\t\t) }\n\t\t\tcontrols={ controls.map( ( control ) => {\n\t\t\t\treturn {\n\t\t\t\t\t...BLOCK_ALIGNMENTS_CONTROLS[ control ],\n\t\t\t\t\tisActive: value === control,\n\t\t\t\t\trole: isCollapsed ? 'menuitemradio' : undefined,\n\t\t\t\t\tonClick: applyOrUnset( control ),\n\t\t\t\t};\n\t\t\t} ) }\n\t\t\t{ ...extraProps }\n\t\t/>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md\n */\nexport default BlockVerticalAlignmentUI;\n"]}
|
|
@@ -87,7 +87,9 @@ const BlockColorsStyleSelector = _ref4 => {
|
|
|
87
87
|
version: '6.3'
|
|
88
88
|
});
|
|
89
89
|
return createElement(Dropdown, {
|
|
90
|
-
|
|
90
|
+
popoverProps: {
|
|
91
|
+
placement: 'bottom-start'
|
|
92
|
+
},
|
|
91
93
|
className: "block-library-colors-selector",
|
|
92
94
|
contentClassName: "block-library-colors-selector__popover",
|
|
93
95
|
renderToggle: renderToggleComponent(other),
|