@wordpress/block-editor 8.4.0 → 8.5.2
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 +2 -0
- package/README.md +56 -19
- 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-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.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/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 +14 -17
- 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 +8 -0
- package/build/components/block-lock/index.js.map +1 -1
- package/build/components/block-lock/menu-item.js +9 -15
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/modal.js +35 -23
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +11 -16
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +50 -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 +50 -5
- package/build/components/block-settings-menu/block-settings-dropdown.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 +1 -1
- 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 +20 -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/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 +48 -9
- package/build/components/copy-handler/index.js.map +1 -1
- 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 +18 -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 +10 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +6 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +19 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +18 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -1
- package/build/components/list-view/branch.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 +26 -4
- package/build/components/rich-text/index.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/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/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 +23 -16
- 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 +76 -12
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +9 -4
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +290 -51
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -2
- 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 +264 -21
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +27 -0
- package/build/store/utils.js.map +1 -0
- 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-alignment-control/ui.js +2 -2
- package/build-module/components/block-alignment-control/ui.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/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 +15 -17
- 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 +1 -0
- package/build-module/components/block-lock/index.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +8 -13
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +34 -24
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +10 -14
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +41 -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 +50 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.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 +1 -1
- 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 +16 -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/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 +48 -9
- package/build-module/components/copy-handler/index.js.map +1 -1
- 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 +2 -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 +9 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +6 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +17 -6
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +18 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -1
- package/build-module/components/list-view/branch.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 +25 -4
- package/build-module/components/rich-text/index.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/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/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 +22 -15
- 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 +76 -13
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +9 -5
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +277 -49
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -2
- 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 +250 -21
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +20 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +142 -101
- package/build-style/style.css +142 -101
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/components/alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/ui.js +2 -2
- 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/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 +19 -26
- 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 +1 -0
- package/src/components/block-lock/menu-item.js +6 -19
- package/src/components/block-lock/modal.js +52 -23
- package/src/components/block-lock/style.scss +7 -5
- package/src/components/block-lock/toolbar.js +7 -14
- package/src/components/block-lock/use-block-lock.js +45 -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 +62 -4
- 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/index.js +2 -2
- package/src/components/block-title/use-block-display-title.js +1 -1
- 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 +18 -2
- package/src/components/block-toolbar/style.scss +6 -0
- package/src/components/block-tools/index.js +0 -19
- package/src/components/block-tools/style.scss +3 -5
- 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/button-block-appender/style.scss +5 -1
- 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 +55 -10
- package/src/components/font-sizes/font-size-picker.js +3 -0
- package/src/components/iframe/index.js +5 -7
- package/src/components/index.js +2 -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 +8 -3
- package/src/components/link-control/index.js +5 -5
- package/src/components/list-view/block-select-button.js +13 -3
- package/src/components/list-view/block.js +24 -8
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/style.scss +56 -14
- 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 +24 -1
- 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/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/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 +25 -17
- package/src/hooks/layout.js +11 -1
- package/src/hooks/style.js +40 -4
- package/src/hooks/test/gap.js +25 -1
- 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 +89 -5
- package/src/layouts/flow.js +15 -4
- package/src/store/actions.js +341 -32
- package/src/store/defaults.js +7 -2
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +329 -26
- package/src/store/test/selectors.js +242 -5
- package/src/store/utils.js +19 -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
|
@@ -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,12 +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';
|
|
23
24
|
import { BlockLockToolbar } from '../block-lock';
|
|
25
|
+
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
24
26
|
import { useShowMoversGestures } from './utils';
|
|
25
27
|
import { store as blockEditorStore } from '../../store';
|
|
28
|
+
import __unstableBlockNameContext from './block-name-context';
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
const BlockToolbar = ( { hideDragHandle } ) => {
|
|
28
31
|
const {
|
|
29
32
|
blockClientIds,
|
|
30
33
|
blockClientId,
|
|
@@ -127,6 +130,9 @@ export default function BlockToolbar( { hideDragHandle } ) {
|
|
|
127
130
|
</ToolbarGroup>
|
|
128
131
|
) }
|
|
129
132
|
</div>
|
|
133
|
+
{ shouldShowVisualToolbar && isMultiToolbar && (
|
|
134
|
+
<BlockGroupToolbar />
|
|
135
|
+
) }
|
|
130
136
|
{ shouldShowVisualToolbar && (
|
|
131
137
|
<>
|
|
132
138
|
<BlockControls.Slot
|
|
@@ -146,9 +152,19 @@ export default function BlockToolbar( { hideDragHandle } ) {
|
|
|
146
152
|
group="other"
|
|
147
153
|
className="block-editor-block-toolbar__slot"
|
|
148
154
|
/>
|
|
155
|
+
<__unstableBlockNameContext.Provider
|
|
156
|
+
value={ blockType?.name }
|
|
157
|
+
>
|
|
158
|
+
<__unstableBlockToolbarLastItem.Slot />
|
|
159
|
+
</__unstableBlockNameContext.Provider>
|
|
149
160
|
</>
|
|
150
161
|
) }
|
|
151
162
|
<BlockSettingsMenu clientIds={ blockClientIds } />
|
|
152
163
|
</div>
|
|
153
164
|
);
|
|
154
|
-
}
|
|
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;
|
|
@@ -95,6 +95,12 @@
|
|
|
95
95
|
.block-editor-block-lock-toolbar {
|
|
96
96
|
margin-left: -$grid-unit-15 * 0.5 !important;
|
|
97
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
|
+
}
|
|
98
104
|
}
|
|
99
105
|
|
|
100
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 ) {
|
|
@@ -312,16 +312,14 @@
|
|
|
312
312
|
// Size multiple sequential buttons to be optically balanced.
|
|
313
313
|
// Icons are 36px, as set by a 24px icon and 12px padding.
|
|
314
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 > .components-toolbar-group > .block-editor-block-toolbar__slot, // When no plugin adds to slots, the segment has a `components-toolbar-group` class.
|
|
316
315
|
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, // The nesting order is sometimes reversed.
|
|
317
316
|
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, // Targets unique markup for the "Replace" button.
|
|
318
|
-
.block-editor-block-toolbar .
|
|
317
|
+
.block-editor-block-toolbar .components-toolbar-group {
|
|
319
318
|
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
320
319
|
padding-right: $grid-unit-15 * 0.5;
|
|
321
320
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
> .components-dropdown .components-button {
|
|
321
|
+
.components-button,
|
|
322
|
+
.components-button.has-icon.has-icon {
|
|
325
323
|
min-width: $block-toolbar-height - $grid-unit-15;
|
|
326
324
|
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
327
325
|
padding-right: $grid-unit-15 * 0.5;
|
|
@@ -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 };
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -78,10 +78,18 @@ export function useClipboardHandler() {
|
|
|
78
78
|
getSelectedBlockClientIds,
|
|
79
79
|
hasMultiSelection,
|
|
80
80
|
getSettings,
|
|
81
|
+
__unstableIsFullySelected,
|
|
82
|
+
__unstableIsSelectionCollapsed,
|
|
83
|
+
__unstableIsSelectionMergeable,
|
|
84
|
+
__unstableGetSelectedBlocksWithPartialSelection,
|
|
81
85
|
} = useSelect( blockEditorStore );
|
|
82
|
-
const {
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
const {
|
|
87
|
+
flashBlock,
|
|
88
|
+
removeBlocks,
|
|
89
|
+
replaceBlocks,
|
|
90
|
+
__unstableDeleteSelection,
|
|
91
|
+
__unstableExpandSelection,
|
|
92
|
+
} = useDispatch( blockEditorStore );
|
|
85
93
|
const notifyCopy = useNotifyCopy();
|
|
86
94
|
|
|
87
95
|
return useRefEffect( ( node ) => {
|
|
@@ -116,20 +124,54 @@ export function useClipboardHandler() {
|
|
|
116
124
|
const eventDefaultPrevented = event.defaultPrevented;
|
|
117
125
|
event.preventDefault();
|
|
118
126
|
|
|
127
|
+
const isSelectionMergeable = __unstableIsSelectionMergeable();
|
|
128
|
+
const shouldHandleWholeBlocks =
|
|
129
|
+
__unstableIsSelectionCollapsed() || __unstableIsFullySelected();
|
|
130
|
+
const expandSelectionIsNeeded =
|
|
131
|
+
! shouldHandleWholeBlocks && ! isSelectionMergeable;
|
|
119
132
|
if ( event.type === 'copy' || event.type === 'cut' ) {
|
|
120
133
|
if ( selectedBlockClientIds.length === 1 ) {
|
|
121
134
|
flashBlock( selectedBlockClientIds[ 0 ] );
|
|
122
135
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
// If we have a partial selection that is not mergeable, just
|
|
137
|
+
// expand the selection to the whole blocks.
|
|
138
|
+
if ( expandSelectionIsNeeded ) {
|
|
139
|
+
__unstableExpandSelection();
|
|
140
|
+
} else {
|
|
141
|
+
notifyCopy( event.type, selectedBlockClientIds );
|
|
142
|
+
let blocks;
|
|
143
|
+
// Check if we have partial selection.
|
|
144
|
+
if ( shouldHandleWholeBlocks ) {
|
|
145
|
+
blocks = getBlocksByClientId( selectedBlockClientIds );
|
|
146
|
+
} else {
|
|
147
|
+
const [
|
|
148
|
+
head,
|
|
149
|
+
tail,
|
|
150
|
+
] = __unstableGetSelectedBlocksWithPartialSelection();
|
|
151
|
+
const inBetweenBlocks = getBlocksByClientId(
|
|
152
|
+
selectedBlockClientIds.slice(
|
|
153
|
+
1,
|
|
154
|
+
selectedBlockClientIds.length - 1
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
blocks = [ head, ...inBetweenBlocks, tail ];
|
|
158
|
+
}
|
|
159
|
+
const serialized = serialize( blocks );
|
|
160
|
+
|
|
161
|
+
event.clipboardData.setData( 'text/plain', serialized );
|
|
162
|
+
event.clipboardData.setData( 'text/html', serialized );
|
|
163
|
+
}
|
|
129
164
|
}
|
|
130
165
|
|
|
131
166
|
if ( event.type === 'cut' ) {
|
|
132
|
-
|
|
167
|
+
// We need to also check if at the start we needed to
|
|
168
|
+
// expand the selection, as in this point we might have
|
|
169
|
+
// programmatically fully selected the blocks above.
|
|
170
|
+
if ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {
|
|
171
|
+
removeBlocks( selectedBlockClientIds );
|
|
172
|
+
} else {
|
|
173
|
+
__unstableDeleteSelection();
|
|
174
|
+
}
|
|
133
175
|
} else if ( event.type === 'paste' ) {
|
|
134
176
|
if ( eventDefaultPrevented ) {
|
|
135
177
|
// This was likely already handled in rich-text/use-paste-handler.js.
|
|
@@ -171,4 +213,7 @@ function CopyHandler( { children } ) {
|
|
|
171
213
|
return <div ref={ useClipboardHandler() }>{ children }</div>;
|
|
172
214
|
}
|
|
173
215
|
|
|
216
|
+
/**
|
|
217
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/copy-handler/README.md
|
|
218
|
+
*/
|
|
174
219
|
export default CopyHandler;
|
|
@@ -203,14 +203,10 @@ function Iframe(
|
|
|
203
203
|
return true;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
206
|
+
// Document set with srcDoc is not immediately ready.
|
|
207
|
+
node.addEventListener( 'load', setDocumentIfReady );
|
|
209
208
|
|
|
210
|
-
|
|
211
|
-
node.addEventListener( 'load', () => {
|
|
212
|
-
setDocumentIfReady();
|
|
213
|
-
} );
|
|
209
|
+
return () => node.removeEventListener( 'load', setDocumentIfReady );
|
|
214
210
|
}, [] );
|
|
215
211
|
const headRef = useRefEffect( ( element ) => {
|
|
216
212
|
scripts
|
|
@@ -264,6 +260,8 @@ function Iframe(
|
|
|
264
260
|
{ ...props }
|
|
265
261
|
ref={ useMergeRefs( [ ref, setRef ] ) }
|
|
266
262
|
tabIndex={ tabIndex }
|
|
263
|
+
// Correct doctype is required to enable rendering in standards mode
|
|
264
|
+
srcDoc="<!doctype html>"
|
|
267
265
|
title={ __( 'Editor canvas' ) }
|
|
268
266
|
>
|
|
269
267
|
{ iframeDocument &&
|
package/src/components/index.js
CHANGED
|
@@ -99,6 +99,8 @@ export { default as withColorContext } from './color-palette/with-color-context'
|
|
|
99
99
|
*/
|
|
100
100
|
|
|
101
101
|
export { default as __unstableBlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';
|
|
102
|
+
export { default as __unstableBlockToolbarLastItem } from './block-toolbar/block-toolbar-last-item';
|
|
103
|
+
export { default as __unstableBlockNameContext } from './block-toolbar/block-name-context';
|
|
102
104
|
export { default as __unstableInserterMenuExtension } from './inserter-menu-extension';
|
|
103
105
|
export { default as __experimentalPreviewOptions } from './preview-options';
|
|
104
106
|
export { default as __experimentalUseResizeCanvas } from './use-resize-canvas';
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import JustifyContentUI from './ui';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const JustifyContentControl = ( props ) => {
|
|
7
7
|
return <JustifyContentUI { ...props } isToolbar={ false } />;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const JustifyToolbar = ( props ) => {
|
|
11
11
|
return <JustifyContentUI { ...props } isToolbar />;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/justify-content-control/README.md
|
|
16
|
+
*/
|
|
17
|
+
export { JustifyContentControl, JustifyToolbar };
|
|
@@ -61,7 +61,7 @@ function KeyboardShortcutsRegister() {
|
|
|
61
61
|
registerShortcut( {
|
|
62
62
|
name: 'core/block-editor/delete-multi-selection',
|
|
63
63
|
category: 'block',
|
|
64
|
-
description: __( '
|
|
64
|
+
description: __( 'Delete selection.' ),
|
|
65
65
|
keyCombination: {
|
|
66
66
|
character: 'del',
|
|
67
67
|
},
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
isLineHeightDefined,
|
|
16
16
|
} from './utils';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const LineHeightControl = ( {
|
|
19
19
|
value: lineHeight,
|
|
20
20
|
onChange,
|
|
21
21
|
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
22
22
|
__nextHasNoMarginBottom = false,
|
|
23
23
|
__unstableInputWidth = '60px',
|
|
24
|
-
} ) {
|
|
24
|
+
} ) => {
|
|
25
25
|
const isDefined = isLineHeightDefined( lineHeight );
|
|
26
26
|
|
|
27
27
|
const adjustNextValue = ( nextValue, wasTypedOrPasted ) => {
|
|
@@ -101,4 +101,9 @@ export default function LineHeightControl( {
|
|
|
101
101
|
/>
|
|
102
102
|
</div>
|
|
103
103
|
);
|
|
104
|
-
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md
|
|
108
|
+
*/
|
|
109
|
+
export default LineHeightControl;
|