@wordpress/block-editor 8.3.0 → 8.5.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/README.md +56 -18
- package/build/components/alignment-control/index.js +13 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/index.js +13 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-icon/index.js +4 -0
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +4 -1
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +4 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-list-appender/index.js +6 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/index.js +32 -0
- package/build/components/block-lock/index.js.map +1 -0
- package/build/components/block-lock/menu-item.js +67 -0
- package/build/components/block-lock/menu-item.js.map +1 -0
- package/build/components/block-lock/modal.js +134 -0
- package/build/components/block-lock/modal.js.map +1 -0
- package/build/components/block-lock/toolbar.js +78 -0
- package/build/components/block-lock/toolbar.js.map +1 -0
- package/build/components/block-mover/index.js +4 -0
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +19 -9
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +2 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +8 -6
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +17 -0
- package/build/components/block-toolbar/block-name-context.js.map +1 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build/components/block-toolbar/index.js +24 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +0 -16
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +92 -47
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +13 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +0 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +3 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/contrast-checker/index.js +4 -0
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +8 -0
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +105 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build/components/copy-handler/index.js +4 -0
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +132 -0
- package/build/components/date-format-picker/index.js.map +1 -0
- package/build/components/font-sizes/font-size-picker.js +4 -0
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/iframe/index.js +6 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +27 -0
- package/build/components/index.js.map +1 -1
- package/build/components/justify-content-control/index.js +13 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -6
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +24 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +38 -13
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +16 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +7 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +9 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +4 -0
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +1 -1
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/rich-text/index.js +27 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +13 -9
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/split-value.js +12 -2
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-firefox-compat.js +49 -0
- package/build/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +34 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -0
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +11 -27
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +9 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +3 -44
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +68 -0
- package/build/components/writing-flow/use-click-selection.js.map +1 -0
- package/build/components/writing-flow/use-drag-selection.js +134 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build/components/writing-flow/use-input.js +116 -0
- package/build/components/writing-flow/use-input.js.map +1 -0
- package/build/components/writing-flow/use-multi-selection.js +18 -38
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +161 -0
- package/build/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build/components/writing-flow/use-tab-nav.js +1 -8
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +3 -3
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +0 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +20 -17
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +5 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +4 -2
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +77 -5
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +7 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +34 -3
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +29 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +82 -15
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +22 -13
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +297 -51
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +25 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +171 -21
- package/build/store/selectors.js.map +1 -1
- package/build/utils/dom.js +2 -1
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/alignment-control/index.js +12 -4
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +12 -4
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +2 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -0
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -2
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -4
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +6 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/index.js +4 -0
- package/build-module/components/block-lock/index.js.map +1 -0
- package/build-module/components/block-lock/menu-item.js +53 -0
- package/build-module/components/block-lock/menu-item.js.map +1 -0
- package/build-module/components/block-lock/modal.js +119 -0
- package/build-module/components/block-lock/modal.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +63 -0
- package/build-module/components/block-lock/toolbar.js.map +1 -0
- package/build-module/components/block-mover/index.js +4 -0
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +18 -9
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +2 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +2 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +8 -6
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-toolbar/block-name-context.js +9 -0
- package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +19 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +0 -16
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +95 -49
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +12 -4
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +0 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +4 -0
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +2 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build-module/components/copy-handler/index.js +4 -0
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +122 -0
- package/build-module/components/date-format-picker/index.js.map +1 -0
- package/build-module/components/font-sizes/font-size-picker.js +4 -0
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +3 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +12 -4
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +14 -5
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +24 -23
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +36 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +16 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +7 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +10 -3
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +4 -0
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +26 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +13 -9
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/split-value.js +12 -2
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-firefox-compat.js +39 -0
- package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +35 -4
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -0
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +12 -28
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +57 -0
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-drag-selection.js +124 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +104 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -0
- package/build-module/components/writing-flow/use-multi-selection.js +18 -37
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +150 -0
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build-module/components/writing-flow/use-tab-nav.js +1 -9
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/anchor.js +7 -6
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +5 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +0 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +19 -18
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +75 -7
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +7 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +33 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +26 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +81 -16
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +20 -13
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -49
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +25 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +162 -20
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +214 -24
- package/build-style/style.css +214 -24
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +28 -27
- package/src/components/alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/index.js +9 -4
- package/src/components/block-draggable/index.js +2 -5
- package/src/components/block-icon/index.js +3 -0
- package/src/components/block-inspector/index.js +4 -0
- package/src/components/block-list/block-html.js +8 -4
- package/src/components/block-list/block.js +5 -1
- package/src/components/block-list/style.scss +4 -5
- package/src/components/block-list/use-block-props/index.js +0 -5
- package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
- package/src/components/block-list-appender/index.js +5 -0
- package/src/components/block-lock/index.js +3 -0
- package/src/components/block-lock/menu-item.js +59 -0
- package/src/components/block-lock/modal.js +170 -0
- package/src/components/block-lock/style.scss +70 -0
- package/src/components/block-lock/toolbar.js +68 -0
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
- package/src/components/block-settings-menu-controls/index.js +33 -12
- package/src/components/block-switcher/index.js +2 -2
- package/src/components/block-switcher/style.scss +8 -1
- package/src/components/block-switcher/test/index.js +2 -2
- package/src/components/block-title/README.md +6 -1
- package/src/components/block-title/index.js +2 -2
- package/src/components/block-title/test/index.js +43 -1
- package/src/components/block-title/use-block-display-title.js +10 -7
- package/src/components/block-toolbar/block-name-context.js +8 -0
- package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
- package/src/components/block-toolbar/index.js +24 -2
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/index.js +0 -19
- package/src/components/block-tools/style.scss +27 -0
- package/src/components/block-variation-transforms/index.js +105 -36
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/block-vertical-alignment-control/index.js +9 -4
- package/src/components/border-radius-control/index.js +0 -1
- package/src/components/border-radius-control/test/utils.js +4 -0
- package/src/components/border-radius-control/utils.js +2 -1
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/style.scss +6 -0
- package/src/components/contrast-checker/index.js +3 -0
- package/src/components/convert-to-group-buttons/index.js +6 -1
- package/src/components/convert-to-group-buttons/toolbar.js +87 -0
- package/src/components/copy-handler/index.js +3 -0
- package/src/components/date-format-picker/README.md +58 -0
- package/src/components/date-format-picker/index.js +161 -0
- package/src/components/date-format-picker/style.scss +31 -0
- package/src/components/font-sizes/font-size-picker.js +3 -0
- package/src/components/iframe/index.js +5 -7
- package/src/components/index.js +3 -0
- package/src/components/justify-content-control/index.js +9 -4
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/line-height-control/index.js +11 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +21 -30
- package/src/components/list-view/block.js +55 -13
- package/src/components/list-view/branch.js +37 -15
- package/src/components/list-view/index.js +6 -0
- package/src/components/list-view/style.scss +56 -14
- package/src/components/list-view/use-block-selection.js +15 -2
- package/src/components/media-placeholder/README.md +8 -0
- package/src/components/media-replace-flow/index.js +3 -0
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/rich-text/index.js +25 -2
- package/src/components/rich-text/index.native.js +24 -8
- package/src/components/rich-text/split-value.js +5 -1
- package/src/components/rich-text/use-firefox-compat.js +39 -0
- package/src/components/rich-text/use-input-rules.js +40 -3
- package/src/components/skip-to-selected-block/index.js +3 -0
- package/src/components/url-input/style.scss +3 -2
- package/src/components/url-popover/image-url-input-ui.js +16 -29
- package/src/components/writing-flow/index.js +8 -0
- package/src/components/writing-flow/readme.md +28 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -53
- package/src/components/writing-flow/use-click-selection.js +65 -0
- package/src/components/writing-flow/use-drag-selection.js +126 -0
- package/src/components/writing-flow/use-input.js +112 -0
- package/src/components/writing-flow/use-multi-selection.js +13 -36
- package/src/components/writing-flow/use-selection-observer.js +153 -0
- package/src/components/writing-flow/use-tab-nav.js +1 -11
- package/src/hooks/anchor.js +8 -6
- package/src/hooks/border-color.js +5 -5
- package/src/hooks/border.js +0 -13
- package/src/hooks/color.js +51 -24
- package/src/hooks/font-family.js +5 -2
- package/src/hooks/font-size.js +10 -7
- package/src/hooks/gap.js +91 -12
- package/src/hooks/layout.js +11 -1
- package/src/hooks/style.js +40 -4
- package/src/hooks/test/gap.js +66 -0
- package/src/hooks/test/style.js +94 -0
- package/src/hooks/test/utils.js +1 -1
- package/src/hooks/utils.js +26 -0
- package/src/layouts/flex.js +93 -6
- package/src/layouts/flow.js +28 -12
- package/src/store/actions.js +349 -32
- package/src/store/defaults.js +7 -1
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +207 -25
- package/src/store/test/selectors.js +305 -5
- package/src/style.scss +2 -0
- package/src/utils/dom.js +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
- package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
- package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
package/src/hooks/style.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
} from './typography';
|
|
43
43
|
import { SPACING_SUPPORT_KEY, DimensionsPanel } from './dimensions';
|
|
44
44
|
import useDisplayBlockControls from '../components/use-display-block-controls';
|
|
45
|
+
import { shouldSkipSerialization } from './utils';
|
|
45
46
|
|
|
46
47
|
const styleSupportKeys = [
|
|
47
48
|
...TYPOGRAPHY_SUPPORT_KEYS,
|
|
@@ -200,6 +201,19 @@ const skipSerializationPathsSave = {
|
|
|
200
201
|
[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],
|
|
201
202
|
};
|
|
202
203
|
|
|
204
|
+
/**
|
|
205
|
+
* A dictionary used to normalize feature names between support flags, style
|
|
206
|
+
* object properties and __experimentSkipSerialization configuration arrays.
|
|
207
|
+
*
|
|
208
|
+
* This allows not having to provide a migration for a support flag and possible
|
|
209
|
+
* backwards compatibility bridges, while still achieving consistency between
|
|
210
|
+
* the support flag and the skip serialization array.
|
|
211
|
+
*
|
|
212
|
+
* @constant
|
|
213
|
+
* @type {Record<string, string>}
|
|
214
|
+
*/
|
|
215
|
+
const renamedFeatures = { gradients: 'gradient' };
|
|
216
|
+
|
|
203
217
|
/**
|
|
204
218
|
* Override props assigned to save component to inject the CSS variables definition.
|
|
205
219
|
*
|
|
@@ -223,9 +237,18 @@ export function addSaveProps(
|
|
|
223
237
|
let { style } = attributes;
|
|
224
238
|
|
|
225
239
|
forEach( skipPaths, ( path, indicator ) => {
|
|
226
|
-
|
|
240
|
+
const skipSerialization = getBlockSupport( blockType, indicator );
|
|
241
|
+
|
|
242
|
+
if ( skipSerialization === true ) {
|
|
227
243
|
style = omit( style, path );
|
|
228
244
|
}
|
|
245
|
+
|
|
246
|
+
if ( Array.isArray( skipSerialization ) ) {
|
|
247
|
+
skipSerialization.forEach( ( featureName ) => {
|
|
248
|
+
const feature = renamedFeatures[ featureName ] || featureName;
|
|
249
|
+
style = omit( style, [ [ ...path, feature ] ] );
|
|
250
|
+
} );
|
|
251
|
+
}
|
|
229
252
|
} );
|
|
230
253
|
|
|
231
254
|
props.style = {
|
|
@@ -304,14 +327,27 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
304
327
|
*/
|
|
305
328
|
const withElementsStyles = createHigherOrderComponent(
|
|
306
329
|
( BlockListBlock ) => ( props ) => {
|
|
307
|
-
const elements = props.attributes.style?.elements;
|
|
308
|
-
|
|
309
330
|
const blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(
|
|
310
331
|
BlockListBlock
|
|
311
332
|
) }`;
|
|
333
|
+
|
|
334
|
+
const skipLinkColorSerialization = shouldSkipSerialization(
|
|
335
|
+
props.name,
|
|
336
|
+
COLOR_SUPPORT_KEY,
|
|
337
|
+
'link'
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
// The Elements API only supports link colors for now,
|
|
341
|
+
// hence the specific omission of `link` in the elements styles.
|
|
342
|
+
// This might need to be refactored or removed if the Elements API
|
|
343
|
+
// changes or `link` supports styles beyond `color`.
|
|
344
|
+
const elements = skipLinkColorSerialization
|
|
345
|
+
? omit( props.attributes.style?.elements, [ 'link' ] )
|
|
346
|
+
: props.attributes.style?.elements;
|
|
347
|
+
|
|
312
348
|
const styles = compileElementsStyles(
|
|
313
349
|
blockElementsContainerIdentifier,
|
|
314
|
-
|
|
350
|
+
elements
|
|
315
351
|
);
|
|
316
352
|
const element = useContext( BlockList.__unstableElementContext );
|
|
317
353
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getGapCSSValue, getGapBoxControlValueFromStyle } from '../gap';
|
|
5
|
+
|
|
6
|
+
describe( 'gap', () => {
|
|
7
|
+
describe( 'getGapBoxControlValueFromStyle()', () => {
|
|
8
|
+
it( 'should return `null` if argument is falsey', () => {
|
|
9
|
+
expect( getGapBoxControlValueFromStyle( undefined ) ).toBeNull();
|
|
10
|
+
expect( getGapBoxControlValueFromStyle( '' ) ).toBeNull();
|
|
11
|
+
} );
|
|
12
|
+
it( 'should return box control value from string', () => {
|
|
13
|
+
const expectedValue = {
|
|
14
|
+
top: '88rem',
|
|
15
|
+
left: '88rem',
|
|
16
|
+
};
|
|
17
|
+
expect( getGapBoxControlValueFromStyle( '88rem' ) ).toEqual(
|
|
18
|
+
expectedValue
|
|
19
|
+
);
|
|
20
|
+
} );
|
|
21
|
+
it( 'should return box control value from object', () => {
|
|
22
|
+
const blockGapValue = {
|
|
23
|
+
top: '222em',
|
|
24
|
+
left: '22px',
|
|
25
|
+
};
|
|
26
|
+
expect( getGapBoxControlValueFromStyle( blockGapValue ) ).toEqual( {
|
|
27
|
+
...blockGapValue,
|
|
28
|
+
} );
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
31
|
+
describe( 'getGapCSSValue()', () => {
|
|
32
|
+
it( 'should return `null` if argument is falsey', () => {
|
|
33
|
+
expect( getGapCSSValue( undefined ) ).toBeNull();
|
|
34
|
+
expect( getGapCSSValue( '' ) ).toBeNull();
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( 'should return single value for gap if argument is valid string', () => {
|
|
38
|
+
expect( getGapCSSValue( '88rem' ) ).toEqual( '88rem' );
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'should return single value for gap if row and column are the same', () => {
|
|
42
|
+
const blockGapValue = {
|
|
43
|
+
top: '88rem',
|
|
44
|
+
left: '88rem',
|
|
45
|
+
};
|
|
46
|
+
expect( getGapCSSValue( blockGapValue ) ).toEqual( '88rem' );
|
|
47
|
+
} );
|
|
48
|
+
|
|
49
|
+
it( 'should return shorthand value for gap if row and column are different', () => {
|
|
50
|
+
const blockGapValue = {
|
|
51
|
+
top: '88px',
|
|
52
|
+
left: '88rem',
|
|
53
|
+
};
|
|
54
|
+
expect( getGapCSSValue( blockGapValue ) ).toEqual( '88px 88rem' );
|
|
55
|
+
} );
|
|
56
|
+
|
|
57
|
+
it( 'should return default value if a top or left is missing', () => {
|
|
58
|
+
const blockGapValue = {
|
|
59
|
+
top: '88px',
|
|
60
|
+
};
|
|
61
|
+
expect( getGapCSSValue( blockGapValue, '1px' ) ).toEqual(
|
|
62
|
+
'88px 1px'
|
|
63
|
+
);
|
|
64
|
+
} );
|
|
65
|
+
} );
|
|
66
|
+
} );
|
package/src/hooks/test/style.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -108,3 +113,92 @@ describe( 'getInlineStyles', () => {
|
|
|
108
113
|
} );
|
|
109
114
|
} );
|
|
110
115
|
} );
|
|
116
|
+
|
|
117
|
+
describe( 'addSaveProps', () => {
|
|
118
|
+
const addSaveProps = applyFilters.bind(
|
|
119
|
+
null,
|
|
120
|
+
'blocks.getSaveContent.extraProps'
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const blockSettings = {
|
|
124
|
+
save: () => <div className="default" />,
|
|
125
|
+
category: 'text',
|
|
126
|
+
title: 'block title',
|
|
127
|
+
supports: {
|
|
128
|
+
spacing: { padding: true },
|
|
129
|
+
color: { gradients: true, text: true },
|
|
130
|
+
typography: {
|
|
131
|
+
fontSize: true,
|
|
132
|
+
__experimentalTextTransform: true,
|
|
133
|
+
__experimentalTextDecoration: true,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const applySkipSerialization = ( features ) => {
|
|
139
|
+
const updatedSettings = { ...blockSettings };
|
|
140
|
+
Object.keys( features ).forEach( ( key ) => {
|
|
141
|
+
updatedSettings.supports[ key ].__experimentalSkipSerialization =
|
|
142
|
+
features[ key ];
|
|
143
|
+
} );
|
|
144
|
+
return updatedSettings;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const attributes = {
|
|
148
|
+
style: {
|
|
149
|
+
color: {
|
|
150
|
+
text: '#d92828',
|
|
151
|
+
gradient:
|
|
152
|
+
'linear-gradient(135deg,rgb(6,147,227) 0%,rgb(223,13,13) 46%,rgb(155,81,224) 100%)',
|
|
153
|
+
},
|
|
154
|
+
spacing: { padding: '10px' },
|
|
155
|
+
typography: {
|
|
156
|
+
fontSize: '1rem',
|
|
157
|
+
textDecoration: 'underline',
|
|
158
|
+
textTransform: 'uppercase',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
it( 'should serialize all styles by default', () => {
|
|
164
|
+
const extraProps = addSaveProps( {}, blockSettings, attributes );
|
|
165
|
+
|
|
166
|
+
expect( extraProps.style ).toEqual( {
|
|
167
|
+
background:
|
|
168
|
+
'linear-gradient(135deg,rgb(6,147,227) 0%,rgb(223,13,13) 46%,rgb(155,81,224) 100%)',
|
|
169
|
+
color: '#d92828',
|
|
170
|
+
padding: '10px',
|
|
171
|
+
fontSize: '1rem',
|
|
172
|
+
textDecoration: 'underline',
|
|
173
|
+
textTransform: 'uppercase',
|
|
174
|
+
} );
|
|
175
|
+
} );
|
|
176
|
+
|
|
177
|
+
it( 'should skip serialization of entire feature set if flag is true', () => {
|
|
178
|
+
const settings = applySkipSerialization( {
|
|
179
|
+
typography: true,
|
|
180
|
+
} );
|
|
181
|
+
const extraProps = addSaveProps( {}, settings, attributes );
|
|
182
|
+
|
|
183
|
+
expect( extraProps.style ).toEqual( {
|
|
184
|
+
background:
|
|
185
|
+
'linear-gradient(135deg,rgb(6,147,227) 0%,rgb(223,13,13) 46%,rgb(155,81,224) 100%)',
|
|
186
|
+
color: '#d92828',
|
|
187
|
+
padding: '10px',
|
|
188
|
+
} );
|
|
189
|
+
} );
|
|
190
|
+
|
|
191
|
+
it( 'should skip serialization of individual features if flag is an array', () => {
|
|
192
|
+
const settings = applySkipSerialization( {
|
|
193
|
+
color: [ 'gradient' ],
|
|
194
|
+
typography: [ 'textDecoration', 'textTransform' ],
|
|
195
|
+
} );
|
|
196
|
+
const extraProps = addSaveProps( {}, settings, attributes );
|
|
197
|
+
|
|
198
|
+
expect( extraProps.style ).toEqual( {
|
|
199
|
+
color: '#d92828',
|
|
200
|
+
padding: '10px',
|
|
201
|
+
fontSize: '1rem',
|
|
202
|
+
} );
|
|
203
|
+
} );
|
|
204
|
+
} );
|
package/src/hooks/test/utils.js
CHANGED
|
@@ -97,7 +97,7 @@ describe( 'anchor', () => {
|
|
|
97
97
|
expect( extraProps.id ).toBe( 'foo' );
|
|
98
98
|
} );
|
|
99
99
|
|
|
100
|
-
it( 'should remove an anchor attribute ID when
|
|
100
|
+
it( 'should remove an anchor attribute ID when field is cleared', () => {
|
|
101
101
|
const attributes = { anchor: '' };
|
|
102
102
|
const extraProps = getSaveContentExtraProps(
|
|
103
103
|
{},
|
package/src/hooks/utils.js
CHANGED
|
@@ -14,6 +14,11 @@ import {
|
|
|
14
14
|
every,
|
|
15
15
|
} from 'lodash';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* WordPress dependencies
|
|
19
|
+
*/
|
|
20
|
+
import { getBlockSupport } from '@wordpress/blocks';
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Removed falsy values from nested object.
|
|
19
24
|
*
|
|
@@ -87,3 +92,24 @@ export function transformStyles(
|
|
|
87
92
|
} );
|
|
88
93
|
return returnBlock;
|
|
89
94
|
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Check whether serialization of specific block support feature or set should
|
|
98
|
+
* be skipped.
|
|
99
|
+
*
|
|
100
|
+
* @param {string|Object} blockType Block name or block type object.
|
|
101
|
+
* @param {string} featureSet Name of block support feature set.
|
|
102
|
+
* @param {string} feature Name of the individual feature to check.
|
|
103
|
+
*
|
|
104
|
+
* @return {boolean} Whether serialization should occur.
|
|
105
|
+
*/
|
|
106
|
+
export function shouldSkipSerialization( blockType, featureSet, feature ) {
|
|
107
|
+
const support = getBlockSupport( blockType, featureSet );
|
|
108
|
+
const skipSerialization = support?.__experimentalSkipSerialization;
|
|
109
|
+
|
|
110
|
+
if ( Array.isArray( skipSerialization ) ) {
|
|
111
|
+
return skipSerialization.includes( feature );
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return skipSerialization;
|
|
115
|
+
}
|
package/src/layouts/flex.js
CHANGED
|
@@ -16,8 +16,14 @@ import { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import { appendSelectors } from './utils';
|
|
19
|
+
import { getGapCSSValue } from '../hooks/gap';
|
|
19
20
|
import useSetting from '../components/use-setting';
|
|
20
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
BlockControls,
|
|
23
|
+
JustifyContentControl,
|
|
24
|
+
BlockVerticalAlignmentControl,
|
|
25
|
+
} from '../components';
|
|
26
|
+
import { shouldSkipSerialization } from '../hooks/utils';
|
|
21
27
|
|
|
22
28
|
// Used with the default, horizontal flex orientation.
|
|
23
29
|
const justifyContentMap = {
|
|
@@ -34,6 +40,12 @@ const alignItemsMap = {
|
|
|
34
40
|
center: 'center',
|
|
35
41
|
};
|
|
36
42
|
|
|
43
|
+
const verticalAlignmentMap = {
|
|
44
|
+
top: 'flex-start',
|
|
45
|
+
center: 'center',
|
|
46
|
+
bottom: 'flex-end',
|
|
47
|
+
};
|
|
48
|
+
|
|
37
49
|
const flexWrapOptions = [ 'wrap', 'nowrap' ];
|
|
38
50
|
|
|
39
51
|
export default {
|
|
@@ -42,8 +54,9 @@ export default {
|
|
|
42
54
|
inspectorControls: function FlexLayoutInspectorControls( {
|
|
43
55
|
layout = {},
|
|
44
56
|
onChange,
|
|
57
|
+
layoutBlockSupport = {},
|
|
45
58
|
} ) {
|
|
46
|
-
const { allowOrientation = true } =
|
|
59
|
+
const { allowOrientation = true } = layoutBlockSupport;
|
|
47
60
|
return (
|
|
48
61
|
<>
|
|
49
62
|
<Flex>
|
|
@@ -74,6 +87,7 @@ export default {
|
|
|
74
87
|
if ( layoutBlockSupport?.allowSwitching ) {
|
|
75
88
|
return null;
|
|
76
89
|
}
|
|
90
|
+
const { allowVerticalAlignment = true } = layoutBlockSupport;
|
|
77
91
|
return (
|
|
78
92
|
<BlockControls group="block" __experimentalShareWithChildBlocks>
|
|
79
93
|
<FlexLayoutJustifyContentControl
|
|
@@ -81,24 +95,40 @@ export default {
|
|
|
81
95
|
onChange={ onChange }
|
|
82
96
|
isToolbar
|
|
83
97
|
/>
|
|
98
|
+
{ allowVerticalAlignment &&
|
|
99
|
+
layout?.orientation !== 'vertical' && (
|
|
100
|
+
<FlexLayoutVerticalAlignmentControl
|
|
101
|
+
layout={ layout }
|
|
102
|
+
onChange={ onChange }
|
|
103
|
+
isToolbar
|
|
104
|
+
/>
|
|
105
|
+
) }
|
|
84
106
|
</BlockControls>
|
|
85
107
|
);
|
|
86
108
|
},
|
|
87
|
-
save: function FlexLayoutStyle( { selector, layout, style } ) {
|
|
109
|
+
save: function FlexLayoutStyle( { selector, layout, style, blockName } ) {
|
|
88
110
|
const { orientation = 'horizontal' } = layout;
|
|
89
111
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
90
112
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
113
|
+
// If a block's block.json skips serialization for spacing or spacing.blockGap,
|
|
114
|
+
// don't apply the user-defined value to the styles.
|
|
91
115
|
const blockGapValue =
|
|
92
|
-
style?.spacing?.blockGap
|
|
116
|
+
style?.spacing?.blockGap &&
|
|
117
|
+
! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
|
|
118
|
+
? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )
|
|
119
|
+
: 'var( --wp--style--block-gap, 0.5em )';
|
|
93
120
|
const justifyContent =
|
|
94
121
|
justifyContentMap[ layout.justifyContent ] ||
|
|
95
122
|
justifyContentMap.left;
|
|
96
123
|
const flexWrap = flexWrapOptions.includes( layout.flexWrap )
|
|
97
124
|
? layout.flexWrap
|
|
98
125
|
: 'wrap';
|
|
126
|
+
const verticalAlignment =
|
|
127
|
+
verticalAlignmentMap[ layout.verticalAlignment ] ||
|
|
128
|
+
verticalAlignmentMap.center;
|
|
99
129
|
const rowOrientation = `
|
|
100
130
|
flex-direction: row;
|
|
101
|
-
align-items:
|
|
131
|
+
align-items: ${ verticalAlignment };
|
|
102
132
|
justify-content: ${ justifyContent };
|
|
103
133
|
`;
|
|
104
134
|
const alignItems =
|
|
@@ -112,8 +142,8 @@ export default {
|
|
|
112
142
|
<style>{ `
|
|
113
143
|
${ appendSelectors( selector ) } {
|
|
114
144
|
display: flex;
|
|
115
|
-
gap: ${ hasBlockGapStylesSupport ? blockGapValue : '0.5em' };
|
|
116
145
|
flex-wrap: ${ flexWrap };
|
|
146
|
+
gap: ${ hasBlockGapStylesSupport ? blockGapValue : '0.5em' };
|
|
117
147
|
${ orientation === 'horizontal' ? rowOrientation : columnOrientation }
|
|
118
148
|
}
|
|
119
149
|
|
|
@@ -132,6 +162,63 @@ export default {
|
|
|
132
162
|
},
|
|
133
163
|
};
|
|
134
164
|
|
|
165
|
+
function FlexLayoutVerticalAlignmentControl( {
|
|
166
|
+
layout,
|
|
167
|
+
onChange,
|
|
168
|
+
isToolbar = false,
|
|
169
|
+
} ) {
|
|
170
|
+
const { verticalAlignment = verticalAlignmentMap.center } = layout;
|
|
171
|
+
|
|
172
|
+
const onVerticalAlignmentChange = ( value ) => {
|
|
173
|
+
onChange( {
|
|
174
|
+
...layout,
|
|
175
|
+
verticalAlignment: value,
|
|
176
|
+
} );
|
|
177
|
+
};
|
|
178
|
+
if ( isToolbar ) {
|
|
179
|
+
return (
|
|
180
|
+
<BlockVerticalAlignmentControl
|
|
181
|
+
onChange={ onVerticalAlignmentChange }
|
|
182
|
+
value={ verticalAlignment }
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const verticalAlignmentOptions = [
|
|
188
|
+
{
|
|
189
|
+
value: 'flex-start',
|
|
190
|
+
label: __( 'Align items top' ),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
value: 'center',
|
|
194
|
+
label: __( 'Align items center' ),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
value: 'flex-end',
|
|
198
|
+
label: __( 'Align items bottom' ),
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<fieldset className="block-editor-hooks__flex-layout-vertical-alignment-control">
|
|
204
|
+
<legend>{ __( 'Vertical alignment' ) }</legend>
|
|
205
|
+
<div>
|
|
206
|
+
{ verticalAlignmentOptions.map( ( value, icon, label ) => {
|
|
207
|
+
return (
|
|
208
|
+
<Button
|
|
209
|
+
key={ value }
|
|
210
|
+
label={ label }
|
|
211
|
+
icon={ icon }
|
|
212
|
+
isPressed={ verticalAlignment === value }
|
|
213
|
+
onClick={ () => onVerticalAlignmentChange( value ) }
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
} ) }
|
|
217
|
+
</div>
|
|
218
|
+
</fieldset>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
135
222
|
function FlexLayoutJustifyContentControl( {
|
|
136
223
|
layout,
|
|
137
224
|
onChange,
|
package/src/layouts/flow.js
CHANGED
|
@@ -14,6 +14,8 @@ import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
|
14
14
|
*/
|
|
15
15
|
import useSetting from '../components/use-setting';
|
|
16
16
|
import { appendSelectors } from './utils';
|
|
17
|
+
import { getGapBoxControlValueFromStyle } from '../hooks/gap';
|
|
18
|
+
import { shouldSkipSerialization } from '../hooks/utils';
|
|
17
19
|
|
|
18
20
|
export default {
|
|
19
21
|
name: 'default',
|
|
@@ -105,12 +107,25 @@ export default {
|
|
|
105
107
|
toolBarControls: function DefaultLayoutToolbarControls() {
|
|
106
108
|
return null;
|
|
107
109
|
},
|
|
108
|
-
save: function DefaultLayoutStyle( {
|
|
110
|
+
save: function DefaultLayoutStyle( {
|
|
111
|
+
selector,
|
|
112
|
+
layout = {},
|
|
113
|
+
style,
|
|
114
|
+
blockName,
|
|
115
|
+
} ) {
|
|
109
116
|
const { contentSize, wideSize } = layout;
|
|
110
117
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
111
118
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
119
|
+
const blockGapStyleValue = getGapBoxControlValueFromStyle(
|
|
120
|
+
style?.spacing?.blockGap
|
|
121
|
+
);
|
|
122
|
+
// If a block's block.json skips serialization for spacing or
|
|
123
|
+
// spacing.blockGap, don't apply the user-defined value to the styles.
|
|
112
124
|
const blockGapValue =
|
|
113
|
-
|
|
125
|
+
blockGapStyleValue?.top &&
|
|
126
|
+
! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
|
|
127
|
+
? blockGapStyleValue?.top
|
|
128
|
+
: 'var( --wp--style--block-gap )';
|
|
114
129
|
|
|
115
130
|
let output =
|
|
116
131
|
!! contentSize || !! wideSize
|
|
@@ -123,11 +138,9 @@ export default {
|
|
|
123
138
|
margin-left: auto !important;
|
|
124
139
|
margin-right: auto !important;
|
|
125
140
|
}
|
|
126
|
-
|
|
127
141
|
${ appendSelectors( selector, '> .alignwide' ) } {
|
|
128
142
|
max-width: ${ wideSize ?? contentSize };
|
|
129
143
|
}
|
|
130
|
-
|
|
131
144
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
132
145
|
max-width: none;
|
|
133
146
|
}
|
|
@@ -137,26 +150,29 @@ export default {
|
|
|
137
150
|
output += `
|
|
138
151
|
${ appendSelectors( selector, '> .alignleft' ) } {
|
|
139
152
|
float: left;
|
|
140
|
-
margin-
|
|
141
|
-
margin-
|
|
153
|
+
margin-inline-start: 0;
|
|
154
|
+
margin-inline-end: 2em;
|
|
142
155
|
}
|
|
143
|
-
|
|
144
156
|
${ appendSelectors( selector, '> .alignright' ) } {
|
|
145
157
|
float: right;
|
|
146
|
-
margin-
|
|
147
|
-
margin-
|
|
158
|
+
margin-inline-start: 2em;
|
|
159
|
+
margin-inline-end: 0;
|
|
148
160
|
}
|
|
149
161
|
|
|
162
|
+
${ appendSelectors( selector, '> .aligncenter' ) } {
|
|
163
|
+
margin-left: auto !important;
|
|
164
|
+
margin-right: auto !important;
|
|
165
|
+
}
|
|
150
166
|
`;
|
|
151
167
|
|
|
152
168
|
if ( hasBlockGapStylesSupport ) {
|
|
153
169
|
output += `
|
|
154
170
|
${ appendSelectors( selector, '> *' ) } {
|
|
155
|
-
margin-
|
|
156
|
-
margin-
|
|
171
|
+
margin-block-start: 0;
|
|
172
|
+
margin-block-end: 0;
|
|
157
173
|
}
|
|
158
174
|
${ appendSelectors( selector, '> * + *' ) } {
|
|
159
|
-
margin-
|
|
175
|
+
margin-block-start: ${ blockGapValue };
|
|
160
176
|
}
|
|
161
177
|
`;
|
|
162
178
|
}
|