@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
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`BlockView should match snapshot 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
className="class"
|
|
6
|
-
>
|
|
4
|
+
<div>
|
|
7
5
|
<div
|
|
8
|
-
|
|
6
|
+
class="class"
|
|
9
7
|
>
|
|
10
|
-
<h2
|
|
11
|
-
className="block-editor-block-compare__heading"
|
|
12
|
-
>
|
|
13
|
-
title
|
|
14
|
-
</h2>
|
|
15
8
|
<div
|
|
16
|
-
|
|
9
|
+
class="block-editor-block-compare__content"
|
|
17
10
|
>
|
|
18
|
-
|
|
11
|
+
<h2
|
|
12
|
+
class="block-editor-block-compare__heading"
|
|
13
|
+
>
|
|
14
|
+
title
|
|
15
|
+
</h2>
|
|
16
|
+
<div
|
|
17
|
+
class="block-editor-block-compare__html"
|
|
18
|
+
>
|
|
19
|
+
raw
|
|
20
|
+
</div>
|
|
21
|
+
<div
|
|
22
|
+
class="block-editor-block-compare__preview edit-post-visual-editor"
|
|
23
|
+
>
|
|
24
|
+
<div>
|
|
25
|
+
render
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
19
28
|
</div>
|
|
20
29
|
<div
|
|
21
|
-
|
|
30
|
+
class="block-editor-block-compare__action"
|
|
22
31
|
>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
<button
|
|
33
|
+
class="components-button is-secondary"
|
|
34
|
+
tabindex="0"
|
|
35
|
+
type="button"
|
|
36
|
+
>
|
|
37
|
+
action
|
|
38
|
+
</button>
|
|
26
39
|
</div>
|
|
27
40
|
</div>
|
|
28
|
-
<div
|
|
29
|
-
className="block-editor-block-compare__action"
|
|
30
|
-
>
|
|
31
|
-
<ForwardRef(Button)
|
|
32
|
-
onClick={[Function]}
|
|
33
|
-
tabIndex="0"
|
|
34
|
-
variant="secondary"
|
|
35
|
-
>
|
|
36
|
-
action
|
|
37
|
-
</ForwardRef(Button)>
|
|
38
|
-
</div>
|
|
39
41
|
</div>
|
|
40
42
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -12,7 +12,7 @@ const noop = () => {};
|
|
|
12
12
|
|
|
13
13
|
describe( 'BlockView', () => {
|
|
14
14
|
test( 'should match snapshot', () => {
|
|
15
|
-
const
|
|
15
|
+
const { container } = render(
|
|
16
16
|
<BlockView
|
|
17
17
|
title="title"
|
|
18
18
|
rawContent="raw"
|
|
@@ -23,6 +23,6 @@ describe( 'BlockView', () => {
|
|
|
23
23
|
/>
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
expect(
|
|
26
|
+
expect( container ).toMatchSnapshot();
|
|
27
27
|
} );
|
|
28
28
|
} );
|
|
@@ -11,14 +11,10 @@ import { store as blockEditorStore } from '../../store';
|
|
|
11
11
|
export default function useBlockOverlayActive( clientId ) {
|
|
12
12
|
return useSelect(
|
|
13
13
|
( select ) => {
|
|
14
|
-
const {
|
|
14
|
+
const { __unstableHasActiveBlockOverlayActive } =
|
|
15
15
|
select( blockEditorStore );
|
|
16
16
|
|
|
17
|
-
return (
|
|
18
|
-
! canEditBlock( clientId ) ||
|
|
19
|
-
( ! isBlockSelected( clientId ) &&
|
|
20
|
-
! hasSelectedInnerBlock( clientId, true ) )
|
|
21
|
-
);
|
|
17
|
+
return __unstableHasActiveBlockOverlayActive( clientId );
|
|
22
18
|
},
|
|
23
19
|
[ clientId ]
|
|
24
20
|
);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
.block-editor-block-
|
|
1
|
+
.block-editor-block-list__block.has-block-overlay {
|
|
2
|
+
cursor: default;
|
|
3
|
+
|
|
2
4
|
&::before {
|
|
3
5
|
content: "";
|
|
4
6
|
position: absolute;
|
|
@@ -9,11 +11,30 @@
|
|
|
9
11
|
background: transparent;
|
|
10
12
|
border: none;
|
|
11
13
|
border-radius: $radius-block-ui;
|
|
12
|
-
z-index: z-index(".block-editor-block-
|
|
14
|
+
z-index: z-index(".block-editor-block-list__block.has-block-overlay");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&::after {
|
|
18
|
+
content: none !important;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
&:hover:not(.is-dragging-blocks)::before {
|
|
16
|
-
background: rgba(var(--wp-admin-theme-color--rgb), 0.
|
|
22
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.3);
|
|
23
|
+
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color) inset;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.is-selected:not(.is-dragging-blocks)::before {
|
|
17
27
|
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color) inset;
|
|
18
28
|
}
|
|
29
|
+
|
|
30
|
+
.block-editor-block-list__block {
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.block-editor-iframe__body.is-zoomed-out &::before {
|
|
35
|
+
// Unfortunately because of the vw unit, this is not always going to be exact
|
|
36
|
+
// When the scrollbar is visible, the frame exceeds the canvas by a few pixels.
|
|
37
|
+
width: calc(100vw);
|
|
38
|
+
left: calc(( 100% - 100vw ) / 2);
|
|
39
|
+
}
|
|
19
40
|
}
|
|
@@ -13,7 +13,10 @@ import BlockIcon from '../block-icon';
|
|
|
13
13
|
export default function BlockDraggableChip( { count, icon } ) {
|
|
14
14
|
return (
|
|
15
15
|
<div className="block-editor-block-draggable-chip-wrapper">
|
|
16
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
className="block-editor-block-draggable-chip"
|
|
18
|
+
data-testid="block-draggable-chip"
|
|
19
|
+
>
|
|
17
20
|
<Flex
|
|
18
21
|
justify="center"
|
|
19
22
|
className="block-editor-block-draggable-chip__content"
|
|
@@ -59,7 +59,11 @@ export const Edit = ( props ) => {
|
|
|
59
59
|
const generatedClassName = hasBlockSupport( blockType, 'className', true )
|
|
60
60
|
? getBlockDefaultClassName( name )
|
|
61
61
|
: null;
|
|
62
|
-
const className = classnames(
|
|
62
|
+
const className = classnames(
|
|
63
|
+
generatedClassName,
|
|
64
|
+
attributes.className,
|
|
65
|
+
props.className
|
|
66
|
+
);
|
|
63
67
|
|
|
64
68
|
return (
|
|
65
69
|
<Component { ...props } context={ context } className={ className } />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -28,13 +28,14 @@ describe( 'Edit', () => {
|
|
|
28
28
|
} );
|
|
29
29
|
|
|
30
30
|
it( 'should return null if block type not defined', () => {
|
|
31
|
-
const
|
|
31
|
+
const { container } = render( <Edit name="core/test-block" /> );
|
|
32
32
|
|
|
33
|
-
expect(
|
|
33
|
+
expect( container ).toBeEmptyDOMElement();
|
|
34
34
|
} );
|
|
35
35
|
|
|
36
36
|
it( 'should use edit implementation of block', () => {
|
|
37
|
-
const edit = () => <div />;
|
|
37
|
+
const edit = () => <div data-testid="foo-bar" />;
|
|
38
|
+
|
|
38
39
|
registerBlockType( 'core/test-block', {
|
|
39
40
|
save: noop,
|
|
40
41
|
category: 'text',
|
|
@@ -42,29 +43,33 @@ describe( 'Edit', () => {
|
|
|
42
43
|
edit,
|
|
43
44
|
} );
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
render( <Edit name="core/test-block" /> );
|
|
46
47
|
|
|
47
|
-
expect(
|
|
48
|
+
expect( screen.getByTestId( 'foo-bar' ) ).toBeVisible();
|
|
48
49
|
} );
|
|
49
50
|
|
|
50
51
|
it( 'should use save implementation of block as fallback', () => {
|
|
51
|
-
const save = () => <div />;
|
|
52
|
+
const save = () => <div data-testid="foo-bar" />;
|
|
53
|
+
|
|
52
54
|
registerBlockType( 'core/test-block', {
|
|
53
55
|
save,
|
|
54
56
|
category: 'text',
|
|
55
57
|
title: 'block title',
|
|
56
58
|
} );
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
render( <Edit name="core/test-block" /> );
|
|
59
61
|
|
|
60
|
-
expect(
|
|
62
|
+
expect( screen.getByTestId( 'foo-bar' ) ).toBeVisible();
|
|
61
63
|
} );
|
|
62
64
|
|
|
63
65
|
it( 'should combine the default class name with a custom one', () => {
|
|
64
|
-
const edit = ( { className } ) =>
|
|
66
|
+
const edit = ( { className } ) => (
|
|
67
|
+
<div data-testid="foo-bar" className={ className } />
|
|
68
|
+
);
|
|
65
69
|
const attributes = {
|
|
66
70
|
className: 'my-class',
|
|
67
71
|
};
|
|
72
|
+
|
|
68
73
|
registerBlockType( 'core/test-block', {
|
|
69
74
|
edit,
|
|
70
75
|
save: noop,
|
|
@@ -72,14 +77,11 @@ describe( 'Edit', () => {
|
|
|
72
77
|
title: 'block title',
|
|
73
78
|
} );
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
<Edit name="core/test-block" attributes={ attributes } />
|
|
77
|
-
);
|
|
80
|
+
render( <Edit name="core/test-block" attributes={ attributes } /> );
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
82
|
-
expect( wrapper.find( edit ).hasClass( 'my-class' ) ).toBe( true );
|
|
82
|
+
const editElement = screen.getByTestId( 'foo-bar' );
|
|
83
|
+
expect( editElement ).toHaveClass( 'wp-block-test-block' );
|
|
84
|
+
expect( editElement ).toHaveClass( 'my-class' );
|
|
83
85
|
} );
|
|
84
86
|
|
|
85
87
|
it( 'should assign context', () => {
|
|
@@ -92,13 +94,13 @@ describe( 'Edit', () => {
|
|
|
92
94
|
save: noop,
|
|
93
95
|
} );
|
|
94
96
|
|
|
95
|
-
const
|
|
97
|
+
const { container } = render(
|
|
96
98
|
<BlockContextProvider value={ { value: 'Ok' } }>
|
|
97
99
|
<Edit name="core/test-block" />
|
|
98
100
|
</BlockContextProvider>
|
|
99
101
|
);
|
|
100
102
|
|
|
101
|
-
expect(
|
|
103
|
+
expect( container ).toHaveTextContent( 'Ok' );
|
|
102
104
|
} );
|
|
103
105
|
|
|
104
106
|
describe( 'light wrapper', () => {
|
|
@@ -113,13 +115,13 @@ describe( 'Edit', () => {
|
|
|
113
115
|
save: noop,
|
|
114
116
|
} );
|
|
115
117
|
|
|
116
|
-
const
|
|
118
|
+
const { container } = render(
|
|
117
119
|
<BlockContextProvider value={ { value: 'Ok' } }>
|
|
118
120
|
<Edit name="core/test-block" />
|
|
119
121
|
</BlockContextProvider>
|
|
120
122
|
);
|
|
121
123
|
|
|
122
|
-
expect(
|
|
124
|
+
expect( container ).toHaveTextContent( 'Ok' );
|
|
123
125
|
} );
|
|
124
126
|
} );
|
|
125
127
|
} );
|
|
@@ -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 ) === 'noContent'
|
|
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
|
+
}
|