@wordpress/block-editor 8.3.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +56 -18
- package/build/components/alignment-control/index.js +13 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/index.js +13 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-icon/index.js +4 -0
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +4 -1
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +4 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-list-appender/index.js +6 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/index.js +32 -0
- package/build/components/block-lock/index.js.map +1 -0
- package/build/components/block-lock/menu-item.js +67 -0
- package/build/components/block-lock/menu-item.js.map +1 -0
- package/build/components/block-lock/modal.js +134 -0
- package/build/components/block-lock/modal.js.map +1 -0
- package/build/components/block-lock/toolbar.js +78 -0
- package/build/components/block-lock/toolbar.js.map +1 -0
- package/build/components/block-mover/index.js +4 -0
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +19 -9
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +2 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +8 -6
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +17 -0
- package/build/components/block-toolbar/block-name-context.js.map +1 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build/components/block-toolbar/index.js +24 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +0 -16
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +92 -47
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +13 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +0 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +3 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/contrast-checker/index.js +4 -0
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +8 -0
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +105 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build/components/copy-handler/index.js +4 -0
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +132 -0
- package/build/components/date-format-picker/index.js.map +1 -0
- package/build/components/font-sizes/font-size-picker.js +4 -0
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/iframe/index.js +6 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +27 -0
- package/build/components/index.js.map +1 -1
- package/build/components/justify-content-control/index.js +13 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -6
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +24 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +38 -13
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +16 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +7 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +9 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +4 -0
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +1 -1
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/rich-text/index.js +27 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +13 -9
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/split-value.js +12 -2
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-firefox-compat.js +49 -0
- package/build/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +34 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -0
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +11 -27
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +9 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +3 -44
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +68 -0
- package/build/components/writing-flow/use-click-selection.js.map +1 -0
- package/build/components/writing-flow/use-drag-selection.js +134 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build/components/writing-flow/use-input.js +116 -0
- package/build/components/writing-flow/use-input.js.map +1 -0
- package/build/components/writing-flow/use-multi-selection.js +18 -38
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +161 -0
- package/build/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build/components/writing-flow/use-tab-nav.js +1 -8
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +3 -3
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +0 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +20 -17
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +5 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +4 -2
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +77 -5
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +7 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +34 -3
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +29 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +82 -15
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +22 -13
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +297 -51
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +25 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +171 -21
- package/build/store/selectors.js.map +1 -1
- package/build/utils/dom.js +2 -1
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/alignment-control/index.js +12 -4
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +12 -4
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +2 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -0
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -2
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -4
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +6 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/index.js +4 -0
- package/build-module/components/block-lock/index.js.map +1 -0
- package/build-module/components/block-lock/menu-item.js +53 -0
- package/build-module/components/block-lock/menu-item.js.map +1 -0
- package/build-module/components/block-lock/modal.js +119 -0
- package/build-module/components/block-lock/modal.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +63 -0
- package/build-module/components/block-lock/toolbar.js.map +1 -0
- package/build-module/components/block-mover/index.js +4 -0
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +18 -9
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +2 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +2 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +8 -6
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-toolbar/block-name-context.js +9 -0
- package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +19 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +0 -16
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +95 -49
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +12 -4
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +0 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +4 -0
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +2 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build-module/components/copy-handler/index.js +4 -0
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +122 -0
- package/build-module/components/date-format-picker/index.js.map +1 -0
- package/build-module/components/font-sizes/font-size-picker.js +4 -0
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +3 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +12 -4
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +14 -5
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +24 -23
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +36 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +16 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +7 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +10 -3
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +4 -0
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +26 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +13 -9
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/split-value.js +12 -2
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-firefox-compat.js +39 -0
- package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +35 -4
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -0
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +12 -28
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +57 -0
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-drag-selection.js +124 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +104 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -0
- package/build-module/components/writing-flow/use-multi-selection.js +18 -37
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +150 -0
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build-module/components/writing-flow/use-tab-nav.js +1 -9
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/anchor.js +7 -6
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +5 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +0 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +19 -18
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +75 -7
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +7 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +33 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +26 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +81 -16
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +20 -13
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -49
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +25 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +162 -20
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +214 -24
- package/build-style/style.css +214 -24
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +28 -27
- package/src/components/alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/index.js +9 -4
- package/src/components/block-draggable/index.js +2 -5
- package/src/components/block-icon/index.js +3 -0
- package/src/components/block-inspector/index.js +4 -0
- package/src/components/block-list/block-html.js +8 -4
- package/src/components/block-list/block.js +5 -1
- package/src/components/block-list/style.scss +4 -5
- package/src/components/block-list/use-block-props/index.js +0 -5
- package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
- package/src/components/block-list-appender/index.js +5 -0
- package/src/components/block-lock/index.js +3 -0
- package/src/components/block-lock/menu-item.js +59 -0
- package/src/components/block-lock/modal.js +170 -0
- package/src/components/block-lock/style.scss +70 -0
- package/src/components/block-lock/toolbar.js +68 -0
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
- package/src/components/block-settings-menu-controls/index.js +33 -12
- package/src/components/block-switcher/index.js +2 -2
- package/src/components/block-switcher/style.scss +8 -1
- package/src/components/block-switcher/test/index.js +2 -2
- package/src/components/block-title/README.md +6 -1
- package/src/components/block-title/index.js +2 -2
- package/src/components/block-title/test/index.js +43 -1
- package/src/components/block-title/use-block-display-title.js +10 -7
- package/src/components/block-toolbar/block-name-context.js +8 -0
- package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
- package/src/components/block-toolbar/index.js +24 -2
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/index.js +0 -19
- package/src/components/block-tools/style.scss +27 -0
- package/src/components/block-variation-transforms/index.js +105 -36
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/block-vertical-alignment-control/index.js +9 -4
- package/src/components/border-radius-control/index.js +0 -1
- package/src/components/border-radius-control/test/utils.js +4 -0
- package/src/components/border-radius-control/utils.js +2 -1
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/style.scss +6 -0
- package/src/components/contrast-checker/index.js +3 -0
- package/src/components/convert-to-group-buttons/index.js +6 -1
- package/src/components/convert-to-group-buttons/toolbar.js +87 -0
- package/src/components/copy-handler/index.js +3 -0
- package/src/components/date-format-picker/README.md +58 -0
- package/src/components/date-format-picker/index.js +161 -0
- package/src/components/date-format-picker/style.scss +31 -0
- package/src/components/font-sizes/font-size-picker.js +3 -0
- package/src/components/iframe/index.js +5 -7
- package/src/components/index.js +3 -0
- package/src/components/justify-content-control/index.js +9 -4
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/line-height-control/index.js +11 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +21 -30
- package/src/components/list-view/block.js +55 -13
- package/src/components/list-view/branch.js +37 -15
- package/src/components/list-view/index.js +6 -0
- package/src/components/list-view/style.scss +56 -14
- package/src/components/list-view/use-block-selection.js +15 -2
- package/src/components/media-placeholder/README.md +8 -0
- package/src/components/media-replace-flow/index.js +3 -0
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/rich-text/index.js +25 -2
- package/src/components/rich-text/index.native.js +24 -8
- package/src/components/rich-text/split-value.js +5 -1
- package/src/components/rich-text/use-firefox-compat.js +39 -0
- package/src/components/rich-text/use-input-rules.js +40 -3
- package/src/components/skip-to-selected-block/index.js +3 -0
- package/src/components/url-input/style.scss +3 -2
- package/src/components/url-popover/image-url-input-ui.js +16 -29
- package/src/components/writing-flow/index.js +8 -0
- package/src/components/writing-flow/readme.md +28 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -53
- package/src/components/writing-flow/use-click-selection.js +65 -0
- package/src/components/writing-flow/use-drag-selection.js +126 -0
- package/src/components/writing-flow/use-input.js +112 -0
- package/src/components/writing-flow/use-multi-selection.js +13 -36
- package/src/components/writing-flow/use-selection-observer.js +153 -0
- package/src/components/writing-flow/use-tab-nav.js +1 -11
- package/src/hooks/anchor.js +8 -6
- package/src/hooks/border-color.js +5 -5
- package/src/hooks/border.js +0 -13
- package/src/hooks/color.js +51 -24
- package/src/hooks/font-family.js +5 -2
- package/src/hooks/font-size.js +10 -7
- package/src/hooks/gap.js +91 -12
- package/src/hooks/layout.js +11 -1
- package/src/hooks/style.js +40 -4
- package/src/hooks/test/gap.js +66 -0
- package/src/hooks/test/style.js +94 -0
- package/src/hooks/test/utils.js +1 -1
- package/src/hooks/utils.js +26 -0
- package/src/layouts/flex.js +93 -6
- package/src/layouts/flow.js +28 -12
- package/src/store/actions.js +349 -32
- package/src/store/defaults.js +7 -1
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +207 -25
- package/src/store/test/selectors.js +305 -5
- package/src/style.scss +2 -0
- package/src/utils/dom.js +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
- package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
- package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
package/src/store/selectors.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
castArray,
|
|
6
|
-
flatMap,
|
|
7
6
|
first,
|
|
8
7
|
isArray,
|
|
9
8
|
isBoolean,
|
|
@@ -28,10 +27,12 @@ import {
|
|
|
28
27
|
hasBlockSupport,
|
|
29
28
|
getPossibleBlockTransformations,
|
|
30
29
|
parse,
|
|
30
|
+
switchToBlockType,
|
|
31
31
|
} from '@wordpress/blocks';
|
|
32
32
|
import { Platform } from '@wordpress/element';
|
|
33
33
|
import { applyFilters } from '@wordpress/hooks';
|
|
34
34
|
import { symbol } from '@wordpress/icons';
|
|
35
|
+
import { __ } from '@wordpress/i18n';
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* A block selection object.
|
|
@@ -215,26 +216,35 @@ export const __unstableGetClientIdsTree = createSelector(
|
|
|
215
216
|
);
|
|
216
217
|
|
|
217
218
|
/**
|
|
218
|
-
* Returns an array containing the clientIds of all descendants
|
|
219
|
-
* of the
|
|
219
|
+
* Returns an array containing the clientIds of all descendants of the blocks
|
|
220
|
+
* given. Returned ids are ordered first by the order of the ids given, then
|
|
221
|
+
* by the order that they appear in the editor.
|
|
220
222
|
*
|
|
221
223
|
* @param {Object} state Global application state.
|
|
222
224
|
* @param {Array} clientIds Array of blocks to inspect.
|
|
223
225
|
*
|
|
224
226
|
* @return {Array} ids of descendants.
|
|
225
227
|
*/
|
|
226
|
-
export const getClientIdsOfDescendants = (
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
export const getClientIdsOfDescendants = createSelector(
|
|
229
|
+
( state, clientIds ) => {
|
|
230
|
+
const collectedIds = [];
|
|
231
|
+
for ( const givenId of clientIds ) {
|
|
232
|
+
for ( const descendantId of getBlockOrder( state, givenId ) ) {
|
|
233
|
+
collectedIds.push(
|
|
234
|
+
descendantId,
|
|
235
|
+
...getClientIdsOfDescendants( state, [ descendantId ] )
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return collectedIds;
|
|
240
|
+
},
|
|
241
|
+
( state ) => [ state.blocks.order ]
|
|
242
|
+
);
|
|
234
243
|
|
|
235
244
|
/**
|
|
236
|
-
* Returns an array containing the clientIds of the top-level blocks
|
|
237
|
-
*
|
|
245
|
+
* Returns an array containing the clientIds of the top-level blocks and
|
|
246
|
+
* their descendants of any depth (for nested blocks). Ids are returned
|
|
247
|
+
* in the same order that they appear in the editor.
|
|
238
248
|
*
|
|
239
249
|
* @param {Object} state Global application state.
|
|
240
250
|
*
|
|
@@ -242,11 +252,14 @@ export const getClientIdsOfDescendants = ( state, clientIds ) =>
|
|
|
242
252
|
*/
|
|
243
253
|
export const getClientIdsWithDescendants = createSelector(
|
|
244
254
|
( state ) => {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
255
|
+
const collectedIds = [];
|
|
256
|
+
for ( const topLevelId of getBlockOrder( state ) ) {
|
|
257
|
+
collectedIds.push(
|
|
258
|
+
topLevelId,
|
|
259
|
+
...getClientIdsOfDescendants( state, [ topLevelId ] )
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
return collectedIds;
|
|
250
263
|
},
|
|
251
264
|
( state ) => [ state.blocks.order ]
|
|
252
265
|
);
|
|
@@ -278,6 +291,29 @@ export const getGlobalBlockCount = createSelector(
|
|
|
278
291
|
( state ) => [ state.blocks.order, state.blocks.byClientId ]
|
|
279
292
|
);
|
|
280
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Returns all global blocks that match a blockName. Results include nested blocks.
|
|
296
|
+
*
|
|
297
|
+
* @param {Object} state Global application state.
|
|
298
|
+
* @param {?string} blockName Optional block name, if not specified, returns an empty array.
|
|
299
|
+
*
|
|
300
|
+
* @return {Array} Array of clientIds of blocks with name equal to blockName.
|
|
301
|
+
*/
|
|
302
|
+
export const __experimentalGetGlobalBlocksByName = createSelector(
|
|
303
|
+
( state, blockName ) => {
|
|
304
|
+
if ( ! blockName ) {
|
|
305
|
+
return EMPTY_ARRAY;
|
|
306
|
+
}
|
|
307
|
+
const clientIds = getClientIdsWithDescendants( state );
|
|
308
|
+
const foundBlocks = clientIds.filter( ( clientId ) => {
|
|
309
|
+
const block = state.blocks.byClientId[ clientId ];
|
|
310
|
+
return block.name === blockName;
|
|
311
|
+
} );
|
|
312
|
+
return foundBlocks.length > 0 ? foundBlocks : EMPTY_ARRAY;
|
|
313
|
+
},
|
|
314
|
+
( state ) => [ state.blocks.order, state.blocks.byClientId ]
|
|
315
|
+
);
|
|
316
|
+
|
|
281
317
|
/**
|
|
282
318
|
* Given an array of block client IDs, returns the corresponding array of block
|
|
283
319
|
* objects.
|
|
@@ -872,6 +908,102 @@ export function getMultiSelectedBlocksEndClientId( state ) {
|
|
|
872
908
|
return selectionEnd.clientId || null;
|
|
873
909
|
}
|
|
874
910
|
|
|
911
|
+
/**
|
|
912
|
+
* Returns true if the selection is not partial.
|
|
913
|
+
*
|
|
914
|
+
* @param {Object} state Editor state.
|
|
915
|
+
*
|
|
916
|
+
* @return {boolean} Whether the selection is mergeable.
|
|
917
|
+
*/
|
|
918
|
+
export function __unstableIsFullySelected( state ) {
|
|
919
|
+
const selectionAnchor = getSelectionStart( state );
|
|
920
|
+
const selectionFocus = getSelectionEnd( state );
|
|
921
|
+
return (
|
|
922
|
+
! selectionAnchor.attributeKey &&
|
|
923
|
+
! selectionFocus.attributeKey &&
|
|
924
|
+
typeof selectionAnchor.offset === 'undefined' &&
|
|
925
|
+
typeof selectionFocus.offset === 'undefined'
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Check whether the selection is mergeable.
|
|
931
|
+
*
|
|
932
|
+
* @param {Object} state Editor state.
|
|
933
|
+
* @param {boolean} isForward Whether to merge forwards.
|
|
934
|
+
*
|
|
935
|
+
* @return {boolean} Whether the selection is mergeable.
|
|
936
|
+
*/
|
|
937
|
+
export function __unstableIsSelectionMergeable( state, isForward ) {
|
|
938
|
+
const selectionAnchor = getSelectionStart( state );
|
|
939
|
+
const selectionFocus = getSelectionEnd( state );
|
|
940
|
+
|
|
941
|
+
// It's not mergeable if the start and end are within the same block.
|
|
942
|
+
if ( selectionAnchor.clientId === selectionFocus.clientId ) return false;
|
|
943
|
+
|
|
944
|
+
// It's not mergeable if there's no rich text selection.
|
|
945
|
+
if (
|
|
946
|
+
! selectionAnchor.attributeKey ||
|
|
947
|
+
! selectionFocus.attributeKey ||
|
|
948
|
+
typeof selectionAnchor.offset === 'undefined' ||
|
|
949
|
+
typeof selectionFocus.offset === 'undefined'
|
|
950
|
+
)
|
|
951
|
+
return false;
|
|
952
|
+
|
|
953
|
+
const anchorRootClientId = getBlockRootClientId(
|
|
954
|
+
state,
|
|
955
|
+
selectionAnchor.clientId
|
|
956
|
+
);
|
|
957
|
+
const focusRootClientId = getBlockRootClientId(
|
|
958
|
+
state,
|
|
959
|
+
selectionFocus.clientId
|
|
960
|
+
);
|
|
961
|
+
|
|
962
|
+
// It's not mergeable if the selection doesn't start and end in the same
|
|
963
|
+
// block list. Maybe in the future it should be allowed.
|
|
964
|
+
if ( anchorRootClientId !== focusRootClientId ) {
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const blockOrder = getBlockOrder( state, anchorRootClientId );
|
|
969
|
+
const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
|
|
970
|
+
const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
|
|
971
|
+
|
|
972
|
+
// Reassign selection start and end based on order.
|
|
973
|
+
let selectionStart, selectionEnd;
|
|
974
|
+
|
|
975
|
+
if ( anchorIndex > focusIndex ) {
|
|
976
|
+
selectionStart = selectionFocus;
|
|
977
|
+
selectionEnd = selectionAnchor;
|
|
978
|
+
} else {
|
|
979
|
+
selectionStart = selectionAnchor;
|
|
980
|
+
selectionEnd = selectionFocus;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const targetBlockClientId = isForward
|
|
984
|
+
? selectionEnd.clientId
|
|
985
|
+
: selectionStart.clientId;
|
|
986
|
+
const blockToMergeClientId = isForward
|
|
987
|
+
? selectionStart.clientId
|
|
988
|
+
: selectionEnd.clientId;
|
|
989
|
+
|
|
990
|
+
const targetBlock = getBlock( state, targetBlockClientId );
|
|
991
|
+
const targetBlockType = getBlockType( targetBlock.name );
|
|
992
|
+
|
|
993
|
+
if ( ! targetBlockType.merge ) return false;
|
|
994
|
+
|
|
995
|
+
const blockToMerge = getBlock( state, blockToMergeClientId );
|
|
996
|
+
|
|
997
|
+
// It's mergeable if the blocks are of the same type.
|
|
998
|
+
if ( blockToMerge.name === targetBlock.name ) return true;
|
|
999
|
+
|
|
1000
|
+
// If the blocks are of a different type, try to transform the block being
|
|
1001
|
+
// merged into the same type of block.
|
|
1002
|
+
const blocksToMerge = switchToBlockType( blockToMerge, targetBlock.name );
|
|
1003
|
+
|
|
1004
|
+
return blocksToMerge && blocksToMerge.length;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
875
1007
|
/**
|
|
876
1008
|
* Returns an array containing all block client IDs in the editor in the order
|
|
877
1009
|
* they appear. Optionally accepts a root client ID of the block list for which
|
|
@@ -1261,10 +1393,28 @@ const canInsertBlockTypeUnmemoized = (
|
|
|
1261
1393
|
parentName
|
|
1262
1394
|
);
|
|
1263
1395
|
|
|
1396
|
+
let hasBlockAllowedAncestor = true;
|
|
1397
|
+
const blockAllowedAncestorBlocks = blockType.ancestor;
|
|
1398
|
+
if ( blockAllowedAncestorBlocks ) {
|
|
1399
|
+
const ancestors = [
|
|
1400
|
+
rootClientId,
|
|
1401
|
+
...getBlockParents( state, rootClientId ),
|
|
1402
|
+
];
|
|
1403
|
+
|
|
1404
|
+
hasBlockAllowedAncestor = some( ancestors, ( ancestorClientId ) =>
|
|
1405
|
+
checkAllowList(
|
|
1406
|
+
blockAllowedAncestorBlocks,
|
|
1407
|
+
getBlockName( state, ancestorClientId )
|
|
1408
|
+
)
|
|
1409
|
+
);
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1264
1412
|
const canInsert =
|
|
1265
|
-
|
|
1266
|
-
hasParentAllowedBlock ===
|
|
1267
|
-
|
|
1413
|
+
hasBlockAllowedAncestor &&
|
|
1414
|
+
( ( hasParentAllowedBlock === null &&
|
|
1415
|
+
hasBlockAllowedParent === null ) ||
|
|
1416
|
+
hasParentAllowedBlock === true ||
|
|
1417
|
+
hasBlockAllowedParent === true );
|
|
1268
1418
|
|
|
1269
1419
|
if ( ! canInsert ) {
|
|
1270
1420
|
return canInsert;
|
|
@@ -1419,6 +1569,23 @@ export function canMoveBlocks( state, clientIds, rootClientId = null ) {
|
|
|
1419
1569
|
);
|
|
1420
1570
|
}
|
|
1421
1571
|
|
|
1572
|
+
/**
|
|
1573
|
+
* Determines if the given block type can be locked/unlocked by a user.
|
|
1574
|
+
*
|
|
1575
|
+
* @param {Object} state Editor state.
|
|
1576
|
+
* @param {(string|Object)} nameOrType Block name or type object.
|
|
1577
|
+
*
|
|
1578
|
+
* @return {boolean} Whether a given block type can be locked/unlocked.
|
|
1579
|
+
*/
|
|
1580
|
+
export function canLockBlockType( state, nameOrType ) {
|
|
1581
|
+
if ( ! hasBlockSupport( nameOrType, 'lock', true ) ) {
|
|
1582
|
+
return false;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
// Use block editor settings as the default value.
|
|
1586
|
+
return !! state.settings?.canLockBlocks;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1422
1589
|
/**
|
|
1423
1590
|
* Returns information about how recently and frequently a block has been inserted.
|
|
1424
1591
|
*
|
|
@@ -1744,6 +1911,7 @@ export const getInserterItems = createSelector(
|
|
|
1744
1911
|
*/
|
|
1745
1912
|
export const getBlockTransformItems = createSelector(
|
|
1746
1913
|
( state, blocks, rootClientId = null ) => {
|
|
1914
|
+
const [ sourceBlock ] = blocks;
|
|
1747
1915
|
const buildBlockTypeTransformItem = buildBlockTypeItem( state, {
|
|
1748
1916
|
buildScope: 'transform',
|
|
1749
1917
|
} );
|
|
@@ -1757,20 +1925,32 @@ export const getBlockTransformItems = createSelector(
|
|
|
1757
1925
|
blockTypeTransformItems,
|
|
1758
1926
|
( { name } ) => name
|
|
1759
1927
|
);
|
|
1928
|
+
|
|
1929
|
+
// Consider unwraping the highest priority.
|
|
1930
|
+
itemsByName[ '*' ] = {
|
|
1931
|
+
frecency: +Infinity,
|
|
1932
|
+
id: '*',
|
|
1933
|
+
isDisabled: false,
|
|
1934
|
+
name: '*',
|
|
1935
|
+
title: __( 'Unwrap' ),
|
|
1936
|
+
icon: itemsByName[ sourceBlock.name ]?.icon,
|
|
1937
|
+
};
|
|
1938
|
+
|
|
1760
1939
|
const possibleTransforms = getPossibleBlockTransformations(
|
|
1761
1940
|
blocks
|
|
1762
1941
|
).reduce( ( accumulator, block ) => {
|
|
1763
|
-
if (
|
|
1942
|
+
if ( block === '*' ) {
|
|
1943
|
+
accumulator.push( itemsByName[ '*' ] );
|
|
1944
|
+
} else if ( itemsByName[ block?.name ] ) {
|
|
1764
1945
|
accumulator.push( itemsByName[ block.name ] );
|
|
1765
1946
|
}
|
|
1766
1947
|
return accumulator;
|
|
1767
1948
|
}, [] );
|
|
1768
|
-
|
|
1949
|
+
return orderBy(
|
|
1769
1950
|
possibleTransforms,
|
|
1770
1951
|
( block ) => itemsByName[ block.name ].frecency,
|
|
1771
1952
|
'desc'
|
|
1772
1953
|
);
|
|
1773
|
-
return possibleBlockTransformations;
|
|
1774
1954
|
},
|
|
1775
1955
|
( state, rootClientId ) => [
|
|
1776
1956
|
state.blockListSettings[ rootClientId ],
|
|
@@ -1914,7 +2094,9 @@ export const __experimentalGetParsedPattern = createSelector(
|
|
|
1914
2094
|
}
|
|
1915
2095
|
return {
|
|
1916
2096
|
...pattern,
|
|
1917
|
-
blocks: parse( pattern.content
|
|
2097
|
+
blocks: parse( pattern.content, {
|
|
2098
|
+
__unstableSkipMigrationLogs: true,
|
|
2099
|
+
} ),
|
|
1918
2100
|
};
|
|
1919
2101
|
},
|
|
1920
2102
|
( state ) => [ state.settings.__experimentalBlockPatterns ]
|