@wordpress/block-editor 9.8.1-next.957ca95e4c.0 → 10.0.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 +6 -0
- package/README.md +13 -1
- package/build/components/alignment-control/ui.js +6 -5
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-actions/index.js +5 -9
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +5 -5
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-content-overlay/index.js +2 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +2 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-inspector/index.js +125 -17
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +40 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +4 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +14 -11
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +3 -2
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -9
- 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-is-hovered.js +1 -2
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -12
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +20 -21
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +1 -7
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +3 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +20 -10
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -6
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +4 -6
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +24 -8
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +58 -16
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +3 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +4 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +3 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +3 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +7 -1
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +114 -25
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -8
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +3 -2
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +13 -5
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +33 -15
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -9
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +9 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +13 -8
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +71 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
- package/build/components/block-vertical-alignment-control/ui.js +5 -2
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +1 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/iframe/index.js +31 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +1 -7
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -5
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +14 -3
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +21 -8
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/tabs.js +11 -4
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +6 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +36 -5
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/block.js +23 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +19 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +8 -4
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +0 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -7
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +1 -1
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/rich-text/index.js +27 -19
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +11 -20
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/text-decoration-control/index.js +1 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +1 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +6 -11
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-popover/index.js +1 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +7 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +9 -28
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +1 -7
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/hooks/align.js +14 -2
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/color-panel.js +2 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/content-lock-ui.js +145 -0
- package/build/hooks/content-lock-ui.js.map +1 -0
- package/build/hooks/duotone.js +8 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +14 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +11 -9
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/metadata-name.js +55 -0
- package/build/hooks/metadata-name.js.map +1 -0
- package/build/hooks/metadata.js +65 -0
- package/build/hooks/metadata.js.map +1 -0
- package/build/hooks/use-typography-props.js +51 -0
- package/build/hooks/use-typography-props.js.map +1 -0
- package/build/hooks/utils.js +3 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +59 -20
- package/build/layouts/constrained.js.map +1 -1
- package/build/store/actions.js +65 -21
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +39 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +95 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +6 -5
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-actions/index.js +5 -8
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +5 -5
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +2 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-inspector/index.js +127 -19
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +41 -9
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +4 -4
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +13 -11
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +3 -2
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +3 -8
- 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-is-hovered.js +1 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +7 -12
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +20 -20
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +1 -6
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +3 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +20 -9
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -5
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +24 -7
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +59 -17
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +3 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +4 -2
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +3 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +3 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +6 -1
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +115 -27
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +9 -8
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +3 -2
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +12 -5
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +30 -15
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -9
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +9 -8
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +13 -8
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +59 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -0
- package/build-module/components/block-vertical-alignment-control/ui.js +5 -2
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/iframe/index.js +32 -5
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +1 -6
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -5
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +14 -3
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +20 -8
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/tabs.js +11 -4
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +6 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +37 -6
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/block.js +23 -11
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +19 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +8 -4
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +0 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -6
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +1 -1
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +27 -18
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +1 -1
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +1 -1
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +6 -11
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -1
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +7 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +9 -28
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +1 -6
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/hooks/align.js +12 -2
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/color-panel.js +2 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +128 -0
- package/build-module/hooks/content-lock-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +6 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +4 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +11 -9
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/metadata-name.js +45 -0
- package/build-module/hooks/metadata-name.js.map +1 -0
- package/build-module/hooks/metadata.js +50 -0
- package/build-module/hooks/metadata.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +38 -0
- package/build-module/hooks/use-typography-props.js.map +1 -0
- package/build-module/hooks/utils.js +4 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +61 -22
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/store/actions.js +58 -20
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +37 -18
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +80 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +95 -45
- package/build-style/style.css +95 -45
- package/package.json +28 -28
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +137 -108
- package/src/components/alignment-control/test/index.js +124 -33
- package/src/components/alignment-control/ui.js +8 -3
- package/src/components/block-actions/index.js +9 -8
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +108 -65
- package/src/components/block-alignment-control/test/index.js +95 -31
- package/src/components/block-alignment-control/ui.js +2 -2
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +28 -26
- package/src/components/block-compare/test/block-view.js +3 -3
- package/src/components/block-content-overlay/index.js +2 -6
- package/src/components/block-content-overlay/style.scss +24 -3
- package/src/components/block-draggable/draggable-chip.js +4 -1
- package/src/components/block-edit/edit.js +5 -1
- package/src/components/block-edit/test/edit.js +23 -21
- package/src/components/block-icon/test/__snapshots__/index.js.snap +22 -0
- package/src/components/block-icon/test/index.js +31 -16
- package/src/components/block-inspector/index.js +126 -12
- package/src/components/block-inspector/style.scss +7 -1
- package/src/components/block-list/block.js +53 -13
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/style.scss +39 -12
- package/src/components/block-list/test/block-list-context.native.js +11 -13
- package/src/components/block-list/use-block-props/index.js +10 -10
- package/src/components/block-list/use-block-props/use-block-class-names.js +4 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -8
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -2
- package/src/components/block-list/use-in-between-inserter.js +11 -13
- package/src/components/block-list-appender/index.js +27 -18
- package/src/components/block-list-appender/index.native.js +3 -6
- package/src/components/block-lock/use-block-lock.js +2 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +15 -9
- package/src/components/block-mover/button.js +6 -5
- package/src/components/block-mover/index.js +8 -7
- package/src/components/block-mover/index.native.js +20 -13
- package/src/components/block-popover/inbetween.js +85 -21
- package/src/components/block-popover/index.js +3 -2
- package/src/components/block-popover/style.scss +3 -4
- package/src/components/block-preview/auto.js +4 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu-controls/README.md +9 -0
- package/src/components/block-settings-menu-controls/index.js +13 -2
- package/src/components/block-styles/preview-panel.js +3 -0
- package/src/components/block-switcher/block-transformations-menu.js +127 -33
- package/src/components/block-switcher/style.scss +4 -2
- package/src/components/block-title/test/index.js +28 -25
- package/src/components/block-toolbar/index.js +27 -17
- package/src/components/block-tools/block-contextual-toolbar.js +10 -3
- package/src/components/block-tools/block-selection-button.js +35 -16
- package/src/components/block-tools/index.js +40 -24
- package/src/components/block-tools/insertion-point.js +3 -7
- package/src/components/block-tools/selected-block-popover.js +9 -7
- package/src/components/block-tools/style.scss +5 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +19 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +57 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +91 -51
- package/src/components/block-vertical-alignment-control/test/index.js +92 -23
- package/src/components/block-vertical-alignment-control/ui.js +3 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -12
- package/src/components/colors/test/with-colors.js +37 -12
- package/src/components/colors-gradients/dropdown.js +1 -1
- package/src/components/contrast-checker/test/index.js +135 -116
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +39 -57
- package/src/components/default-block-appender/test/index.js +32 -18
- package/src/components/font-sizes/README.MD +9 -0
- package/src/components/iframe/index.js +64 -5
- package/src/components/inner-blocks/README.md +2 -1
- package/src/components/inner-blocks/default-block-appender.js +1 -6
- package/src/components/inner-blocks/index.js +3 -2
- package/src/components/inner-blocks/use-inner-block-template-sync.js +9 -5
- package/src/components/inner-blocks/use-nested-settings-update.js +3 -1
- package/src/components/inserter/index.js +2 -8
- package/src/components/inserter/library.js +11 -5
- package/src/components/inserter/menu.js +42 -29
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/stories/fixtures.js +44 -0
- package/src/components/inserter/stories/index.js +90 -0
- package/src/components/inserter/style.scss +21 -27
- package/src/components/inserter/tabs.js +8 -4
- package/src/components/link-control/link-preview.js +5 -3
- package/src/components/link-control/search-input.js +2 -2
- package/src/components/link-control/search-item.js +39 -7
- package/src/components/list-view/block.js +29 -10
- package/src/components/list-view/branch.js +27 -4
- package/src/components/list-view/index.js +8 -3
- package/src/components/list-view/use-block-selection.js +0 -1
- package/src/components/media-placeholder/test/index.js +2 -2
- package/src/components/media-replace-flow/README.md +1 -1
- package/src/components/provider/use-block-sync.js +3 -6
- package/src/components/publish-date-time-picker/index.js +1 -1
- package/src/components/rich-text/index.js +24 -35
- package/src/components/rich-text/index.native.js +8 -21
- package/src/components/text-decoration-control/index.js +1 -1
- package/src/components/text-transform-control/index.js +1 -1
- package/src/components/tool-selector/index.js +9 -11
- package/src/components/url-input/test/button.js +145 -71
- package/src/components/url-popover/index.js +1 -1
- package/src/components/url-popover/test/__snapshots__/index.js.snap +108 -80
- package/src/components/url-popover/test/index.js +14 -12
- package/src/components/use-block-drop-zone/index.js +15 -4
- package/src/components/use-moving-animation/index.js +9 -24
- package/src/components/warning/test/__snapshots__/index.js.snap +11 -14
- package/src/components/warning/test/index.js +32 -29
- package/src/components/writing-flow/use-select-all.js +4 -6
- package/src/hooks/align.js +22 -13
- package/src/hooks/color-panel.js +2 -1
- package/src/hooks/content-lock-ui.js +161 -0
- package/src/hooks/duotone.js +13 -1
- package/src/hooks/index.js +4 -0
- package/src/hooks/layout.js +25 -19
- package/src/hooks/layout.scss +7 -1
- package/src/hooks/metadata-name.js +48 -0
- package/src/hooks/metadata.js +64 -0
- package/src/hooks/test/use-typography-props.js +28 -0
- package/src/hooks/use-typography-props.js +41 -0
- package/src/hooks/utils.js +2 -11
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +73 -24
- package/src/store/actions.js +45 -4
- package/src/store/reducer.js +33 -21
- package/src/store/selectors.js +98 -19
- package/src/store/test/reducer.js +8 -5
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/components/colors/test/__snapshots__/with-colors.js.snap +0 -23
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getTypographyClassesAndStyles } from '../use-typography-props';
|
|
5
|
+
|
|
6
|
+
describe( 'getTypographyClassesAndStyles', () => {
|
|
7
|
+
it( 'should return styles and classes', () => {
|
|
8
|
+
const attributes = {
|
|
9
|
+
fontFamily: 'tofu',
|
|
10
|
+
fontSize: 'large',
|
|
11
|
+
style: {
|
|
12
|
+
typography: {
|
|
13
|
+
letterSpacing: '22px',
|
|
14
|
+
fontSize: '2rem',
|
|
15
|
+
textTransform: 'uppercase',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
expect( getTypographyClassesAndStyles( attributes ) ).toEqual( {
|
|
20
|
+
className: 'has-tofu-font-family has-large-font-size',
|
|
21
|
+
style: {
|
|
22
|
+
letterSpacing: '22px',
|
|
23
|
+
fontSize: '2rem',
|
|
24
|
+
textTransform: 'uppercase',
|
|
25
|
+
},
|
|
26
|
+
} );
|
|
27
|
+
} );
|
|
28
|
+
} );
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { kebabCase } from 'lodash';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { getInlineStyles } from './style';
|
|
11
|
+
import { getFontSizeClass } from '../components/font-sizes';
|
|
12
|
+
|
|
13
|
+
// This utility is intended to assist where the serialization of the typography
|
|
14
|
+
// block support is being skipped for a block but the typography related CSS
|
|
15
|
+
// styles still need to be generated so they can be applied to inner elements.
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Provides the CSS class names and inline styles for a block's typography support
|
|
19
|
+
* attributes.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} attributes Block attributes.
|
|
22
|
+
*
|
|
23
|
+
* @return {Object} Typography block support derived CSS classes & styles.
|
|
24
|
+
*/
|
|
25
|
+
export function getTypographyClassesAndStyles( attributes ) {
|
|
26
|
+
const typographyStyles = attributes?.style?.typography || {};
|
|
27
|
+
const style = getInlineStyles( { typography: typographyStyles } );
|
|
28
|
+
const fontFamilyClassName = !! attributes?.fontFamily
|
|
29
|
+
? `has-${ kebabCase( attributes.fontFamily ) }-font-family`
|
|
30
|
+
: '';
|
|
31
|
+
|
|
32
|
+
const className = classnames(
|
|
33
|
+
fontFamilyClassName,
|
|
34
|
+
getFontSizeClass( attributes?.fontSize )
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
};
|
|
41
|
+
}
|
package/src/hooks/utils.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
pickBy,
|
|
6
|
-
isEmpty,
|
|
7
|
-
mapValues,
|
|
8
|
-
forEach,
|
|
9
|
-
get,
|
|
10
|
-
setWith,
|
|
11
|
-
clone,
|
|
12
|
-
every,
|
|
13
|
-
} from 'lodash';
|
|
4
|
+
import { pickBy, isEmpty, mapValues, get, setWith, clone, every } from 'lodash';
|
|
14
5
|
|
|
15
6
|
/**
|
|
16
7
|
* WordPress dependencies
|
|
@@ -77,7 +68,7 @@ export function transformStyles(
|
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
let returnBlock = result;
|
|
80
|
-
|
|
71
|
+
Object.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {
|
|
81
72
|
if ( isActive ) {
|
|
82
73
|
migrationPaths[ support ].forEach( ( path ) => {
|
|
83
74
|
const styleValue = get( referenceBlockAttributes, path );
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export {
|
|
|
6
6
|
getBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,
|
|
7
7
|
useBorderProps as __experimentalUseBorderProps,
|
|
8
8
|
getColorClassesAndStyles as __experimentalGetColorClassesAndStyles,
|
|
9
|
+
getTypographyClassesAndStyles,
|
|
9
10
|
useColorProps as __experimentalUseColorProps,
|
|
10
11
|
useCustomSides as __experimentalUseCustomSides,
|
|
11
12
|
getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
Button,
|
|
6
5
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
7
6
|
__experimentalUnitControl as UnitControl,
|
|
7
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
8
|
+
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
8
9
|
} from '@wordpress/components';
|
|
9
10
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Icon,
|
|
13
|
+
positionCenter,
|
|
14
|
+
stretchWide,
|
|
15
|
+
justifyLeft,
|
|
16
|
+
justifyCenter,
|
|
17
|
+
justifyRight,
|
|
18
|
+
} from '@wordpress/icons';
|
|
11
19
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
12
20
|
|
|
13
21
|
/**
|
|
@@ -25,7 +33,30 @@ export default {
|
|
|
25
33
|
layout,
|
|
26
34
|
onChange,
|
|
27
35
|
} ) {
|
|
28
|
-
const { wideSize, contentSize } = layout;
|
|
36
|
+
const { wideSize, contentSize, justifyContent = 'center' } = layout;
|
|
37
|
+
const onJustificationChange = ( value ) => {
|
|
38
|
+
onChange( {
|
|
39
|
+
...layout,
|
|
40
|
+
justifyContent: value,
|
|
41
|
+
} );
|
|
42
|
+
};
|
|
43
|
+
const justificationOptions = [
|
|
44
|
+
{
|
|
45
|
+
value: 'left',
|
|
46
|
+
icon: justifyLeft,
|
|
47
|
+
label: __( 'Justify items left' ),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
value: 'center',
|
|
51
|
+
icon: justifyCenter,
|
|
52
|
+
label: __( 'Justify items center' ),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: 'right',
|
|
56
|
+
icon: justifyRight,
|
|
57
|
+
label: __( 'Justify items right' ),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
29
60
|
const units = useCustomUnits( {
|
|
30
61
|
availableUnits: useSetting( 'spacing.units' ) || [
|
|
31
62
|
'%',
|
|
@@ -35,7 +66,6 @@ export default {
|
|
|
35
66
|
'vw',
|
|
36
67
|
],
|
|
37
68
|
} );
|
|
38
|
-
|
|
39
69
|
return (
|
|
40
70
|
<>
|
|
41
71
|
<div className="block-editor-hooks__layout-controls">
|
|
@@ -80,28 +110,28 @@ export default {
|
|
|
80
110
|
<Icon icon={ stretchWide } />
|
|
81
111
|
</div>
|
|
82
112
|
</div>
|
|
83
|
-
<div className="block-editor-hooks__layout-controls-reset">
|
|
84
|
-
<Button
|
|
85
|
-
variant="secondary"
|
|
86
|
-
isSmall
|
|
87
|
-
disabled={ ! contentSize && ! wideSize }
|
|
88
|
-
onClick={ () =>
|
|
89
|
-
onChange( {
|
|
90
|
-
contentSize: undefined,
|
|
91
|
-
wideSize: undefined,
|
|
92
|
-
inherit: false,
|
|
93
|
-
} )
|
|
94
|
-
}
|
|
95
|
-
>
|
|
96
|
-
{ __( 'Reset' ) }
|
|
97
|
-
</Button>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
113
|
<p className="block-editor-hooks__layout-controls-helptext">
|
|
101
114
|
{ __(
|
|
102
115
|
'Customize the width for all elements that are assigned to the center or wide columns.'
|
|
103
116
|
) }
|
|
104
117
|
</p>
|
|
118
|
+
<ToggleGroupControl
|
|
119
|
+
__experimentalIsBorderless
|
|
120
|
+
label={ __( 'Justification' ) }
|
|
121
|
+
value={ justifyContent }
|
|
122
|
+
onChange={ onJustificationChange }
|
|
123
|
+
>
|
|
124
|
+
{ justificationOptions.map( ( { value, icon, label } ) => {
|
|
125
|
+
return (
|
|
126
|
+
<ToggleGroupControlOptionIcon
|
|
127
|
+
key={ value }
|
|
128
|
+
value={ value }
|
|
129
|
+
icon={ icon }
|
|
130
|
+
label={ label }
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
} ) }
|
|
134
|
+
</ToggleGroupControl>
|
|
105
135
|
</>
|
|
106
136
|
);
|
|
107
137
|
},
|
|
@@ -116,7 +146,7 @@ export default {
|
|
|
116
146
|
hasBlockGapSupport,
|
|
117
147
|
layoutDefinitions,
|
|
118
148
|
} ) {
|
|
119
|
-
const { contentSize, wideSize } = layout;
|
|
149
|
+
const { contentSize, wideSize, justifyContent } = layout;
|
|
120
150
|
const blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );
|
|
121
151
|
|
|
122
152
|
// If a block's block.json skips serialization for spacing or
|
|
@@ -131,6 +161,11 @@ export default {
|
|
|
131
161
|
}
|
|
132
162
|
}
|
|
133
163
|
|
|
164
|
+
const marginLeft =
|
|
165
|
+
justifyContent === 'left' ? '0 !important' : 'auto !important';
|
|
166
|
+
const marginRight =
|
|
167
|
+
justifyContent === 'right' ? '0 !important' : 'auto !important';
|
|
168
|
+
|
|
134
169
|
let output =
|
|
135
170
|
!! contentSize || !! wideSize
|
|
136
171
|
? `
|
|
@@ -139,8 +174,8 @@ export default {
|
|
|
139
174
|
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
140
175
|
) } {
|
|
141
176
|
max-width: ${ contentSize ?? wideSize };
|
|
142
|
-
margin-left:
|
|
143
|
-
margin-right:
|
|
177
|
+
margin-left: ${ marginLeft };
|
|
178
|
+
margin-right: ${ marginRight }t;
|
|
144
179
|
}
|
|
145
180
|
${ appendSelectors( selector, '> .alignwide' ) } {
|
|
146
181
|
max-width: ${ wideSize ?? contentSize };
|
|
@@ -151,6 +186,20 @@ export default {
|
|
|
151
186
|
`
|
|
152
187
|
: '';
|
|
153
188
|
|
|
189
|
+
if ( justifyContent === 'left' ) {
|
|
190
|
+
output += `${ appendSelectors(
|
|
191
|
+
selector,
|
|
192
|
+
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
193
|
+
) }
|
|
194
|
+
{ margin-left: ${ marginLeft }; }`;
|
|
195
|
+
} else if ( justifyContent === 'right' ) {
|
|
196
|
+
output += `${ appendSelectors(
|
|
197
|
+
selector,
|
|
198
|
+
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
199
|
+
) }
|
|
200
|
+
{ margin-right: ${ marginRight }; }`;
|
|
201
|
+
}
|
|
202
|
+
|
|
154
203
|
// If there is custom padding, add negative margins for alignfull blocks.
|
|
155
204
|
if ( style?.spacing?.padding ) {
|
|
156
205
|
// The style object might be storing a preset so we need to make sure we get a usable value.
|
package/src/store/actions.js
CHANGED
|
@@ -1474,25 +1474,52 @@ export const __unstableMarkAutomaticChange =
|
|
|
1474
1474
|
/**
|
|
1475
1475
|
* Action that enables or disables the navigation mode.
|
|
1476
1476
|
*
|
|
1477
|
-
* @param {
|
|
1477
|
+
* @param {boolean} isNavigationMode Enable/Disable navigation mode.
|
|
1478
1478
|
*/
|
|
1479
1479
|
export const setNavigationMode =
|
|
1480
1480
|
( isNavigationMode = true ) =>
|
|
1481
1481
|
( { dispatch } ) => {
|
|
1482
|
-
dispatch(
|
|
1482
|
+
dispatch.__unstableSetEditorMode(
|
|
1483
|
+
isNavigationMode ? 'navigation' : 'edit'
|
|
1484
|
+
);
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Action that sets the editor mode
|
|
1489
|
+
*
|
|
1490
|
+
* @param {string} mode Editor mode
|
|
1491
|
+
*/
|
|
1492
|
+
export const __unstableSetEditorMode =
|
|
1493
|
+
( mode ) =>
|
|
1494
|
+
( { dispatch, select } ) => {
|
|
1495
|
+
// When switching to zoom-out mode, we need to select the root block
|
|
1496
|
+
if ( mode === 'zoom-out' ) {
|
|
1497
|
+
const firstSelectedClientId = select.getBlockSelectionStart();
|
|
1498
|
+
if ( firstSelectedClientId ) {
|
|
1499
|
+
dispatch.selectBlock(
|
|
1500
|
+
select.getBlockHierarchyRootClientId(
|
|
1501
|
+
firstSelectedClientId
|
|
1502
|
+
)
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1483
1506
|
|
|
1484
|
-
|
|
1507
|
+
dispatch( { type: 'SET_EDITOR_MODE', mode } );
|
|
1508
|
+
|
|
1509
|
+
if ( mode === 'navigation' ) {
|
|
1485
1510
|
speak(
|
|
1486
1511
|
__(
|
|
1487
1512
|
'You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.'
|
|
1488
1513
|
)
|
|
1489
1514
|
);
|
|
1490
|
-
} else {
|
|
1515
|
+
} else if ( mode === 'edit' ) {
|
|
1491
1516
|
speak(
|
|
1492
1517
|
__(
|
|
1493
1518
|
'You are currently in edit mode. To return to the navigation mode, press Escape.'
|
|
1494
1519
|
)
|
|
1495
1520
|
);
|
|
1521
|
+
} else if ( mode === 'zoom-out' ) {
|
|
1522
|
+
speak( __( 'You are currently in zoom-out mode.' ) );
|
|
1496
1523
|
}
|
|
1497
1524
|
};
|
|
1498
1525
|
|
|
@@ -1673,3 +1700,17 @@ export function setBlockVisibility( updates ) {
|
|
|
1673
1700
|
updates,
|
|
1674
1701
|
};
|
|
1675
1702
|
}
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Action that sets whether a block is being temporaritly edited as blocks.
|
|
1706
|
+
*
|
|
1707
|
+
* @param {?string} temporarilyEditingAsBlocks The block's clientId being temporaritly edited as blocks.
|
|
1708
|
+
*/
|
|
1709
|
+
export function __unstableSetTemporarilyEditingAsBlocks(
|
|
1710
|
+
temporarilyEditingAsBlocks
|
|
1711
|
+
) {
|
|
1712
|
+
return {
|
|
1713
|
+
type: 'SET_TEMPORARILY_EDITING_AS_BLOCKS',
|
|
1714
|
+
temporarilyEditingAsBlocks,
|
|
1715
|
+
};
|
|
1716
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import {
|
|
5
5
|
flow,
|
|
6
6
|
reduce,
|
|
7
|
-
first,
|
|
8
|
-
last,
|
|
9
7
|
omit,
|
|
10
8
|
without,
|
|
11
9
|
mapValues,
|
|
@@ -1004,13 +1002,10 @@ export const blocks = flow(
|
|
|
1004
1002
|
|
|
1005
1003
|
case 'MOVE_BLOCKS_UP': {
|
|
1006
1004
|
const { clientIds, rootClientId = '' } = action;
|
|
1007
|
-
const firstClientId =
|
|
1005
|
+
const firstClientId = clientIds[ 0 ];
|
|
1008
1006
|
const subState = state[ rootClientId ];
|
|
1009
1007
|
|
|
1010
|
-
if (
|
|
1011
|
-
! subState.length ||
|
|
1012
|
-
firstClientId === first( subState )
|
|
1013
|
-
) {
|
|
1008
|
+
if ( ! subState.length || firstClientId === subState[ 0 ] ) {
|
|
1014
1009
|
return state;
|
|
1015
1010
|
}
|
|
1016
1011
|
|
|
@@ -1029,11 +1024,14 @@ export const blocks = flow(
|
|
|
1029
1024
|
|
|
1030
1025
|
case 'MOVE_BLOCKS_DOWN': {
|
|
1031
1026
|
const { clientIds, rootClientId = '' } = action;
|
|
1032
|
-
const firstClientId =
|
|
1033
|
-
const lastClientId =
|
|
1027
|
+
const firstClientId = clientIds[ 0 ];
|
|
1028
|
+
const lastClientId = clientIds[ clientIds.length - 1 ];
|
|
1034
1029
|
const subState = state[ rootClientId ];
|
|
1035
1030
|
|
|
1036
|
-
if (
|
|
1031
|
+
if (
|
|
1032
|
+
! subState.length ||
|
|
1033
|
+
lastClientId === subState[ subState.length - 1 ]
|
|
1034
|
+
) {
|
|
1037
1035
|
return state;
|
|
1038
1036
|
}
|
|
1039
1037
|
|
|
@@ -1610,21 +1608,21 @@ export const blockListSettings = ( state = {}, action ) => {
|
|
|
1610
1608
|
};
|
|
1611
1609
|
|
|
1612
1610
|
/**
|
|
1613
|
-
* Reducer returning
|
|
1611
|
+
* Reducer returning which mode is enabled.
|
|
1614
1612
|
*
|
|
1615
1613
|
* @param {string} state Current state.
|
|
1616
1614
|
* @param {Object} action Dispatched action.
|
|
1617
1615
|
*
|
|
1618
1616
|
* @return {string} Updated state.
|
|
1619
1617
|
*/
|
|
1620
|
-
export function
|
|
1621
|
-
// Let inserting block always trigger Edit mode.
|
|
1622
|
-
if ( action.type === 'INSERT_BLOCKS' ) {
|
|
1623
|
-
return
|
|
1618
|
+
export function editorMode( state = 'edit', action ) {
|
|
1619
|
+
// Let inserting block in navigation mode always trigger Edit mode.
|
|
1620
|
+
if ( action.type === 'INSERT_BLOCKS' && state === 'navigation' ) {
|
|
1621
|
+
return 'edit';
|
|
1624
1622
|
}
|
|
1625
1623
|
|
|
1626
|
-
if ( action.type === '
|
|
1627
|
-
return action.
|
|
1624
|
+
if ( action.type === 'SET_EDITOR_MODE' ) {
|
|
1625
|
+
return action.mode;
|
|
1628
1626
|
}
|
|
1629
1627
|
|
|
1630
1628
|
return state;
|
|
@@ -1639,13 +1637,11 @@ export function isNavigationMode( state = false, action ) {
|
|
|
1639
1637
|
* @return {string|null} Updated state.
|
|
1640
1638
|
*/
|
|
1641
1639
|
export function hasBlockMovingClientId( state = null, action ) {
|
|
1642
|
-
// Let inserting block always trigger Edit mode.
|
|
1643
|
-
|
|
1644
1640
|
if ( action.type === 'SET_BLOCK_MOVING_MODE' ) {
|
|
1645
1641
|
return action.hasBlockMovingClientId;
|
|
1646
1642
|
}
|
|
1647
1643
|
|
|
1648
|
-
if ( action.type === '
|
|
1644
|
+
if ( action.type === 'SET_EDITOR_MODE' ) {
|
|
1649
1645
|
return null;
|
|
1650
1646
|
}
|
|
1651
1647
|
|
|
@@ -1778,6 +1774,21 @@ export function lastBlockInserted( state = {}, action ) {
|
|
|
1778
1774
|
return state;
|
|
1779
1775
|
}
|
|
1780
1776
|
|
|
1777
|
+
/**
|
|
1778
|
+
* Reducer returning the block that is eding temporarily edited as blocks.
|
|
1779
|
+
*
|
|
1780
|
+
* @param {Object} state Current state.
|
|
1781
|
+
* @param {Object} action Dispatched action.
|
|
1782
|
+
*
|
|
1783
|
+
* @return {Object} Updated state.
|
|
1784
|
+
*/
|
|
1785
|
+
export function temporarilyEditingAsBlocks( state = '', action ) {
|
|
1786
|
+
if ( action.type === 'SET_TEMPORARILY_EDITING_AS_BLOCKS' ) {
|
|
1787
|
+
return action.temporarilyEditingAsBlocks;
|
|
1788
|
+
}
|
|
1789
|
+
return state;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1781
1792
|
export default combineReducers( {
|
|
1782
1793
|
blocks,
|
|
1783
1794
|
isTyping,
|
|
@@ -1793,9 +1804,10 @@ export default combineReducers( {
|
|
|
1793
1804
|
settings,
|
|
1794
1805
|
preferences,
|
|
1795
1806
|
lastBlockAttributesChange,
|
|
1796
|
-
|
|
1807
|
+
editorMode,
|
|
1797
1808
|
hasBlockMovingClientId,
|
|
1798
1809
|
automaticChangeStatus,
|
|
1799
1810
|
highlightedBlock,
|
|
1800
1811
|
lastBlockInserted,
|
|
1812
|
+
temporarilyEditingAsBlocks,
|
|
1801
1813
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
castArray,
|
|
6
|
-
first,
|
|
7
|
-
last,
|
|
8
|
-
map,
|
|
9
|
-
reduce,
|
|
10
|
-
some,
|
|
11
|
-
find,
|
|
12
|
-
filter,
|
|
13
|
-
orderBy,
|
|
14
|
-
} from 'lodash';
|
|
4
|
+
import { castArray, map, reduce, some, find, filter, orderBy } from 'lodash';
|
|
15
5
|
import createSelector from 'rememo';
|
|
16
6
|
|
|
17
7
|
/**
|
|
@@ -798,7 +788,7 @@ export const getMultiSelectedBlocks = createSelector(
|
|
|
798
788
|
* @return {?string} First block client ID in the multi-selection set.
|
|
799
789
|
*/
|
|
800
790
|
export function getFirstMultiSelectedBlockClientId( state ) {
|
|
801
|
-
return
|
|
791
|
+
return getMultiSelectedBlockClientIds( state )[ 0 ] || null;
|
|
802
792
|
}
|
|
803
793
|
|
|
804
794
|
/**
|
|
@@ -810,7 +800,8 @@ export function getFirstMultiSelectedBlockClientId( state ) {
|
|
|
810
800
|
* @return {?string} Last block client ID in the multi-selection set.
|
|
811
801
|
*/
|
|
812
802
|
export function getLastMultiSelectedBlockClientId( state ) {
|
|
813
|
-
|
|
803
|
+
const selectedClientIds = getMultiSelectedBlockClientIds( state );
|
|
804
|
+
return selectedClientIds[ selectedClientIds.length - 1 ] || null;
|
|
814
805
|
}
|
|
815
806
|
|
|
816
807
|
/**
|
|
@@ -948,6 +939,14 @@ export function __unstableIsSelectionCollapsed( state ) {
|
|
|
948
939
|
);
|
|
949
940
|
}
|
|
950
941
|
|
|
942
|
+
export function __unstableSelectionHasUnmergeableBlock( state ) {
|
|
943
|
+
return getSelectedBlockClientIds( state ).some( ( clientId ) => {
|
|
944
|
+
const blockName = getBlockName( state, clientId );
|
|
945
|
+
const blockType = getBlockType( blockName );
|
|
946
|
+
return ! blockType.merge;
|
|
947
|
+
} );
|
|
948
|
+
}
|
|
949
|
+
|
|
951
950
|
/**
|
|
952
951
|
* Check whether the selection is mergeable.
|
|
953
952
|
*
|
|
@@ -1009,19 +1008,19 @@ export function __unstableIsSelectionMergeable( state, isForward ) {
|
|
|
1009
1008
|
? selectionStart.clientId
|
|
1010
1009
|
: selectionEnd.clientId;
|
|
1011
1010
|
|
|
1012
|
-
const
|
|
1013
|
-
const targetBlockType = getBlockType(
|
|
1011
|
+
const targetBlockName = getBlockName( state, targetBlockClientId );
|
|
1012
|
+
const targetBlockType = getBlockType( targetBlockName );
|
|
1014
1013
|
|
|
1015
1014
|
if ( ! targetBlockType.merge ) return false;
|
|
1016
1015
|
|
|
1017
1016
|
const blockToMerge = getBlock( state, blockToMergeClientId );
|
|
1018
1017
|
|
|
1019
1018
|
// It's mergeable if the blocks are of the same type.
|
|
1020
|
-
if ( blockToMerge.name ===
|
|
1019
|
+
if ( blockToMerge.name === targetBlockName ) return true;
|
|
1021
1020
|
|
|
1022
1021
|
// If the blocks are of a different type, try to transform the block being
|
|
1023
1022
|
// merged into the same type of block.
|
|
1024
|
-
const blocksToMerge = switchToBlockType( blockToMerge,
|
|
1023
|
+
const blocksToMerge = switchToBlockType( blockToMerge, targetBlockName );
|
|
1025
1024
|
|
|
1026
1025
|
return blocksToMerge && blocksToMerge.length;
|
|
1027
1026
|
}
|
|
@@ -2542,7 +2541,18 @@ function getReusableBlocks( state ) {
|
|
|
2542
2541
|
* @return {boolean} Is navigation mode enabled.
|
|
2543
2542
|
*/
|
|
2544
2543
|
export function isNavigationMode( state ) {
|
|
2545
|
-
return state.
|
|
2544
|
+
return state.editorMode === 'navigation';
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
/**
|
|
2548
|
+
* Returns the current editor mode.
|
|
2549
|
+
*
|
|
2550
|
+
* @param {Object} state Editor state.
|
|
2551
|
+
*
|
|
2552
|
+
* @return {string} the editor mode.
|
|
2553
|
+
*/
|
|
2554
|
+
export function __unstableGetEditorMode( state ) {
|
|
2555
|
+
return state.editorMode;
|
|
2546
2556
|
}
|
|
2547
2557
|
|
|
2548
2558
|
/**
|
|
@@ -2625,7 +2635,7 @@ export const __experimentalGetActiveBlockIdByBlockNames = createSelector(
|
|
|
2625
2635
|
);
|
|
2626
2636
|
if ( entityAreaParents ) {
|
|
2627
2637
|
// Last parent closest/most interior.
|
|
2628
|
-
return
|
|
2638
|
+
return entityAreaParents[ entityAreaParents.length - 1 ];
|
|
2629
2639
|
}
|
|
2630
2640
|
return null;
|
|
2631
2641
|
},
|
|
@@ -2679,3 +2689,72 @@ export const __unstableGetVisibleBlocks = createSelector(
|
|
|
2679
2689
|
},
|
|
2680
2690
|
( state ) => [ state.blocks.visibility ]
|
|
2681
2691
|
);
|
|
2692
|
+
|
|
2693
|
+
export const __unstableGetContentLockingParent = createSelector(
|
|
2694
|
+
( state, clientId ) => {
|
|
2695
|
+
let current = clientId;
|
|
2696
|
+
let result;
|
|
2697
|
+
while ( !! state.blocks.parents[ current ] ) {
|
|
2698
|
+
current = state.blocks.parents[ current ];
|
|
2699
|
+
if ( getTemplateLock( state, current ) === 'noContent' ) {
|
|
2700
|
+
result = current;
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
return result;
|
|
2704
|
+
},
|
|
2705
|
+
( state ) => [ state.blocks.parents, state.blockListSettings ]
|
|
2706
|
+
);
|
|
2707
|
+
|
|
2708
|
+
export function __unstableGetTemporarilyEditingAsBlocks( state ) {
|
|
2709
|
+
return state.temporarilyEditingAsBlocks;
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
export function __unstableHasActiveBlockOverlayActive( state, clientId ) {
|
|
2713
|
+
// If the block editing is locked, the block overlay is always active.
|
|
2714
|
+
if ( ! canEditBlock( state, clientId ) ) {
|
|
2715
|
+
return true;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
const editorMode = __unstableGetEditorMode( state );
|
|
2719
|
+
|
|
2720
|
+
// In zoom-out mode, the block overlay is always active for top level blocks.
|
|
2721
|
+
if (
|
|
2722
|
+
editorMode === 'zoom-out' &&
|
|
2723
|
+
! getBlockRootClientId( state, clientId )
|
|
2724
|
+
) {
|
|
2725
|
+
return true;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
// In navigation mode, the block overlay is active when the block is not
|
|
2729
|
+
// selected (and doesn't contain a selected child). The same behavior is
|
|
2730
|
+
// also enabled in all modes for blocks that have controlled children
|
|
2731
|
+
// (reusable block, template part, navigation), unless explicitly disabled
|
|
2732
|
+
// with `supports.__experimentalDisableBlockOverlay`.
|
|
2733
|
+
const blockSupportDisable = hasBlockSupport(
|
|
2734
|
+
getBlockName( state, clientId ),
|
|
2735
|
+
'__experimentalDisableBlockOverlay',
|
|
2736
|
+
false
|
|
2737
|
+
);
|
|
2738
|
+
const shouldEnableIfUnselected =
|
|
2739
|
+
editorMode === 'navigation' ||
|
|
2740
|
+
( blockSupportDisable
|
|
2741
|
+
? false
|
|
2742
|
+
: areInnerBlocksControlled( state, clientId ) );
|
|
2743
|
+
|
|
2744
|
+
return (
|
|
2745
|
+
shouldEnableIfUnselected &&
|
|
2746
|
+
! isBlockSelected( state, clientId ) &&
|
|
2747
|
+
! hasSelectedInnerBlock( state, clientId, true )
|
|
2748
|
+
);
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
export function __unstableIsWithinBlockOverlay( state, clientId ) {
|
|
2752
|
+
let parent = state.blocks.parents[ clientId ];
|
|
2753
|
+
while ( !! parent ) {
|
|
2754
|
+
if ( __unstableHasActiveBlockOverlayActive( state, parent ) ) {
|
|
2755
|
+
return true;
|
|
2756
|
+
}
|
|
2757
|
+
parent = state.blocks.parents[ parent ];
|
|
2758
|
+
}
|
|
2759
|
+
return false;
|
|
2760
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { omit } from 'lodash';
|
|
5
4
|
import deepFreeze from 'deep-freeze';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -260,7 +259,8 @@ describe( 'state', () => {
|
|
|
260
259
|
|
|
261
260
|
const state = blocks( existingState, action );
|
|
262
261
|
|
|
263
|
-
|
|
262
|
+
const { tree, ...restState } = state;
|
|
263
|
+
expect( restState ).toEqual( {
|
|
264
264
|
isPersistentChange: true,
|
|
265
265
|
isIgnoredChange: false,
|
|
266
266
|
byClientId: {
|
|
@@ -342,7 +342,8 @@ describe( 'state', () => {
|
|
|
342
342
|
|
|
343
343
|
const state = blocks( existingState, action );
|
|
344
344
|
|
|
345
|
-
|
|
345
|
+
const { tree, ...restState } = state;
|
|
346
|
+
expect( restState ).toEqual( {
|
|
346
347
|
isPersistentChange: true,
|
|
347
348
|
isIgnoredChange: false,
|
|
348
349
|
byClientId: {
|
|
@@ -466,7 +467,8 @@ describe( 'state', () => {
|
|
|
466
467
|
|
|
467
468
|
const state = blocks( existingState, action );
|
|
468
469
|
|
|
469
|
-
|
|
470
|
+
const { tree, ...restState } = state;
|
|
471
|
+
expect( restState ).toEqual( {
|
|
470
472
|
isPersistentChange: true,
|
|
471
473
|
isIgnoredChange: false,
|
|
472
474
|
byClientId: {
|
|
@@ -603,7 +605,8 @@ describe( 'state', () => {
|
|
|
603
605
|
|
|
604
606
|
const state = blocks( existingState, action );
|
|
605
607
|
|
|
606
|
-
|
|
608
|
+
const { tree, ...restState } = state;
|
|
609
|
+
expect( restState ).toEqual( {
|
|
607
610
|
isPersistentChange: true,
|
|
608
611
|
isIgnoredChange: false,
|
|
609
612
|
byClientId: {
|
|
@@ -221,7 +221,7 @@ export function getPxFromCssUnit( cssUnit, options = {} ) {
|
|
|
221
221
|
let parsedUnit = parseUnit( cssUnit );
|
|
222
222
|
|
|
223
223
|
if ( ! parsedUnit.unit ) {
|
|
224
|
-
parsedUnit = parseUnitFunction( cssUnit
|
|
224
|
+
parsedUnit = parseUnitFunction( cssUnit );
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {
|