@wordpress/block-editor 9.8.1-next.957ca95e4c.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +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/autocomplete/index.js +2 -2
- package/build/components/autocomplete/index.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-list-compact.native.js +2 -1
- package/build/components/block-list/block-list-compact.native.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 +82 -52
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +31 -7
- 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/border-radius-control/linked-button.js +5 -6
- package/build/components/border-radius-control/linked-button.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/convert-to-group-buttons/toolbar.js +8 -3
- package/build/components/convert-to-group-buttons/toolbar.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 +9 -3
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +28 -17
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +28 -4
- 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/drop-indicator.js +30 -28
- package/build/components/list-view/drop-indicator.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/format-toolbar-container.js +9 -9
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +31 -21
- 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/spacing-sizes-control/linked-button.js +2 -3
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -4
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/text-decoration-control/index.js +19 -15
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +25 -17
- 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/image-url-input-ui.js +6 -4
- package/build/components/url-popover/image-url-input-ui.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/typography.js +10 -11
- package/build/hooks/typography.js.map +1 -1
- 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 +43 -19
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +96 -10
- 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/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.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-list-compact.native.js +2 -1
- package/build-module/components/block-list/block-list-compact.native.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 +83 -53
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +31 -7
- 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/border-radius-control/linked-button.js +5 -6
- package/build-module/components/border-radius-control/linked-button.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/convert-to-group-buttons/toolbar.js +8 -3
- package/build-module/components/convert-to-group-buttons/toolbar.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 +9 -3
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +28 -17
- 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 +28 -4
- 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/drop-indicator.js +30 -28
- package/build-module/components/list-view/drop-indicator.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/format-toolbar-container.js +10 -10
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +31 -20
- 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/spacing-sizes-control/linked-button.js +2 -3
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -4
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +21 -16
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +28 -20
- 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/image-url-input-ui.js +6 -4
- package/build-module/components/url-popover/image-url-input-ui.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/typography.js +10 -11
- package/build-module/hooks/typography.js.map +1 -1
- 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 +41 -19
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +81 -10
- 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 +142 -46
- package/build-style/style.css +142 -46
- 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/autocomplete/index.js +2 -5
- 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-list-compact.native.js +1 -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 +57 -11
- 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 +124 -62
- package/src/components/block-popover/index.js +47 -8
- 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/border-radius-control/linked-button.js +12 -11
- 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/convert-to-group-buttons/toolbar.js +6 -2
- 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 +10 -2
- package/src/components/inner-blocks/use-inner-block-template-sync.js +40 -25
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -3
- 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/drop-indicator.js +33 -32
- 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/format-toolbar-container.js +18 -10
- package/src/components/rich-text/index.js +26 -37
- package/src/components/rich-text/index.native.js +8 -21
- package/src/components/spacing-sizes-control/linked-button.js +2 -3
- package/src/components/spacing-sizes-control/style.scss +4 -1
- package/src/components/spacing-sizes-control/utils.js +1 -8
- package/src/components/text-decoration-control/index.js +31 -23
- package/src/components/text-decoration-control/style.scss +18 -0
- package/src/components/text-transform-control/index.js +42 -26
- package/src/components/text-transform-control/style.scss +18 -0
- package/src/components/tool-selector/index.js +9 -11
- package/src/components/url-input/test/button.js +145 -71
- package/src/components/url-popover/image-url-input-ui.js +5 -3
- 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/typography.js +13 -14
- 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 +36 -21
- package/src/store/selectors.js +99 -20
- package/src/store/test/reducer.js +8 -5
- package/src/store/test/selectors.js +4 -4
- package/src/style.scss +2 -0
- 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,22 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`BlockIcon renders a Icon 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<span
|
|
6
|
+
class="block-editor-block-icon"
|
|
7
|
+
>
|
|
8
|
+
<svg
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
focusable="false"
|
|
11
|
+
height="24"
|
|
12
|
+
viewBox="0 0 24 24"
|
|
13
|
+
width="24"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
`;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { Icon } from '@wordpress/components';
|
|
10
9
|
import { image } from '@wordpress/icons';
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -16,42 +15,58 @@ import BlockIcon from '../';
|
|
|
16
15
|
|
|
17
16
|
describe( 'BlockIcon', () => {
|
|
18
17
|
it( 'renders a Icon', () => {
|
|
19
|
-
const
|
|
18
|
+
const { container } = render( <BlockIcon icon={ image } /> );
|
|
20
19
|
|
|
21
|
-
expect(
|
|
22
|
-
wrapper.containsMatchingElement( <Icon icon={ image } /> )
|
|
23
|
-
).toBe( true );
|
|
20
|
+
expect( container ).toMatchSnapshot();
|
|
24
21
|
} );
|
|
25
22
|
|
|
26
23
|
it( 'renders a span without the has-colors classname', () => {
|
|
27
|
-
const
|
|
24
|
+
const { container } = render( <BlockIcon icon={ image } /> );
|
|
28
25
|
|
|
29
|
-
expect(
|
|
26
|
+
expect( container.firstChild ).not.toHaveClass( 'has-colors' );
|
|
30
27
|
} );
|
|
31
28
|
|
|
32
29
|
it( 'renders a span with the has-colors classname', () => {
|
|
33
|
-
const
|
|
30
|
+
const { container } = render( <BlockIcon icon={ image } showColors /> );
|
|
34
31
|
|
|
35
|
-
expect(
|
|
32
|
+
expect( container.firstChild ).toHaveClass( 'has-colors' );
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
it( 'supports adding a className to the wrapper', () => {
|
|
36
|
+
const { container } = render(
|
|
37
|
+
<BlockIcon icon={ image } className="foo-bar" />
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect( container.firstChild ).toHaveClass( 'foo-bar' );
|
|
36
41
|
} );
|
|
37
42
|
|
|
38
43
|
it( 'skips adding background and foreground styles when colors are not enabled', () => {
|
|
39
|
-
const
|
|
40
|
-
<BlockIcon
|
|
44
|
+
const { container } = render(
|
|
45
|
+
<BlockIcon
|
|
46
|
+
icon={ {
|
|
47
|
+
background: 'white',
|
|
48
|
+
foreground: 'black',
|
|
49
|
+
src: 'image',
|
|
50
|
+
} }
|
|
51
|
+
/>
|
|
41
52
|
);
|
|
42
53
|
|
|
43
|
-
expect(
|
|
54
|
+
expect( container.firstChild ).not.toHaveAttribute( 'style' );
|
|
44
55
|
} );
|
|
45
56
|
|
|
46
57
|
it( 'adds background and foreground styles when colors are enabled', () => {
|
|
47
|
-
const
|
|
58
|
+
const { container } = render(
|
|
48
59
|
<BlockIcon
|
|
49
|
-
icon={ {
|
|
60
|
+
icon={ {
|
|
61
|
+
background: 'white',
|
|
62
|
+
foreground: 'black',
|
|
63
|
+
src: 'image',
|
|
64
|
+
} }
|
|
50
65
|
showColors
|
|
51
66
|
/>
|
|
52
67
|
);
|
|
53
68
|
|
|
54
|
-
expect(
|
|
69
|
+
expect( container.firstChild ).toHaveStyle( {
|
|
55
70
|
backgroundColor: 'white',
|
|
56
71
|
color: 'black',
|
|
57
72
|
} );
|
|
@@ -11,8 +11,13 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
PanelBody,
|
|
13
13
|
__experimentalUseSlot as useSlot,
|
|
14
|
+
FlexItem,
|
|
15
|
+
__experimentalHStack as HStack,
|
|
16
|
+
__experimentalVStack as VStack,
|
|
17
|
+
Button,
|
|
14
18
|
} from '@wordpress/components';
|
|
15
|
-
import { useSelect } from '@wordpress/data';
|
|
19
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
20
|
+
import { useMemo, useCallback } from '@wordpress/element';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Internal dependencies
|
|
@@ -29,36 +34,135 @@ import DefaultStylePicker from '../default-style-picker';
|
|
|
29
34
|
import BlockVariationTransforms from '../block-variation-transforms';
|
|
30
35
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
31
36
|
import { store as blockEditorStore } from '../../store';
|
|
37
|
+
import BlockIcon from '../block-icon';
|
|
38
|
+
|
|
39
|
+
function useContentBlocks( blockTypes, block ) {
|
|
40
|
+
const contenBlocksObjectAux = useMemo( () => {
|
|
41
|
+
return blockTypes.reduce( ( result, blockType ) => {
|
|
42
|
+
if (
|
|
43
|
+
Object.entries( blockType.attributes ).some(
|
|
44
|
+
( [ , { __experimentalRole } ] ) =>
|
|
45
|
+
__experimentalRole === 'content'
|
|
46
|
+
)
|
|
47
|
+
) {
|
|
48
|
+
result[ blockType.name ] = true;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}, {} );
|
|
52
|
+
}, [ blockTypes ] );
|
|
53
|
+
const isContentBlock = useCallback(
|
|
54
|
+
( blockName ) => {
|
|
55
|
+
return !! contenBlocksObjectAux[ blockName ];
|
|
56
|
+
},
|
|
57
|
+
[ blockTypes ]
|
|
58
|
+
);
|
|
59
|
+
return useMemo( () => {
|
|
60
|
+
return getContentBlocks( [ block ], isContentBlock );
|
|
61
|
+
}, [ block, isContentBlock ] );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getContentBlocks( blocks, isContentBlock ) {
|
|
65
|
+
const result = [];
|
|
66
|
+
for ( const block of blocks ) {
|
|
67
|
+
if ( isContentBlock( block.name ) ) {
|
|
68
|
+
result.push( block );
|
|
69
|
+
}
|
|
70
|
+
result.push( ...getContentBlocks( block.innerBlocks, isContentBlock ) );
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function BlockNavigationButton( { blockTypes, block, selectedBlock } ) {
|
|
76
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
77
|
+
const blockType = blockTypes.find( ( { name } ) => name === block.name );
|
|
78
|
+
const isSelected =
|
|
79
|
+
selectedBlock && selectedBlock.clientId === block.clientId;
|
|
80
|
+
return (
|
|
81
|
+
<Button
|
|
82
|
+
isPressed={ isSelected }
|
|
83
|
+
onClick={ () => selectBlock( block.clientId ) }
|
|
84
|
+
>
|
|
85
|
+
<HStack justify="flex-start">
|
|
86
|
+
<BlockIcon icon={ blockType.icon } />
|
|
87
|
+
<FlexItem>{ blockType.title }</FlexItem>
|
|
88
|
+
</HStack>
|
|
89
|
+
</Button>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function BlockInspectorLockedBlocks( { topLevelLockedBlock } ) {
|
|
94
|
+
const { blockTypes, block, selectedBlock } = useSelect(
|
|
95
|
+
( select ) => {
|
|
96
|
+
return {
|
|
97
|
+
blockTypes: select( blocksStore ).getBlockTypes(),
|
|
98
|
+
block: select( blockEditorStore ).getBlock(
|
|
99
|
+
topLevelLockedBlock
|
|
100
|
+
),
|
|
101
|
+
selectedBlock: select( blockEditorStore ).getSelectedBlock(),
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
[ topLevelLockedBlock ]
|
|
105
|
+
);
|
|
106
|
+
const blockInformation = useBlockDisplayInformation( topLevelLockedBlock );
|
|
107
|
+
const contentBlocks = useContentBlocks( blockTypes, block );
|
|
108
|
+
return (
|
|
109
|
+
<div className="block-editor-block-inspector">
|
|
110
|
+
<BlockCard { ...blockInformation } />
|
|
111
|
+
<BlockVariationTransforms blockClientId={ topLevelLockedBlock } />
|
|
112
|
+
<VStack
|
|
113
|
+
spacing={ 1 }
|
|
114
|
+
padding={ 4 }
|
|
115
|
+
className="block-editor-block-inspector__block-buttons-container"
|
|
116
|
+
>
|
|
117
|
+
<h2 className="block-editor-block-card__title">
|
|
118
|
+
{ __( 'Content' ) }
|
|
119
|
+
</h2>
|
|
120
|
+
{ contentBlocks.map( ( contentBlock ) => (
|
|
121
|
+
<BlockNavigationButton
|
|
122
|
+
selectedBlock={ selectedBlock }
|
|
123
|
+
key={ contentBlock.clientId }
|
|
124
|
+
block={ contentBlock }
|
|
125
|
+
blockTypes={ blockTypes }
|
|
126
|
+
/>
|
|
127
|
+
) ) }
|
|
128
|
+
</VStack>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
32
132
|
|
|
33
133
|
const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
34
134
|
const {
|
|
35
135
|
count,
|
|
36
|
-
hasBlockStyles,
|
|
37
136
|
selectedBlockName,
|
|
38
137
|
selectedBlockClientId,
|
|
39
138
|
blockType,
|
|
139
|
+
topLevelLockedBlock,
|
|
40
140
|
} = useSelect( ( select ) => {
|
|
41
141
|
const {
|
|
42
142
|
getSelectedBlockClientId,
|
|
43
143
|
getSelectedBlockCount,
|
|
44
144
|
getBlockName,
|
|
145
|
+
__unstableGetContentLockingParent,
|
|
146
|
+
getTemplateLock,
|
|
45
147
|
} = select( blockEditorStore );
|
|
46
|
-
const { getBlockStyles } = select( blocksStore );
|
|
47
148
|
|
|
48
149
|
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
49
150
|
const _selectedBlockName =
|
|
50
151
|
_selectedBlockClientId && getBlockName( _selectedBlockClientId );
|
|
51
152
|
const _blockType =
|
|
52
153
|
_selectedBlockName && getBlockType( _selectedBlockName );
|
|
53
|
-
const blockStyles =
|
|
54
|
-
_selectedBlockName && getBlockStyles( _selectedBlockName );
|
|
55
154
|
|
|
56
155
|
return {
|
|
57
156
|
count: getSelectedBlockCount(),
|
|
58
157
|
selectedBlockClientId: _selectedBlockClientId,
|
|
59
158
|
selectedBlockName: _selectedBlockName,
|
|
60
159
|
blockType: _blockType,
|
|
61
|
-
|
|
160
|
+
topLevelLockedBlock:
|
|
161
|
+
getTemplateLock( _selectedBlockClientId ) === 'contentOnly'
|
|
162
|
+
? _selectedBlockClientId
|
|
163
|
+
: __unstableGetContentLockingParent(
|
|
164
|
+
_selectedBlockClientId
|
|
165
|
+
),
|
|
62
166
|
};
|
|
63
167
|
}, [] );
|
|
64
168
|
|
|
@@ -109,20 +213,30 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
109
213
|
}
|
|
110
214
|
return null;
|
|
111
215
|
}
|
|
216
|
+
if ( topLevelLockedBlock ) {
|
|
217
|
+
return (
|
|
218
|
+
<BlockInspectorLockedBlocks
|
|
219
|
+
topLevelLockedBlock={ topLevelLockedBlock }
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
112
223
|
return (
|
|
113
224
|
<BlockInspectorSingleBlock
|
|
114
225
|
clientId={ selectedBlockClientId }
|
|
115
226
|
blockName={ blockType.name }
|
|
116
|
-
hasBlockStyles={ hasBlockStyles }
|
|
117
227
|
/>
|
|
118
228
|
);
|
|
119
229
|
};
|
|
120
230
|
|
|
121
|
-
const BlockInspectorSingleBlock = ( {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
231
|
+
const BlockInspectorSingleBlock = ( { clientId, blockName } ) => {
|
|
232
|
+
const hasBlockStyles = useSelect(
|
|
233
|
+
( select ) => {
|
|
234
|
+
const { getBlockStyles } = select( blocksStore );
|
|
235
|
+
const blockStyles = getBlockStyles( blockName );
|
|
236
|
+
return blockStyles && blockStyles.length > 0;
|
|
237
|
+
},
|
|
238
|
+
[ blockName ]
|
|
239
|
+
);
|
|
126
240
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
127
241
|
return (
|
|
128
242
|
<div className="block-editor-block-inspector">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.block-editor-block-inspector {
|
|
2
|
-
p {
|
|
2
|
+
p:not(.components-base-control__help) {
|
|
3
3
|
margin-top: 0;
|
|
4
4
|
}
|
|
5
5
|
|
|
@@ -34,3 +34,9 @@
|
|
|
34
34
|
padding: ($grid-unit-20 * 2) $grid-unit-20;
|
|
35
35
|
text-align: center;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
.block-editor-block-inspector__block-buttons-container {
|
|
40
|
+
border-top: $border-width solid $gray-200;
|
|
41
|
+
padding: $grid-unit-20;
|
|
42
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { omit } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -19,6 +18,7 @@ import {
|
|
|
19
18
|
isUnmodifiedDefaultBlock,
|
|
20
19
|
serializeRawBlock,
|
|
21
20
|
switchToBlockType,
|
|
21
|
+
store as blocksStore,
|
|
22
22
|
} from '@wordpress/blocks';
|
|
23
23
|
import { withFilters } from '@wordpress/components';
|
|
24
24
|
import {
|
|
@@ -94,10 +94,38 @@ function BlockListBlock( {
|
|
|
94
94
|
onMerge,
|
|
95
95
|
toggleSelection,
|
|
96
96
|
} ) {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const {
|
|
98
|
+
themeSupportsLayout,
|
|
99
|
+
hasContentLockedParent,
|
|
100
|
+
isContentBlock,
|
|
101
|
+
isContentLocking,
|
|
102
|
+
isTemporarilyEditingAsBlocks,
|
|
103
|
+
} = useSelect(
|
|
104
|
+
( select ) => {
|
|
105
|
+
const {
|
|
106
|
+
getSettings,
|
|
107
|
+
__unstableGetContentLockingParent,
|
|
108
|
+
getTemplateLock,
|
|
109
|
+
__unstableGetTemporarilyEditingAsBlocks,
|
|
110
|
+
} = select( blockEditorStore );
|
|
111
|
+
const _hasContentLockedParent =
|
|
112
|
+
!! __unstableGetContentLockingParent( clientId );
|
|
113
|
+
return {
|
|
114
|
+
themeSupportsLayout: getSettings().supportsLayout,
|
|
115
|
+
isContentBlock:
|
|
116
|
+
select( blocksStore ).__experimentalHasContentRoleAttribute(
|
|
117
|
+
name
|
|
118
|
+
),
|
|
119
|
+
hasContentLockedParent: _hasContentLockedParent,
|
|
120
|
+
isContentLocking:
|
|
121
|
+
getTemplateLock( clientId ) === 'contentOnly' &&
|
|
122
|
+
! _hasContentLockedParent,
|
|
123
|
+
isTemporarilyEditingAsBlocks:
|
|
124
|
+
__unstableGetTemporarilyEditingAsBlocks() === clientId,
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
[ name, clientId ]
|
|
128
|
+
);
|
|
101
129
|
const { removeBlock } = useDispatch( blockEditorStore );
|
|
102
130
|
const onRemove = useCallback( () => removeBlock( clientId ), [ clientId ] );
|
|
103
131
|
|
|
@@ -123,6 +151,12 @@ function BlockListBlock( {
|
|
|
123
151
|
|
|
124
152
|
const blockType = getBlockType( name );
|
|
125
153
|
|
|
154
|
+
if ( hasContentLockedParent && ! isContentBlock ) {
|
|
155
|
+
wrapperProps = {
|
|
156
|
+
...wrapperProps,
|
|
157
|
+
tabIndex: -1,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
126
160
|
// Determine whether the block has props to apply to the wrapper.
|
|
127
161
|
if ( blockType?.getEditWrapperProps ) {
|
|
128
162
|
wrapperProps = mergeWrapperProps(
|
|
@@ -185,18 +219,24 @@ function BlockListBlock( {
|
|
|
185
219
|
block = <Block { ...wrapperProps }>{ blockEdit }</Block>;
|
|
186
220
|
}
|
|
187
221
|
|
|
222
|
+
const { 'data-align': dataAlign, ...restWrapperProps } = wrapperProps ?? {};
|
|
223
|
+
|
|
188
224
|
const value = {
|
|
189
225
|
clientId,
|
|
190
|
-
className:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
226
|
+
className: classnames(
|
|
227
|
+
{
|
|
228
|
+
'is-content-locked': isContentLocking,
|
|
229
|
+
'is-content-locked-temporarily-editing-as-blocks':
|
|
230
|
+
isTemporarilyEditingAsBlocks,
|
|
231
|
+
'is-content-block': hasContentLockedParent && isContentBlock,
|
|
232
|
+
},
|
|
233
|
+
dataAlign && themeSupportsLayout && `align${ dataAlign }`,
|
|
234
|
+
className
|
|
235
|
+
),
|
|
236
|
+
wrapperProps: restWrapperProps,
|
|
198
237
|
isAligned,
|
|
199
238
|
};
|
|
239
|
+
|
|
200
240
|
const memoizedValue = useMemo( () => value, Object.values( value ) );
|
|
201
241
|
|
|
202
242
|
return (
|
|
@@ -34,15 +34,15 @@ export const IntersectionObserver = createContext();
|
|
|
34
34
|
function Root( { className, ...settings } ) {
|
|
35
35
|
const [ element, setElement ] = useState();
|
|
36
36
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
37
|
-
const { isOutlineMode, isFocusMode,
|
|
37
|
+
const { isOutlineMode, isFocusMode, editorMode } = useSelect(
|
|
38
38
|
( select ) => {
|
|
39
|
-
const { getSettings,
|
|
39
|
+
const { getSettings, __unstableGetEditorMode } =
|
|
40
40
|
select( blockEditorStore );
|
|
41
41
|
const { outlineMode, focusMode } = getSettings();
|
|
42
42
|
return {
|
|
43
43
|
isOutlineMode: outlineMode,
|
|
44
44
|
isFocusMode: focusMode,
|
|
45
|
-
|
|
45
|
+
editorMode: __unstableGetEditorMode(),
|
|
46
46
|
};
|
|
47
47
|
},
|
|
48
48
|
[]
|
|
@@ -74,7 +74,7 @@ function Root( { className, ...settings } ) {
|
|
|
74
74
|
className: classnames( 'is-root-container', className, {
|
|
75
75
|
'is-outline-mode': isOutlineMode,
|
|
76
76
|
'is-focus-mode': isFocusMode && isLargeViewport,
|
|
77
|
-
'is-navigate-mode':
|
|
77
|
+
'is-navigate-mode': editorMode === 'navigation',
|
|
78
78
|
} ),
|
|
79
79
|
},
|
|
80
80
|
settings
|
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
.block-editor-block-list__layout {
|
|
14
14
|
position: relative;
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
// Hide selections on this element, otherwise Safari will include it stacked
|
|
17
|
+
// under your actual selection.
|
|
18
|
+
&::selection {
|
|
19
|
+
background: transparent;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// The primary indicator of selection in text is the native selection marker.
|
|
22
23
|
// When selecting multiple blocks, we provide an additional selection indicator.
|
|
23
|
-
&.is-navigate-mode .block-editor-block-list__block.is-selected,
|
|
24
|
-
&.is-navigate-mode .block-editor-block-list__block.is-hovered,
|
|
25
24
|
.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected),
|
|
26
25
|
.block-editor-block-list__block.is-highlighted,
|
|
27
26
|
.block-editor-block-list__block.is-highlighted ~ .is-multi-selected {
|
|
@@ -50,15 +49,17 @@
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
// Provide exceptions for placeholders.
|
|
53
|
-
.components-placeholder
|
|
52
|
+
.components-placeholder,
|
|
53
|
+
.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected) {
|
|
54
54
|
::selection {
|
|
55
55
|
background: transparent;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Hide the selection indicator on .block-editor-block-list__layout, else Safari will show it stacked.
|
|
61
|
+
.has-multi-selection &::selection {
|
|
62
|
+
background: transparent;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
.block-editor-block-list__block.is-highlighted::after {
|
|
@@ -123,20 +124,37 @@
|
|
|
123
124
|
padding: 0;
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
.is-content-locked {
|
|
128
|
+
.block-editor-block-list__block {
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
.is-content-block {
|
|
132
|
+
pointer-events: initial;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
126
136
|
.block-editor-block-list__layout .block-editor-block-list__block {
|
|
127
137
|
position: relative;
|
|
128
138
|
|
|
129
139
|
// Re-enable text-selection on editable blocks.
|
|
130
140
|
user-select: text;
|
|
131
141
|
|
|
132
|
-
// Hide the select style pseudo element as it
|
|
142
|
+
// Hide the select style pseudo element as otherwise it gets shwon as "selected" in Safari.
|
|
133
143
|
&.is-partially-selected::after {
|
|
134
|
-
|
|
144
|
+
// By positioning this pseudo element outside the boundaries of the parent block,
|
|
145
|
+
// when partially selected it hides the pseudo element selection in Safari.
|
|
146
|
+
top: -0.5px;
|
|
147
|
+
right: -0.5px;
|
|
148
|
+
bottom: -0.5px;
|
|
149
|
+
left: -0.5px;
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
&.is-highlighted::after,
|
|
138
153
|
&.is-highlighted ~ .is-multi-selected::after {
|
|
139
|
-
|
|
154
|
+
top: 0;
|
|
155
|
+
right: 0;
|
|
156
|
+
bottom: 0;
|
|
157
|
+
left: 0;
|
|
140
158
|
}
|
|
141
159
|
|
|
142
160
|
// Break long strings of text without spaces so they don't overflow the block.
|
|
@@ -331,6 +349,14 @@
|
|
|
331
349
|
}
|
|
332
350
|
}
|
|
333
351
|
|
|
352
|
+
.is-focus-mode .block-editor-block-list__block.is-content-locked.has-child-selected,
|
|
353
|
+
.is-focus-mode .block-editor-block-list__block.is-content-locked-temporarily-editing-as-blocks.has-child-selected {
|
|
354
|
+
&,
|
|
355
|
+
& .block-editor-block-list__block {
|
|
356
|
+
opacity: 1;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
334
360
|
.wp-block[data-align="left"] > *,
|
|
335
361
|
.wp-block[data-align="right"] > *,
|
|
336
362
|
.wp-block.alignleft,
|
|
@@ -431,3 +457,23 @@
|
|
|
431
457
|
margin-bottom: auto;
|
|
432
458
|
}
|
|
433
459
|
}
|
|
460
|
+
|
|
461
|
+
/** Zoom Out mode styles **/
|
|
462
|
+
.block-editor-iframe__body {
|
|
463
|
+
transition: all 0.3s;
|
|
464
|
+
transform-origin: top center;
|
|
465
|
+
|
|
466
|
+
&.is-zoomed-out {
|
|
467
|
+
margin: 100px 0;
|
|
468
|
+
transform: scale(0.45);
|
|
469
|
+
|
|
470
|
+
// Add a bit more space between the top level blocks.
|
|
471
|
+
.wp-site-blocks > * + * {
|
|
472
|
+
margin-block-start: 2.5rem;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
> .block-list-appender {
|
|
476
|
+
display: none;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { cloneDeep } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
@@ -19,6 +14,9 @@ import {
|
|
|
19
14
|
ROOT_LEVEL_ID,
|
|
20
15
|
} from './fixtures/block-list-context.native';
|
|
21
16
|
|
|
17
|
+
// Deep clone an object to avoid mutating it later.
|
|
18
|
+
const cloneObject = ( obj ) => JSON.parse( JSON.stringify( obj ) );
|
|
19
|
+
|
|
22
20
|
describe( 'findBlockLayoutByClientId', () => {
|
|
23
21
|
it( "finds a block's layout data at root level", () => {
|
|
24
22
|
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
@@ -66,7 +64,7 @@ describe( 'findBlockLayoutByClientId', () => {
|
|
|
66
64
|
describe( 'deleteBlockLayoutByClientId', () => {
|
|
67
65
|
it( "deletes a block's layout data at root level", () => {
|
|
68
66
|
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
69
|
-
const defaultBlockLayouts =
|
|
67
|
+
const defaultBlockLayouts = cloneObject( BLOCKS_LAYOUTS_DATA );
|
|
70
68
|
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
71
69
|
defaultBlockLayouts,
|
|
72
70
|
ROOT_LEVEL_ID
|
|
@@ -82,7 +80,7 @@ describe( 'deleteBlockLayoutByClientId', () => {
|
|
|
82
80
|
|
|
83
81
|
it( "deletes a nested block's layout data with inner blocks", () => {
|
|
84
82
|
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
85
|
-
const defaultBlockLayouts =
|
|
83
|
+
const defaultBlockLayouts = cloneObject( BLOCKS_LAYOUTS_DATA );
|
|
86
84
|
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
87
85
|
defaultBlockLayouts,
|
|
88
86
|
NESTED_WITH_INNER_BLOCKS_ID
|
|
@@ -98,7 +96,7 @@ describe( 'deleteBlockLayoutByClientId', () => {
|
|
|
98
96
|
|
|
99
97
|
it( "deletes a deep nested block's layout data", () => {
|
|
100
98
|
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
101
|
-
const defaultBlockLayouts =
|
|
99
|
+
const defaultBlockLayouts = cloneObject( BLOCKS_LAYOUTS_DATA );
|
|
102
100
|
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
103
101
|
defaultBlockLayouts,
|
|
104
102
|
DEEP_NESTED_ID
|
|
@@ -120,7 +118,7 @@ describe( 'updateBlocksLayouts', () => {
|
|
|
120
118
|
findBlockLayoutByClientId,
|
|
121
119
|
updateBlocksLayouts,
|
|
122
120
|
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
123
|
-
const currentBlockLayouts =
|
|
121
|
+
const currentBlockLayouts = cloneObject( blocksLayouts );
|
|
124
122
|
const BLOCK_CLIENT_ID = PARAGRAPH_BLOCK_LAYOUT_DATA.clientId;
|
|
125
123
|
|
|
126
124
|
updateBlocksLayouts( currentBlockLayouts, PARAGRAPH_BLOCK_LAYOUT_DATA );
|
|
@@ -142,7 +140,7 @@ describe( 'updateBlocksLayouts', () => {
|
|
|
142
140
|
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
143
141
|
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
144
142
|
const currentBlockLayouts = {
|
|
145
|
-
current:
|
|
143
|
+
current: cloneObject( BLOCKS_LAYOUTS_DATA ),
|
|
146
144
|
};
|
|
147
145
|
const PARENT_BLOCK_CLIENT_ID = GROUP_BLOCK_LAYOUT_DATA.clientId;
|
|
148
146
|
|
|
@@ -181,7 +179,7 @@ describe( 'updateBlocksLayouts', () => {
|
|
|
181
179
|
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
182
180
|
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
183
181
|
const currentBlockLayouts = {
|
|
184
|
-
current:
|
|
182
|
+
current: cloneObject( BLOCKS_LAYOUTS_DATA ),
|
|
185
183
|
};
|
|
186
184
|
|
|
187
185
|
// Add block layout data to it's parents inner blocks
|
|
@@ -207,7 +205,7 @@ describe( 'updateBlocksLayouts', () => {
|
|
|
207
205
|
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
208
206
|
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
209
207
|
const currentBlockLayouts = {
|
|
210
|
-
current:
|
|
208
|
+
current: cloneObject( BLOCKS_LAYOUTS_DATA ),
|
|
211
209
|
};
|
|
212
210
|
|
|
213
211
|
updateBlocksLayouts( currentBlockLayouts, {
|
|
@@ -227,7 +225,7 @@ describe( 'updateBlocksLayouts', () => {
|
|
|
227
225
|
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
228
226
|
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
229
227
|
const currentBlockLayouts = {
|
|
230
|
-
current:
|
|
228
|
+
current: cloneObject( BLOCKS_LAYOUTS_DATA ),
|
|
231
229
|
};
|
|
232
230
|
|
|
233
231
|
updateBlocksLayouts( currentBlockLayouts, {
|