@wordpress/block-editor 8.3.1 → 8.5.1
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-content-overlay/index.js +13 -4
- package/build/components/block-content-overlay/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 +40 -0
- package/build/components/block-lock/index.js.map +1 -0
- package/build/components/block-lock/menu-item.js +52 -0
- package/build/components/block-lock/menu-item.js.map +1 -0
- package/build/components/block-lock/modal.js +155 -0
- package/build/components/block-lock/modal.js.map +1 -0
- package/build/components/block-lock/toolbar.js +65 -0
- package/build/components/block-lock/toolbar.js.map +1 -0
- package/build/components/block-lock/use-block-lock.js +53 -0
- package/build/components/block-lock/use-block-lock.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-pattern-setup/index.js +37 -22
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +4 -2
- package/build/components/block-preview/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 +8 -3
- 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 +18 -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 +197 -23
- 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-content-overlay/index.js +13 -4
- package/build-module/components/block-content-overlay/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 +5 -0
- package/build-module/components/block-lock/index.js.map +1 -0
- package/build-module/components/block-lock/menu-item.js +39 -0
- package/build-module/components/block-lock/menu-item.js.map +1 -0
- package/build-module/components/block-lock/modal.js +138 -0
- package/build-module/components/block-lock/modal.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +51 -0
- package/build-module/components/block-lock/toolbar.js.map +1 -0
- package/build-module/components/block-lock/use-block-lock.js +44 -0
- package/build-module/components/block-lock/use-block-lock.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-pattern-setup/index.js +39 -24
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -2
- package/build-module/components/block-preview/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 +9 -4
- 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 +19 -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 +186 -22
- 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 +248 -49
- package/build-style/style.css +248 -49
- 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-content-overlay/index.js +19 -2
- 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 +4 -0
- package/src/components/block-lock/menu-item.js +39 -0
- package/src/components/block-lock/modal.js +194 -0
- package/src/components/block-lock/style.scss +70 -0
- package/src/components/block-lock/toolbar.js +51 -0
- package/src/components/block-lock/use-block-lock.js +49 -0
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-pattern-setup/index.js +84 -59
- package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
- package/src/components/block-pattern-setup/style.scss +32 -26
- package/src/components/block-preview/auto.js +10 -1
- package/src/components/block-preview/index.js +2 -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 +15 -3
- package/src/components/block-switcher/style.scss +15 -4
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
- 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 +14 -31
- 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 +229 -27
- 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
|
@@ -2,47 +2,63 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import {
|
|
7
|
+
Button,
|
|
7
8
|
DropdownMenu,
|
|
8
9
|
MenuGroup,
|
|
9
10
|
MenuItemsChoice,
|
|
11
|
+
VisuallyHidden,
|
|
10
12
|
} from '@wordpress/components';
|
|
11
13
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import {
|
|
14
|
+
import { useMemo } from '@wordpress/element';
|
|
13
15
|
import { chevronDown } from '@wordpress/icons';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
17
19
|
*/
|
|
18
|
-
import { __experimentalGetMatchingVariation as getMatchingVariation } from '../../utils';
|
|
19
20
|
import { store as blockEditorStore } from '../../store';
|
|
20
21
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
function VariationsButtons( {
|
|
23
|
+
className,
|
|
24
|
+
onSelectVariation,
|
|
25
|
+
selectedValue,
|
|
26
|
+
variations,
|
|
27
|
+
} ) {
|
|
28
|
+
return (
|
|
29
|
+
<fieldset className={ className }>
|
|
30
|
+
<VisuallyHidden as="legend">
|
|
31
|
+
{ __( 'Transform to variation' ) }
|
|
32
|
+
</VisuallyHidden>
|
|
33
|
+
{ variations.map( ( variation ) => (
|
|
34
|
+
<Button
|
|
35
|
+
key={ variation.name }
|
|
36
|
+
icon={ variation.icon }
|
|
37
|
+
isPressed={ selectedValue === variation.name }
|
|
38
|
+
label={
|
|
39
|
+
selectedValue === variation.name
|
|
40
|
+
? variation.title
|
|
41
|
+
: sprintf(
|
|
42
|
+
/* translators: %s: Name of the block variation */
|
|
43
|
+
__( 'Transform to %s' ),
|
|
44
|
+
variation.title
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
onClick={ () => onSelectVariation( variation.name ) }
|
|
48
|
+
aria-label={ variation.title }
|
|
49
|
+
showTooltip
|
|
50
|
+
/>
|
|
51
|
+
) ) }
|
|
52
|
+
</fieldset>
|
|
38
53
|
);
|
|
39
|
-
|
|
40
|
-
setSelectedValue(
|
|
41
|
-
getMatchingVariation( blockAttributes, variations )?.name
|
|
42
|
-
);
|
|
43
|
-
}, [ blockAttributes, variations ] );
|
|
44
|
-
if ( ! variations?.length ) return null;
|
|
54
|
+
}
|
|
45
55
|
|
|
56
|
+
function VariationsDropdown( {
|
|
57
|
+
className,
|
|
58
|
+
onSelectVariation,
|
|
59
|
+
selectedValue,
|
|
60
|
+
variations,
|
|
61
|
+
} ) {
|
|
46
62
|
const selectOptions = variations.map(
|
|
47
63
|
( { name, title, description } ) => ( {
|
|
48
64
|
value: name,
|
|
@@ -50,27 +66,21 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
|
50
66
|
info: description,
|
|
51
67
|
} )
|
|
52
68
|
);
|
|
53
|
-
|
|
54
|
-
updateBlockAttributes( blockClientId, {
|
|
55
|
-
...variations.find( ( { name } ) => name === variationName )
|
|
56
|
-
.attributes,
|
|
57
|
-
} );
|
|
58
|
-
};
|
|
59
|
-
const baseClass = 'block-editor-block-variation-transforms';
|
|
69
|
+
|
|
60
70
|
return (
|
|
61
71
|
<DropdownMenu
|
|
62
|
-
className={
|
|
72
|
+
className={ className }
|
|
63
73
|
label={ __( 'Transform to variation' ) }
|
|
64
74
|
text={ __( 'Transform to variation' ) }
|
|
65
75
|
popoverProps={ {
|
|
66
76
|
position: 'bottom center',
|
|
67
|
-
className: `${
|
|
77
|
+
className: `${ className }__popover`,
|
|
68
78
|
} }
|
|
69
79
|
icon={ chevronDown }
|
|
70
80
|
toggleProps={ { iconPosition: 'right' } }
|
|
71
81
|
>
|
|
72
82
|
{ () => (
|
|
73
|
-
<div className={ `${
|
|
83
|
+
<div className={ `${ className }__container` }>
|
|
74
84
|
<MenuGroup>
|
|
75
85
|
<MenuItemsChoice
|
|
76
86
|
choices={ selectOptions }
|
|
@@ -84,4 +94,63 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
|
84
94
|
);
|
|
85
95
|
}
|
|
86
96
|
|
|
97
|
+
function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
98
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
99
|
+
const { activeBlockVariation, variations } = useSelect(
|
|
100
|
+
( select ) => {
|
|
101
|
+
const { getActiveBlockVariation, getBlockVariations } = select(
|
|
102
|
+
blocksStore
|
|
103
|
+
);
|
|
104
|
+
const { getBlockName, getBlockAttributes } = select(
|
|
105
|
+
blockEditorStore
|
|
106
|
+
);
|
|
107
|
+
const name = blockClientId && getBlockName( blockClientId );
|
|
108
|
+
return {
|
|
109
|
+
activeBlockVariation: getActiveBlockVariation(
|
|
110
|
+
name,
|
|
111
|
+
getBlockAttributes( blockClientId )
|
|
112
|
+
),
|
|
113
|
+
variations: name && getBlockVariations( name, 'transform' ),
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
[ blockClientId ]
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const selectedValue = activeBlockVariation?.name;
|
|
120
|
+
|
|
121
|
+
// Check if each variation has a unique icon.
|
|
122
|
+
const hasUniqueIcons = useMemo( () => {
|
|
123
|
+
const variationIcons = new Set();
|
|
124
|
+
variations.forEach( ( variation ) => {
|
|
125
|
+
if ( variation.icon ) {
|
|
126
|
+
variationIcons.add( variation.icon );
|
|
127
|
+
}
|
|
128
|
+
} );
|
|
129
|
+
return variationIcons.size === variations.length;
|
|
130
|
+
}, [ variations ] );
|
|
131
|
+
|
|
132
|
+
const onSelectVariation = ( variationName ) => {
|
|
133
|
+
updateBlockAttributes( blockClientId, {
|
|
134
|
+
...variations.find( ( { name } ) => name === variationName )
|
|
135
|
+
.attributes,
|
|
136
|
+
} );
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const baseClass = 'block-editor-block-variation-transforms';
|
|
140
|
+
|
|
141
|
+
// Skip rendering if there are no variations
|
|
142
|
+
if ( ! variations?.length ) return null;
|
|
143
|
+
|
|
144
|
+
const Component = hasUniqueIcons ? VariationsButtons : VariationsDropdown;
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<Component
|
|
148
|
+
className={ baseClass }
|
|
149
|
+
onSelectVariation={ onSelectVariation }
|
|
150
|
+
selectedValue={ selectedValue }
|
|
151
|
+
variations={ variations }
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
87
156
|
export default __experimentalBlockVariationTransforms;
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import BlockVerticalAlignmentUI from './ui';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const BlockVerticalAlignmentControl = ( props ) => {
|
|
7
7
|
return <BlockVerticalAlignmentUI { ...props } isToolbar={ false } />;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const BlockVerticalAlignmentToolbar = ( props ) => {
|
|
11
11
|
return <BlockVerticalAlignmentUI { ...props } isToolbar />;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-control/README.md
|
|
16
|
+
*/
|
|
17
|
+
export { BlockVerticalAlignmentControl, BlockVerticalAlignmentToolbar };
|
|
@@ -150,6 +150,10 @@ describe( 'hasMixedValues', () => {
|
|
|
150
150
|
expect( hasMixedValues( '2px' ) ).toBe( false );
|
|
151
151
|
} );
|
|
152
152
|
|
|
153
|
+
it( 'should return false when passed a string value containing a unit with no quantity', () => {
|
|
154
|
+
expect( hasMixedValues( 'em' ) ).toBe( false );
|
|
155
|
+
} );
|
|
156
|
+
|
|
153
157
|
it( 'should return true when passed mixed values', () => {
|
|
154
158
|
const values = {
|
|
155
159
|
bottomLeft: '1em',
|
|
@@ -91,7 +91,8 @@ export function getAllValue( values = {} ) {
|
|
|
91
91
|
*/
|
|
92
92
|
export function hasMixedValues( values = {} ) {
|
|
93
93
|
const allValue = getAllValue( values );
|
|
94
|
-
const isMixed =
|
|
94
|
+
const isMixed =
|
|
95
|
+
typeof values === 'string' ? false : isNaN( parseFloat( allValue ) );
|
|
95
96
|
|
|
96
97
|
return isMixed;
|
|
97
98
|
}
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
6
|
-
padding: $grid-unit-10;
|
|
7
6
|
width: 100%;
|
|
8
7
|
height: auto;
|
|
9
8
|
color: $gray-900;
|
|
10
9
|
box-shadow: inset 0 0 0 $border-width $gray-900;
|
|
11
10
|
|
|
11
|
+
// Needs specificity to override button styles.
|
|
12
|
+
&.components-button.components-button {
|
|
13
|
+
padding: $grid-unit-15;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
.is-dark-theme & {
|
|
13
17
|
color: $light-gray-placeholder;
|
|
14
18
|
box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;
|
|
@@ -69,13 +69,64 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
69
69
|
min-height: 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
.emotion-10 {
|
|
73
|
+
display: -webkit-box;
|
|
74
|
+
display: -webkit-flex;
|
|
75
|
+
display: -ms-flexbox;
|
|
76
|
+
display: flex;
|
|
77
|
+
-webkit-align-items: flex-start;
|
|
78
|
+
-webkit-box-align: flex-start;
|
|
79
|
+
-ms-flex-align: flex-start;
|
|
80
|
+
align-items: flex-start;
|
|
81
|
+
-webkit-flex-direction: row;
|
|
82
|
+
-ms-flex-direction: row;
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
-webkit-box-pack: justify;
|
|
85
|
+
-webkit-justify-content: space-between;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
width: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.emotion-10>*+*:not( marquee ) {
|
|
91
|
+
margin-left: calc(4px * 2);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.emotion-10>* {
|
|
95
|
+
min-width: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.emotion-13 {
|
|
99
|
+
display: block;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
display: block;
|
|
104
|
+
max-height: 100%;
|
|
105
|
+
max-width: 100%;
|
|
106
|
+
min-height: 0;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
-webkit-flex: 1;
|
|
109
|
+
-ms-flex: 1;
|
|
110
|
+
flex: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.emotion-15 {
|
|
114
|
+
display: block;
|
|
115
|
+
max-height: 100%;
|
|
116
|
+
max-width: 100%;
|
|
117
|
+
min-height: 0;
|
|
118
|
+
min-width: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
72
121
|
<div
|
|
73
122
|
className="components-base-control block-editor-color-gradient-control emotion-0 emotion-1"
|
|
74
123
|
>
|
|
75
124
|
<div
|
|
76
125
|
className="components-base-control__field emotion-2 emotion-3"
|
|
77
126
|
>
|
|
78
|
-
<fieldset
|
|
127
|
+
<fieldset
|
|
128
|
+
className="block-editor-color-gradient-control__fieldset"
|
|
129
|
+
>
|
|
79
130
|
<div
|
|
80
131
|
className="components-flex components-h-stack components-v-stack emotion-4 emotion-5"
|
|
81
132
|
data-wp-c16t={true}
|
|
@@ -104,8 +155,10 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
104
155
|
<button
|
|
105
156
|
aria-expanded={false}
|
|
106
157
|
aria-haspopup="true"
|
|
107
|
-
aria-label="Custom color picker"
|
|
108
|
-
className="components-color-palette__custom-color"
|
|
158
|
+
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
159
|
+
className="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
160
|
+
data-wp-c16t={true}
|
|
161
|
+
data-wp-component="Flex"
|
|
109
162
|
onClick={[Function]}
|
|
110
163
|
style={
|
|
111
164
|
Object {
|
|
@@ -114,7 +167,20 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
114
167
|
}
|
|
115
168
|
}
|
|
116
169
|
>
|
|
117
|
-
|
|
170
|
+
<span
|
|
171
|
+
className="components-truncate components-flex-item components-color-palette__custom-color-name emotion-5 emotion-13 emotion-5"
|
|
172
|
+
data-wp-c16t={true}
|
|
173
|
+
data-wp-component="FlexItem"
|
|
174
|
+
>
|
|
175
|
+
red
|
|
176
|
+
</span>
|
|
177
|
+
<span
|
|
178
|
+
className="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
179
|
+
data-wp-c16t={true}
|
|
180
|
+
data-wp-component="FlexItem"
|
|
181
|
+
>
|
|
182
|
+
f00
|
|
183
|
+
</span>
|
|
118
184
|
</button>
|
|
119
185
|
</div>
|
|
120
186
|
<div
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
.block-editor-color-gradient-control__fieldset {
|
|
8
|
+
// Prevents the `fieldset` from growing beyond its parent's size
|
|
9
|
+
// in order to fit its content.
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
.block-editor-panel-color-gradient-settings {
|
|
8
14
|
.block-editor-panel-color-gradient-settings__panel-title {
|
|
9
15
|
display: flex;
|
|
@@ -11,6 +11,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
11
11
|
*/
|
|
12
12
|
import { store as blockEditorStore } from '../../store';
|
|
13
13
|
import useConvertToGroupButtonProps from './use-convert-to-group-button-props';
|
|
14
|
+
import BlockGroupToolbar from './toolbar';
|
|
14
15
|
|
|
15
16
|
function ConvertToGroupButton( {
|
|
16
17
|
clientIds,
|
|
@@ -73,4 +74,8 @@ function ConvertToGroupButton( {
|
|
|
73
74
|
);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
export {
|
|
77
|
+
export {
|
|
78
|
+
BlockGroupToolbar,
|
|
79
|
+
ConvertToGroupButton,
|
|
80
|
+
useConvertToGroupButtonProps,
|
|
81
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { switchToBlockType } from '@wordpress/blocks';
|
|
6
|
+
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
7
|
+
import { group, row, stack } from '@wordpress/icons';
|
|
8
|
+
import { _x } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { useConvertToGroupButtonProps } from '../convert-to-group-buttons';
|
|
14
|
+
import { store as blockEditorStore } from '../../store';
|
|
15
|
+
|
|
16
|
+
const layouts = {
|
|
17
|
+
group: undefined,
|
|
18
|
+
row: { type: 'flex', flexWrap: 'nowrap' },
|
|
19
|
+
stack: { type: 'flex', orientation: 'vertical' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function BlockGroupToolbar() {
|
|
23
|
+
const {
|
|
24
|
+
blocksSelection,
|
|
25
|
+
clientIds,
|
|
26
|
+
groupingBlockName,
|
|
27
|
+
isGroupable,
|
|
28
|
+
} = useConvertToGroupButtonProps();
|
|
29
|
+
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
30
|
+
|
|
31
|
+
const { canRemove } = useSelect(
|
|
32
|
+
( select ) => {
|
|
33
|
+
const { canRemoveBlocks } = select( blockEditorStore );
|
|
34
|
+
return {
|
|
35
|
+
canRemove: canRemoveBlocks( clientIds ),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
[ clientIds ]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const onConvertToGroup = ( layout = 'group' ) => {
|
|
42
|
+
const newBlocks = switchToBlockType(
|
|
43
|
+
blocksSelection,
|
|
44
|
+
groupingBlockName
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if ( newBlocks && newBlocks.length > 0 ) {
|
|
48
|
+
// Because the block is not in the store yet we can't use
|
|
49
|
+
// updateBlockAttributes so need to manually update attributes.
|
|
50
|
+
newBlocks[ 0 ].attributes.layout = layouts[ layout ];
|
|
51
|
+
replaceBlocks( clientIds, newBlocks );
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onConvertToRow = () => onConvertToGroup( 'row' );
|
|
56
|
+
const onConvertToStack = () => onConvertToGroup( 'stack' );
|
|
57
|
+
|
|
58
|
+
// Don't render the button if the current selection cannot be grouped.
|
|
59
|
+
// A good example is selecting multiple button blocks within a Buttons block:
|
|
60
|
+
// The group block is not a valid child of Buttons, so we should not show the button.
|
|
61
|
+
// Any blocks that are locked against removal also cannot be grouped.
|
|
62
|
+
if ( ! isGroupable || ! canRemove ) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<ToolbarGroup>
|
|
68
|
+
<ToolbarButton
|
|
69
|
+
icon={ group }
|
|
70
|
+
label={ _x( 'Group', 'verb' ) }
|
|
71
|
+
onClick={ onConvertToGroup }
|
|
72
|
+
/>
|
|
73
|
+
<ToolbarButton
|
|
74
|
+
icon={ row }
|
|
75
|
+
label={ _x( 'Row', 'single horizontal line' ) }
|
|
76
|
+
onClick={ onConvertToRow }
|
|
77
|
+
/>
|
|
78
|
+
<ToolbarButton
|
|
79
|
+
icon={ stack }
|
|
80
|
+
label={ _x( 'Stack', 'verb' ) }
|
|
81
|
+
onClick={ onConvertToStack }
|
|
82
|
+
/>
|
|
83
|
+
</ToolbarGroup>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default BlockGroupToolbar;
|
|
@@ -171,4 +171,7 @@ function CopyHandler( { children } ) {
|
|
|
171
171
|
return <div ref={ useClipboardHandler() }>{ children }</div>;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/copy-handler/README.md
|
|
176
|
+
*/
|
|
174
177
|
export default CopyHandler;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# DateFormatPicker
|
|
2
|
+
|
|
3
|
+
The `DateFormatPicker` component renders controls that let the user choose a
|
|
4
|
+
_date format_. That is, how they want their dates to be formatted.
|
|
5
|
+
|
|
6
|
+
A user can pick _Default_ to use the default date format (usually set at the
|
|
7
|
+
site level).
|
|
8
|
+
|
|
9
|
+
Otherwise, a user may choose a suggested date format or type in their own date
|
|
10
|
+
format by selecting _Custom_.
|
|
11
|
+
|
|
12
|
+
All date format strings should be in the format accepted by by the [`dateI18n`
|
|
13
|
+
function in
|
|
14
|
+
`@wordpress/date`](https://github.com/WordPress/gutenberg/tree/trunk/packages/date#datei18n).
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```jsx
|
|
19
|
+
import { DateFormatPicker } from '@wordpress/block-editor';
|
|
20
|
+
|
|
21
|
+
const Example = () => {
|
|
22
|
+
const [ format, setFormat ] = useState( null );
|
|
23
|
+
return (
|
|
24
|
+
<DateFormatPicker
|
|
25
|
+
format={ format }
|
|
26
|
+
defaultFormat={ 'M j, Y' }
|
|
27
|
+
onChange={ ( nextFormat ) =>
|
|
28
|
+
setFormat( nextFormat );
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
### `format`
|
|
38
|
+
|
|
39
|
+
The current date format selected by the user. If `null`, _Default_ is selected.
|
|
40
|
+
|
|
41
|
+
- Type: `string|null`
|
|
42
|
+
- Required: Yes
|
|
43
|
+
|
|
44
|
+
### `defaultFormat`
|
|
45
|
+
|
|
46
|
+
The default format string. Used to show to the user what the date will look like
|
|
47
|
+
if _Default_ is selected.
|
|
48
|
+
|
|
49
|
+
- Type: `string`
|
|
50
|
+
- Required: Yes
|
|
51
|
+
|
|
52
|
+
### `onChange`
|
|
53
|
+
|
|
54
|
+
Called when the user makes a selection, or when the user types in a date format.
|
|
55
|
+
`null` indicates that _Default_ is selected.
|
|
56
|
+
|
|
57
|
+
- Type: `( format: string|null ) => void`
|
|
58
|
+
- Required: Yes
|