@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
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
5
|
+
import { Platform } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
const ALIGN_SUPPORT_KEY = 'align';
|
|
8
|
+
const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
|
|
9
|
+
const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
10
|
+
const COLOR_SUPPORT_KEY = 'color';
|
|
11
|
+
const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
|
|
12
|
+
const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
13
|
+
const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
|
|
14
|
+
const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
|
|
15
|
+
/**
|
|
16
|
+
* Key within block settings' support array indicating support for font style.
|
|
17
|
+
*/
|
|
18
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
19
|
+
/**
|
|
20
|
+
* Key within block settings' support array indicating support for font weight.
|
|
21
|
+
*/
|
|
22
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
23
|
+
/**
|
|
24
|
+
* Key within block settings' supports array indicating support for text
|
|
25
|
+
* decorations e.g. settings found in `block.json`.
|
|
26
|
+
*/
|
|
27
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
28
|
+
/**
|
|
29
|
+
* Key within block settings' supports array indicating support for text
|
|
30
|
+
* transforms e.g. settings found in `block.json`.
|
|
31
|
+
*/
|
|
32
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
33
|
+
/**
|
|
34
|
+
* Key within block settings' supports array indicating support for letter-spacing
|
|
35
|
+
* e.g. settings found in `block.json`.
|
|
36
|
+
*/
|
|
37
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
38
|
+
const LAYOUT_SUPPORT_KEY = '__experimentalLayout';
|
|
39
|
+
const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
40
|
+
LINE_HEIGHT_SUPPORT_KEY,
|
|
41
|
+
FONT_SIZE_SUPPORT_KEY,
|
|
42
|
+
FONT_STYLE_SUPPORT_KEY,
|
|
43
|
+
FONT_WEIGHT_SUPPORT_KEY,
|
|
44
|
+
FONT_FAMILY_SUPPORT_KEY,
|
|
45
|
+
TEXT_DECORATION_SUPPORT_KEY,
|
|
46
|
+
TEXT_TRANSFORM_SUPPORT_KEY,
|
|
47
|
+
LETTER_SPACING_SUPPORT_KEY,
|
|
48
|
+
];
|
|
49
|
+
const SPACING_SUPPORT_KEY = 'spacing';
|
|
50
|
+
const styleSupportKeys = [
|
|
51
|
+
...TYPOGRAPHY_SUPPORT_KEYS,
|
|
52
|
+
BORDER_SUPPORT_KEY,
|
|
53
|
+
COLOR_SUPPORT_KEY,
|
|
54
|
+
SPACING_SUPPORT_KEY,
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the block defines support for align.
|
|
59
|
+
*
|
|
60
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
61
|
+
* @return {boolean} Whether the block supports the feature.
|
|
62
|
+
*/
|
|
63
|
+
export const hasAlignSupport = ( nameOrType ) =>
|
|
64
|
+
hasBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns the block support value for align, if defined.
|
|
68
|
+
*
|
|
69
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
70
|
+
* @return {unknown} The block support value.
|
|
71
|
+
*/
|
|
72
|
+
export const getAlignSupport = ( nameOrType ) =>
|
|
73
|
+
getBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if the block defines support for align wide.
|
|
77
|
+
*
|
|
78
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
79
|
+
* @return {boolean} Whether the block supports the feature.
|
|
80
|
+
*/
|
|
81
|
+
export const hasAlignWideSupport = ( nameOrType ) =>
|
|
82
|
+
hasBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns the block support value for align wide, if defined.
|
|
86
|
+
*
|
|
87
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
88
|
+
* @return {unknown} The block support value.
|
|
89
|
+
*/
|
|
90
|
+
export const getAlignWideSupport = ( nameOrType ) =>
|
|
91
|
+
getBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Determine whether there is block support for border properties.
|
|
95
|
+
*
|
|
96
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
97
|
+
* @param {string} feature Border feature to check support for.
|
|
98
|
+
*
|
|
99
|
+
* @return {boolean} Whether there is support.
|
|
100
|
+
*/
|
|
101
|
+
export function hasBorderSupport( nameOrType, feature = 'any' ) {
|
|
102
|
+
if ( Platform.OS !== 'web' ) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const support = getBlockSupport( nameOrType, BORDER_SUPPORT_KEY );
|
|
107
|
+
|
|
108
|
+
if ( support === true ) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if ( feature === 'any' ) {
|
|
113
|
+
return !! (
|
|
114
|
+
support?.color ||
|
|
115
|
+
support?.radius ||
|
|
116
|
+
support?.width ||
|
|
117
|
+
support?.style
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return !! support?.[ feature ];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get block support for border properties.
|
|
126
|
+
*
|
|
127
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
128
|
+
* @param {string} feature Border feature to get.
|
|
129
|
+
*
|
|
130
|
+
* @return {unknown} The block support.
|
|
131
|
+
*/
|
|
132
|
+
export const getBorderSupport = ( nameOrType, feature ) =>
|
|
133
|
+
getBlockSupport( nameOrType, [ BORDER_SUPPORT_KEY, feature ] );
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Returns true if the block defines support for color.
|
|
137
|
+
*
|
|
138
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
139
|
+
* @return {boolean} Whether the block supports the feature.
|
|
140
|
+
*/
|
|
141
|
+
export const hasColorSupport = ( nameOrType ) => {
|
|
142
|
+
const colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );
|
|
143
|
+
return (
|
|
144
|
+
colorSupport &&
|
|
145
|
+
( colorSupport.link === true ||
|
|
146
|
+
colorSupport.gradient === true ||
|
|
147
|
+
colorSupport.background !== false ||
|
|
148
|
+
colorSupport.text !== false )
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Returns true if the block defines support for link color.
|
|
154
|
+
*
|
|
155
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
156
|
+
* @return {boolean} Whether the block supports the feature.
|
|
157
|
+
*/
|
|
158
|
+
export const hasLinkColorSupport = ( nameOrType ) => {
|
|
159
|
+
if ( Platform.OS !== 'web' ) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
colorSupport !== null &&
|
|
167
|
+
typeof colorSupport === 'object' &&
|
|
168
|
+
!! colorSupport.link
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns true if the block defines support for gradient color.
|
|
174
|
+
*
|
|
175
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
176
|
+
* @return {boolean} Whether the block supports the feature.
|
|
177
|
+
*/
|
|
178
|
+
export const hasGradientSupport = ( nameOrType ) => {
|
|
179
|
+
const colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
colorSupport !== null &&
|
|
183
|
+
typeof colorSupport === 'object' &&
|
|
184
|
+
!! colorSupport.gradients
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Returns true if the block defines support for background color.
|
|
190
|
+
*
|
|
191
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
192
|
+
* @return {boolean} Whether the block supports the feature.
|
|
193
|
+
*/
|
|
194
|
+
export const hasBackgroundColorSupport = ( nameOrType ) => {
|
|
195
|
+
const colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );
|
|
196
|
+
|
|
197
|
+
return colorSupport && colorSupport.background !== false;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returns true if the block defines support for background color.
|
|
202
|
+
*
|
|
203
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
204
|
+
* @return {boolean} Whether the block supports the feature.
|
|
205
|
+
*/
|
|
206
|
+
export const hasTextColorSupport = ( nameOrType ) => {
|
|
207
|
+
const colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );
|
|
208
|
+
|
|
209
|
+
return colorSupport && colorSupport.text !== false;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get block support for color properties.
|
|
214
|
+
*
|
|
215
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
216
|
+
* @param {string} feature Color feature to get.
|
|
217
|
+
*
|
|
218
|
+
* @return {unknown} The block support.
|
|
219
|
+
*/
|
|
220
|
+
export const getColorSupport = ( nameOrType, feature ) =>
|
|
221
|
+
getBlockSupport( nameOrType, [ COLOR_SUPPORT_KEY, feature ] );
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Returns true if the block defines support for custom class name.
|
|
225
|
+
*
|
|
226
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
227
|
+
* @return {boolean} Whether the block supports the feature.
|
|
228
|
+
*/
|
|
229
|
+
export const hasCustomClassNameSupport = ( nameOrType ) =>
|
|
230
|
+
hasBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Returns the block support value for custom class name, if defined.
|
|
234
|
+
*
|
|
235
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
236
|
+
* @return {unknown} The block support value.
|
|
237
|
+
*/
|
|
238
|
+
export const getCustomClassNameSupport = ( nameOrType ) =>
|
|
239
|
+
getBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Returns true if the block defines support for font family.
|
|
243
|
+
*
|
|
244
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
245
|
+
* @return {boolean} Whether the block supports the feature.
|
|
246
|
+
*/
|
|
247
|
+
export const hasFontFamilySupport = ( nameOrType ) =>
|
|
248
|
+
hasBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Returns the block support value for font family, if defined.
|
|
252
|
+
*
|
|
253
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
254
|
+
* @return {unknown} The block support value.
|
|
255
|
+
*/
|
|
256
|
+
export const getFontFamilySupport = ( nameOrType ) =>
|
|
257
|
+
getBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Returns true if the block defines support for font size.
|
|
261
|
+
*
|
|
262
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
263
|
+
* @return {boolean} Whether the block supports the feature.
|
|
264
|
+
*/
|
|
265
|
+
export const hasFontSizeSupport = ( nameOrType ) =>
|
|
266
|
+
hasBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Returns the block support value for font size, if defined.
|
|
270
|
+
*
|
|
271
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
272
|
+
* @return {unknown} The block support value.
|
|
273
|
+
*/
|
|
274
|
+
export const getFontSizeSupport = ( nameOrType ) =>
|
|
275
|
+
getBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Returns true if the block defines support for layout.
|
|
279
|
+
*
|
|
280
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
281
|
+
* @return {boolean} Whether the block supports the feature.
|
|
282
|
+
*/
|
|
283
|
+
export const hasLayoutSupport = ( nameOrType ) =>
|
|
284
|
+
hasBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Returns the block support value for layout, if defined.
|
|
288
|
+
*
|
|
289
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
290
|
+
* @return {unknown} The block support value.
|
|
291
|
+
*/
|
|
292
|
+
export const getLayoutSupport = ( nameOrType ) =>
|
|
293
|
+
getBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Returns true if the block defines support for style.
|
|
297
|
+
*
|
|
298
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
299
|
+
* @return {boolean} Whether the block supports the feature.
|
|
300
|
+
*/
|
|
301
|
+
export const hasStyleSupport = ( nameOrType ) =>
|
|
302
|
+
styleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Align options for group block sets Full width option 1`] = `
|
|
4
|
+
"<!-- wp:group {\\"align\\":\\"full\\",\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
|
|
5
|
+
<div class=\\"wp-block-group alignfull\\"></div>
|
|
6
|
+
<!-- /wp:group -->"
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`Align options for group block sets None option 1`] = `
|
|
10
|
+
"<!-- wp:group {\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
|
|
11
|
+
<div class=\\"wp-block-group\\"></div>
|
|
12
|
+
<!-- /wp:group -->"
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Align options for group block sets Wide width option 1`] = `
|
|
16
|
+
"<!-- wp:group {\\"align\\":\\"wide\\",\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
|
|
17
|
+
<div class=\\"wp-block-group alignwide\\"></div>
|
|
18
|
+
<!-- /wp:group -->"
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Align options for media block sets Align center option 1`] = `
|
|
22
|
+
"<!-- wp:image {\\"align\\":\\"center\\",\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
23
|
+
<figure class=\\"wp-block-image aligncenter size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
24
|
+
<!-- /wp:image -->"
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`Align options for media block sets Align left option 1`] = `
|
|
28
|
+
"<!-- wp:image {\\"align\\":\\"left\\",\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
29
|
+
<figure class=\\"wp-block-image alignleft size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
30
|
+
<!-- /wp:image -->"
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`Align options for media block sets Align right option 1`] = `
|
|
34
|
+
"<!-- wp:image {\\"align\\":\\"right\\",\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
35
|
+
<figure class=\\"wp-block-image alignright size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
36
|
+
<!-- /wp:image -->"
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Align options for media block sets Full width option 1`] = `
|
|
40
|
+
"<!-- wp:image {\\"align\\":\\"full\\",\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
41
|
+
<figure class=\\"wp-block-image alignfull size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
42
|
+
<!-- /wp:image -->"
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`Align options for media block sets None option 1`] = `
|
|
46
|
+
"<!-- wp:image {\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
47
|
+
<figure class=\\"wp-block-image size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
48
|
+
<!-- /wp:image -->"
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`Align options for media block sets Wide width option 1`] = `
|
|
52
|
+
"<!-- wp:image {\\"align\\":\\"wide\\",\\"id\\":1,\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
|
|
53
|
+
<figure class=\\"wp-block-image alignwide size-large\\"><img src=\\"https://test-site.files.wordpress.com/local-image-1.jpeg\\" alt=\\"\\" class=\\"wp-image-1\\"/></figure>
|
|
54
|
+
<!-- /wp:image -->"
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
exports[`Align options for text block sets Align text center option 1`] = `
|
|
58
|
+
"<!-- wp:paragraph {\\"align\\":\\"center\\"} -->
|
|
59
|
+
<p class=\\"has-text-align-center\\"></p>
|
|
60
|
+
<!-- /wp:paragraph -->"
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
exports[`Align options for text block sets Align text left option 1`] = `
|
|
64
|
+
"<!-- wp:paragraph {\\"align\\":\\"left\\"} -->
|
|
65
|
+
<p class=\\"has-text-align-left\\"></p>
|
|
66
|
+
<!-- /wp:paragraph -->"
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
exports[`Align options for text block sets Align text right option 1`] = `
|
|
70
|
+
"<!-- wp:paragraph {\\"align\\":\\"right\\"} -->
|
|
71
|
+
<p class=\\"has-text-align-right\\"></p>
|
|
72
|
+
<!-- /wp:paragraph -->"
|
|
73
|
+
`;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
getEditorHtml,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
getBlock,
|
|
9
|
+
fireEvent,
|
|
10
|
+
within,
|
|
11
|
+
} from 'test/helpers';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
17
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
18
|
+
|
|
19
|
+
const imageHTML = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none"} -->
|
|
20
|
+
<figure class="wp-block-image size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
21
|
+
<!-- /wp:image -->`;
|
|
22
|
+
|
|
23
|
+
beforeAll( () => {
|
|
24
|
+
// Register all core blocks
|
|
25
|
+
registerCoreBlocks();
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
afterAll( () => {
|
|
29
|
+
// Clean up registered blocks
|
|
30
|
+
getBlockTypes().forEach( ( block ) => {
|
|
31
|
+
unregisterBlockType( block.name );
|
|
32
|
+
} );
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
describe( 'Align options', () => {
|
|
36
|
+
describe( 'for media block', () => {
|
|
37
|
+
[
|
|
38
|
+
'None',
|
|
39
|
+
'Align left',
|
|
40
|
+
'Align center',
|
|
41
|
+
'Align right',
|
|
42
|
+
'Wide width',
|
|
43
|
+
'Full width',
|
|
44
|
+
].forEach( ( alignmentOption ) =>
|
|
45
|
+
it( `sets ${ alignmentOption } option`, async () => {
|
|
46
|
+
const screen = await initializeEditor( {
|
|
47
|
+
initialHtml: imageHTML,
|
|
48
|
+
} );
|
|
49
|
+
const { getByLabelText } = screen;
|
|
50
|
+
|
|
51
|
+
// Get Image block
|
|
52
|
+
const imageBlock = await getBlock( screen, 'Image' );
|
|
53
|
+
expect( imageBlock ).toBeVisible();
|
|
54
|
+
fireEvent.press( imageBlock );
|
|
55
|
+
|
|
56
|
+
// Open alignments menu
|
|
57
|
+
const alignmentButtons = getByLabelText( 'Align' );
|
|
58
|
+
fireEvent.press( alignmentButtons );
|
|
59
|
+
|
|
60
|
+
// Select alignment option.
|
|
61
|
+
fireEvent.press( await getByLabelText( alignmentOption ) );
|
|
62
|
+
|
|
63
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
64
|
+
} )
|
|
65
|
+
);
|
|
66
|
+
} );
|
|
67
|
+
|
|
68
|
+
describe( 'for text block', () => {
|
|
69
|
+
[ 'Align text left', 'Align text center', 'Align text right' ].forEach(
|
|
70
|
+
( alignmentOption ) =>
|
|
71
|
+
it( `sets ${ alignmentOption } option`, async () => {
|
|
72
|
+
const screen = await initializeEditor();
|
|
73
|
+
const { getByLabelText } = screen;
|
|
74
|
+
|
|
75
|
+
// Add Paragraph block
|
|
76
|
+
await addBlock( screen, 'Paragraph' );
|
|
77
|
+
|
|
78
|
+
// Get Paragraph block
|
|
79
|
+
const paragraphBlock = await getBlock(
|
|
80
|
+
screen,
|
|
81
|
+
'Paragraph'
|
|
82
|
+
);
|
|
83
|
+
expect( paragraphBlock ).toBeVisible();
|
|
84
|
+
|
|
85
|
+
// Open alignments menu
|
|
86
|
+
const alignmentButtons = getByLabelText( 'Align text' );
|
|
87
|
+
fireEvent.press( alignmentButtons );
|
|
88
|
+
|
|
89
|
+
// Select alignment option.
|
|
90
|
+
fireEvent.press( await getByLabelText( alignmentOption ) );
|
|
91
|
+
|
|
92
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
93
|
+
} )
|
|
94
|
+
);
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
describe( 'for group block', () => {
|
|
98
|
+
[ 'None', 'Wide width', 'Full width' ].forEach( ( alignmentOption ) =>
|
|
99
|
+
it( `sets ${ alignmentOption } option`, async () => {
|
|
100
|
+
const screen = await initializeEditor();
|
|
101
|
+
const { getByLabelText } = screen;
|
|
102
|
+
|
|
103
|
+
// Add Group block
|
|
104
|
+
await addBlock( screen, 'Group' );
|
|
105
|
+
|
|
106
|
+
// Get Paragraph block
|
|
107
|
+
const groupBlock = await getBlock( screen, 'Group' );
|
|
108
|
+
expect( groupBlock ).toBeVisible();
|
|
109
|
+
|
|
110
|
+
// Trigger inner blocks layout
|
|
111
|
+
const innerBlockListWrapper = await within(
|
|
112
|
+
groupBlock
|
|
113
|
+
).findByTestId( 'block-list-wrapper' );
|
|
114
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
115
|
+
nativeEvent: {
|
|
116
|
+
layout: {
|
|
117
|
+
width: 300,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
} );
|
|
121
|
+
|
|
122
|
+
// Open alignments menu
|
|
123
|
+
const alignmentButtons = getByLabelText( 'Align' );
|
|
124
|
+
fireEvent.press( alignmentButtons );
|
|
125
|
+
|
|
126
|
+
// Select alignment option.
|
|
127
|
+
fireEvent.press( await getByLabelText( alignmentOption ) );
|
|
128
|
+
|
|
129
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
130
|
+
} )
|
|
131
|
+
);
|
|
132
|
+
} );
|
|
133
|
+
} );
|
package/src/hooks/test/utils.js
CHANGED
|
@@ -7,9 +7,113 @@ import { applyFilters } from '@wordpress/hooks';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import '../anchor';
|
|
10
|
+
import { immutableSet } from '../utils';
|
|
10
11
|
|
|
11
12
|
const noop = () => {};
|
|
12
13
|
|
|
14
|
+
describe( 'immutableSet', () => {
|
|
15
|
+
describe( 'handling falsy values properly', () => {
|
|
16
|
+
it( 'should create a new object if `undefined` is passed', () => {
|
|
17
|
+
const result = immutableSet( undefined, 'test', 1 );
|
|
18
|
+
|
|
19
|
+
expect( result ).toEqual( { test: 1 } );
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
it( 'should create a new object if `null` is passed', () => {
|
|
23
|
+
const result = immutableSet( null, 'test', 1 );
|
|
24
|
+
|
|
25
|
+
expect( result ).toEqual( { test: 1 } );
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'should create a new object if `false` is passed', () => {
|
|
29
|
+
const result = immutableSet( false, 'test', 1 );
|
|
30
|
+
|
|
31
|
+
expect( result ).toEqual( { test: 1 } );
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
it( 'should create a new object if `0` is passed', () => {
|
|
35
|
+
const result = immutableSet( 0, 'test', 1 );
|
|
36
|
+
|
|
37
|
+
expect( result ).toEqual( { test: 1 } );
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
it( 'should create a new object if an empty string is passed', () => {
|
|
41
|
+
const result = immutableSet( '', 'test', 1 );
|
|
42
|
+
|
|
43
|
+
expect( result ).toEqual( { test: 1 } );
|
|
44
|
+
} );
|
|
45
|
+
|
|
46
|
+
it( 'should create a new object if a NaN is passed', () => {
|
|
47
|
+
const result = immutableSet( NaN, 'test', 1 );
|
|
48
|
+
|
|
49
|
+
expect( result ).toEqual( { test: 1 } );
|
|
50
|
+
} );
|
|
51
|
+
} );
|
|
52
|
+
|
|
53
|
+
describe( 'manages data assignment properly', () => {
|
|
54
|
+
it( 'assigns value properly when it does not exist', () => {
|
|
55
|
+
const result = immutableSet( {}, 'test', 1 );
|
|
56
|
+
|
|
57
|
+
expect( result ).toEqual( { test: 1 } );
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
it( 'overrides existing values', () => {
|
|
61
|
+
const result = immutableSet( { test: 1 }, 'test', 2 );
|
|
62
|
+
|
|
63
|
+
expect( result ).toEqual( { test: 2 } );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
describe( 'with array notation access', () => {
|
|
67
|
+
it( 'assigns values at deeper levels', () => {
|
|
68
|
+
const result = immutableSet( {}, [ 'foo', 'bar', 'baz' ], 5 );
|
|
69
|
+
|
|
70
|
+
expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
|
|
71
|
+
} );
|
|
72
|
+
|
|
73
|
+
it( 'overrides existing values at deeper levels', () => {
|
|
74
|
+
const result = immutableSet(
|
|
75
|
+
{ foo: { bar: { baz: 1 } } },
|
|
76
|
+
[ 'foo', 'bar', 'baz' ],
|
|
77
|
+
5
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
it( 'keeps other properties intact', () => {
|
|
84
|
+
const result = immutableSet(
|
|
85
|
+
{ foo: { bar: { baz: 1 } } },
|
|
86
|
+
[ 'foo', 'bar', 'test' ],
|
|
87
|
+
5
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
expect( result ).toEqual( {
|
|
91
|
+
foo: { bar: { baz: 1, test: 5 } },
|
|
92
|
+
} );
|
|
93
|
+
} );
|
|
94
|
+
} );
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
describe( 'does not mutate the original object', () => {
|
|
98
|
+
it( 'clones the object at the first level', () => {
|
|
99
|
+
const input = {};
|
|
100
|
+
const result = immutableSet( input, 'test', 1 );
|
|
101
|
+
|
|
102
|
+
expect( result ).not.toBe( input );
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
it( 'clones the object at deeper levels', () => {
|
|
106
|
+
const input = { foo: { bar: { baz: 1 } } };
|
|
107
|
+
const result = immutableSet( input, [ 'foo', 'bar', 'baz' ], 2 );
|
|
108
|
+
|
|
109
|
+
expect( result ).not.toBe( input );
|
|
110
|
+
expect( result.foo ).not.toBe( input.foo );
|
|
111
|
+
expect( result.foo.bar ).not.toBe( input.foo.bar );
|
|
112
|
+
expect( result.foo.bar.baz ).not.toBe( input.foo.bar.baz );
|
|
113
|
+
} );
|
|
114
|
+
} );
|
|
115
|
+
} );
|
|
116
|
+
|
|
13
117
|
describe( 'anchor', () => {
|
|
14
118
|
const blockSettings = {
|
|
15
119
|
save: noop,
|
package/src/hooks/typography.js
CHANGED
|
@@ -111,7 +111,7 @@ export function TypographyPanel( props ) {
|
|
|
111
111
|
} );
|
|
112
112
|
|
|
113
113
|
return (
|
|
114
|
-
<InspectorControls
|
|
114
|
+
<InspectorControls group="typography">
|
|
115
115
|
{ ! isFontFamilyDisabled && (
|
|
116
116
|
<ToolsPanelItem
|
|
117
117
|
hasValue={ () => hasFontFamilyValue( props ) }
|
|
@@ -92,9 +92,9 @@ export function useColorProps( attributes ) {
|
|
|
92
92
|
// Some color settings have a special handling for deprecated flags in `useSetting`,
|
|
93
93
|
// so we can't unwrap them by doing const { ... } = useSetting('color')
|
|
94
94
|
// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
|
|
95
|
-
const userPalette = useSetting( 'color.palette.custom' )
|
|
96
|
-
const themePalette = useSetting( 'color.palette.theme' )
|
|
97
|
-
const defaultPalette = useSetting( 'color.palette.default' )
|
|
95
|
+
const userPalette = useSetting( 'color.palette.custom' );
|
|
96
|
+
const themePalette = useSetting( 'color.palette.theme' );
|
|
97
|
+
const defaultPalette = useSetting( 'color.palette.default' );
|
|
98
98
|
const gradientsPerOrigin = useSetting( 'color.gradients' ) || EMPTY_OBJECT;
|
|
99
99
|
const colors = useMemo(
|
|
100
100
|
() => [
|