@wordpress/block-editor 9.6.0 → 9.8.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 +4 -0
- package/build/components/block-alignment-control/use-available-alignments.js +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-edit-visually-button/index.js +46 -0
- package/build/components/block-edit-visually-button/index.js.map +1 -0
- package/build/components/block-list/block.js +12 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +5 -3
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +10 -4
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-settings-menu/index.js +2 -6
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-styles/index.js +3 -6
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -16
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +10 -2
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +126 -0
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
- package/build/components/block-types-list/index.js +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/border-radius-control/all-input-control.js +31 -3
- package/build/components/border-radius-control/all-input-control.js.map +1 -1
- package/build/components/border-radius-control/index.js +23 -7
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +21 -6
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/utils.js +13 -16
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +6 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +17 -4
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +7 -4
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +5 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/copy-handler/index.js +6 -0
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -7
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/components.js +5 -5
- package/build/components/duotone/components.js.map +1 -1
- package/build/components/font-appearance-control/index.js +10 -4
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +1 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +17 -4
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +22 -6
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +11 -4
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/index.native.js +8 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/search-items.js +22 -4
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -19
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +6 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js +1 -7
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/link-preview.js +0 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -7
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/expander.js +3 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -7
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-upload/index.native.js +8 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/{use-no-recursive-renders → recursion-provider}/index.js +40 -18
- package/build/components/recursion-provider/index.js.map +1 -0
- package/build/components/rich-text/index.js +6 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-before-input-rules.js +110 -0
- package/build/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build/components/rich-text/use-enter.js +0 -4
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +8 -11
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/all-input-control.js +53 -0
- package/build/components/spacing-sizes-control/all-input-control.js.map +1 -0
- package/build/components/spacing-sizes-control/axial-input-controls.js +69 -0
- package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
- package/build/components/spacing-sizes-control/index.js +100 -0
- package/build/components/spacing-sizes-control/index.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls.js +52 -0
- package/build/components/spacing-sizes-control/input-controls.js.map +1 -0
- package/build/components/spacing-sizes-control/linked-button.js +38 -0
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js +208 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
- package/build/components/spacing-sizes-control/utils.js +202 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -0
- package/build/components/text-decoration-control/index.js +3 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +3 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +4 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -25
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +9 -2
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +4 -2
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +10 -2
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/border-radius.js +2 -7
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border.js +2 -2
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +4 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +15 -0
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +4 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/gap.js +6 -4
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -7
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/layout.js +29 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +28 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +19 -8
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +4 -50
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/constrained.js +215 -0
- package/build/layouts/constrained.js.map +1 -0
- package/build/layouts/flex.js +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +7 -151
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/layouts/utils.js +43 -0
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +25 -3
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +4 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-variation-transforms.js +15 -9
- package/build/utils/block-variation-transforms.js.map +1 -1
- package/build/utils/pasting.js +9 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-edit-visually-button/index.js +35 -0
- package/build-module/components/block-edit-visually-button/index.js.map +1 -0
- package/build-module/components/block-list/block.js +13 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +5 -3
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +8 -4
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +3 -6
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +4 -7
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -16
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +4 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +8 -2
- 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 +114 -0
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
- package/build-module/components/block-types-list/index.js +1 -1
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/border-radius-control/all-input-control.js +32 -4
- package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +24 -8
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +22 -7
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +13 -16
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +7 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +16 -3
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +7 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +5 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/copy-handler/index.js +7 -1
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -6
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/duotone/components.js +5 -5
- package/build-module/components/duotone/components.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +7 -4
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +1 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +16 -3
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +2 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/index.native.js +9 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/search-items.js +19 -5
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -17
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +5 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +5 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js +1 -6
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +0 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -6
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +5 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/expander.js +3 -2
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -6
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +9 -2
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -19
- package/build-module/components/recursion-provider/index.js.map +1 -0
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-before-input-rules.js +96 -0
- package/build-module/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build-module/components/rich-text/use-enter.js +0 -4
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +8 -10
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/all-input-control.js +41 -0
- package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -0
- package/build-module/components/spacing-sizes-control/axial-input-controls.js +57 -0
- package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
- package/build-module/components/spacing-sizes-control/index.js +83 -0
- package/build-module/components/spacing-sizes-control/index.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls.js +41 -0
- package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -0
- package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +192 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
- package/build-module/components/spacing-sizes-control/utils.js +174 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -0
- package/build-module/components/text-decoration-control/index.js +4 -2
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +4 -2
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +4 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +5 -26
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +9 -2
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +4 -2
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +10 -2
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/border-radius.js +2 -7
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border.js +2 -2
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +4 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +13 -0
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/gap.js +3 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -6
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/layout.js +29 -14
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +26 -12
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +17 -8
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +7 -53
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/constrained.js +197 -0
- package/build-module/layouts/constrained.js.map +1 -0
- package/build-module/layouts/flex.js +1 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +8 -145
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/layouts/utils.js +40 -0
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +25 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +5 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-variation-transforms.js +14 -7
- package/build-module/utils/block-variation-transforms.js.map +1 -1
- package/build-module/utils/pasting.js +9 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/style-rtl.css +154 -27
- package/build-style/style.css +154 -27
- package/package.json +30 -28
- package/src/components/block-alignment-control/use-available-alignments.js +1 -1
- package/src/components/block-edit-visually-button/index.js +39 -0
- package/src/components/block-list/block.js +13 -2
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-popover/inbetween.js +5 -1
- package/src/components/block-popover/index.js +22 -13
- package/src/components/block-popover/style.scss +25 -2
- package/src/components/block-settings-menu/index.js +11 -15
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/style.scss +10 -0
- package/src/components/block-switcher/index.js +9 -13
- package/src/components/block-switcher/test/index.js +1 -0
- package/src/components/block-toolbar/index.js +2 -0
- package/src/components/block-tools/selected-block-popover.js +7 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +123 -0
- package/src/components/block-types-list/index.js +1 -1
- package/src/components/border-radius-control/all-input-control.js +41 -4
- package/src/components/border-radius-control/index.js +29 -6
- package/src/components/border-radius-control/input-controls.js +40 -13
- package/src/components/border-radius-control/test/utils.js +22 -60
- package/src/components/border-radius-control/utils.js +12 -16
- package/src/components/color-palette/test/__snapshots__/control.js.snap +93 -77
- package/src/components/colors/utils.js +5 -2
- package/src/components/colors/with-colors.js +11 -1
- package/src/components/colors-gradients/control.js +12 -8
- package/src/components/colors-gradients/dropdown.js +7 -2
- package/src/components/colors-gradients/style.scss +27 -5
- package/src/components/colors-gradients/test/control.js +3 -3
- package/src/components/copy-handler/index.js +18 -0
- package/src/components/date-format-picker/index.js +12 -14
- package/src/components/date-format-picker/style.scss +0 -4
- package/src/components/duotone/components.js +5 -5
- package/src/components/duotone-control/style.scss +0 -4
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-appearance-control/style.scss +0 -2
- package/src/components/font-family/index.js +1 -1
- package/src/components/font-sizes/with-font-sizes.js +11 -1
- package/src/components/image-size-control/README.md +7 -0
- package/src/components/image-size-control/index.js +2 -0
- package/src/components/index.js +5 -1
- package/src/components/index.native.js +4 -1
- package/src/components/inserter/index.native.js +7 -2
- package/src/components/inserter/search-items.js +17 -5
- package/src/components/inserter-list-item/index.js +1 -17
- package/src/components/letter-spacing-control/index.js +2 -0
- package/src/components/line-height-control/index.js +2 -0
- package/src/components/link-control/is-url-like.js +1 -6
- package/src/components/link-control/link-preview.js +0 -1
- package/src/components/link-control/test/index.js +540 -893
- package/src/components/link-control/use-search-handler.js +1 -6
- package/src/components/list-view/block-select-button.js +7 -2
- package/src/components/list-view/expander.js +4 -2
- package/src/components/list-view/style.scss +11 -4
- package/src/components/list-view/use-block-selection.js +2 -8
- package/src/components/media-replace-flow/style.scss +1 -0
- package/src/components/media-upload/index.native.js +7 -3
- package/src/components/preview-options/index.js +2 -2
- package/src/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -28
- package/src/components/{use-no-recursive-renders/test/use-no-recursive-renders.js → recursion-provider/test/index.js} +5 -6
- package/src/components/rich-text/README.md +13 -1
- package/src/components/rich-text/index.js +2 -0
- package/src/components/rich-text/index.native.js +2 -0
- package/src/components/rich-text/use-before-input-rules.js +91 -0
- package/src/components/rich-text/use-enter.js +0 -3
- package/src/components/rich-text/use-format-types.js +6 -6
- package/src/components/spacing-sizes-control/all-input-control.js +40 -0
- package/src/components/spacing-sizes-control/axial-input-controls.js +62 -0
- package/src/components/spacing-sizes-control/index.js +91 -0
- package/src/components/spacing-sizes-control/input-controls.js +46 -0
- package/src/components/spacing-sizes-control/linked-button.js +25 -0
- package/src/components/spacing-sizes-control/spacing-input-control.js +280 -0
- package/src/components/spacing-sizes-control/style.scss +122 -0
- package/src/components/spacing-sizes-control/test/utils.js +156 -0
- package/src/components/spacing-sizes-control/utils.js +195 -0
- package/src/components/text-decoration-control/index.js +4 -2
- package/src/components/text-transform-control/index.js +4 -2
- package/src/components/url-input/index.js +1 -1
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +3 -0
- package/src/components/url-popover/style.scss +0 -3
- package/src/components/writing-flow/use-arrow-nav.js +4 -33
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-multi-selection.js +4 -1
- package/src/components/writing-flow/use-select-all.js +2 -1
- package/src/components/writing-flow/use-selection-observer.js +10 -2
- package/src/hooks/border-radius.js +2 -6
- package/src/hooks/border.js +2 -2
- package/src/hooks/color.js +13 -3
- package/src/hooks/dimensions.js +15 -0
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/gap.js +7 -2
- package/src/hooks/generated-class-name.js +6 -9
- package/src/hooks/layout.js +53 -16
- package/src/hooks/margin.js +49 -17
- package/src/hooks/padding.js +41 -14
- package/src/hooks/style.js +5 -56
- package/src/hooks/test/gap.js +22 -0
- package/src/hooks/typography.scss +0 -1
- package/src/layouts/constrained.js +217 -0
- package/src/layouts/flex.js +1 -1
- package/src/layouts/flow.js +6 -164
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/constrained.js +21 -0
- package/src/layouts/utils.js +34 -0
- package/src/store/actions.js +32 -4
- package/src/store/selectors.js +5 -4
- package/src/style.scss +1 -0
- package/src/utils/block-variation-transforms.js +13 -6
- package/src/utils/pasting.js +10 -1
- package/src/utils/test/block-variation-transforms.js +24 -0
- package/src/utils/test/pasting.js +10 -0
- package/build/components/block-settings-menu/block-edit-visually-button.js +0 -70
- package/build/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
- package/build/components/use-no-recursive-renders/index.js.map +0 -1
- package/build-module/components/block-settings-menu/block-edit-visually-button.js +0 -56
- package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
- package/build-module/components/use-no-recursive-renders/index.js.map +0 -1
- package/src/components/block-settings-menu/block-edit-visually-button.js +0 -52
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { isEmpty } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks is given value is a spacing preset.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} value Value to check
|
|
15
|
+
*
|
|
16
|
+
* @return {boolean} Return true if value is string in format var:preset|spacing|.
|
|
17
|
+
*/
|
|
18
|
+
export function isValueSpacingPreset( value ) {
|
|
19
|
+
if ( ! value?.includes ) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return value === '0' || value.includes( 'var:preset|spacing|' );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Converts a spacing preset into a custom value.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} value Value to convert
|
|
29
|
+
* @param {Array} spacingSizes Array of the current spacing preset objects
|
|
30
|
+
*
|
|
31
|
+
* @return {string} Mapping of the spacing preset to its equivalent custom value.
|
|
32
|
+
*/
|
|
33
|
+
export function getCustomValueFromPreset( value, spacingSizes ) {
|
|
34
|
+
if ( ! isValueSpacingPreset( value ) ) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const slug = getSpacingPresetSlug( value );
|
|
39
|
+
const spacingSize = spacingSizes.find(
|
|
40
|
+
( size ) => String( size.slug ) === slug
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return spacingSize?.size;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Converts a spacing preset into a custom value.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} value Value to convert.
|
|
50
|
+
*
|
|
51
|
+
* @return {string} CSS var string for given spacing preset value.
|
|
52
|
+
*/
|
|
53
|
+
export function getSpacingPresetCssVar( value ) {
|
|
54
|
+
if ( ! value ) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const slug = value.match( /var:preset\|spacing\|(.+)/ );
|
|
59
|
+
|
|
60
|
+
if ( ! slug ) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return `var(--wp--preset--spacing--${ slug[ 1 ] })`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the slug section of the given spacing preset string.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} value Value to extract slug from.
|
|
71
|
+
*
|
|
72
|
+
* @return {number} The int value of the slug from given spacing preset.
|
|
73
|
+
*/
|
|
74
|
+
export function getSpacingPresetSlug( value ) {
|
|
75
|
+
if ( ! value ) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ( value === '0' || value === 'default' ) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const slug = value.match( /var:preset\|spacing\|(.+)/ );
|
|
84
|
+
|
|
85
|
+
return slug ? slug[ 1 ] : undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Converts spacing preset value into a Range component value .
|
|
90
|
+
*
|
|
91
|
+
* @param {string} presetValue Value to convert to Range value.
|
|
92
|
+
* @param {Array} spacingSizes Array of current spacing preset value objects.
|
|
93
|
+
*
|
|
94
|
+
* @return {number} The int value for use in Range control.
|
|
95
|
+
*/
|
|
96
|
+
export function getSliderValueFromPreset( presetValue, spacingSizes ) {
|
|
97
|
+
if ( presetValue === undefined ) {
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
const slug =
|
|
101
|
+
parseFloat( presetValue, 10 ) === 0
|
|
102
|
+
? '0'
|
|
103
|
+
: getSpacingPresetSlug( presetValue );
|
|
104
|
+
const sliderValue = spacingSizes.findIndex( ( spacingSize ) => {
|
|
105
|
+
return String( spacingSize.slug ) === slug;
|
|
106
|
+
} );
|
|
107
|
+
|
|
108
|
+
// Returning NaN rather than undefined as undefined makes range control thumb sit in center
|
|
109
|
+
return sliderValue !== -1 ? sliderValue : NaN;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const LABELS = {
|
|
113
|
+
all: __( 'All sides' ),
|
|
114
|
+
top: __( 'Top' ),
|
|
115
|
+
bottom: __( 'Bottom' ),
|
|
116
|
+
left: __( 'Left' ),
|
|
117
|
+
right: __( 'Right' ),
|
|
118
|
+
mixed: __( 'Mixed' ),
|
|
119
|
+
vertical: __( 'Vertical' ),
|
|
120
|
+
horizontal: __( 'Horizontal' ),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const DEFAULT_VALUES = {
|
|
124
|
+
top: undefined,
|
|
125
|
+
right: undefined,
|
|
126
|
+
bottom: undefined,
|
|
127
|
+
left: undefined,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Gets an items with the most occurrence within an array
|
|
134
|
+
* https://stackoverflow.com/a/20762713
|
|
135
|
+
*
|
|
136
|
+
* @param {Array<any>} arr Array of items to check.
|
|
137
|
+
* @return {any} The item with the most occurrences.
|
|
138
|
+
*/
|
|
139
|
+
function mode( arr ) {
|
|
140
|
+
return arr
|
|
141
|
+
.sort(
|
|
142
|
+
( a, b ) =>
|
|
143
|
+
arr.filter( ( v ) => v === a ).length -
|
|
144
|
+
arr.filter( ( v ) => v === b ).length
|
|
145
|
+
)
|
|
146
|
+
.pop();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Gets the 'all' input value from values data.
|
|
151
|
+
*
|
|
152
|
+
* @param {Object} values Box spacing values
|
|
153
|
+
*
|
|
154
|
+
* @return {string} The most common value from all sides of box.
|
|
155
|
+
*/
|
|
156
|
+
export function getAllRawValue( values = {} ) {
|
|
157
|
+
return mode( Object.values( values ) );
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Checks to determine if values are mixed.
|
|
162
|
+
*
|
|
163
|
+
* @param {Object} values Box values.
|
|
164
|
+
* @param {Array} sides Sides that values relate to.
|
|
165
|
+
*
|
|
166
|
+
* @return {boolean} Whether values are mixed.
|
|
167
|
+
*/
|
|
168
|
+
export function isValuesMixed( values = {}, sides = ALL_SIDES ) {
|
|
169
|
+
return (
|
|
170
|
+
( Object.values( values ).length >= 1 &&
|
|
171
|
+
Object.values( values ).length < sides.length ) ||
|
|
172
|
+
new Set( Object.values( values ) ).size > 1
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Checks to determine if values are defined.
|
|
178
|
+
*
|
|
179
|
+
* @param {Object} values Box values.
|
|
180
|
+
*
|
|
181
|
+
* @return {boolean} Whether values are defined.
|
|
182
|
+
*/
|
|
183
|
+
export function isValuesDefined( values ) {
|
|
184
|
+
return (
|
|
185
|
+
values !== undefined &&
|
|
186
|
+
! isEmpty(
|
|
187
|
+
Object.values( values ).filter(
|
|
188
|
+
// Switching units when input is empty causes values only
|
|
189
|
+
// containing units. This gives false positive on mixed values
|
|
190
|
+
// unless filtered.
|
|
191
|
+
( value ) => !! value && /\d/.test( value )
|
|
192
|
+
)
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button } from '@wordpress/components';
|
|
4
|
+
import { BaseControl, Button } from '@wordpress/components';
|
|
5
5
|
import { formatStrikethrough, formatUnderline } from '@wordpress/icons';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
@@ -30,7 +30,9 @@ const TEXT_DECORATIONS = [
|
|
|
30
30
|
export default function TextDecorationControl( { value, onChange } ) {
|
|
31
31
|
return (
|
|
32
32
|
<fieldset className="block-editor-text-decoration-control">
|
|
33
|
-
<
|
|
33
|
+
<BaseControl.VisualLabel as="legend">
|
|
34
|
+
{ __( 'Decoration' ) }
|
|
35
|
+
</BaseControl.VisualLabel>
|
|
34
36
|
<div className="block-editor-text-decoration-control__buttons">
|
|
35
37
|
{ TEXT_DECORATIONS.map( ( textDecoration ) => {
|
|
36
38
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button } from '@wordpress/components';
|
|
4
|
+
import { BaseControl, Button } from '@wordpress/components';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import {
|
|
7
7
|
formatCapitalize,
|
|
@@ -39,7 +39,9 @@ const TEXT_TRANSFORMS = [
|
|
|
39
39
|
export default function TextTransformControl( { value, onChange } ) {
|
|
40
40
|
return (
|
|
41
41
|
<fieldset className="block-editor-text-transform-control">
|
|
42
|
-
<
|
|
42
|
+
<BaseControl.VisualLabel as="legend">
|
|
43
|
+
{ __( 'Letter case' ) }
|
|
44
|
+
</BaseControl.VisualLabel>
|
|
43
45
|
<div className="block-editor-text-transform-control__buttons">
|
|
44
46
|
{ TEXT_TRANSFORMS.map( ( textTransform ) => {
|
|
45
47
|
return (
|
|
@@ -462,7 +462,7 @@ class URLInput extends Component {
|
|
|
462
462
|
'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label
|
|
463
463
|
'aria-expanded': showSuggestions,
|
|
464
464
|
'aria-autocomplete': 'list',
|
|
465
|
-
'aria-
|
|
465
|
+
'aria-controls': suggestionsListboxId,
|
|
466
466
|
'aria-activedescendant':
|
|
467
467
|
selectedSuggestion !== null
|
|
468
468
|
? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`
|
|
@@ -51,6 +51,7 @@ const ImageURLInputUI = ( {
|
|
|
51
51
|
rel,
|
|
52
52
|
} ) => {
|
|
53
53
|
const [ isOpen, setIsOpen ] = useState( false );
|
|
54
|
+
const buttonRef = useRef( null );
|
|
54
55
|
const openLinkUI = useCallback( () => {
|
|
55
56
|
setIsOpen( true );
|
|
56
57
|
} );
|
|
@@ -245,9 +246,11 @@ const ImageURLInputUI = ( {
|
|
|
245
246
|
label={ url ? __( 'Edit link' ) : __( 'Insert link' ) }
|
|
246
247
|
aria-expanded={ isOpen }
|
|
247
248
|
onClick={ openLinkUI }
|
|
249
|
+
ref={ buttonRef }
|
|
248
250
|
/>
|
|
249
251
|
{ isOpen && (
|
|
250
252
|
<URLPopover
|
|
253
|
+
anchorRef={ buttonRef }
|
|
251
254
|
onFocusOutside={ onFocusOutside() }
|
|
252
255
|
onClose={ closeLinkUI }
|
|
253
256
|
renderSettings={ () => advancedOptions }
|
|
@@ -17,7 +17,7 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import { getBlockClientId } from '../../utils/dom';
|
|
21
21
|
import { store as blockEditorStore } from '../../store';
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -130,11 +130,8 @@ export function getClosestTabbable(
|
|
|
130
130
|
|
|
131
131
|
export default function useArrowNav() {
|
|
132
132
|
const {
|
|
133
|
-
getSelectedBlockClientId,
|
|
134
133
|
getMultiSelectedBlocksStartClientId,
|
|
135
134
|
getMultiSelectedBlocksEndClientId,
|
|
136
|
-
getPreviousBlockClientId,
|
|
137
|
-
getNextBlockClientId,
|
|
138
135
|
getSettings,
|
|
139
136
|
hasMultiSelection,
|
|
140
137
|
__unstableIsFullySelected,
|
|
@@ -150,26 +147,13 @@ export default function useArrowNav() {
|
|
|
150
147
|
verticalRect = null;
|
|
151
148
|
}
|
|
152
149
|
|
|
153
|
-
|
|
154
|
-
* Returns true if the given target field is the last in its block which
|
|
155
|
-
* can be considered for tab transition. For example, in a block with
|
|
156
|
-
* two text fields, this would return true when reversing from the first
|
|
157
|
-
* of the two fields, but false when reversing from the second.
|
|
158
|
-
*
|
|
159
|
-
* @param {Element} target Currently focused text field.
|
|
160
|
-
* @param {boolean} isReverse True if considering as the first field.
|
|
161
|
-
*
|
|
162
|
-
* @return {boolean} Whether field is at edge for tab transition.
|
|
163
|
-
*/
|
|
164
|
-
function isTabbableEdge( target, isReverse ) {
|
|
150
|
+
function isClosestTabbableABlock( target, isReverse ) {
|
|
165
151
|
const closestTabbable = getClosestTabbable(
|
|
166
152
|
target,
|
|
167
153
|
isReverse,
|
|
168
154
|
node
|
|
169
155
|
);
|
|
170
|
-
return (
|
|
171
|
-
! closestTabbable || ! isInSameBlock( target, closestTabbable )
|
|
172
|
-
);
|
|
156
|
+
return closestTabbable && getBlockClientId( closestTabbable );
|
|
173
157
|
}
|
|
174
158
|
|
|
175
159
|
function onKeyDown( event ) {
|
|
@@ -254,23 +238,10 @@ export default function useArrowNav() {
|
|
|
254
238
|
// next, which is the exact reverse of LTR.
|
|
255
239
|
const isReverseDir = isRTL( target ) ? ! isReverse : isReverse;
|
|
256
240
|
const { keepCaretInsideBlock } = getSettings();
|
|
257
|
-
const selectedBlockClientId = getSelectedBlockClientId();
|
|
258
241
|
|
|
259
242
|
if ( isShift ) {
|
|
260
|
-
const selectionEndClientId =
|
|
261
|
-
getMultiSelectedBlocksEndClientId();
|
|
262
|
-
const selectionBeforeEndClientId = getPreviousBlockClientId(
|
|
263
|
-
selectionEndClientId || selectedBlockClientId
|
|
264
|
-
);
|
|
265
|
-
const selectionAfterEndClientId = getNextBlockClientId(
|
|
266
|
-
selectionEndClientId || selectedBlockClientId
|
|
267
|
-
);
|
|
268
|
-
|
|
269
243
|
if (
|
|
270
|
-
|
|
271
|
-
( ( isReverse && selectionBeforeEndClientId ) ||
|
|
272
|
-
( ! isReverse && selectionAfterEndClientId ) ) &&
|
|
273
|
-
isTabbableEdge( target, isReverse ) &&
|
|
244
|
+
isClosestTabbableABlock( target, isReverse ) &&
|
|
274
245
|
isNavEdge( target, isReverse )
|
|
275
246
|
) {
|
|
276
247
|
node.contentEditable = true;
|
|
@@ -27,7 +27,7 @@ function setContentEditableWrapper( node, value ) {
|
|
|
27
27
|
export default function useDragSelection() {
|
|
28
28
|
const { startMultiSelect, stopMultiSelect } =
|
|
29
29
|
useDispatch( blockEditorStore );
|
|
30
|
-
const { isSelectionEnabled, hasMultiSelection } =
|
|
30
|
+
const { isSelectionEnabled, hasMultiSelection, isDraggingBlocks } =
|
|
31
31
|
useSelect( blockEditorStore );
|
|
32
32
|
return useRefEffect(
|
|
33
33
|
( node ) => {
|
|
@@ -72,6 +72,12 @@ export default function useDragSelection() {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function onMouseLeave( { buttons, target } ) {
|
|
75
|
+
// Avoid triggering a multi-selection if the user is already
|
|
76
|
+
// dragging blocks.
|
|
77
|
+
if ( isDraggingBlocks() ) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
// The primary button must be pressed to initiate selection.
|
|
76
82
|
// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
77
83
|
if ( buttons !== 1 ) {
|
|
@@ -75,8 +75,11 @@ export default function useMultiSelection() {
|
|
|
75
75
|
// able to select across instances immediately.
|
|
76
76
|
node.contentEditable = true;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// For some browsers, like Safari, it is important that focus
|
|
79
|
+
// happens BEFORE selection removal.
|
|
79
80
|
node.focus();
|
|
81
|
+
|
|
82
|
+
defaultView.getSelection().removeAllRanges();
|
|
80
83
|
},
|
|
81
84
|
[
|
|
82
85
|
hasMultiSelection,
|
|
@@ -19,7 +19,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
19
19
|
export default function useSelectAll() {
|
|
20
20
|
const { getBlockOrder, getSelectedBlockClientIds, getBlockRootClientId } =
|
|
21
21
|
useSelect( blockEditorStore );
|
|
22
|
-
const { multiSelect } = useDispatch( blockEditorStore );
|
|
22
|
+
const { multiSelect, selectBlock } = useDispatch( blockEditorStore );
|
|
23
23
|
const isMatch = useShortcutEventMatch();
|
|
24
24
|
|
|
25
25
|
return useRefEffect( ( node ) => {
|
|
@@ -53,6 +53,7 @@ export default function useSelectAll() {
|
|
|
53
53
|
const lastClientId = last( blockClientIds );
|
|
54
54
|
|
|
55
55
|
if ( firstClientId === lastClientId ) {
|
|
56
|
+
selectBlock( firstClientId );
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -25,7 +25,11 @@ function extractSelectionStartNode( selection ) {
|
|
|
25
25
|
return anchorNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
if ( anchorOffset === 0 ) {
|
|
29
|
+
return anchorNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return anchorNode.childNodes[ anchorOffset - 1 ];
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
/**
|
|
@@ -44,7 +48,11 @@ function extractSelectionEndNode( selection ) {
|
|
|
44
48
|
return focusNode;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
if ( focusOffset === focusNode.childNodes.length ) {
|
|
52
|
+
return focusNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return focusNode.childNodes[ focusOffset ];
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
function findDepth( a, b ) {
|
|
@@ -19,17 +19,13 @@ export function BorderRadiusEdit( props ) {
|
|
|
19
19
|
} = props;
|
|
20
20
|
|
|
21
21
|
const onChange = ( newRadius ) => {
|
|
22
|
-
|
|
22
|
+
const newStyle = cleanEmptyObject( {
|
|
23
23
|
...style,
|
|
24
24
|
border: {
|
|
25
25
|
...style?.border,
|
|
26
26
|
radius: newRadius,
|
|
27
27
|
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
if ( newRadius === undefined || newRadius === '' ) {
|
|
31
|
-
newStyle = cleanEmptyObject( newStyle );
|
|
32
|
-
}
|
|
28
|
+
} );
|
|
33
29
|
|
|
34
30
|
setAttributes( { style: newStyle } );
|
|
35
31
|
};
|
package/src/hooks/border.js
CHANGED
|
@@ -268,10 +268,10 @@ export function BorderPanel( props ) {
|
|
|
268
268
|
<BorderBoxControl
|
|
269
269
|
colors={ colors }
|
|
270
270
|
enableAlpha={ true }
|
|
271
|
+
enableStyle={ isStyleSupported }
|
|
271
272
|
onChange={ onBorderChange }
|
|
272
|
-
popoverPlacement="left-start"
|
|
273
273
|
popoverOffset={ 40 }
|
|
274
|
-
|
|
274
|
+
popoverPlacement="left-start"
|
|
275
275
|
value={ hydratedBorder }
|
|
276
276
|
__experimentalHasMultipleOrigins={ true }
|
|
277
277
|
__experimentalIsRenderedInSidebar={ true }
|
package/src/hooks/color.js
CHANGED
|
@@ -450,14 +450,24 @@ export function ColorEdit( props ) {
|
|
|
450
450
|
};
|
|
451
451
|
};
|
|
452
452
|
|
|
453
|
-
const enableContrastChecking =
|
|
454
|
-
Platform.OS === 'web' && ! gradient && ! style?.color?.gradient;
|
|
455
|
-
|
|
456
453
|
const defaultColorControls = getBlockSupport( props.name, [
|
|
457
454
|
COLOR_SUPPORT_KEY,
|
|
458
455
|
'__experimentalDefaultControls',
|
|
459
456
|
] );
|
|
460
457
|
|
|
458
|
+
const enableContrastChecking =
|
|
459
|
+
Platform.OS === 'web' &&
|
|
460
|
+
! gradient &&
|
|
461
|
+
! style?.color?.gradient &&
|
|
462
|
+
// Contrast checking is enabled by default.
|
|
463
|
+
// Deactivating it requires `enableContrastChecker` to have
|
|
464
|
+
// an explicit value of `false`.
|
|
465
|
+
false !==
|
|
466
|
+
getBlockSupport( props.name, [
|
|
467
|
+
COLOR_SUPPORT_KEY,
|
|
468
|
+
'enableContrastChecker',
|
|
469
|
+
] );
|
|
470
|
+
|
|
461
471
|
return (
|
|
462
472
|
<ColorPanel
|
|
463
473
|
enableContrastChecking={ enableContrastChecking }
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -33,6 +38,7 @@ import {
|
|
|
33
38
|
resetPadding,
|
|
34
39
|
useIsPaddingDisabled,
|
|
35
40
|
} from './padding';
|
|
41
|
+
import useSetting from '../components/use-setting';
|
|
36
42
|
|
|
37
43
|
export const SPACING_SUPPORT_KEY = 'spacing';
|
|
38
44
|
export const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];
|
|
@@ -51,6 +57,7 @@ export function DimensionsPanel( props ) {
|
|
|
51
57
|
const isMarginDisabled = useIsMarginDisabled( props );
|
|
52
58
|
const isDisabled = useIsDimensionsDisabled( props );
|
|
53
59
|
const isSupported = hasDimensionsSupport( props.name );
|
|
60
|
+
const spacingSizes = useSetting( 'spacing.spacingSizes' );
|
|
54
61
|
|
|
55
62
|
if ( isDisabled || ! isSupported ) {
|
|
56
63
|
return null;
|
|
@@ -77,6 +84,10 @@ export function DimensionsPanel( props ) {
|
|
|
77
84
|
<InspectorControls __experimentalGroup="dimensions">
|
|
78
85
|
{ ! isPaddingDisabled && (
|
|
79
86
|
<ToolsPanelItem
|
|
87
|
+
className={ classnames( {
|
|
88
|
+
'tools-panel-item-spacing':
|
|
89
|
+
spacingSizes && spacingSizes.length > 0,
|
|
90
|
+
} ) }
|
|
80
91
|
hasValue={ () => hasPaddingValue( props ) }
|
|
81
92
|
label={ __( 'Padding' ) }
|
|
82
93
|
onDeselect={ () => resetPadding( props ) }
|
|
@@ -89,6 +100,10 @@ export function DimensionsPanel( props ) {
|
|
|
89
100
|
) }
|
|
90
101
|
{ ! isMarginDisabled && (
|
|
91
102
|
<ToolsPanelItem
|
|
103
|
+
className={ classnames( {
|
|
104
|
+
'tools-panel-item-spacing':
|
|
105
|
+
spacingSizes && spacingSizes.length > 0,
|
|
106
|
+
} ) }
|
|
92
107
|
hasValue={ () => hasMarginValue( props ) }
|
|
93
108
|
label={ __( 'Margin' ) }
|
|
94
109
|
onDeselect={ () => resetMargin( props ) }
|
package/src/hooks/duotone.js
CHANGED
|
@@ -35,10 +35,10 @@ extend( [ namesPlugin ] );
|
|
|
35
35
|
/**
|
|
36
36
|
* SVG and stylesheet needed for rendering the duotone filter.
|
|
37
37
|
*
|
|
38
|
-
* @param {Object}
|
|
39
|
-
* @param {string}
|
|
40
|
-
* @param {string}
|
|
41
|
-
* @param {string[]|"unset"} props.colors
|
|
38
|
+
* @param {Object} props Duotone props.
|
|
39
|
+
* @param {string} props.selector Selector to apply the filter to.
|
|
40
|
+
* @param {string} props.id Unique id for this duotone filter.
|
|
41
|
+
* @param {string[]|"unset"} props.colors Array of RGB color strings ordered from dark to light.
|
|
42
42
|
*
|
|
43
43
|
* @return {WPElement} Duotone element.
|
|
44
44
|
*/
|
package/src/hooks/gap.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';
|
|
17
|
+
import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
|
|
17
18
|
import useSetting from '../components/use-setting';
|
|
18
19
|
import { AXIAL_SIDES, SPACING_SUPPORT_KEY, useCustomSides } from './dimensions';
|
|
19
20
|
import { cleanEmptyObject } from './utils';
|
|
@@ -54,8 +55,12 @@ export function getGapBoxControlValueFromStyle( blockGapValue ) {
|
|
|
54
55
|
|
|
55
56
|
const isValueString = typeof blockGapValue === 'string';
|
|
56
57
|
return {
|
|
57
|
-
top: isValueString
|
|
58
|
-
|
|
58
|
+
top: isValueString
|
|
59
|
+
? getSpacingPresetCssVar( blockGapValue )
|
|
60
|
+
: getSpacingPresetCssVar( blockGapValue?.top ),
|
|
61
|
+
left: isValueString
|
|
62
|
+
? getSpacingPresetCssVar( blockGapValue )
|
|
63
|
+
: getSpacingPresetCssVar( blockGapValue?.left ),
|
|
59
64
|
};
|
|
60
65
|
}
|
|
61
66
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { uniq } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,10 +21,12 @@ export function addGeneratedClassName( extraProps, blockType ) {
|
|
|
26
21
|
// We have some extra classes and want to add the default classname
|
|
27
22
|
// We use uniq to prevent duplicate classnames.
|
|
28
23
|
|
|
29
|
-
extraProps.className =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
extraProps.className = [
|
|
25
|
+
...new Set( [
|
|
26
|
+
getBlockDefaultClassName( blockType.name ),
|
|
27
|
+
...extraProps.className.split( ' ' ),
|
|
28
|
+
] ),
|
|
29
|
+
]
|
|
33
30
|
.join( ' ' )
|
|
34
31
|
.trim();
|
|
35
32
|
} else {
|