@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
|
@@ -33,6 +33,8 @@ var _useBlockToolbarPopoverProps = _interopRequireDefault(require("./use-block-t
|
|
|
33
33
|
|
|
34
34
|
var _inserter = _interopRequireDefault(require("../inserter"));
|
|
35
35
|
|
|
36
|
+
var _experiments = require("../../experiments");
|
|
37
|
+
|
|
36
38
|
/**
|
|
37
39
|
* External dependencies
|
|
38
40
|
*/
|
|
@@ -50,12 +52,13 @@ function selector(select) {
|
|
|
50
52
|
isMultiSelecting,
|
|
51
53
|
hasMultiSelection,
|
|
52
54
|
isTyping,
|
|
53
|
-
|
|
55
|
+
isBlockInterfaceHidden,
|
|
54
56
|
getSettings,
|
|
55
57
|
getLastMultiSelectedBlockClientId
|
|
56
|
-
} = select(_store.store);
|
|
58
|
+
} = (0, _experiments.unlock)(select(_store.store));
|
|
57
59
|
return {
|
|
58
60
|
editorMode: __unstableGetEditorMode(),
|
|
61
|
+
hasMultiSelection: hasMultiSelection(),
|
|
59
62
|
isMultiSelecting: isMultiSelecting(),
|
|
60
63
|
isTyping: isTyping(),
|
|
61
64
|
isBlockInterfaceHidden: isBlockInterfaceHidden(),
|
|
@@ -78,6 +81,7 @@ function SelectedBlockPopover(_ref) {
|
|
|
78
81
|
} = _ref;
|
|
79
82
|
const {
|
|
80
83
|
editorMode,
|
|
84
|
+
hasMultiSelection,
|
|
81
85
|
isMultiSelecting,
|
|
82
86
|
isTyping,
|
|
83
87
|
isBlockInterfaceHidden,
|
|
@@ -106,7 +110,7 @@ function SelectedBlockPopover(_ref) {
|
|
|
106
110
|
stopTyping
|
|
107
111
|
} = (0, _data.useDispatch)(_store.store);
|
|
108
112
|
const showEmptyBlockSideInserter = !isTyping && editorMode === 'edit' && isEmptyDefaultBlock;
|
|
109
|
-
const shouldShowBreadcrumb = editorMode === 'navigation' || editorMode === 'zoom-out';
|
|
113
|
+
const shouldShowBreadcrumb = !hasMultiSelection && (editorMode === 'navigation' || editorMode === 'zoom-out');
|
|
110
114
|
const shouldShowContextualToolbar = editorMode === 'edit' && !hasFixedToolbar && isLargeViewport && !isMultiSelecting && !showEmptyBlockSideInserter && !isTyping && !isBlockInterfaceHidden;
|
|
111
115
|
const canFocusHiddenToolbar = editorMode === 'edit' && !shouldShowContextualToolbar && !hasFixedToolbar && !isDistractionFree && !isEmptyDefaultBlock;
|
|
112
116
|
(0, _keyboardShortcuts.useShortcut)('core/block-editor/focus-toolbar', () => {
|
|
@@ -126,52 +130,56 @@ function SelectedBlockPopover(_ref) {
|
|
|
126
130
|
clientId
|
|
127
131
|
});
|
|
128
132
|
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
133
|
+
if (showEmptyBlockSideInserter) {
|
|
134
|
+
return (0, _element.createElement)(_blockPopover.default, (0, _extends2.default)({
|
|
135
|
+
clientId: capturingClientId || clientId,
|
|
136
|
+
__unstableCoverTarget: true,
|
|
137
|
+
bottomClientId: lastClientId,
|
|
138
|
+
className: (0, _classnames.default)('block-editor-block-list__block-side-inserter-popover', {
|
|
139
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
140
|
+
}),
|
|
141
|
+
__unstablePopoverSlot: __unstablePopoverSlot,
|
|
142
|
+
__unstableContentRef: __unstableContentRef,
|
|
143
|
+
resize: false,
|
|
144
|
+
shift: false
|
|
145
|
+
}, popoverProps), (0, _element.createElement)("div", {
|
|
146
|
+
className: "block-editor-block-list__empty-block-inserter"
|
|
147
|
+
}, (0, _element.createElement)(_inserter.default, {
|
|
148
|
+
position: "bottom right",
|
|
149
|
+
rootClientId: rootClientId,
|
|
150
|
+
clientId: clientId,
|
|
151
|
+
__experimentalIsQuick: true
|
|
152
|
+
})));
|
|
131
153
|
}
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// it should focus the toolbar right after the mount.
|
|
162
|
-
, {
|
|
163
|
-
focusOnMount: isToolbarForced.current,
|
|
164
|
-
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
165
|
-
__experimentalOnIndexChange: index => {
|
|
166
|
-
initialToolbarItemIndexRef.current = index;
|
|
167
|
-
} // Resets the index whenever the active block changes so
|
|
168
|
-
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
169
|
-
,
|
|
170
|
-
key: clientId
|
|
171
|
-
}), shouldShowBreadcrumb && (0, _element.createElement)(_blockSelectionButton.default, {
|
|
172
|
-
clientId: clientId,
|
|
173
|
-
rootClientId: rootClientId
|
|
174
|
-
})));
|
|
155
|
+
if (shouldShowBreadcrumb || shouldShowContextualToolbar) {
|
|
156
|
+
return (0, _element.createElement)(_blockPopover.default, (0, _extends2.default)({
|
|
157
|
+
clientId: capturingClientId || clientId,
|
|
158
|
+
bottomClientId: lastClientId,
|
|
159
|
+
className: (0, _classnames.default)('block-editor-block-list__block-popover', {
|
|
160
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
161
|
+
}),
|
|
162
|
+
__unstablePopoverSlot: __unstablePopoverSlot,
|
|
163
|
+
__unstableContentRef: __unstableContentRef,
|
|
164
|
+
resize: false
|
|
165
|
+
}, popoverProps), shouldShowContextualToolbar && showContents && (0, _element.createElement)(_blockContextualToolbar.default // If the toolbar is being shown because of being forced
|
|
166
|
+
// it should focus the toolbar right after the mount.
|
|
167
|
+
, {
|
|
168
|
+
focusOnMount: isToolbarForced.current,
|
|
169
|
+
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
170
|
+
__experimentalOnIndexChange: index => {
|
|
171
|
+
initialToolbarItemIndexRef.current = index;
|
|
172
|
+
} // Resets the index whenever the active block changes so
|
|
173
|
+
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
174
|
+
,
|
|
175
|
+
key: clientId
|
|
176
|
+
}), shouldShowBreadcrumb && (0, _element.createElement)(_blockSelectionButton.default, {
|
|
177
|
+
clientId: clientId,
|
|
178
|
+
rootClientId: rootClientId
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return null;
|
|
175
183
|
}
|
|
176
184
|
|
|
177
185
|
function wrapperSelector(select) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","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":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAQA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,oCAAoC,EAAEC,sBALjC;AAMLC,IAAA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A1B,CAPH;AAQNhC,IAAAA;AARM,GAAP;AAUA;;AAEc,SAASuC,mBAAT,QAGX;AAAA,MAHyC;AAC5CtC,IAAAA,qBAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMsC,QAAQ,GAAG,qBAAWlB,eAAX,EAA4B,EAA5B,CAAjB;;AAEA,MAAK,CAAEkB,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL5C,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkC,IAAAA,IAHK;AAILjC,IAAAA,mBAJK;AAKLE,IAAAA,iBALK;AAMLP,IAAAA,iBANK;AAOLmC,IAAAA;AAPK,MAQFY,QARJ;;AAUA,MAAK,CAAET,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,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":["selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","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":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AASA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,sBALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQF,yBAAQP,MAAM,CAAEQ,YAAF,CAAd,CARJ;AAUA,SAAO;AACNC,IAAAA,UAAU,EAAER,uBAAuB,EAD7B;AAENE,IAAAA,iBAAiB,EAAEA,iBAAiB,EAF9B;AAGND,IAAAA,gBAAgB,EAAEA,gBAAgB,EAH5B;AAINE,IAAAA,QAAQ,EAAEA,QAAQ,EAJZ;AAKNC,IAAAA,sBAAsB,EAAEA,sBAAsB,EALxC;AAMNK,IAAAA,eAAe,EAAEJ,WAAW,GAAGI,eANzB;AAONC,IAAAA,iBAAiB,EAAEL,WAAW,GAAGK,iBAP3B;AAQNC,IAAAA,YAAY,EAAET,iBAAiB,KAC5BI,iCAAiC,EADL,GAE5B;AAVG,GAAP;AAYA;;AAED,SAASM,oBAAT,OAQI;AAAA,MAR2B;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA,mBAH8B;AAI9BC,IAAAA,YAJ8B;AAIhB;AACdC,IAAAA,iBAL8B;AAM9BC,IAAAA,qBAN8B;AAO9BC,IAAAA;AAP8B,GAQ3B;AACH,QAAM;AACLX,IAAAA,UADK;AAELN,IAAAA,iBAFK;AAGLD,IAAAA,gBAHK;AAILE,IA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qB,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"]}
|
|
@@ -9,12 +9,16 @@ var _compose = require("@wordpress/compose");
|
|
|
9
9
|
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
|
|
12
|
+
var _dom = require("@wordpress/dom");
|
|
13
|
+
|
|
12
14
|
var _element = require("@wordpress/element");
|
|
13
15
|
|
|
14
16
|
var _store = require("../../store");
|
|
15
17
|
|
|
16
18
|
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
|
|
17
19
|
|
|
20
|
+
var _position = require("../../hooks/position");
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* WordPress dependencies
|
|
20
24
|
*/
|
|
@@ -46,24 +50,34 @@ const RESTRICTED_HEIGHT_PROPS = { ...COMMON_PROPS,
|
|
|
46
50
|
*
|
|
47
51
|
* @param {Element} contentElement The DOM element that represents the editor content or canvas.
|
|
48
52
|
* @param {Element} selectedBlockElement The outer DOM element of the first selected block.
|
|
53
|
+
* @param {Element} scrollContainer The scrollable container for the contentElement.
|
|
49
54
|
* @param {number} toolbarHeight The height of the toolbar in pixels.
|
|
55
|
+
* @param {boolean} isSticky Whether or not the selected block is sticky or fixed.
|
|
50
56
|
*
|
|
51
57
|
* @return {Object} The popover props used to determine the position of the toolbar.
|
|
52
58
|
*/
|
|
53
59
|
|
|
54
|
-
function getProps(contentElement, selectedBlockElement, toolbarHeight) {
|
|
60
|
+
function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) {
|
|
55
61
|
if (!contentElement || !selectedBlockElement) {
|
|
56
62
|
return DEFAULT_PROPS;
|
|
57
|
-
}
|
|
63
|
+
} // Get how far the content area has been scrolled.
|
|
58
64
|
|
|
65
|
+
|
|
66
|
+
const scrollTop = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollTop) || 0;
|
|
59
67
|
const blockRect = selectedBlockElement.getBoundingClientRect();
|
|
60
|
-
const contentRect = contentElement.getBoundingClientRect(); //
|
|
68
|
+
const contentRect = contentElement.getBoundingClientRect(); // Get the vertical position of top of the visible content area.
|
|
69
|
+
|
|
70
|
+
const topOfContentElementInViewport = scrollTop + contentRect.top; // The document element's clientHeight represents the viewport height.
|
|
61
71
|
|
|
62
|
-
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight;
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; // The restricted height area is calculated as the sum of the
|
|
73
|
+
// vertical position of the visible content area, plus the height
|
|
74
|
+
// of the block toolbar.
|
|
65
75
|
|
|
66
|
-
|
|
76
|
+
const restrictedTopArea = topOfContentElementInViewport + toolbarHeight;
|
|
77
|
+
const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;
|
|
78
|
+
const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; // Sticky blocks are treated as if they will never have enough space for the toolbar above.
|
|
79
|
+
|
|
80
|
+
if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) {
|
|
67
81
|
return DEFAULT_PROPS;
|
|
68
82
|
}
|
|
69
83
|
|
|
@@ -87,12 +101,31 @@ function useBlockToolbarPopoverProps(_ref) {
|
|
|
87
101
|
} = _ref;
|
|
88
102
|
const selectedBlockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
89
103
|
const [toolbarHeight, setToolbarHeight] = (0, _element.useState)(0);
|
|
90
|
-
const
|
|
91
|
-
|
|
104
|
+
const {
|
|
105
|
+
blockIndex,
|
|
106
|
+
isSticky
|
|
107
|
+
} = (0, _data.useSelect)(select => {
|
|
108
|
+
const {
|
|
109
|
+
getBlockIndex,
|
|
110
|
+
getBlockAttributes
|
|
111
|
+
} = select(_store.store);
|
|
112
|
+
return {
|
|
113
|
+
blockIndex: getBlockIndex(clientId),
|
|
114
|
+
isSticky: (0, _position.hasStickyOrFixedPositionValue)(getBlockAttributes(clientId))
|
|
115
|
+
};
|
|
116
|
+
}, [clientId]);
|
|
117
|
+
const scrollContainer = (0, _element.useMemo)(() => {
|
|
118
|
+
if (!contentElement) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (0, _dom.getScrollContainer)(contentElement);
|
|
123
|
+
}, [contentElement]);
|
|
124
|
+
const [props, setProps] = (0, _element.useState)(() => getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky));
|
|
92
125
|
const popoverRef = (0, _compose.useRefEffect)(popoverNode => {
|
|
93
126
|
setToolbarHeight(popoverNode.offsetHeight);
|
|
94
127
|
}, []);
|
|
95
|
-
const updateProps = (0, _element.useCallback)(() => setProps(getProps(contentElement, selectedBlockElement, toolbarHeight)), [contentElement, selectedBlockElement, toolbarHeight]); // Update props when the block is moved. This also ensures the props are
|
|
128
|
+
const updateProps = (0, _element.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
|
|
96
129
|
// correct on initial mount, and when the selected block or content element
|
|
97
130
|
// changes (since the callback ref will update).
|
|
98
131
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"names":["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","blockEditorStore","getBlockIndex","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,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,E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cAAL,EAAsB;AACrBA,QAAAA,cAAc,CAACK,UAAf;AACA;AACD,KAND;AAOA,GAxBD,EAwBG,CAAET,WAAF,EAAe1B,cAAf,EAA+BC,oBAA/B,CAxBH;AA0BA,SAAO,EACN,GAAGgB,KADG;AAENmB,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":["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","blockEditorStore","props","setProps","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAWA;AACA;AACA;AAKA,MAAMA,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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UAAF,EAAcU,WAAd,CAA9B,EArDG,CAuDH;;AACA,gCAAiB,MAAM;AAAA;;AACtB,QAAK,CAAEhC,cAAF,IAAoB,CAAEC,oBAA3B,EAAkD;AACjD;AACA,KAHqB,CAKtB;;;AACA,UAAMgC,WAAW,GAAGjC,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEY,aAAnB,0DAAG,sBAA+BsB,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,GAAGpC,oBAAH,aAAGA,oBAAH,gDAAGA,oBAAoB,CAAEW,aAAzB,0DAAG,sBAAqCsB,WAAvD;;AACA,QAAKG,SAAS,CAACC,cAAf,EAAgC;AAC/BF,MAAAA,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAd,CAA8BN,WAA9B,CAAjB;AACAI,MAAAA,cAAc,CAACG,OAAf,CAAwBtC,oBAAxB;AACA;;AAED,WAAO,MAAM;AAAA;;AACZgC,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,GAxBD,EAwBG,CAAET,WAAF,EAAehC,cAAf,EAA+BC,oBAA/B,CAxBH;AA0BA,SAAO,EACN,GAAG0B,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"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.alignTop = exports.alignCenter = exports.alignBottom = void 0;
|
|
6
|
+
exports.spaceBetween = exports.alignTop = exports.alignStretch = exports.alignCenter = exports.alignBottom = void 0;
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
@@ -33,4 +33,18 @@ const alignTop = (0, _element.createElement)(_components.SVG, {
|
|
|
33
33
|
d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z"
|
|
34
34
|
}));
|
|
35
35
|
exports.alignTop = alignTop;
|
|
36
|
+
const alignStretch = (0, _element.createElement)(_components.SVG, {
|
|
37
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
+
viewBox: "0 0 24 24"
|
|
39
|
+
}, (0, _element.createElement)(_components.Path, {
|
|
40
|
+
d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z"
|
|
41
|
+
}));
|
|
42
|
+
exports.alignStretch = alignStretch;
|
|
43
|
+
const spaceBetween = (0, _element.createElement)(_components.SVG, {
|
|
44
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
45
|
+
viewBox: "0 0 24 24"
|
|
46
|
+
}, (0, _element.createElement)(_components.Path, {
|
|
47
|
+
d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z"
|
|
48
|
+
}));
|
|
49
|
+
exports.spaceBetween = spaceBetween;
|
|
36
50
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/icons.js"],"names":["alignBottom","alignCenter","alignTop"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,WAAW,GACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,WAAW,GACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,QAAQ,GACpB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;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":["alignBottom","alignCenter","alignTop","alignStretch","spaceBetween"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,WAAW,GACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,WAAW,GACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,QAAQ,GACpB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,YAAY,GACxB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM;;AAMA,MAAMC,YAAY,GACxB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,4BAAX;AAAwC,EAAA,OAAO,EAAC;AAAhD,GACC,4BAAC,gBAAD;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"]}
|
|
@@ -36,13 +36,18 @@ const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
|
36
36
|
bottom: {
|
|
37
37
|
icon: _icons.alignBottom,
|
|
38
38
|
title: (0, _i18n._x)('Align bottom', 'Block vertical alignment setting')
|
|
39
|
+
},
|
|
40
|
+
stretch: {
|
|
41
|
+
icon: _icons.alignStretch,
|
|
42
|
+
title: (0, _i18n._x)('Stretch to fill', 'Block vertical alignment setting')
|
|
43
|
+
},
|
|
44
|
+
'space-between': {
|
|
45
|
+
icon: _icons.spaceBetween,
|
|
46
|
+
title: (0, _i18n._x)('Space between', 'Block vertical alignment setting')
|
|
39
47
|
}
|
|
40
48
|
};
|
|
41
49
|
const DEFAULT_CONTROLS = ['top', 'center', 'bottom'];
|
|
42
50
|
const DEFAULT_CONTROL = 'top';
|
|
43
|
-
const POPOVER_PROPS = {
|
|
44
|
-
variant: 'toolbar'
|
|
45
|
-
};
|
|
46
51
|
|
|
47
52
|
function BlockVerticalAlignmentUI(_ref) {
|
|
48
53
|
let {
|
|
@@ -64,7 +69,7 @@ function BlockVerticalAlignmentUI(_ref) {
|
|
|
64
69
|
isCollapsed
|
|
65
70
|
} : {
|
|
66
71
|
popoverProps: {
|
|
67
|
-
|
|
72
|
+
variant: 'toolbar'
|
|
68
73
|
}
|
|
69
74
|
};
|
|
70
75
|
return (0, _element.createElement)(UIComponent, (0, _extends2.default)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/ui.js"],"names":["BLOCK_ALIGNMENTS_CONTROLS","top","icon","alignTop","title","center","alignCenter","bottom","alignBottom","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-vertical-alignment-control/ui.js"],"names":["BLOCK_ALIGNMENTS_CONTROLS","top","icon","alignTop","title","center","alignCenter","bottom","alignBottom","stretch","alignStretch","spaceBetween","DEFAULT_CONTROLS","DEFAULT_CONTROL","BlockVerticalAlignmentUI","value","onChange","controls","isCollapsed","isToolbar","applyOrUnset","align","undefined","activeAlignment","defaultAlignmentControl","UIComponent","ToolbarGroup","ToolbarDropdownMenu","extraProps","popoverProps","variant","map","control","isActive","role","onClick"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AASA,MAAMA,yBAAyB,GAAG;AACjCC,EAAAA,GAAG,EAAE;AACJC,IAAAA,IAAI,EAAEC,eADF;AAEJC,IAAAA,KAAK,EAAE,cAAI,WAAJ,EAAiB,kCAAjB;AAFH,GAD4B;AAKjCC,EAAAA,MAAM,EAAE;AACPH,IAAAA,IAAI,EAAEI,kBADC;AAEPF,IAAAA,KAAK,EAAE,cAAI,cAAJ,EAAoB,kCAApB;AAFA,GALyB;AASjCG,EAAAA,MAAM,EAAE;AACPL,IAAAA,IAAI,EAAEM,kBADC;AAEPJ,IAAAA,KAAK,EAAE,cAAI,cAAJ,EAAoB,kCAApB;AAFA,GATyB;AAajCK,EAAAA,OAAO,EAAE;AACRP,IAAAA,IAAI,EAAEQ,mBADE;AAERN,IAAAA,KAAK,EAAE,cAAI,iBAAJ,EAAuB,kCAAvB;AAFC,GAbwB;AAiBjC,mBAAiB;AAChBF,IAAAA,IAAI,EAAES,mBADU;AAEhBP,IAAAA,KAAK,EAAE,cAAI,eAAJ,EAAqB,kCAArB;AAFS;AAjBgB,CAAlC;AAuBA,MAAMQ,gBAAgB,GAAG,CAAE,KAAF,EAAS,QAAT,EAAmB,QAAnB,CAAzB;AACA,MAAMC,eAAe,GAAG,KAAxB;;AAEA,SAASC,wBAAT,OAMI;AAAA,MAN+B;AAClCC,IAAAA,KADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAAQ,GAAGL,gBAHuB;AAIlCM,IAAAA,WAAW,GAAG,IAJoB;AAKlCC,IAAAA;AALkC,GAM/B;;AACH,WAASC,YAAT,CAAuBC,KAAvB,EAA+B;AAC9B,WAAO,MAAML,QAAQ,CAAED,KAAK,KAAKM,KAAV,GAAkBC,SAAlB,GAA8BD,KAAhC,CAArB;AACA;;AAED,QAAME,eAAe,GAAGvB,yBAAyB,CAAEe,KAAF,CAAjD;AACA,QAAMS,uBAAuB,GAC5BxB,yBAAyB,CAAEa,eAAF,CAD1B;AAGA,QAAMY,WAAW,GAAGN,SAAS,GAAGO,wBAAH,GAAkBC,+BAA/C;AACA,QAAMC,UAAU,GAAGT,SAAS,GACzB;AAAED,IAAAA;AAAF,GADyB,GAEzB;AAAEW,IAAAA,YAAY,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAX;AAAhB,GAFH;AAIA,SACC,4BAAC,WAAD;AACC,IAAA,IAAI,EACHP,eAAe,GACZA,eAAe,CAACrB,IADJ,GAEZsB,uBAAuB,CAACtB,IAJ7B;AAMC,IAAA,KAAK,EAAG,cACP,2BADO,EAEP,wCAFO,CANT;AAUC,IAAA,QAAQ,EAAGe,QAAQ,CAACc,GAAT,CAAgBC,OAAF,IAAe;AACvC,aAAO,EACN,GAAGhC,yBAAyB,CAAEgC,OAAF,CADtB;AAENC,QAAAA,QAAQ,EAAElB,KAAK,KAAKiB,OAFd;AAGNE,QAAAA,IAAI,EAAEhB,WAAW,GAAG,eAAH,GAAqBI,SAHhC;AAINa,QAAAA,OAAO,EAAEf,YAAY,CAAEY,OAAF;AAJf,OAAP;AAMA,KAPU;AAVZ,KAkBMJ,UAlBN,EADD;AAsBA;AAED;AACA;AACA;;;eACed,wB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { 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"]}
|
|
@@ -99,7 +99,9 @@ const BlockColorsStyleSelector = _ref4 => {
|
|
|
99
99
|
version: '6.3'
|
|
100
100
|
});
|
|
101
101
|
return (0, _element.createElement)(_components.Dropdown, {
|
|
102
|
-
|
|
102
|
+
popoverProps: {
|
|
103
|
+
placement: 'bottom-start'
|
|
104
|
+
},
|
|
103
105
|
className: "block-library-colors-selector",
|
|
104
106
|
contentClassName: "block-library-colors-selector__popover",
|
|
105
107
|
renderToggle: renderToggleComponent(other),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other","alternative","since","version"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,MAAMA,oBAAoB,GAAG,MAC5B,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,6BAAX;AAAyC,EAAA,OAAO,EAAC;AAAjD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADD;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,iBAAiB,GAAG,QAA4B;AAAA,MAA1B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA0B;AACrD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,SAAS,EAAI,GAAGA,SAAW,iDAD5B;AAEC,IAAA,KAAK,EAAGD;AAFT,KAIC,4BAAC,oBAAD,OAJD,CADD,CADD;AAUA,CAXD;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,qBAAqB,GAC1B;AAAA,MAAE;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAF;AAAA,SACA,SAA4B;AAAA,QAA1B;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,KAA0B;;AAC3B,UAAMC,eAAe,GAAKC,KAAF,IAAa;AACpC,UAAK,CAAEF,MAAF,IAAYE,KAAK,CAACC,OAAN,KAAkBC,cAAnC,EAA0C;AACzCF,QAAAA,KAAK,CAACG,cAAN;AACAN,QAAAA,QAAQ;AACR;AACD,KALD;;AAOA,WACC,4BAAC,wBAAD,QACC,4BAAC,yBAAD;AACC,MAAA,SAAS,EAAC,mEADX;AAEC,MAAA,KAAK,EAAG,cAAI,sBAAJ,CAFT;AAGC,MAAA,OAAO,EAAGA,QAHX;AAIC,MAAA,SAAS,EAAGE,eAJb;AAKC,MAAA,IAAI,EACH,4BAAC,eAAD,QACC,4BAAC,SAAD,QACC,4BAAC,iBAAD,OADD,CADD;AANF,MADD,CADD;AAiBA,GA1BD;AAAA,CADD;;AA6BA,MAAMK,wBAAwB,GAAG,SAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAA4B;AAC9D,2BAAa,yCAAb,EAAuD;AACtDC,IAAAA,WAAW,EAAE,oBADyC;AAEtDC,IAAAA,KAAK,EAAE,KAF+C;AAGtDC,IAAAA,OAAO,EAAE;AAH6C,GAAvD;AAMA,SACC,4BAAC,oBAAD;AACC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"names":["ColorSelectorSVGIcon","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","BlockColorsStyleSelector","children","other","alternative","since","version","placement"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,MAAMA,oBAAoB,GAAG,MAC5B,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,6BAAX;AAAyC,EAAA,OAAO,EAAC;AAAjD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADD;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,iBAAiB,GAAG,QAA4B;AAAA,MAA1B;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAA0B;AACrD,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,SAAS,EAAI,GAAGA,SAAW,iDAD5B;AAEC,IAAA,KAAK,EAAGD;AAFT,KAIC,4BAAC,oBAAD,OAJD,CADD,CADD;AAUA,CAXD;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,qBAAqB,GAC1B;AAAA,MAAE;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAF;AAAA,SACA,SAA4B;AAAA,QAA1B;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,KAA0B;;AAC3B,UAAMC,eAAe,GAAKC,KAAF,IAAa;AACpC,UAAK,CAAEF,MAAF,IAAYE,KAAK,CAACC,OAAN,KAAkBC,cAAnC,EAA0C;AACzCF,QAAAA,KAAK,CAACG,cAAN;AACAN,QAAAA,QAAQ;AACR;AACD,KALD;;AAOA,WACC,4BAAC,wBAAD,QACC,4BAAC,yBAAD;AACC,MAAA,SAAS,EAAC,mEADX;AAEC,MAAA,KAAK,EAAG,cAAI,sBAAJ,CAFT;AAGC,MAAA,OAAO,EAAGA,QAHX;AAIC,MAAA,SAAS,EAAGE,eAJb;AAKC,MAAA,IAAI,EACH,4BAAC,eAAD,QACC,4BAAC,SAAD,QACC,4BAAC,iBAAD,OADD,CADD;AANF,MADD,CADD;AAiBA,GA1BD;AAAA,CADD;;AA6BA,MAAMK,wBAAwB,GAAG,SAA8B;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,GAA4B;AAC9D,2BAAa,yCAAb,EAAuD;AACtDC,IAAAA,WAAW,EAAE,oBADyC;AAEtDC,IAAAA,KAAK,EAAE,KAF+C;AAGtDC,IAAAA,OAAO,EAAE;AAH6C,GAAvD;AAMA,SACC,4BAAC,oBAAD;AACC,IAAA,YAAY,EAAG;AAAEC,MAAAA,SAAS,EAAE;AAAb,KADhB;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,gBAAgB,EAAC,wCAHlB;AAIC,IAAA,YAAY,EAAGhB,qBAAqB,CAAEY,KAAF,CAJrC;AAKC,IAAA,aAAa,EAAG,MAAMD;AALvB,IADD;AASA,CAhBD;;eAkBeD,wB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"https://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent =\n\t( { TextColor, BackgroundColor } ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst openOnArrowDown = ( event ) => {\n\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonToggle();\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t\t</BackgroundColor>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"]}
|
|
@@ -93,9 +93,7 @@ function NonDefaultControls(_ref2) {
|
|
|
93
93
|
__experimentalHint: (0, _i18n.__)('Enter your own date format')
|
|
94
94
|
};
|
|
95
95
|
const [isCustom, setIsCustom] = (0, _element.useState)(() => !!format && !suggestedFormats.includes(format));
|
|
96
|
-
return (0, _element.createElement)(
|
|
97
|
-
className: "block-editor-date-format-picker__custom-format-select-control"
|
|
98
|
-
}, (0, _element.createElement)(_components.CustomSelectControl, {
|
|
96
|
+
return (0, _element.createElement)(_components.__experimentalVStack, null, (0, _element.createElement)(_components.CustomSelectControl, {
|
|
99
97
|
__nextUnconstrainedWidth: true,
|
|
100
98
|
label: (0, _i18n.__)('Choose a format'),
|
|
101
99
|
options: [...suggestedOptions, customOption],
|
|
@@ -112,7 +110,8 @@ function NonDefaultControls(_ref2) {
|
|
|
112
110
|
onChange(selectedItem.format);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
})
|
|
113
|
+
}), isCustom && (0, _element.createElement)(_components.TextControl, {
|
|
114
|
+
__nextHasNoMarginBottom: true,
|
|
116
115
|
label: (0, _i18n.__)('Custom format'),
|
|
117
116
|
hideLabelFromVision: true,
|
|
118
117
|
help: (0, _element.createInterpolateElement)((0, _i18n.__)('Enter a date or time <Link>format string</Link>.'), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"names":["EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","checked","NonDefaultControls","suggestedFormats","Set","suggestedOptions","map","suggestedFormat","index","key","name","customOption","className","__experimentalHint","isCustom","setIsCustom","includes","find","option","selectedItem","Link","value"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,IAAIC,IAAJ,CAAU,IAAV,EAAgB,CAAhB,EAAmB,EAAnB,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,MADyC;AAEzCC,IAAAA,aAFyC;AAGzCC,IAAAA;AAHyC,GAItC;AACH,SACC;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KAA8B,cAAI,aAAJ,CAA9B,CADD,EAEC,4BAAC,yBAAD;AACC,IAAA,KAAK,EACJ,qDACG,cAAI,gBAAJ,CADH,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACG,oBAAUD,aAAV,EAAyBJ,YAAzB,CADH,CAFD,CAFF;AASC,IAAA,OAAO,EAAG,CAAEG,MATb;AAUC,IAAA,QAAQ,EAAKG,OAAF,IACVD,QAAQ,CAAEC,OAAO,GAAG,IAAH,GAAUF,aAAnB;AAXV,IAFD,EAgBGD,MAAM,IACP,4BAAC,kBAAD;AAAoB,IAAA,MAAM,EAAGA,MAA7B;AAAsC,IAAA,QAAQ,EAAGE;AAAjD,IAjBF,CADD;AAsBA;;AAED,SAASE,kBAAT,QAAoD;AAAA;;AAAA,MAAvB;AAAEJ,IAAAA,MAAF;AAAUE,IAAAA;AAAV,GAAuB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAMG,gBAAgB,GAAG,CACxB,GAAG,IAAIC,GAAJ,CAAS,CACX,OADW,EAEX,cAAI,OAAJ,EAAa,mBAAb,CAFW,EAGX,cAAI,aAAJ,EAAmB,6BAAnB,CAHW,EAIX,cAAI,QAAJ,EAAc,oBAAd,CAJW,EAKX,cAAI,cAAJ,EAAoB,8BAApB,CALW,EAMX,cAAI,QAAJ,EAAc,kBAAd,CANW,EAOX,cAAI,KAAJ,EAAW,oCAAX,CAPW,CAAT,CADqB,CAAzB;AAYA,QAAMC,gBAAgB,GAAGF,gBAAgB,CAACG,GAAjB,CACxB,CAAEC,eAAF,EAAmBC,KAAnB,MAAgC;AAC/BC,IAAAA,GAAG,EAAG,aAAaD,KAAO,EADK;AAE/BE,IAAAA,IAAI,EAAE,oBAAUH,eAAV,EAA2BZ,YAA3B,CAFyB;AAG/BG,IAAAA,MAAM,EAAES;AAHuB,GAAhC,CADwB,CAAzB;AAOA,QAAMI,YAAY,GAAG;AACpBF,IAAAA,GAAG,EAAE,QADe;AAEpBC,IAAAA,IAAI,EAAE,cAAI,QAAJ,CAFc;AAGpBE,IAAAA,SAAS,EACR,8EAJmB;AAKpBC,IAAAA,kBAAkB,EAAE,cAAI,4BAAJ;AALA,GAArB;AAQA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBACjC,MAAM,CAAC,CAAEjB,MAAH,IAAa,CAAEK,gBAAgB,CAACa,QAAjB,CAA2BlB,MAA3B,CADY,CAAlC;AAIA,SACC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"names":["EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","checked","NonDefaultControls","suggestedFormats","Set","suggestedOptions","map","suggestedFormat","index","key","name","customOption","className","__experimentalHint","isCustom","setIsCustom","includes","find","option","selectedItem","Link","value"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,IAAIC,IAAJ,CAAU,IAAV,EAAgB,CAAhB,EAA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;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ,CAFT;AAGC,IAAA,mBAAmB,MAHpB;AAIC,IAAA,IAAI,EAAG,uCACN,cACC,kDADD,CADM,EAIN;AACCM,MAAAA,IAAI,EACH,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,iEADM;AADR;AAFF,KAJM,CAJR;AAkBC,IAAA,KAAK,EAAGtB,MAlBT;AAmBC,IAAA,QAAQ,EAAKuB,KAAF,IAAarB,QAAQ,CAAEqB,KAAF;AAnBjC,IAtBF,CADD;AA+CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __( 'Default format' ) }\n\t\t\t\t\t\t<span className=\"block-editor-date-format-picker__default-format-toggle-control__hint\">\n\t\t\t\t\t\t\t{ dateI18n( defaultFormat, EXAMPLE_DATE ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t'Y-m-d',\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/formatting-date-and-time/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -75,6 +75,7 @@ function DefaultStylePicker(_ref) {
|
|
|
75
75
|
return onUpdatePreferredStyleVariations && (0, _element.createElement)("div", {
|
|
76
76
|
className: "default-style-picker__default-switcher"
|
|
77
77
|
}, (0, _element.createElement)(_components.SelectControl, {
|
|
78
|
+
__nextHasNoMarginBottom: true,
|
|
78
79
|
options: selectOptions,
|
|
79
80
|
value: preferredStyle || '',
|
|
80
81
|
label: (0, _i18n.__)('Default Style'),
|