@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
|
@@ -20,16 +20,19 @@ import {
|
|
|
20
20
|
useConvertToGroupButtonProps,
|
|
21
21
|
ConvertToGroupButton,
|
|
22
22
|
} from '../convert-to-group-buttons';
|
|
23
|
+
import { BlockLockMenuItem } from '../block-lock';
|
|
23
24
|
import { store as blockEditorStore } from '../../store';
|
|
24
25
|
|
|
25
26
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
26
27
|
|
|
27
28
|
const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
28
|
-
const { selectedBlocks, selectedClientIds } = useSelect(
|
|
29
|
+
const { selectedBlocks, selectedClientIds, canRemove } = useSelect(
|
|
29
30
|
( select ) => {
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const {
|
|
32
|
+
getBlocksByClientId,
|
|
33
|
+
getSelectedBlockClientIds,
|
|
34
|
+
canRemoveBlocks,
|
|
35
|
+
} = select( blockEditorStore );
|
|
33
36
|
const ids =
|
|
34
37
|
clientIds !== null ? clientIds : getSelectedBlockClientIds();
|
|
35
38
|
return {
|
|
@@ -38,30 +41,48 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
38
41
|
( block ) => block.name
|
|
39
42
|
),
|
|
40
43
|
selectedClientIds: ids,
|
|
44
|
+
canRemove: canRemoveBlocks( ids ),
|
|
41
45
|
};
|
|
42
46
|
},
|
|
43
47
|
[ clientIds ]
|
|
44
48
|
);
|
|
45
49
|
|
|
50
|
+
const showLockButton = selectedClientIds.length === 1;
|
|
51
|
+
|
|
46
52
|
// Check if current selection of blocks is Groupable or Ungroupable
|
|
47
53
|
// and pass this props down to ConvertToGroupButton.
|
|
48
54
|
const convertToGroupButtonProps = useConvertToGroupButtonProps();
|
|
49
55
|
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
50
|
-
const showConvertToGroupButton =
|
|
56
|
+
const showConvertToGroupButton =
|
|
57
|
+
( isGroupable || isUngroupable ) && canRemove;
|
|
58
|
+
|
|
51
59
|
return (
|
|
52
60
|
<Slot fillProps={ { ...fillProps, selectedBlocks, selectedClientIds } }>
|
|
53
61
|
{ ( fills ) => {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
if (
|
|
63
|
+
! fills?.length > 0 &&
|
|
64
|
+
! showConvertToGroupButton &&
|
|
65
|
+
! showLockButton
|
|
66
|
+
) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<MenuGroup>
|
|
72
|
+
{ showLockButton && (
|
|
73
|
+
<BlockLockMenuItem
|
|
74
|
+
clientId={ selectedClientIds[ 0 ] }
|
|
75
|
+
/>
|
|
76
|
+
) }
|
|
77
|
+
{ fills }
|
|
78
|
+
{ showConvertToGroupButton && (
|
|
58
79
|
<ConvertToGroupButton
|
|
59
80
|
{ ...convertToGroupButtonProps }
|
|
60
81
|
onClose={ fillProps?.onClose }
|
|
61
82
|
/>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
) }
|
|
84
|
+
</MenuGroup>
|
|
85
|
+
);
|
|
65
86
|
} }
|
|
66
87
|
</Slot>
|
|
67
88
|
);
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isTemplatePart,
|
|
21
21
|
} from '@wordpress/blocks';
|
|
22
22
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
23
|
-
import {
|
|
23
|
+
import { copy } from '@wordpress/icons';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -69,7 +69,7 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
69
69
|
// appropriate icon to communicate the non-uniformity.
|
|
70
70
|
_icon = isSelectionOfSameType
|
|
71
71
|
? getBlockType( firstBlockName )?.icon
|
|
72
|
-
:
|
|
72
|
+
: copy;
|
|
73
73
|
}
|
|
74
74
|
return {
|
|
75
75
|
possibleBlockTransformations: getBlockTransformItems(
|
|
@@ -108,7 +108,19 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
108
108
|
disabled
|
|
109
109
|
className="block-editor-block-switcher__no-switcher-icon"
|
|
110
110
|
title={ blockTitle }
|
|
111
|
-
icon={
|
|
111
|
+
icon={
|
|
112
|
+
<>
|
|
113
|
+
<BlockIcon icon={ icon } showColors />
|
|
114
|
+
{ ( isReusable || isTemplate ) && (
|
|
115
|
+
<span className="block-editor-block-switcher__toggle-text">
|
|
116
|
+
<BlockTitle
|
|
117
|
+
clientId={ clientIds }
|
|
118
|
+
maximumLength={ 35 }
|
|
119
|
+
/>
|
|
120
|
+
</span>
|
|
121
|
+
) }
|
|
122
|
+
</>
|
|
123
|
+
}
|
|
112
124
|
/>
|
|
113
125
|
</ToolbarGroup>
|
|
114
126
|
);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
.block-editor-block-switcher {
|
|
2
2
|
position: relative;
|
|
3
|
+
padding: 0 ($grid-unit-15 * 0.5);
|
|
4
|
+
|
|
5
|
+
// @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
|
|
6
|
+
// This is best fixed by making the mover control area a proper single toolbar group.
|
|
7
|
+
// It needs specificity due to style inherited from .components-accessible-toolbar .components-button.has-icon.has-icon.
|
|
8
|
+
.components-button.components-dropdown-menu__toggle.has-icon.has-icon {
|
|
9
|
+
min-width: $button-size;
|
|
10
|
+
}
|
|
3
11
|
}
|
|
4
12
|
|
|
5
13
|
// Show an indicator triangle.
|
|
@@ -8,7 +16,6 @@
|
|
|
8
16
|
position: relative;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
|
-
|
|
12
19
|
.components-button.block-editor-block-switcher__toggle,
|
|
13
20
|
.components-button.block-editor-block-switcher__no-switcher-icon {
|
|
14
21
|
margin: 0;
|
|
@@ -39,11 +46,15 @@
|
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
.components-button.block-editor-block-switcher__no-switcher-icon {
|
|
42
|
-
|
|
49
|
+
display: flex;
|
|
50
|
+
// The `!important` is used to vastly simplify the overriding of an inherited selector.
|
|
51
|
+
// Can be removed if we refactor .block-editor-block-toolbar .components-toolbar-group .components-button.has-icon.has-icon
|
|
52
|
+
padding: ($grid-unit-15 * 0.5) $grid-unit-15 !important;
|
|
43
53
|
|
|
44
|
-
.block-editor-
|
|
54
|
+
.block-editor-block-icon {
|
|
45
55
|
margin-right: auto;
|
|
46
56
|
margin-left: auto;
|
|
57
|
+
min-width: $icon-size !important;
|
|
47
58
|
}
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -165,7 +176,7 @@
|
|
|
165
176
|
// The block switcher in the contextual toolbar should be bigger.
|
|
166
177
|
.block-editor-block-contextual-toolbar {
|
|
167
178
|
.components-button.block-editor-block-switcher__no-switcher-icon {
|
|
168
|
-
width: $
|
|
179
|
+
min-width: $button-size;
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
.components-button.block-editor-block-switcher__no-switcher-icon,
|
|
@@ -6,19 +6,21 @@ exports[`BlockSwitcherDropdownMenu should render disabled block switcher with mu
|
|
|
6
6
|
className="block-editor-block-switcher__no-switcher-icon"
|
|
7
7
|
disabled={true}
|
|
8
8
|
icon={
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
<React.Fragment>
|
|
10
|
+
<Memo(BlockIcon)
|
|
11
|
+
icon={
|
|
12
|
+
<SVG
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<Path
|
|
17
|
+
d="M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"
|
|
18
|
+
/>
|
|
19
|
+
</SVG>
|
|
20
|
+
}
|
|
21
|
+
showColors={true}
|
|
22
|
+
/>
|
|
23
|
+
</React.Fragment>
|
|
22
24
|
}
|
|
23
25
|
/>
|
|
24
26
|
</ToolbarGroup>
|
|
@@ -10,7 +10,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
|
|
11
11
|
import { DOWN } from '@wordpress/keycodes';
|
|
12
12
|
import { Button } from '@wordpress/components';
|
|
13
|
-
import {
|
|
13
|
+
import { copy } from '@wordpress/icons';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -131,7 +131,7 @@ describe( 'BlockSwitcherDropdownMenu', () => {
|
|
|
131
131
|
test( 'should render disabled block switcher with multi block of different types when no transforms', () => {
|
|
132
132
|
useSelect.mockImplementation( () => ( {
|
|
133
133
|
possibleBlockTransformations: [],
|
|
134
|
-
icon:
|
|
134
|
+
icon: copy,
|
|
135
135
|
} ) );
|
|
136
136
|
const wrapper = shallow(
|
|
137
137
|
<BlockSwitcherDropdownMenu
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Block Title
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Block Title component renders a block's configured title as a string.
|
|
4
|
+
|
|
5
|
+
It prioritizes contextual titles such as block variation and reusable block labels when returning a value. If none is found, it will return the display title specified in the block's metadata.
|
|
6
|
+
|
|
7
|
+
The component will be empty if a title cannot be determined.
|
|
8
|
+
|
|
4
9
|
|
|
5
10
|
## Usage
|
|
6
11
|
|
|
@@ -14,8 +14,8 @@ import useBlockDisplayTitle from './use-block-display-title';
|
|
|
14
14
|
* <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/>
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
-
* @param {Object}
|
|
18
|
-
* @param {string}
|
|
17
|
+
* @param {Object} props
|
|
18
|
+
* @param {string} props.clientId Client ID of block.
|
|
19
19
|
* @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.
|
|
20
20
|
*
|
|
21
21
|
* @return {JSX.Element} Block title.
|
|
@@ -26,6 +26,9 @@ jest.mock( '@wordpress/blocks', () => {
|
|
|
26
26
|
case 'name-with-label':
|
|
27
27
|
return { title: 'Block With Label' };
|
|
28
28
|
|
|
29
|
+
case 'name-with-custom-label':
|
|
30
|
+
return { title: 'Block With Custom Label' };
|
|
31
|
+
|
|
29
32
|
case 'name-with-long-label':
|
|
30
33
|
return { title: 'Block With Long Label' };
|
|
31
34
|
}
|
|
@@ -38,6 +41,9 @@ jest.mock( '@wordpress/blocks', () => {
|
|
|
38
41
|
case 'Block With Long Label':
|
|
39
42
|
return 'This is a longer label than typical for blocks to have.';
|
|
40
43
|
|
|
44
|
+
case 'Block With Custom Label':
|
|
45
|
+
return 'A Custom Label like a Block Variation Label';
|
|
46
|
+
|
|
41
47
|
default:
|
|
42
48
|
return title;
|
|
43
49
|
}
|
|
@@ -61,7 +67,7 @@ jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
|
61
67
|
} );
|
|
62
68
|
|
|
63
69
|
describe( 'BlockTitle', () => {
|
|
64
|
-
it( 'renders nothing if name is
|
|
70
|
+
it( 'renders nothing if name is falsey', () => {
|
|
65
71
|
useSelect.mockImplementation( () => ( {
|
|
66
72
|
name: null,
|
|
67
73
|
attributes: null,
|
|
@@ -106,6 +112,42 @@ describe( 'BlockTitle', () => {
|
|
|
106
112
|
expect( wrapper.text() ).toBe( 'Test Label' );
|
|
107
113
|
} );
|
|
108
114
|
|
|
115
|
+
it( 'should prioritize reusable block title over title', () => {
|
|
116
|
+
useSelect.mockImplementation( () => ( {
|
|
117
|
+
name: 'name-with-label',
|
|
118
|
+
reusableBlockTitle: 'Reuse me!',
|
|
119
|
+
attributes: null,
|
|
120
|
+
} ) );
|
|
121
|
+
|
|
122
|
+
const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
|
|
123
|
+
|
|
124
|
+
expect( wrapper.text() ).toBe( 'Reuse me!' );
|
|
125
|
+
} );
|
|
126
|
+
|
|
127
|
+
it( 'should prioritize block label over title', () => {
|
|
128
|
+
useSelect.mockImplementation( () => ( {
|
|
129
|
+
name: 'name-with-custom-label',
|
|
130
|
+
attributes: null,
|
|
131
|
+
} ) );
|
|
132
|
+
|
|
133
|
+
const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
|
|
134
|
+
|
|
135
|
+
expect( wrapper.text() ).toBe(
|
|
136
|
+
'A Custom Label like a Block Variation Label'
|
|
137
|
+
);
|
|
138
|
+
} );
|
|
139
|
+
|
|
140
|
+
it( 'should default to block information title if no reusable title or block name is available', () => {
|
|
141
|
+
useSelect.mockImplementation( () => ( {
|
|
142
|
+
name: 'some-rando-name',
|
|
143
|
+
attributes: null,
|
|
144
|
+
} ) );
|
|
145
|
+
|
|
146
|
+
const wrapper = shallow( <BlockTitle clientId="id-name-with-label" /> );
|
|
147
|
+
|
|
148
|
+
expect( wrapper.text() ).toBe( 'Block With Label' );
|
|
149
|
+
} );
|
|
150
|
+
|
|
109
151
|
it( 'truncates the label with custom truncate length', () => {
|
|
110
152
|
useSelect.mockImplementation( () => ( {
|
|
111
153
|
name: 'name-with-long-label',
|
|
@@ -29,7 +29,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
29
29
|
* useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 );
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
|
-
* @param {string}
|
|
32
|
+
* @param {string} clientId Client ID of block.
|
|
33
33
|
* @param {number|undefined} maximumLength The maximum length that the block title string may be before truncated.
|
|
34
34
|
* @return {?string} Block title.
|
|
35
35
|
*/
|
|
@@ -70,14 +70,17 @@ export default function useBlockDisplayTitle( clientId, maximumLength ) {
|
|
|
70
70
|
const blockLabel = blockType
|
|
71
71
|
? getBlockLabel( blockType, attributes )
|
|
72
72
|
: null;
|
|
73
|
+
|
|
73
74
|
const label = reusableBlockTitle || blockLabel;
|
|
74
75
|
// Label will fallback to the title if no label is defined for the current
|
|
75
|
-
// label context. If the label is defined we prioritize it over
|
|
76
|
+
// label context. If the label is defined we prioritize it over a
|
|
76
77
|
// possible block variation title match.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const blockTitle =
|
|
79
|
+
label && label !== blockType.title ? label : blockInformation.title;
|
|
80
|
+
|
|
81
|
+
if ( maximumLength && maximumLength > 0 ) {
|
|
82
|
+
return truncate( blockTitle, { length: maximumLength } );
|
|
81
83
|
}
|
|
82
|
-
|
|
84
|
+
|
|
85
|
+
return blockTitle;
|
|
83
86
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createSlotFill } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
const { Fill: __unstableBlockToolbarLastItem, Slot } = createSlotFill(
|
|
7
|
+
'__unstableBlockToolbarLastItem'
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
__unstableBlockToolbarLastItem.Slot = Slot;
|
|
11
|
+
|
|
12
|
+
export default __unstableBlockToolbarLastItem;
|
|
@@ -19,11 +19,15 @@ import BlockMover from '../block-mover';
|
|
|
19
19
|
import BlockParentSelector from '../block-parent-selector';
|
|
20
20
|
import BlockSwitcher from '../block-switcher';
|
|
21
21
|
import BlockControls from '../block-controls';
|
|
22
|
+
import __unstableBlockToolbarLastItem from './block-toolbar-last-item';
|
|
22
23
|
import BlockSettingsMenu from '../block-settings-menu';
|
|
24
|
+
import { BlockLockToolbar } from '../block-lock';
|
|
25
|
+
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
23
26
|
import { useShowMoversGestures } from './utils';
|
|
24
27
|
import { store as blockEditorStore } from '../../store';
|
|
28
|
+
import __unstableBlockNameContext from './block-name-context';
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
const BlockToolbar = ( { hideDragHandle } ) => {
|
|
27
31
|
const {
|
|
28
32
|
blockClientIds,
|
|
29
33
|
blockClientId,
|
|
@@ -114,6 +118,11 @@ export default function BlockToolbar( { hideDragHandle } ) {
|
|
|
114
118
|
{ ( shouldShowVisualToolbar || isMultiToolbar ) && (
|
|
115
119
|
<ToolbarGroup className="block-editor-block-toolbar__block-controls">
|
|
116
120
|
<BlockSwitcher clientIds={ blockClientIds } />
|
|
121
|
+
{ ! isMultiToolbar && (
|
|
122
|
+
<BlockLockToolbar
|
|
123
|
+
clientId={ blockClientIds[ 0 ] }
|
|
124
|
+
/>
|
|
125
|
+
) }
|
|
117
126
|
<BlockMover
|
|
118
127
|
clientIds={ blockClientIds }
|
|
119
128
|
hideDragHandle={ hideDragHandle || hasReducedUI }
|
|
@@ -121,6 +130,9 @@ export default function BlockToolbar( { hideDragHandle } ) {
|
|
|
121
130
|
</ToolbarGroup>
|
|
122
131
|
) }
|
|
123
132
|
</div>
|
|
133
|
+
{ shouldShowVisualToolbar && isMultiToolbar && (
|
|
134
|
+
<BlockGroupToolbar />
|
|
135
|
+
) }
|
|
124
136
|
{ shouldShowVisualToolbar && (
|
|
125
137
|
<>
|
|
126
138
|
<BlockControls.Slot
|
|
@@ -140,9 +152,19 @@ export default function BlockToolbar( { hideDragHandle } ) {
|
|
|
140
152
|
group="other"
|
|
141
153
|
className="block-editor-block-toolbar__slot"
|
|
142
154
|
/>
|
|
155
|
+
<__unstableBlockNameContext.Provider
|
|
156
|
+
value={ blockType?.name }
|
|
157
|
+
>
|
|
158
|
+
<__unstableBlockToolbarLastItem.Slot />
|
|
159
|
+
</__unstableBlockNameContext.Provider>
|
|
143
160
|
</>
|
|
144
161
|
) }
|
|
145
162
|
<BlockSettingsMenu clientIds={ blockClientIds } />
|
|
146
163
|
</div>
|
|
147
164
|
);
|
|
148
|
-
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md
|
|
169
|
+
*/
|
|
170
|
+
export default BlockToolbar;
|
|
@@ -91,6 +91,16 @@
|
|
|
91
91
|
.block-editor-block-mover {
|
|
92
92
|
margin-left: -$grid-unit-15 * 0.5;
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
.block-editor-block-lock-toolbar {
|
|
96
|
+
margin-left: -$grid-unit-15 * 0.5 !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
|
|
100
|
+
// This is best fixed by making the mover control area a proper single toolbar group.
|
|
101
|
+
.components-toolbar-group {
|
|
102
|
+
padding: 0;
|
|
103
|
+
}
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
.block-editor-block-toolbar,
|
|
@@ -92,25 +92,6 @@ export default function BlockTools( {
|
|
|
92
92
|
event.preventDefault();
|
|
93
93
|
insertBeforeBlock( first( clientIds ) );
|
|
94
94
|
}
|
|
95
|
-
} else if (
|
|
96
|
-
isMatch( 'core/block-editor/delete-multi-selection', event )
|
|
97
|
-
) {
|
|
98
|
-
/**
|
|
99
|
-
* Check if the target element is a text area, input or
|
|
100
|
-
* event.defaultPrevented and return early. In all these
|
|
101
|
-
* cases backspace could be handled elsewhere.
|
|
102
|
-
*/
|
|
103
|
-
if (
|
|
104
|
-
[ 'INPUT', 'TEXTAREA' ].includes( event.target.nodeName ) ||
|
|
105
|
-
event.defaultPrevented
|
|
106
|
-
) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const clientIds = getSelectedBlockClientIds();
|
|
110
|
-
if ( clientIds.length > 1 ) {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
removeBlocks( clientIds );
|
|
113
|
-
}
|
|
114
95
|
} else if ( isMatch( 'core/block-editor/unselect', event ) ) {
|
|
115
96
|
const clientIds = getSelectedBlockClientIds();
|
|
116
97
|
if ( clientIds.length > 1 ) {
|
|
@@ -307,3 +307,30 @@
|
|
|
307
307
|
.is-dragging-components-draggable .components-tooltip {
|
|
308
308
|
display: none;
|
|
309
309
|
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
// Size multiple sequential buttons to be optically balanced.
|
|
313
|
+
// Icons are 36px, as set by a 24px icon and 12px padding.
|
|
314
|
+
.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot, // When a plugin adds to a slot, the segment has a `components-toolbar` class.
|
|
315
|
+
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, // The nesting order is sometimes reversed.
|
|
316
|
+
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, // Targets unique markup for the "Replace" button.
|
|
317
|
+
.block-editor-block-toolbar .components-toolbar-group {
|
|
318
|
+
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
319
|
+
padding-right: $grid-unit-15 * 0.5;
|
|
320
|
+
|
|
321
|
+
.components-button,
|
|
322
|
+
.components-button.has-icon.has-icon {
|
|
323
|
+
min-width: $block-toolbar-height - $grid-unit-15;
|
|
324
|
+
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
325
|
+
padding-right: $grid-unit-15 * 0.5;
|
|
326
|
+
|
|
327
|
+
svg {
|
|
328
|
+
min-width: $button-size-small; // This is the optimal icon size, and we size the whole button after this.
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&::before {
|
|
332
|
+
left: 2px;
|
|
333
|
+
right: 2px;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|