@wordpress/block-editor 9.5.0 → 9.7.1-next.d6164808d3.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-lock/modal.js +2 -2
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/mover-description.js +95 -32
- package/build/components/block-mover/mover-description.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-settings-menu/index.js +2 -6
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/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-styles/preview.native.js +1 -3
- package/build/components/block-styles/preview.native.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/block-selection-button.js +1 -7
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.js +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +65 -23
- package/build/components/block-types-list/index.native.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 +8 -4
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +9 -3
- 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-editor/cropper.js +4 -3
- package/build/components/image-editor/cropper.js.map +1 -1
- package/build/components/image-editor/index.js +3 -1
- package/build/components/image-editor/index.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/block-types-tab.native.js +30 -16
- package/build/components/inserter/block-types-tab.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/preview-panel.js +8 -8
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -1
- package/build/components/inserter/reusable-blocks-tab.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/search-results.native.js +5 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +21 -0
- package/build/components/inserter/utils.native.js.map +1 -1
- package/build/components/inserter-list-item/index.js +7 -20
- 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/branch.js +1 -7
- package/build/components/list-view/branch.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/observe-typing/index.js +22 -8
- package/build/components/observe-typing/index.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/format-toolbar-container.js +61 -12
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +8 -2
- 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 +39 -22
- 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/components/writing-flow/use-tab-nav.js +1 -1
- package/build/components/writing-flow/use-tab-nav.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 +42 -15
- 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 +40 -76
- 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 +6 -145
- 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-lock/modal.js +2 -2
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/mover-description.js +97 -33
- package/build-module/components/block-mover/mover-description.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-settings-menu/index.js +3 -6
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +2 -2
- package/build-module/components/block-settings-menu-controls/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-styles/preview.native.js +2 -3
- package/build-module/components/block-styles/preview.native.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/block-selection-button.js +1 -7
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- 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/block-types-list/index.native.js +67 -25
- package/build-module/components/block-types-list/index.native.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 +8 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +10 -4
- 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-editor/cropper.js +4 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/index.js +3 -1
- package/build-module/components/image-editor/index.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/block-types-tab.native.js +31 -15
- package/build-module/components/inserter/block-types-tab.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/preview-panel.js +9 -9
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +6 -2
- package/build-module/components/inserter/reusable-blocks-tab.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/search-results.native.js +6 -3
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +19 -0
- package/build-module/components/inserter/utils.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -18
- 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/branch.js +1 -6
- package/build-module/components/list-view/branch.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/observe-typing/index.js +22 -8
- package/build-module/components/observe-typing/index.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/format-toolbar-container.js +58 -12
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +7 -2
- 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 +39 -22
- 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/components/writing-flow/use-tab-nav.js +1 -1
- package/build-module/components/writing-flow/use-tab-nav.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 +42 -15
- 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 +44 -81
- 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 +7 -140
- 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-lock/modal.js +5 -5
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- package/src/components/block-mover/mover-description.js +131 -48
- package/src/components/block-mover/test/mover-description.js +55 -3
- package/src/components/block-popover/inbetween.js +5 -1
- package/src/components/block-popover/style.scss +25 -2
- package/src/components/block-settings-menu/index.js +11 -15
- package/src/components/block-settings-menu-controls/index.js +2 -2
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/preview.native.js +2 -2
- 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/block-selection-button.js +0 -5
- package/src/components/block-tools/index.js +4 -1
- package/src/components/block-types-list/index.js +1 -1
- package/src/components/block-types-list/index.native.js +76 -24
- package/src/components/block-types-list/style.native.scss +18 -0
- 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 +91 -79
- package/src/components/colors/test/__snapshots__/with-colors.js.snap +1 -1
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/colors/utils.js +5 -2
- package/src/components/colors/with-colors.js +11 -1
- package/src/components/colors-gradients/control.js +13 -8
- package/src/components/colors-gradients/dropdown.js +14 -3
- package/src/components/colors-gradients/style.scss +33 -12
- 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-editor/cropper.js +9 -3
- package/src/components/image-editor/index.js +2 -0
- 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/block-types-tab.native.js +42 -21
- package/src/components/inserter/index.native.js +7 -2
- package/src/components/inserter/preview-panel.js +6 -14
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -2
- package/src/components/inserter/search-items.js +17 -5
- package/src/components/inserter/search-results.native.js +4 -2
- package/src/components/inserter/test/block-types-tab.native.js +2 -0
- package/src/components/inserter/test/utils.native.js +37 -0
- package/src/components/inserter/utils.native.js +11 -0
- package/src/components/inserter-list-item/index.js +5 -18
- 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/branch.js +1 -6
- 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/observe-typing/index.js +17 -14
- 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/format-toolbar-container.js +63 -14
- package/src/components/rich-text/index.js +3 -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 +38 -17
- 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/components/writing-flow/use-tab-nav.js +1 -1
- 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 +66 -18
- package/src/hooks/margin.js +49 -17
- package/src/hooks/padding.js +41 -14
- package/src/hooks/style.js +42 -86
- 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 -151
- 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
|
@@ -11,7 +11,7 @@ import { useState, useLayoutEffect } from '@wordpress/element';
|
|
|
11
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
12
|
import {
|
|
13
13
|
Button,
|
|
14
|
-
|
|
14
|
+
__experimentalTruncate as Truncate,
|
|
15
15
|
Slot,
|
|
16
16
|
Fill,
|
|
17
17
|
} from '@wordpress/components';
|
|
@@ -117,15 +117,12 @@ function BlockStyles( {
|
|
|
117
117
|
onClick={ () => onSelectStylePreview( style ) }
|
|
118
118
|
aria-current={ activeStyle.name === style.name }
|
|
119
119
|
>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
limit={ 12 }
|
|
123
|
-
ellipsizeMode="tail"
|
|
120
|
+
<Truncate
|
|
121
|
+
numberOfLines={ 1 }
|
|
124
122
|
className="block-editor-block-styles__item-text"
|
|
125
|
-
truncate
|
|
126
123
|
>
|
|
127
124
|
{ buttonText }
|
|
128
|
-
</
|
|
125
|
+
</Truncate>
|
|
129
126
|
</Button>
|
|
130
127
|
);
|
|
131
128
|
} ) }
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
Dimensions,
|
|
9
9
|
Animated,
|
|
10
10
|
Easing,
|
|
11
|
+
Image,
|
|
11
12
|
} from 'react-native';
|
|
12
|
-
import FastImage from 'react-native-fast-image';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
@@ -91,7 +91,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
|
|
|
91
91
|
<View style={ styles.imageWrapper }>
|
|
92
92
|
{ isActive &&
|
|
93
93
|
getOutline( [ styles.outline, innerOutlineStyle ] ) }
|
|
94
|
-
<
|
|
94
|
+
<Image
|
|
95
95
|
style={ [ styles.image, styles[ name ] ] }
|
|
96
96
|
source={ { uri: url } }
|
|
97
97
|
/>
|
|
@@ -64,6 +64,16 @@
|
|
|
64
64
|
box-shadow: inset 0 0 0 1px $white, 0 0 0 2px var(--wp-admin-theme-color);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
.block-editor-block-styles__item-text {
|
|
69
|
+
word-break: break-all;
|
|
70
|
+
// The Button component is white-space: nowrap, and that won't work with line-clamp.
|
|
71
|
+
white-space: normal;
|
|
72
|
+
|
|
73
|
+
// Without this, the ellipsis can sometimes be partially hidden by the Button padding.
|
|
74
|
+
text-align: start;
|
|
75
|
+
text-align-last: center;
|
|
76
|
+
}
|
|
67
77
|
}
|
|
68
78
|
|
|
69
79
|
// To prevent overflow in the preview container,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { castArray
|
|
4
|
+
import { castArray } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -28,10 +28,10 @@ import { copy } from '@wordpress/icons';
|
|
|
28
28
|
import { store as blockEditorStore } from '../../store';
|
|
29
29
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
30
30
|
import BlockIcon from '../block-icon';
|
|
31
|
-
import BlockTitle from '../block-title';
|
|
32
31
|
import BlockTransformationsMenu from './block-transformations-menu';
|
|
33
32
|
import BlockStylesMenu from './block-styles-menu';
|
|
34
33
|
import PatternTransformationsMenu from './pattern-transformations-menu';
|
|
34
|
+
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
35
35
|
|
|
36
36
|
export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
37
37
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
@@ -41,7 +41,6 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
41
41
|
canRemove,
|
|
42
42
|
hasBlockStyles,
|
|
43
43
|
icon,
|
|
44
|
-
blockTitle,
|
|
45
44
|
patterns,
|
|
46
45
|
} = useSelect(
|
|
47
46
|
( select ) => {
|
|
@@ -64,7 +63,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
64
63
|
_icon = blockInformation?.icon; // Take into account active block variations.
|
|
65
64
|
} else {
|
|
66
65
|
const isSelectionOfSameType =
|
|
67
|
-
|
|
66
|
+
new Set( blocks.map( ( { name } ) => name ) ).size === 1;
|
|
68
67
|
// When selection consists of blocks of multiple types, display an
|
|
69
68
|
// appropriate icon to communicate the non-uniformity.
|
|
70
69
|
_icon = isSelectionOfSameType
|
|
@@ -79,7 +78,6 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
79
78
|
canRemove: canRemoveBlocks( clientIds, rootClientId ),
|
|
80
79
|
hasBlockStyles: !! styles?.length,
|
|
81
80
|
icon: _icon,
|
|
82
|
-
blockTitle: getBlockType( firstBlockName )?.title,
|
|
83
81
|
patterns: __experimentalGetPatternTransformItems(
|
|
84
82
|
blocks,
|
|
85
83
|
rootClientId
|
|
@@ -89,6 +87,10 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
89
87
|
[ clientIds, blocks, blockInformation?.icon ]
|
|
90
88
|
);
|
|
91
89
|
|
|
90
|
+
const blockTitle = useBlockDisplayTitle( {
|
|
91
|
+
clientId: Array.isArray( clientIds ) ? clientIds[ 0 ] : clientIds,
|
|
92
|
+
maximumLength: 35,
|
|
93
|
+
} );
|
|
92
94
|
const isReusable = blocks.length === 1 && isReusableBlock( blocks[ 0 ] );
|
|
93
95
|
const isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );
|
|
94
96
|
|
|
@@ -119,10 +121,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
119
121
|
<BlockIcon icon={ icon } showColors />
|
|
120
122
|
{ ( isReusable || isTemplate ) && (
|
|
121
123
|
<span className="block-editor-block-switcher__toggle-text">
|
|
122
|
-
|
|
123
|
-
clientId={ clientIds }
|
|
124
|
-
maximumLength={ 35 }
|
|
125
|
-
/>
|
|
124
|
+
{ blockTitle }
|
|
126
125
|
</span>
|
|
127
126
|
) }
|
|
128
127
|
</>
|
|
@@ -176,10 +175,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
176
175
|
/>
|
|
177
176
|
{ ( isReusable || isTemplate ) && (
|
|
178
177
|
<span className="block-editor-block-switcher__toggle-text">
|
|
179
|
-
|
|
180
|
-
clientId={ clientIds }
|
|
181
|
-
maximumLength={ 35 }
|
|
182
|
-
/>
|
|
178
|
+
{ blockTitle }
|
|
183
179
|
</span>
|
|
184
180
|
) }
|
|
185
181
|
</>
|
|
@@ -18,6 +18,7 @@ import { copy } from '@wordpress/icons';
|
|
|
18
18
|
import { BlockSwitcher, BlockSwitcherDropdownMenu } from '../';
|
|
19
19
|
|
|
20
20
|
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
21
|
+
jest.mock( '../../block-title/use-block-display-title', () => jest.fn() );
|
|
21
22
|
|
|
22
23
|
describe( 'BlockSwitcher', () => {
|
|
23
24
|
test( 'should not render block switcher without blocks', () => {
|
|
@@ -23,6 +23,7 @@ import __unstableBlockToolbarLastItem from './block-toolbar-last-item';
|
|
|
23
23
|
import BlockSettingsMenu from '../block-settings-menu';
|
|
24
24
|
import { BlockLockToolbar } from '../block-lock';
|
|
25
25
|
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
26
|
+
import BlockEditVisuallyButton from '../block-edit-visually-button';
|
|
26
27
|
import { useShowMoversGestures } from './utils';
|
|
27
28
|
import { store as blockEditorStore } from '../../store';
|
|
28
29
|
import __unstableBlockNameContext from './block-name-context';
|
|
@@ -159,6 +160,7 @@ const BlockToolbar = ( { hideDragHandle } ) => {
|
|
|
159
160
|
</__unstableBlockNameContext.Provider>
|
|
160
161
|
</>
|
|
161
162
|
) }
|
|
163
|
+
<BlockEditVisuallyButton clientIds={ blockClientIds } />
|
|
162
164
|
<BlockSettingsMenu clientIds={ blockClientIds } />
|
|
163
165
|
</div>
|
|
164
166
|
);
|
|
@@ -102,7 +102,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
102
102
|
getMultiSelectedBlocksEndClientId,
|
|
103
103
|
getPreviousBlockClientId,
|
|
104
104
|
getNextBlockClientId,
|
|
105
|
-
isNavigationMode,
|
|
106
105
|
} = useSelect( blockEditorStore );
|
|
107
106
|
const {
|
|
108
107
|
selectBlock,
|
|
@@ -160,10 +159,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
160
159
|
selectedBlockClientId;
|
|
161
160
|
}
|
|
162
161
|
const startingBlockClientId = hasBlockMovingClientId();
|
|
163
|
-
if ( isEscape && isNavigationMode() ) {
|
|
164
|
-
clearSelectedBlock();
|
|
165
|
-
event.preventDefault();
|
|
166
|
-
}
|
|
167
162
|
if ( isEscape && startingBlockClientId && ! event.defaultPrevented ) {
|
|
168
163
|
setBlockMovingClientId( null );
|
|
169
164
|
event.preventDefault();
|
|
@@ -53,6 +53,8 @@ export default function BlockTools( {
|
|
|
53
53
|
} = useDispatch( blockEditorStore );
|
|
54
54
|
|
|
55
55
|
function onKeyDown( event ) {
|
|
56
|
+
if ( event.defaultPrevented ) return;
|
|
57
|
+
|
|
56
58
|
if ( isMatch( 'core/block-editor/move-up', event ) ) {
|
|
57
59
|
const clientIds = getSelectedBlockClientIds();
|
|
58
60
|
if ( clientIds.length ) {
|
|
@@ -93,12 +95,13 @@ export default function BlockTools( {
|
|
|
93
95
|
}
|
|
94
96
|
} else if ( isMatch( 'core/block-editor/unselect', event ) ) {
|
|
95
97
|
const clientIds = getSelectedBlockClientIds();
|
|
96
|
-
if ( clientIds.length
|
|
98
|
+
if ( clientIds.length ) {
|
|
97
99
|
event.preventDefault();
|
|
98
100
|
clearSelectedBlock();
|
|
99
101
|
event.target.ownerDocument.defaultView
|
|
100
102
|
.getSelection()
|
|
101
103
|
.removeAllRanges();
|
|
104
|
+
__unstableContentRef?.current.focus();
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
import {
|
|
5
5
|
Dimensions,
|
|
6
6
|
FlatList,
|
|
7
|
+
SectionList,
|
|
7
8
|
StyleSheet,
|
|
9
|
+
Text,
|
|
8
10
|
TouchableWithoutFeedback,
|
|
9
11
|
View,
|
|
10
12
|
} from 'react-native';
|
|
@@ -13,7 +15,11 @@ import {
|
|
|
13
15
|
* WordPress dependencies
|
|
14
16
|
*/
|
|
15
17
|
import { useState, useEffect } from '@wordpress/element';
|
|
16
|
-
import { BottomSheet, InserterButton } from '@wordpress/components';
|
|
18
|
+
import { BottomSheet, Gradient, InserterButton } from '@wordpress/components';
|
|
19
|
+
import {
|
|
20
|
+
usePreferredColorScheme,
|
|
21
|
+
usePreferredColorSchemeStyle,
|
|
22
|
+
} from '@wordpress/compose';
|
|
17
23
|
|
|
18
24
|
/**
|
|
19
25
|
* Internal dependencies
|
|
@@ -24,7 +30,7 @@ const MIN_COL_NUM = 3;
|
|
|
24
30
|
|
|
25
31
|
export default function BlockTypesList( {
|
|
26
32
|
name,
|
|
27
|
-
|
|
33
|
+
sections,
|
|
28
34
|
onSelect,
|
|
29
35
|
listProps,
|
|
30
36
|
initialNumToRender = 3,
|
|
@@ -80,33 +86,79 @@ export default function BlockTypesList( {
|
|
|
80
86
|
listProps.contentContainerStyle
|
|
81
87
|
);
|
|
82
88
|
|
|
89
|
+
const renderSection = ( { item } ) => {
|
|
90
|
+
return (
|
|
91
|
+
<TouchableWithoutFeedback accessible={ false }>
|
|
92
|
+
<FlatList
|
|
93
|
+
data={ item.list }
|
|
94
|
+
key={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.
|
|
95
|
+
numColumns={ numberOfColumns }
|
|
96
|
+
ItemSeparatorComponent={ () => (
|
|
97
|
+
<TouchableWithoutFeedback accessible={ false }>
|
|
98
|
+
<View
|
|
99
|
+
style={
|
|
100
|
+
styles[ 'block-types-list__row-separator' ]
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
</TouchableWithoutFeedback>
|
|
104
|
+
) }
|
|
105
|
+
scrollEnabled={ false }
|
|
106
|
+
renderItem={ renderListItem }
|
|
107
|
+
/>
|
|
108
|
+
</TouchableWithoutFeedback>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const renderListItem = ( { item } ) => {
|
|
113
|
+
return (
|
|
114
|
+
<InserterButton
|
|
115
|
+
item={ item }
|
|
116
|
+
itemWidth={ itemWidth }
|
|
117
|
+
maxWidth={ maxWidth }
|
|
118
|
+
onSelect={ onSelect }
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const colorScheme = usePreferredColorScheme();
|
|
124
|
+
const sectionHeaderGradientValue =
|
|
125
|
+
colorScheme === 'light'
|
|
126
|
+
? 'linear-gradient(#fff 70%, rgba(255, 255, 255, 0))'
|
|
127
|
+
: 'linear-gradient(#2e2e2e 70%, rgba(46, 46, 46, 0))';
|
|
128
|
+
const sectionHeaderTitleStyles = usePreferredColorSchemeStyle(
|
|
129
|
+
styles[ 'block-types-list__section-header-title' ],
|
|
130
|
+
styles[ 'block-types-list__section-header-title--dark' ]
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const renderSectionHeader = ( { section: { metadata } } ) => {
|
|
134
|
+
if ( ! metadata?.icon || ! metadata?.title ) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<TouchableWithoutFeedback accessible={ false }>
|
|
140
|
+
<Gradient
|
|
141
|
+
gradientValue={ sectionHeaderGradientValue }
|
|
142
|
+
style={ styles[ 'block-types-list__section-header' ] }
|
|
143
|
+
>
|
|
144
|
+
{ metadata?.icon }
|
|
145
|
+
<Text style={ sectionHeaderTitleStyles }>
|
|
146
|
+
{ metadata?.title }
|
|
147
|
+
</Text>
|
|
148
|
+
</Gradient>
|
|
149
|
+
</TouchableWithoutFeedback>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
83
153
|
return (
|
|
84
|
-
<
|
|
154
|
+
<SectionList
|
|
85
155
|
onLayout={ onLayout }
|
|
86
|
-
key={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.
|
|
87
156
|
testID={ `InserterUI-${ name }` }
|
|
88
157
|
keyboardShouldPersistTaps="always"
|
|
89
|
-
|
|
90
|
-
data={ items }
|
|
158
|
+
sections={ sections }
|
|
91
159
|
initialNumToRender={ initialNumToRender }
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<View
|
|
95
|
-
style={ styles[ 'block-types-list__row-separator' ] }
|
|
96
|
-
/>
|
|
97
|
-
</TouchableWithoutFeedback>
|
|
98
|
-
) }
|
|
99
|
-
keyExtractor={ ( item ) => item.id }
|
|
100
|
-
renderItem={ ( { item } ) => (
|
|
101
|
-
<InserterButton
|
|
102
|
-
{ ...{
|
|
103
|
-
item,
|
|
104
|
-
itemWidth,
|
|
105
|
-
maxWidth,
|
|
106
|
-
onSelect,
|
|
107
|
-
} }
|
|
108
|
-
/>
|
|
109
|
-
) }
|
|
160
|
+
renderItem={ renderSection }
|
|
161
|
+
renderSectionHeader={ renderSectionHeader }
|
|
110
162
|
{ ...listProps }
|
|
111
163
|
contentContainerStyle={ {
|
|
112
164
|
...contentContainerStyle,
|
|
@@ -5,3 +5,21 @@
|
|
|
5
5
|
.block-types-list__column {
|
|
6
6
|
padding: $grid-unit-20;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
.block-types-list__section-header {
|
|
10
|
+
align-items: center;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding-bottom: 16;
|
|
14
|
+
padding-top: 32;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.block-types-list__section-header-title {
|
|
18
|
+
color: $black;
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
margin-left: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.block-types-list__section-header-title--dark {
|
|
24
|
+
color: $white;
|
|
25
|
+
}
|
|
@@ -7,14 +7,50 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getAllValue,
|
|
12
|
+
getAllUnit,
|
|
13
|
+
hasMixedValues,
|
|
14
|
+
hasDefinedValues,
|
|
15
|
+
} from './utils';
|
|
16
|
+
|
|
17
|
+
export default function AllInputControl( {
|
|
18
|
+
onChange,
|
|
19
|
+
selectedUnits,
|
|
20
|
+
setSelectedUnits,
|
|
21
|
+
values,
|
|
22
|
+
...props
|
|
23
|
+
} ) {
|
|
24
|
+
let allValue = getAllValue( values );
|
|
25
|
+
|
|
26
|
+
if ( allValue === undefined ) {
|
|
27
|
+
// If we don't have any value set the unit to any current selection
|
|
28
|
+
// or the most common unit from the individual radii values.
|
|
29
|
+
allValue = getAllUnit( selectedUnits );
|
|
30
|
+
}
|
|
11
31
|
|
|
12
|
-
export default function AllInputControl( { onChange, values, ...props } ) {
|
|
13
|
-
const allValue = getAllValue( values );
|
|
14
32
|
const hasValues = hasDefinedValues( values );
|
|
15
33
|
const isMixed = hasValues && hasMixedValues( values );
|
|
16
34
|
const allPlaceholder = isMixed ? __( 'Mixed' ) : null;
|
|
17
35
|
|
|
36
|
+
// Filter out CSS-unit-only values to prevent invalid styles.
|
|
37
|
+
const handleOnChange = ( next ) => {
|
|
38
|
+
const isNumeric = ! isNaN( parseFloat( next ) );
|
|
39
|
+
const nextValue = isNumeric ? next : undefined;
|
|
40
|
+
onChange( nextValue );
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Store current unit selection for use as fallback for individual
|
|
44
|
+
// radii controls.
|
|
45
|
+
const handleOnUnitChange = ( unit ) => {
|
|
46
|
+
setSelectedUnits( {
|
|
47
|
+
topLeft: unit,
|
|
48
|
+
topRight: unit,
|
|
49
|
+
bottomLeft: unit,
|
|
50
|
+
bottomRight: unit,
|
|
51
|
+
} );
|
|
52
|
+
};
|
|
53
|
+
|
|
18
54
|
return (
|
|
19
55
|
<UnitControl
|
|
20
56
|
{ ...props }
|
|
@@ -22,7 +58,8 @@ export default function AllInputControl( { onChange, values, ...props } ) {
|
|
|
22
58
|
disableUnits={ isMixed }
|
|
23
59
|
isOnly
|
|
24
60
|
value={ allValue }
|
|
25
|
-
onChange={
|
|
61
|
+
onChange={ handleOnChange }
|
|
62
|
+
onUnitChange={ handleOnUnitChange }
|
|
26
63
|
placeholder={ allPlaceholder }
|
|
27
64
|
/>
|
|
28
65
|
);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
BaseControl,
|
|
5
6
|
RangeControl,
|
|
6
7
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
7
8
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
@@ -24,10 +25,10 @@ import {
|
|
|
24
25
|
} from './utils';
|
|
25
26
|
|
|
26
27
|
const DEFAULT_VALUES = {
|
|
27
|
-
topLeft:
|
|
28
|
-
topRight:
|
|
29
|
-
bottomLeft:
|
|
30
|
-
bottomRight:
|
|
28
|
+
topLeft: undefined,
|
|
29
|
+
topRight: undefined,
|
|
30
|
+
bottomLeft: undefined,
|
|
31
|
+
bottomRight: undefined,
|
|
31
32
|
};
|
|
32
33
|
const MIN_BORDER_RADIUS_VALUE = 0;
|
|
33
34
|
const MAX_BORDER_RADIUS_VALUES = {
|
|
@@ -50,11 +51,27 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
50
51
|
! hasDefinedValues( values ) || ! hasMixedValues( values )
|
|
51
52
|
);
|
|
52
53
|
|
|
54
|
+
// Tracking selected units via internal state allows filtering of CSS unit
|
|
55
|
+
// only values from being saved while maintaining preexisting unit selection
|
|
56
|
+
// behaviour. Filtering CSS unit only values prevents invalid style values.
|
|
57
|
+
const [ selectedUnits, setSelectedUnits ] = useState( {
|
|
58
|
+
flat:
|
|
59
|
+
typeof values === 'string'
|
|
60
|
+
? parseQuantityAndUnitFromRawValue( values )[ 1 ]
|
|
61
|
+
: undefined,
|
|
62
|
+
topLeft: parseQuantityAndUnitFromRawValue( values?.topLeft )[ 1 ],
|
|
63
|
+
topRight: parseQuantityAndUnitFromRawValue( values?.topRight )[ 1 ],
|
|
64
|
+
bottomLeft: parseQuantityAndUnitFromRawValue( values?.bottomLeft )[ 1 ],
|
|
65
|
+
bottomRight: parseQuantityAndUnitFromRawValue(
|
|
66
|
+
values?.bottomRight
|
|
67
|
+
)[ 1 ],
|
|
68
|
+
} );
|
|
69
|
+
|
|
53
70
|
const units = useCustomUnits( {
|
|
54
71
|
availableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],
|
|
55
72
|
} );
|
|
56
73
|
|
|
57
|
-
const unit = getAllUnit(
|
|
74
|
+
const unit = getAllUnit( selectedUnits );
|
|
58
75
|
const unitConfig = units && units.find( ( item ) => item.value === unit );
|
|
59
76
|
const step = unitConfig?.step || 1;
|
|
60
77
|
|
|
@@ -70,7 +87,9 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
70
87
|
|
|
71
88
|
return (
|
|
72
89
|
<fieldset className="components-border-radius-control">
|
|
73
|
-
<
|
|
90
|
+
<BaseControl.VisualLabel as="legend">
|
|
91
|
+
{ __( 'Radius' ) }
|
|
92
|
+
</BaseControl.VisualLabel>
|
|
74
93
|
<div className="components-border-radius-control__wrapper">
|
|
75
94
|
{ isLinked ? (
|
|
76
95
|
<>
|
|
@@ -79,6 +98,8 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
79
98
|
values={ values }
|
|
80
99
|
min={ MIN_BORDER_RADIUS_VALUE }
|
|
81
100
|
onChange={ onChange }
|
|
101
|
+
selectedUnits={ selectedUnits }
|
|
102
|
+
setSelectedUnits={ setSelectedUnits }
|
|
82
103
|
units={ units }
|
|
83
104
|
/>
|
|
84
105
|
<RangeControl
|
|
@@ -98,6 +119,8 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
98
119
|
<InputControls
|
|
99
120
|
min={ MIN_BORDER_RADIUS_VALUE }
|
|
100
121
|
onChange={ onChange }
|
|
122
|
+
selectedUnits={ selectedUnits }
|
|
123
|
+
setSelectedUnits={ setSelectedUnits }
|
|
101
124
|
values={ values || DEFAULT_VALUES }
|
|
102
125
|
units={ units }
|
|
103
126
|
/>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
5
6
|
__experimentalUnitControl as UnitControl,
|
|
6
7
|
Tooltip,
|
|
7
8
|
} from '@wordpress/components';
|
|
@@ -16,6 +17,8 @@ const CORNERS = {
|
|
|
16
17
|
|
|
17
18
|
export default function BoxInputControls( {
|
|
18
19
|
onChange,
|
|
20
|
+
selectedUnits,
|
|
21
|
+
setSelectedUnits,
|
|
19
22
|
values: valuesProp,
|
|
20
23
|
...props
|
|
21
24
|
} ) {
|
|
@@ -24,12 +27,22 @@ export default function BoxInputControls( {
|
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
// Filter out CSS-unit-only values to prevent invalid styles.
|
|
31
|
+
const isNumeric = ! isNaN( parseFloat( next ) );
|
|
32
|
+
const nextValue = isNumeric ? next : undefined;
|
|
33
|
+
|
|
27
34
|
onChange( {
|
|
28
35
|
...values,
|
|
29
|
-
[ corner ]:
|
|
36
|
+
[ corner ]: nextValue,
|
|
30
37
|
} );
|
|
31
38
|
};
|
|
32
39
|
|
|
40
|
+
const createHandleOnUnitChange = ( side ) => ( next ) => {
|
|
41
|
+
const newUnits = { ...selectedUnits };
|
|
42
|
+
newUnits[ side ] = next;
|
|
43
|
+
setSelectedUnits( newUnits );
|
|
44
|
+
};
|
|
45
|
+
|
|
33
46
|
// For shorthand style & backwards compatibility, handle flat string value.
|
|
34
47
|
const values =
|
|
35
48
|
typeof valuesProp !== 'string'
|
|
@@ -46,18 +59,32 @@ export default function BoxInputControls( {
|
|
|
46
59
|
// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
|
|
47
60
|
return (
|
|
48
61
|
<div className="components-border-radius-control__input-controls-wrapper">
|
|
49
|
-
{ Object.entries( CORNERS ).map( ( [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
{ Object.entries( CORNERS ).map( ( [ corner, label ] ) => {
|
|
63
|
+
const [ parsedQuantity, parsedUnit ] =
|
|
64
|
+
parseQuantityAndUnitFromRawValue( values[ corner ] );
|
|
65
|
+
|
|
66
|
+
const computedUnit = values[ corner ]
|
|
67
|
+
? parsedUnit
|
|
68
|
+
: selectedUnits[ corner ] || selectedUnits.flat;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Tooltip text={ label } position="top" key={ corner }>
|
|
72
|
+
<div className="components-border-radius-control__tooltip-wrapper">
|
|
73
|
+
<UnitControl
|
|
74
|
+
{ ...props }
|
|
75
|
+
aria-label={ label }
|
|
76
|
+
value={ [ parsedQuantity, computedUnit ].join(
|
|
77
|
+
''
|
|
78
|
+
) }
|
|
79
|
+
onChange={ createHandleOnChange( corner ) }
|
|
80
|
+
onUnitChange={ createHandleOnUnitChange(
|
|
81
|
+
corner
|
|
82
|
+
) }
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
</Tooltip>
|
|
86
|
+
);
|
|
87
|
+
} ) }
|
|
61
88
|
</div>
|
|
62
89
|
);
|
|
63
90
|
}
|