@wordpress/block-editor 12.15.0 → 12.16.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 +2 -0
- package/README.md +9 -4
- package/build/components/block-canvas/index.js +22 -6
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-list/block.js +28 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +14 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +61 -18
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- 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 +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +89 -27
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +86 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/global-styles/color-panel.js +22 -20
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +9 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +20 -31
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/index.native.js +8 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +14 -7
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +2 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -62
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +2 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +7 -34
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +5 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- package/build/components/use-block-drop-zone/index.js +70 -8
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/align.js +20 -68
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +13 -29
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +28 -31
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +58 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +76 -89
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +12 -29
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +24 -38
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/dimensions.js +21 -17
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +16 -25
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -119
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +25 -14
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +16 -101
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +51 -88
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +34 -14
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +154 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +8 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +34 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +8 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +10 -60
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/object.js +21 -61
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build-module/components/block-canvas/index.js +23 -7
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-list/block.js +29 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +14 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +62 -19
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- 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 +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -1
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +88 -25
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +23 -21
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +10 -4
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +20 -31
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +2 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -32
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +7 -34
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +5 -1
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- package/build-module/components/use-block-drop-zone/index.js +69 -8
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/align.js +19 -66
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +11 -26
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +26 -28
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +57 -78
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +74 -86
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +11 -27
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +20 -39
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/dimensions.js +21 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +14 -23
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +49 -119
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +18 -14
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +5 -3
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +13 -98
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +51 -84
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +33 -12
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +149 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +7 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +33 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +8 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -53
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/object.js +21 -60
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-style/style-rtl.css +113 -293
- package/build-style/style.css +113 -293
- package/package.json +31 -31
- package/src/components/block-canvas/index.js +31 -17
- package/src/components/block-caption/README.md +2 -2
- package/src/components/block-card/index.js +5 -3
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block.js +39 -5
- package/src/components/block-list/block.native.js +18 -4
- package/src/components/block-list/use-block-props/index.js +74 -21
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-patterns-list/index.js +1 -1
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/index.js +180 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +90 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/global-styles/color-panel.js +34 -25
- package/src/components/global-styles/filters-panel.js +8 -4
- package/src/components/global-styles/typography-panel.js +23 -43
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +16 -8
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +15 -17
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +2 -2
- package/src/components/preview-options/index.js +6 -86
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +5 -46
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +7 -48
- package/src/components/rich-text/use-input-rules.js +6 -1
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/use-block-drop-zone/index.js +114 -14
- package/src/components/use-on-block-drop/index.js +2 -1
- package/src/components/use-resize-canvas/README.md +3 -3
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/index.js +15 -1
- package/src/hooks/align.js +15 -76
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +13 -33
- package/src/hooks/background.js +28 -23
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +67 -118
- package/src/hooks/color.js +100 -132
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +8 -40
- package/src/hooks/custom-fields.js +20 -47
- package/src/hooks/dimensions.js +20 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +10 -29
- package/src/hooks/font-size.js +66 -162
- package/src/hooks/index.js +42 -14
- package/src/hooks/index.native.js +6 -3
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +13 -102
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +117 -187
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/typography.js +20 -16
- package/src/hooks/utils.js +187 -6
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +8 -0
- package/src/store/private-selectors.js +45 -0
- package/src/store/reducer.js +8 -0
- package/src/store/selectors.js +5 -69
- package/src/store/utils.js +74 -0
- package/src/style.scss +0 -2
- package/src/utils/object.js +18 -69
- package/src/utils/selection.js +9 -2
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/test/color.js +0 -112
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useMergeRefs } from '@wordpress/compose';
|
|
5
|
+
import { useRef } from '@wordpress/element';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
10
|
import BlockList from '../block-list';
|
|
11
|
+
import BlockTools from '../block-tools';
|
|
10
12
|
import EditorStyles from '../editor-styles';
|
|
11
13
|
import Iframe from '../iframe';
|
|
12
14
|
import WritingFlow from '../writing-flow';
|
|
@@ -23,11 +25,15 @@ export function ExperimentalBlockCanvas( {
|
|
|
23
25
|
} ) {
|
|
24
26
|
const resetTypingRef = useMouseMoveTypingReset();
|
|
25
27
|
const clearerRef = useBlockSelectionClearer();
|
|
26
|
-
const
|
|
28
|
+
const localRef = useRef();
|
|
29
|
+
const contentRef = useMergeRefs( [ contentRefProp, clearerRef, localRef ] );
|
|
27
30
|
|
|
28
31
|
if ( ! shouldIframe ) {
|
|
29
32
|
return (
|
|
30
|
-
|
|
33
|
+
<BlockTools
|
|
34
|
+
__unstableContentRef={ localRef }
|
|
35
|
+
style={ { height, display: 'flex' } }
|
|
36
|
+
>
|
|
31
37
|
<EditorStyles
|
|
32
38
|
styles={ styles }
|
|
33
39
|
scope=".editor-styles-wrapper"
|
|
@@ -36,29 +42,37 @@ export function ExperimentalBlockCanvas( {
|
|
|
36
42
|
ref={ contentRef }
|
|
37
43
|
className="editor-styles-wrapper"
|
|
38
44
|
tabIndex={ -1 }
|
|
39
|
-
style={ {
|
|
45
|
+
style={ {
|
|
46
|
+
height: '100%',
|
|
47
|
+
width: '100%',
|
|
48
|
+
} }
|
|
40
49
|
>
|
|
41
50
|
{ children }
|
|
42
51
|
</WritingFlow>
|
|
43
|
-
|
|
52
|
+
</BlockTools>
|
|
44
53
|
);
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
return (
|
|
48
|
-
<
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
contentRef={ contentRef }
|
|
52
|
-
style={ {
|
|
53
|
-
width: '100%',
|
|
54
|
-
height,
|
|
55
|
-
...iframeProps?.style,
|
|
56
|
-
} }
|
|
57
|
-
name="editor-canvas"
|
|
57
|
+
<BlockTools
|
|
58
|
+
__unstableContentRef={ localRef }
|
|
59
|
+
style={ { height, display: 'flex' } }
|
|
58
60
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
<Iframe
|
|
62
|
+
{ ...iframeProps }
|
|
63
|
+
ref={ resetTypingRef }
|
|
64
|
+
contentRef={ contentRef }
|
|
65
|
+
style={ {
|
|
66
|
+
width: '100%',
|
|
67
|
+
height: '100%',
|
|
68
|
+
...iframeProps?.style,
|
|
69
|
+
} }
|
|
70
|
+
name="editor-canvas"
|
|
71
|
+
>
|
|
72
|
+
<EditorStyles styles={ styles } />
|
|
73
|
+
{ children }
|
|
74
|
+
</Iframe>
|
|
75
|
+
</BlockTools>
|
|
62
76
|
);
|
|
63
77
|
}
|
|
64
78
|
|
|
@@ -16,7 +16,7 @@ The `BlockCaption` component renders block-level UI for adding and editing capti
|
|
|
16
16
|
Renders an editable caption field designed specifically for block-level use.
|
|
17
17
|
|
|
18
18
|
```jsx
|
|
19
|
-
import { BlockCaption } from '@wordpress/block-editor';
|
|
19
|
+
import { BlockCaption, RichText } from '@wordpress/block-editor';
|
|
20
20
|
|
|
21
21
|
const MyBlockCaption = (
|
|
22
22
|
clientId,
|
|
@@ -29,7 +29,7 @@ const MyBlockCaption = (
|
|
|
29
29
|
clientId={ clientId }
|
|
30
30
|
accessible={ true }
|
|
31
31
|
accessibilityLabelCreator={ ( caption ) =>
|
|
32
|
-
|
|
32
|
+
RichText.isEmpty( caption )
|
|
33
33
|
? /* translators: accessibility text. Empty caption. */
|
|
34
34
|
'Caption. Empty'
|
|
35
35
|
: sprintf(
|
|
@@ -62,9 +62,11 @@ function BlockCard( { title, icon, description, blockType, className } ) {
|
|
|
62
62
|
<BlockIcon icon={ icon } showColors />
|
|
63
63
|
<div className="block-editor-block-card__content">
|
|
64
64
|
<h2 className="block-editor-block-card__title">{ title }</h2>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
{ description && (
|
|
66
|
+
<span className="block-editor-block-card__description">
|
|
67
|
+
{ description }
|
|
68
|
+
</span>
|
|
69
|
+
) }
|
|
68
70
|
</div>
|
|
69
71
|
</div>
|
|
70
72
|
);
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
.block-editor-block-card {
|
|
2
|
-
display: flex;
|
|
3
2
|
align-items: flex-start;
|
|
3
|
+
color: $gray-900;
|
|
4
|
+
display: flex;
|
|
5
|
+
padding: $grid-unit-20;
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
.block-editor-block-card__content {
|
|
7
9
|
flex-grow: 1;
|
|
8
|
-
margin-bottom: $grid-unit-05;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.block-editor-block-card__title {
|
|
12
13
|
font-weight: 500;
|
|
13
14
|
|
|
14
15
|
&.block-editor-block-card__title {
|
|
16
|
+
font-size: $default-font-size;
|
|
15
17
|
line-height: $button-size-small;
|
|
16
|
-
margin: 0
|
|
18
|
+
margin: 0;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
.block-editor-block-card__description {
|
|
23
|
+
display: block;
|
|
21
24
|
font-size: $default-font-size;
|
|
25
|
+
margin-top: $grid-unit-05;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
.block-editor-block-card .block-editor-block-icon {
|
|
@@ -1,45 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Internal dependencies
|
|
9
7
|
*/
|
|
10
8
|
import groups from './groups';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import {
|
|
10
|
+
useBlockEditContext,
|
|
11
|
+
mayDisplayControlsKey,
|
|
12
|
+
mayDisplayParentControlsKey,
|
|
13
|
+
} from '../block-edit/context';
|
|
14
14
|
|
|
15
15
|
export default function useBlockControlsFill( group, shareWithChildBlocks ) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const isParentDisplayed = useSelect(
|
|
19
|
-
( select ) => {
|
|
20
|
-
if ( ! shareWithChildBlocks ) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const { getBlockName, hasSelectedInnerBlock } =
|
|
25
|
-
select( blockEditorStore );
|
|
26
|
-
const { hasBlockSupport } = select( blocksStore );
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
hasBlockSupport(
|
|
30
|
-
getBlockName( clientId ),
|
|
31
|
-
'__experimentalExposeControlsToChildren',
|
|
32
|
-
false
|
|
33
|
-
) && hasSelectedInnerBlock( clientId )
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
[ shareWithChildBlocks, clientId ]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
if ( isDisplayed ) {
|
|
16
|
+
const context = useBlockEditContext();
|
|
17
|
+
if ( context[ mayDisplayControlsKey ] ) {
|
|
40
18
|
return groups[ group ]?.Fill;
|
|
41
19
|
}
|
|
42
|
-
if (
|
|
20
|
+
if ( context[ mayDisplayParentControlsKey ] && shareWithChildBlocks ) {
|
|
43
21
|
return groups.parent.Fill;
|
|
44
22
|
}
|
|
45
23
|
return null;
|
|
@@ -59,7 +59,7 @@ describe( 'BlockControls', () => {
|
|
|
59
59
|
it( 'should render a dynamic toolbar of controls', () => {
|
|
60
60
|
render(
|
|
61
61
|
<SlotFillProvider>
|
|
62
|
-
<BlockEdit name="core/test-block"
|
|
62
|
+
<BlockEdit name="core/test-block" mayDisplayControls>
|
|
63
63
|
<BlockControls controls={ controls }>
|
|
64
64
|
<p>Child</p>
|
|
65
65
|
</BlockControls>
|
|
@@ -84,7 +84,7 @@ describe( 'BlockControls', () => {
|
|
|
84
84
|
it( 'should render its children', () => {
|
|
85
85
|
render(
|
|
86
86
|
<SlotFillProvider>
|
|
87
|
-
<BlockEdit name="core/test-block"
|
|
87
|
+
<BlockEdit name="core/test-block" mayDisplayControls>
|
|
88
88
|
<BlockControls controls={ controls }>
|
|
89
89
|
<p>Child</p>
|
|
90
90
|
</BlockControls>
|
|
@@ -99,7 +99,7 @@ describe( 'BlockControls', () => {
|
|
|
99
99
|
it( 'should a dynamic toolbar when passed as children', () => {
|
|
100
100
|
render(
|
|
101
101
|
<SlotFillProvider>
|
|
102
|
-
<BlockEdit name="core/test-block"
|
|
102
|
+
<BlockEdit name="core/test-block" mayDisplayControls>
|
|
103
103
|
<BlockControls>
|
|
104
104
|
<ToolbarGroup controls={ controls } />
|
|
105
105
|
</BlockControls>
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createContext, useContext } from '@wordpress/element';
|
|
5
5
|
|
|
6
|
+
export const mayDisplayControlsKey = Symbol( 'mayDisplayControls' );
|
|
7
|
+
export const mayDisplayParentControlsKey = Symbol( 'mayDisplayParentControls' );
|
|
8
|
+
|
|
6
9
|
export const DEFAULT_BLOCK_EDIT_CONTEXT = {
|
|
7
10
|
name: '',
|
|
8
11
|
isSelected: false,
|
|
@@ -8,7 +8,12 @@ import { hasBlockSupport } from '@wordpress/blocks';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import Edit from './edit';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
BlockEditContextProvider,
|
|
13
|
+
useBlockEditContext,
|
|
14
|
+
mayDisplayControlsKey,
|
|
15
|
+
mayDisplayParentControlsKey,
|
|
16
|
+
} from './context';
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
19
|
* The `useBlockEditContext` hook provides information about the block this hook is being used in.
|
|
@@ -20,7 +25,13 @@ import { BlockEditContextProvider, useBlockEditContext } from './context';
|
|
|
20
25
|
*/
|
|
21
26
|
export { useBlockEditContext };
|
|
22
27
|
|
|
23
|
-
export default function BlockEdit(
|
|
28
|
+
export default function BlockEdit( {
|
|
29
|
+
mayDisplayControls,
|
|
30
|
+
mayDisplayParentControls,
|
|
31
|
+
// The remaining props are passed through the BlockEdit filters and are thus
|
|
32
|
+
// public API!
|
|
33
|
+
...props
|
|
34
|
+
} ) {
|
|
24
35
|
const {
|
|
25
36
|
name,
|
|
26
37
|
isSelected,
|
|
@@ -32,19 +43,34 @@ export default function BlockEdit( props ) {
|
|
|
32
43
|
const layoutSupport =
|
|
33
44
|
hasBlockSupport( name, 'layout', false ) ||
|
|
34
45
|
hasBlockSupport( name, '__experimentalLayout', false );
|
|
35
|
-
const context = {
|
|
36
|
-
name,
|
|
37
|
-
isSelected,
|
|
38
|
-
clientId,
|
|
39
|
-
layout: layoutSupport ? layout : null,
|
|
40
|
-
__unstableLayoutClassNames,
|
|
41
|
-
};
|
|
42
46
|
return (
|
|
43
47
|
<BlockEditContextProvider
|
|
44
48
|
// It is important to return the same object if props haven't
|
|
45
49
|
// changed to avoid unnecessary rerenders.
|
|
46
50
|
// See https://reactjs.org/docs/context.html#caveats.
|
|
47
|
-
value={ useMemo(
|
|
51
|
+
value={ useMemo(
|
|
52
|
+
() => ( {
|
|
53
|
+
name,
|
|
54
|
+
isSelected,
|
|
55
|
+
clientId,
|
|
56
|
+
layout: layoutSupport ? layout : null,
|
|
57
|
+
__unstableLayoutClassNames,
|
|
58
|
+
// We use symbols in favour of an __unstable prefix to avoid
|
|
59
|
+
// usage outside of the package (this context is exposed).
|
|
60
|
+
[ mayDisplayControlsKey ]: mayDisplayControls,
|
|
61
|
+
[ mayDisplayParentControlsKey ]: mayDisplayParentControls,
|
|
62
|
+
} ),
|
|
63
|
+
[
|
|
64
|
+
name,
|
|
65
|
+
isSelected,
|
|
66
|
+
clientId,
|
|
67
|
+
layoutSupport,
|
|
68
|
+
layout,
|
|
69
|
+
__unstableLayoutClassNames,
|
|
70
|
+
mayDisplayControls,
|
|
71
|
+
mayDisplayParentControls,
|
|
72
|
+
]
|
|
73
|
+
) }
|
|
48
74
|
>
|
|
49
75
|
<Edit { ...props } />
|
|
50
76
|
</BlockEditContextProvider>
|
|
@@ -7,14 +7,17 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { unlock } from '../../lock-unlock';
|
|
10
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
useBlockEditContext,
|
|
12
|
+
mayDisplayControlsKey,
|
|
13
|
+
} from '../block-edit/context';
|
|
11
14
|
|
|
12
15
|
const { createPrivateSlotFill } = unlock( componentsPrivateApis );
|
|
13
16
|
const { Fill, Slot } = createPrivateSlotFill( 'BlockInformation' );
|
|
14
17
|
|
|
15
18
|
const BlockInfo = ( props ) => {
|
|
16
|
-
const
|
|
17
|
-
if ( !
|
|
19
|
+
const context = useBlockEditContext();
|
|
20
|
+
if ( ! context[ mayDisplayControlsKey ] ) {
|
|
18
21
|
return null;
|
|
19
22
|
}
|
|
20
23
|
return <Fill { ...props } />;
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
switchToBlockType,
|
|
16
16
|
getDefaultBlockName,
|
|
17
17
|
isUnmodifiedBlock,
|
|
18
|
+
store as blocksStore,
|
|
18
19
|
} from '@wordpress/blocks';
|
|
19
20
|
import { withFilters } from '@wordpress/components';
|
|
20
21
|
import {
|
|
@@ -53,10 +54,18 @@ function mergeWrapperProps( propsA, propsB ) {
|
|
|
53
54
|
...propsB,
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
// May be set to undefined, so check if the property is set!
|
|
58
|
+
if (
|
|
59
|
+
propsA?.hasOwnProperty( 'className' ) &&
|
|
60
|
+
propsB?.hasOwnProperty( 'className' )
|
|
61
|
+
) {
|
|
57
62
|
newProps.className = classnames( propsA.className, propsB.className );
|
|
58
63
|
}
|
|
59
|
-
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
propsA?.hasOwnProperty( 'style' ) &&
|
|
67
|
+
propsB?.hasOwnProperty( 'style' )
|
|
68
|
+
) {
|
|
60
69
|
newProps.style = { ...propsA.style, ...propsB.style };
|
|
61
70
|
}
|
|
62
71
|
|
|
@@ -95,21 +104,40 @@ function BlockListBlock( {
|
|
|
95
104
|
themeSupportsLayout,
|
|
96
105
|
isTemporarilyEditingAsBlocks,
|
|
97
106
|
blockEditingMode,
|
|
107
|
+
mayDisplayControls,
|
|
108
|
+
mayDisplayParentControls,
|
|
98
109
|
} = useSelect(
|
|
99
110
|
( select ) => {
|
|
100
111
|
const {
|
|
101
112
|
getSettings,
|
|
102
113
|
__unstableGetTemporarilyEditingAsBlocks,
|
|
103
114
|
getBlockEditingMode,
|
|
115
|
+
getBlockName,
|
|
116
|
+
isFirstMultiSelectedBlock,
|
|
117
|
+
getMultiSelectedBlockClientIds,
|
|
118
|
+
hasSelectedInnerBlock,
|
|
104
119
|
} = select( blockEditorStore );
|
|
120
|
+
const { hasBlockSupport } = select( blocksStore );
|
|
105
121
|
return {
|
|
106
122
|
themeSupportsLayout: getSettings().supportsLayout,
|
|
107
123
|
isTemporarilyEditingAsBlocks:
|
|
108
124
|
__unstableGetTemporarilyEditingAsBlocks() === clientId,
|
|
109
125
|
blockEditingMode: getBlockEditingMode( clientId ),
|
|
126
|
+
mayDisplayControls:
|
|
127
|
+
isSelected ||
|
|
128
|
+
( isFirstMultiSelectedBlock( clientId ) &&
|
|
129
|
+
getMultiSelectedBlockClientIds().every(
|
|
130
|
+
( id ) => getBlockName( id ) === name
|
|
131
|
+
) ),
|
|
132
|
+
mayDisplayParentControls:
|
|
133
|
+
hasBlockSupport(
|
|
134
|
+
getBlockName( clientId ),
|
|
135
|
+
'__experimentalExposeControlsToChildren',
|
|
136
|
+
false
|
|
137
|
+
) && hasSelectedInnerBlock( clientId ),
|
|
110
138
|
};
|
|
111
139
|
},
|
|
112
|
-
[ clientId ]
|
|
140
|
+
[ clientId, isSelected, name ]
|
|
113
141
|
);
|
|
114
142
|
const { removeBlock } = useDispatch( blockEditorStore );
|
|
115
143
|
const onRemove = useCallback( () => removeBlock( clientId ), [ clientId ] );
|
|
@@ -137,6 +165,8 @@ function BlockListBlock( {
|
|
|
137
165
|
__unstableParentLayout={
|
|
138
166
|
Object.keys( parentLayout ).length ? parentLayout : undefined
|
|
139
167
|
}
|
|
168
|
+
mayDisplayControls={ mayDisplayControls }
|
|
169
|
+
mayDisplayParentControls={ mayDisplayParentControls }
|
|
140
170
|
/>
|
|
141
171
|
);
|
|
142
172
|
|
|
@@ -161,6 +191,10 @@ function BlockListBlock( {
|
|
|
161
191
|
!! wrapperProps[ 'data-align' ] &&
|
|
162
192
|
! themeSupportsLayout;
|
|
163
193
|
|
|
194
|
+
// Support for sticky position in classic themes with alignment wrappers.
|
|
195
|
+
|
|
196
|
+
const isSticky = className?.includes( 'is-position-sticky' );
|
|
197
|
+
|
|
164
198
|
// For aligned blocks, provide a wrapper element so the block can be
|
|
165
199
|
// positioned relative to the block column.
|
|
166
200
|
// This is only kept for classic themes that don't support layout
|
|
@@ -172,7 +206,7 @@ function BlockListBlock( {
|
|
|
172
206
|
if ( isAligned ) {
|
|
173
207
|
blockEdit = (
|
|
174
208
|
<div
|
|
175
|
-
className=
|
|
209
|
+
className={ classnames( 'wp-block', isSticky && className ) }
|
|
176
210
|
data-align={ wrapperProps[ 'data-align' ] }
|
|
177
211
|
>
|
|
178
212
|
{ blockEdit }
|
|
@@ -221,7 +255,7 @@ function BlockListBlock( {
|
|
|
221
255
|
isTemporarilyEditingAsBlocks,
|
|
222
256
|
},
|
|
223
257
|
dataAlign && themeSupportsLayout && `align${ dataAlign }`,
|
|
224
|
-
className
|
|
258
|
+
! ( dataAlign && isSticky ) && className
|
|
225
259
|
),
|
|
226
260
|
wrapperProps: restWrapperProps,
|
|
227
261
|
isAligned,
|
|
@@ -148,6 +148,7 @@ function BlockListBlock( {
|
|
|
148
148
|
isDescendentBlockSelected,
|
|
149
149
|
isParentSelected,
|
|
150
150
|
order,
|
|
151
|
+
mayDisplayControls,
|
|
151
152
|
} = useSelect(
|
|
152
153
|
( select ) => {
|
|
153
154
|
const {
|
|
@@ -158,6 +159,9 @@ function BlockListBlock( {
|
|
|
158
159
|
getSelectedBlockClientId,
|
|
159
160
|
getSettings,
|
|
160
161
|
hasSelectedInnerBlock,
|
|
162
|
+
getBlockName,
|
|
163
|
+
isFirstMultiSelectedBlock,
|
|
164
|
+
getMultiSelectedBlockClientIds,
|
|
161
165
|
} = select( blockEditorStore );
|
|
162
166
|
const currentBlockType = getBlockType( name || 'core/missing' );
|
|
163
167
|
const currentBlockCategory = currentBlockType?.category;
|
|
@@ -205,6 +209,12 @@ function BlockListBlock( {
|
|
|
205
209
|
isDescendentBlockSelected: descendentBlockSelected,
|
|
206
210
|
isParentSelected: parentSelected,
|
|
207
211
|
order: blockOrder,
|
|
212
|
+
mayDisplayControls:
|
|
213
|
+
isSelected ||
|
|
214
|
+
( isFirstMultiSelectedBlock( clientId ) &&
|
|
215
|
+
getMultiSelectedBlockClientIds().every(
|
|
216
|
+
( id ) => getBlockName( id ) === name
|
|
217
|
+
) ),
|
|
208
218
|
};
|
|
209
219
|
},
|
|
210
220
|
[ clientId, isSelected, name, rootClientId ]
|
|
@@ -243,10 +253,13 @@ function BlockListBlock( {
|
|
|
243
253
|
);
|
|
244
254
|
|
|
245
255
|
// Block level styles.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
256
|
+
let wrapperProps = {};
|
|
257
|
+
if ( blockType?.getEditWrapperProps ) {
|
|
258
|
+
wrapperProps = getWrapperProps(
|
|
259
|
+
attributes,
|
|
260
|
+
blockType.getEditWrapperProps
|
|
261
|
+
);
|
|
262
|
+
}
|
|
250
263
|
|
|
251
264
|
// Inherited styles merged with block level styles.
|
|
252
265
|
const mergedStyle = useMemo( () => {
|
|
@@ -346,6 +359,7 @@ function BlockListBlock( {
|
|
|
346
359
|
: undefined
|
|
347
360
|
}
|
|
348
361
|
wrapperProps={ wrapperProps }
|
|
362
|
+
mayDisplayControls={ mayDisplayControls }
|
|
349
363
|
/>
|
|
350
364
|
<View onLayout={ onLayout } />
|
|
351
365
|
</GlobalStylesContext.Provider>
|
|
@@ -11,6 +11,8 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
11
11
|
import {
|
|
12
12
|
__unstableGetBlockProps as getBlockProps,
|
|
13
13
|
getBlockType,
|
|
14
|
+
isReusableBlock,
|
|
15
|
+
getBlockDefaultClassName,
|
|
14
16
|
store as blocksStore,
|
|
15
17
|
} from '@wordpress/blocks';
|
|
16
18
|
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
@@ -25,17 +27,12 @@ import { BlockListBlockContext } from '../block-list-block-context';
|
|
|
25
27
|
import { useFocusFirstElement } from './use-focus-first-element';
|
|
26
28
|
import { useIsHovered } from './use-is-hovered';
|
|
27
29
|
import { useBlockEditContext } from '../../block-edit/context';
|
|
28
|
-
import { useBlockClassNames } from './use-block-class-names';
|
|
29
|
-
import { useBlockDefaultClassName } from './use-block-default-class-name';
|
|
30
|
-
import { useBlockCustomClassName } from './use-block-custom-class-name';
|
|
31
|
-
import { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';
|
|
32
30
|
import { useFocusHandler } from './use-focus-handler';
|
|
33
31
|
import { useEventHandlers } from './use-selected-block-event-handlers';
|
|
34
32
|
import { useNavModeExit } from './use-nav-mode-exit';
|
|
35
33
|
import { useBlockRefProvider } from './use-block-refs';
|
|
36
34
|
import { useIntersectionObserver } from './use-intersection-observer';
|
|
37
35
|
import { store as blockEditorStore } from '../../../store';
|
|
38
|
-
import useBlockOverlayActive from '../../block-content-overlay';
|
|
39
36
|
import { unlock } from '../../../lock-unlock';
|
|
40
37
|
|
|
41
38
|
/**
|
|
@@ -99,10 +96,15 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
99
96
|
name,
|
|
100
97
|
blockApiVersion,
|
|
101
98
|
blockTitle,
|
|
99
|
+
isSelected,
|
|
102
100
|
isPartOfSelection,
|
|
103
101
|
adjustScrolling,
|
|
104
102
|
enableAnimation,
|
|
105
103
|
isSubtreeDisabled,
|
|
104
|
+
isOutlineEnabled,
|
|
105
|
+
hasOverlay,
|
|
106
|
+
initialPosition,
|
|
107
|
+
classNames,
|
|
106
108
|
} = useSelect(
|
|
107
109
|
( select ) => {
|
|
108
110
|
const {
|
|
@@ -117,9 +119,21 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
117
119
|
isAncestorMultiSelected,
|
|
118
120
|
isFirstMultiSelectedBlock,
|
|
119
121
|
isBlockSubtreeDisabled,
|
|
122
|
+
getSettings,
|
|
123
|
+
isBlockHighlighted,
|
|
124
|
+
__unstableIsFullySelected,
|
|
125
|
+
__unstableSelectionHasUnmergeableBlock,
|
|
126
|
+
isBlockBeingDragged,
|
|
127
|
+
hasSelectedInnerBlock,
|
|
128
|
+
hasBlockMovingClientId,
|
|
129
|
+
canInsertBlockType,
|
|
130
|
+
getBlockRootClientId,
|
|
131
|
+
__unstableHasActiveBlockOverlayActive,
|
|
132
|
+
__unstableGetEditorMode,
|
|
133
|
+
getSelectedBlocksInitialCaretPosition,
|
|
120
134
|
} = unlock( select( blockEditorStore ) );
|
|
121
135
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
122
|
-
const
|
|
136
|
+
const _isSelected = isBlockSelected( clientId );
|
|
123
137
|
const isPartOfMultiSelection =
|
|
124
138
|
isBlockMultiSelected( clientId ) ||
|
|
125
139
|
isAncestorMultiSelected( clientId );
|
|
@@ -127,6 +141,16 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
127
141
|
const blockType = getBlockType( blockName );
|
|
128
142
|
const attributes = getBlockAttributes( clientId );
|
|
129
143
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
144
|
+
const { outlineMode } = getSettings();
|
|
145
|
+
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
146
|
+
const checkDeep = true;
|
|
147
|
+
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
|
|
148
|
+
clientId,
|
|
149
|
+
checkDeep
|
|
150
|
+
);
|
|
151
|
+
const typing = isTyping();
|
|
152
|
+
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
153
|
+
const movingClientId = hasBlockMovingClientId();
|
|
130
154
|
|
|
131
155
|
return {
|
|
132
156
|
index: getBlockIndex( clientId ),
|
|
@@ -134,31 +158,62 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
134
158
|
name: blockName,
|
|
135
159
|
blockApiVersion: blockType?.apiVersion || 1,
|
|
136
160
|
blockTitle: match?.title || blockType?.title,
|
|
137
|
-
|
|
161
|
+
isSelected: _isSelected,
|
|
162
|
+
isPartOfSelection: _isSelected || isPartOfMultiSelection,
|
|
138
163
|
adjustScrolling:
|
|
139
|
-
|
|
164
|
+
_isSelected || isFirstMultiSelectedBlock( clientId ),
|
|
140
165
|
enableAnimation:
|
|
141
|
-
!
|
|
166
|
+
! typing &&
|
|
142
167
|
getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
|
|
143
168
|
isSubtreeDisabled: isBlockSubtreeDisabled( clientId ),
|
|
169
|
+
isOutlineEnabled: outlineMode,
|
|
170
|
+
hasOverlay: __unstableHasActiveBlockOverlayActive( clientId ),
|
|
171
|
+
initialPosition:
|
|
172
|
+
_isSelected && __unstableGetEditorMode() === 'edit'
|
|
173
|
+
? getSelectedBlocksInitialCaretPosition()
|
|
174
|
+
: undefined,
|
|
175
|
+
classNames: classnames(
|
|
176
|
+
{
|
|
177
|
+
'is-selected': _isSelected,
|
|
178
|
+
'is-highlighted': isBlockHighlighted( clientId ),
|
|
179
|
+
'is-multi-selected': isMultiSelected,
|
|
180
|
+
'is-partially-selected':
|
|
181
|
+
isMultiSelected &&
|
|
182
|
+
! __unstableIsFullySelected() &&
|
|
183
|
+
! __unstableSelectionHasUnmergeableBlock(),
|
|
184
|
+
'is-reusable': isReusableBlock( blockType ),
|
|
185
|
+
'is-dragging': isBlockBeingDragged( clientId ),
|
|
186
|
+
'has-child-selected': isAncestorOfSelectedBlock,
|
|
187
|
+
'remove-outline': _isSelected && outlineMode && typing,
|
|
188
|
+
'is-block-moving-mode': !! movingClientId,
|
|
189
|
+
'can-insert-moving-block':
|
|
190
|
+
movingClientId &&
|
|
191
|
+
canInsertBlockType(
|
|
192
|
+
getBlockName( movingClientId ),
|
|
193
|
+
getBlockRootClientId( clientId )
|
|
194
|
+
),
|
|
195
|
+
},
|
|
196
|
+
hasLightBlockWrapper ? attributes.className : undefined,
|
|
197
|
+
hasLightBlockWrapper
|
|
198
|
+
? getBlockDefaultClassName( blockName )
|
|
199
|
+
: undefined
|
|
200
|
+
),
|
|
144
201
|
};
|
|
145
202
|
},
|
|
146
203
|
[ clientId ]
|
|
147
204
|
);
|
|
148
205
|
|
|
149
|
-
const hasOverlay = useBlockOverlayActive( clientId );
|
|
150
|
-
|
|
151
206
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
152
207
|
const blockLabel = sprintf( __( 'Block: %s' ), blockTitle );
|
|
153
208
|
const htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';
|
|
154
209
|
const mergedRefs = useMergeRefs( [
|
|
155
210
|
props.ref,
|
|
156
|
-
useFocusFirstElement( clientId ),
|
|
211
|
+
useFocusFirstElement( { clientId, initialPosition } ),
|
|
157
212
|
useBlockRefProvider( clientId ),
|
|
158
213
|
useFocusHandler( clientId ),
|
|
159
|
-
useEventHandlers( clientId ),
|
|
214
|
+
useEventHandlers( { clientId, isSelected } ),
|
|
160
215
|
useNavModeExit( clientId ),
|
|
161
|
-
useIsHovered(),
|
|
216
|
+
useIsHovered( { isEnabled: isOutlineEnabled } ),
|
|
162
217
|
useIntersectionObserver(),
|
|
163
218
|
useMovingAnimation( {
|
|
164
219
|
isSelected: isPartOfSelection,
|
|
@@ -190,18 +245,16 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
190
245
|
'data-title': blockTitle,
|
|
191
246
|
inert: isSubtreeDisabled ? 'true' : undefined,
|
|
192
247
|
className: classnames(
|
|
193
|
-
|
|
194
|
-
|
|
248
|
+
'block-editor-block-list__block',
|
|
249
|
+
{
|
|
250
|
+
// The wp-block className is important for editor styles.
|
|
195
251
|
'wp-block': ! isAligned,
|
|
196
252
|
'has-block-overlay': hasOverlay,
|
|
197
|
-
}
|
|
253
|
+
},
|
|
198
254
|
className,
|
|
199
255
|
props.className,
|
|
200
256
|
wrapperProps.className,
|
|
201
|
-
|
|
202
|
-
useBlockDefaultClassName( clientId ),
|
|
203
|
-
useBlockCustomClassName( clientId ),
|
|
204
|
-
useBlockMovingModeClassNames( clientId )
|
|
257
|
+
classNames
|
|
205
258
|
),
|
|
206
259
|
style: { ...wrapperProps.style, ...props.style },
|
|
207
260
|
};
|