@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,9 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { ToolbarButton, MenuItem } from '@wordpress/components';
|
|
5
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
6
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
|
-
import { addFilter } from '@wordpress/hooks';
|
|
8
6
|
import { __ } from '@wordpress/i18n';
|
|
9
7
|
import { useEffect, useRef, useCallback } from '@wordpress/element';
|
|
10
8
|
|
|
@@ -37,129 +35,119 @@ function StopEditingAsBlocksOnOutsideSelect( {
|
|
|
37
35
|
return null;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
[ props.clientId ]
|
|
63
|
-
);
|
|
38
|
+
function ContentLockControlsPure( { clientId, isSelected } ) {
|
|
39
|
+
const { getBlockListSettings, getSettings } = useSelect( blockEditorStore );
|
|
40
|
+
const focusModeToRevert = useRef();
|
|
41
|
+
const { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(
|
|
42
|
+
( select ) => {
|
|
43
|
+
const {
|
|
44
|
+
__unstableGetContentLockingParent,
|
|
45
|
+
getTemplateLock,
|
|
46
|
+
__unstableGetTemporarilyEditingAsBlocks,
|
|
47
|
+
} = select( blockEditorStore );
|
|
48
|
+
return {
|
|
49
|
+
templateLock: getTemplateLock( clientId ),
|
|
50
|
+
isLockedByParent:
|
|
51
|
+
!! __unstableGetContentLockingParent( clientId ),
|
|
52
|
+
isEditingAsBlocks:
|
|
53
|
+
__unstableGetTemporarilyEditingAsBlocks() === clientId,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
[ clientId ]
|
|
57
|
+
);
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
updateBlockAttributes,
|
|
75
|
-
} = useDispatch( blockEditorStore );
|
|
59
|
+
const {
|
|
60
|
+
updateSettings,
|
|
61
|
+
updateBlockListSettings,
|
|
62
|
+
__unstableSetTemporarilyEditingAsBlocks,
|
|
63
|
+
} = useDispatch( blockEditorStore );
|
|
64
|
+
const isContentLocked =
|
|
65
|
+
! isLockedByParent && templateLock === 'contentOnly';
|
|
66
|
+
const { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =
|
|
67
|
+
useDispatch( blockEditorStore );
|
|
76
68
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
const stopEditingAsBlock = useCallback( () => {
|
|
70
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
71
|
+
updateBlockAttributes( clientId, {
|
|
72
|
+
templateLock: 'contentOnly',
|
|
73
|
+
} );
|
|
74
|
+
updateBlockListSettings( clientId, {
|
|
75
|
+
...getBlockListSettings( clientId ),
|
|
76
|
+
templateLock: 'contentOnly',
|
|
77
|
+
} );
|
|
78
|
+
updateSettings( { focusMode: focusModeToRevert.current } );
|
|
79
|
+
__unstableSetTemporarilyEditingAsBlocks();
|
|
80
|
+
}, [
|
|
81
|
+
clientId,
|
|
82
|
+
updateSettings,
|
|
83
|
+
updateBlockListSettings,
|
|
84
|
+
getBlockListSettings,
|
|
85
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
86
|
+
updateBlockAttributes,
|
|
87
|
+
__unstableSetTemporarilyEditingAsBlocks,
|
|
88
|
+
] );
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
if ( ! isContentLocked && ! isEditingAsBlocks ) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
101
93
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
const showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;
|
|
95
|
+
const showStartEditingAsBlocks =
|
|
96
|
+
! isEditingAsBlocks && isContentLocked && isSelected;
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</>
|
|
156
|
-
);
|
|
157
|
-
},
|
|
158
|
-
'withContentLockControls'
|
|
159
|
-
);
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
{ showStopEditingAsBlocks && (
|
|
101
|
+
<>
|
|
102
|
+
<StopEditingAsBlocksOnOutsideSelect
|
|
103
|
+
clientId={ clientId }
|
|
104
|
+
stopEditingAsBlock={ stopEditingAsBlock }
|
|
105
|
+
/>
|
|
106
|
+
<BlockControls group="other">
|
|
107
|
+
<ToolbarButton
|
|
108
|
+
onClick={ () => {
|
|
109
|
+
stopEditingAsBlock();
|
|
110
|
+
} }
|
|
111
|
+
>
|
|
112
|
+
{ __( 'Done' ) }
|
|
113
|
+
</ToolbarButton>
|
|
114
|
+
</BlockControls>
|
|
115
|
+
</>
|
|
116
|
+
) }
|
|
117
|
+
{ showStartEditingAsBlocks && (
|
|
118
|
+
<BlockSettingsMenuControls>
|
|
119
|
+
{ ( { onClose } ) => (
|
|
120
|
+
<MenuItem
|
|
121
|
+
onClick={ () => {
|
|
122
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
123
|
+
updateBlockAttributes( clientId, {
|
|
124
|
+
templateLock: undefined,
|
|
125
|
+
} );
|
|
126
|
+
updateBlockListSettings( clientId, {
|
|
127
|
+
...getBlockListSettings( clientId ),
|
|
128
|
+
templateLock: false,
|
|
129
|
+
} );
|
|
130
|
+
focusModeToRevert.current =
|
|
131
|
+
getSettings().focusMode;
|
|
132
|
+
updateSettings( { focusMode: true } );
|
|
133
|
+
__unstableSetTemporarilyEditingAsBlocks(
|
|
134
|
+
clientId
|
|
135
|
+
);
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Modify' ) }
|
|
140
|
+
</MenuItem>
|
|
141
|
+
) }
|
|
142
|
+
</BlockSettingsMenuControls>
|
|
143
|
+
) }
|
|
144
|
+
</>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
160
147
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
export default {
|
|
149
|
+
edit: ContentLockControlsPure,
|
|
150
|
+
hasSupport() {
|
|
151
|
+
return true;
|
|
152
|
+
},
|
|
153
|
+
};
|
|
@@ -10,7 +10,6 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
10
10
|
import { TextControl } from '@wordpress/components';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
13
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -39,7 +38,7 @@ export function addAttribute( settings ) {
|
|
|
39
38
|
return settings;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
function
|
|
41
|
+
function CustomClassNameControlsPure( { className, setAttributes } ) {
|
|
43
42
|
const blockEditingMode = useBlockEditingMode();
|
|
44
43
|
if ( blockEditingMode !== 'default' ) {
|
|
45
44
|
return null;
|
|
@@ -52,7 +51,7 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
52
51
|
__next40pxDefaultSize
|
|
53
52
|
autoComplete="off"
|
|
54
53
|
label={ __( 'Additional CSS class(es)' ) }
|
|
55
|
-
value={
|
|
54
|
+
value={ className || '' }
|
|
56
55
|
onChange={ ( nextValue ) => {
|
|
57
56
|
setAttributes( {
|
|
58
57
|
className: nextValue !== '' ? nextValue : undefined,
|
|
@@ -64,39 +63,13 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* @param {Component} BlockEdit Original component.
|
|
73
|
-
*
|
|
74
|
-
* @return {Component} Wrapped component.
|
|
75
|
-
*/
|
|
76
|
-
export const withCustomClassNameControls = createHigherOrderComponent(
|
|
77
|
-
( BlockEdit ) => {
|
|
78
|
-
return ( props ) => {
|
|
79
|
-
const hasCustomClassName = hasBlockSupport(
|
|
80
|
-
props.name,
|
|
81
|
-
'customClassName',
|
|
82
|
-
true
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<BlockEdit { ...props } />
|
|
88
|
-
{ hasCustomClassName && props.isSelected && (
|
|
89
|
-
<CustomClassNameControls
|
|
90
|
-
attributes={ props.attributes }
|
|
91
|
-
setAttributes={ props.setAttributes }
|
|
92
|
-
/>
|
|
93
|
-
) }
|
|
94
|
-
</>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
66
|
+
export default {
|
|
67
|
+
edit: CustomClassNameControlsPure,
|
|
68
|
+
attributeKeys: [ 'className' ],
|
|
69
|
+
hasSupport( name ) {
|
|
70
|
+
return hasBlockSupport( name, 'customClassName', true );
|
|
97
71
|
},
|
|
98
|
-
|
|
99
|
-
);
|
|
72
|
+
};
|
|
100
73
|
|
|
101
74
|
/**
|
|
102
75
|
* Override props assigned to save component to inject the className, if block
|
|
@@ -167,11 +140,6 @@ addFilter(
|
|
|
167
140
|
'core/editor/custom-class-name/attribute',
|
|
168
141
|
addAttribute
|
|
169
142
|
);
|
|
170
|
-
addFilter(
|
|
171
|
-
'editor.BlockEdit',
|
|
172
|
-
'core/editor/custom-class-name/with-inspector-controls',
|
|
173
|
-
withCustomClassNameControls
|
|
174
|
-
);
|
|
175
143
|
addFilter(
|
|
176
144
|
'blocks.getSaveContent.extraProps',
|
|
177
145
|
'core/editor/custom-class-name/save-props',
|
|
@@ -5,7 +5,6 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
5
5
|
import { PanelBody, TextControl } from '@wordpress/components';
|
|
6
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
7
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
8
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -34,7 +33,7 @@ function addAttribute( settings ) {
|
|
|
34
33
|
return settings;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
function
|
|
36
|
+
function CustomFieldsControlPure( { name, connections, setAttributes } ) {
|
|
38
37
|
const blockEditingMode = useBlockEditingMode();
|
|
39
38
|
if ( blockEditingMode !== 'default' ) {
|
|
40
39
|
return null;
|
|
@@ -44,8 +43,8 @@ function CustomFieldsControl( props ) {
|
|
|
44
43
|
// attribute to use for the connection. Only the `content` attribute
|
|
45
44
|
// of the paragraph block and the `url` attribute of the image block are supported.
|
|
46
45
|
let attributeName;
|
|
47
|
-
if (
|
|
48
|
-
if (
|
|
46
|
+
if ( name === 'core/paragraph' ) attributeName = 'content';
|
|
47
|
+
if ( name === 'core/image' ) attributeName = 'url';
|
|
49
48
|
|
|
50
49
|
return (
|
|
51
50
|
<InspectorControls>
|
|
@@ -55,19 +54,17 @@ function CustomFieldsControl( props ) {
|
|
|
55
54
|
autoComplete="off"
|
|
56
55
|
label={ __( 'Custom field meta_key' ) }
|
|
57
56
|
value={
|
|
58
|
-
|
|
59
|
-
attributeName
|
|
60
|
-
]?.value || ''
|
|
57
|
+
connections?.attributes?.[ attributeName ]?.value || ''
|
|
61
58
|
}
|
|
62
59
|
onChange={ ( nextValue ) => {
|
|
63
60
|
if ( nextValue === '' ) {
|
|
64
|
-
|
|
61
|
+
setAttributes( {
|
|
65
62
|
connections: undefined,
|
|
66
63
|
[ attributeName ]: undefined,
|
|
67
64
|
placeholder: undefined,
|
|
68
65
|
} );
|
|
69
66
|
} else {
|
|
70
|
-
|
|
67
|
+
setAttributes( {
|
|
71
68
|
connections: {
|
|
72
69
|
attributes: {
|
|
73
70
|
// The attributeName will be either `content` or `url`.
|
|
@@ -93,50 +90,26 @@ function CustomFieldsControl( props ) {
|
|
|
93
90
|
);
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* between paragraph content and a custom field.
|
|
101
|
-
*
|
|
102
|
-
* @param {Component} BlockEdit Original component.
|
|
103
|
-
*
|
|
104
|
-
* @return {Component} Wrapped component.
|
|
105
|
-
*/
|
|
106
|
-
const withCustomFieldsControls = createHigherOrderComponent( ( BlockEdit ) => {
|
|
107
|
-
return ( props ) => {
|
|
108
|
-
const hasCustomFieldsSupport = hasBlockSupport(
|
|
109
|
-
props.name,
|
|
110
|
-
'__experimentalConnections',
|
|
111
|
-
false
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
// Check if the current block is a paragraph or image block.
|
|
115
|
-
// Currently, only these two blocks are supported.
|
|
116
|
-
if ( ! [ 'core/paragraph', 'core/image' ].includes( props.name ) ) {
|
|
117
|
-
return <BlockEdit key="edit" { ...props } />;
|
|
118
|
-
}
|
|
119
|
-
|
|
93
|
+
export default {
|
|
94
|
+
edit: CustomFieldsControlPure,
|
|
95
|
+
attributeKeys: [ 'connections' ],
|
|
96
|
+
hasSupport( name ) {
|
|
120
97
|
return (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
) }
|
|
126
|
-
</>
|
|
98
|
+
hasBlockSupport( name, '__experimentalConnections', false ) &&
|
|
99
|
+
// Check if the current block is a paragraph or image block.
|
|
100
|
+
// Currently, only these two blocks are supported.
|
|
101
|
+
[ 'core/paragraph', 'core/image' ].includes( name )
|
|
127
102
|
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
103
|
+
},
|
|
104
|
+
};
|
|
130
105
|
|
|
131
|
-
if (
|
|
106
|
+
if (
|
|
107
|
+
window.__experimentalConnections ||
|
|
108
|
+
window.__experimentalPatternPartialSyncing
|
|
109
|
+
) {
|
|
132
110
|
addFilter(
|
|
133
111
|
'blocks.registerBlockType',
|
|
134
112
|
'core/editor/connections/attribute',
|
|
135
113
|
addAttribute
|
|
136
114
|
);
|
|
137
|
-
addFilter(
|
|
138
|
-
'editor.BlockEdit',
|
|
139
|
-
'core/editor/connections/with-inspector-controls',
|
|
140
|
-
withCustomFieldsControls
|
|
141
|
-
);
|
|
142
115
|
}
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useState, useEffect, useCallback } from '@wordpress/element';
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
6
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
7
7
|
import deprecated from '@wordpress/deprecated';
|
|
8
|
+
import { pure } from '@wordpress/compose';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -19,7 +20,7 @@ import { PaddingVisualizer } from './padding';
|
|
|
19
20
|
import { store as blockEditorStore } from '../store';
|
|
20
21
|
import { unlock } from '../lock-unlock';
|
|
21
22
|
|
|
22
|
-
import { cleanEmptyObject
|
|
23
|
+
import { cleanEmptyObject } from './utils';
|
|
23
24
|
|
|
24
25
|
export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
|
|
25
26
|
export const SPACING_SUPPORT_KEY = 'spacing';
|
|
@@ -65,17 +66,13 @@ function DimensionsInspectorControl( { children, resetAllFilter } ) {
|
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
const {
|
|
70
|
-
clientId,
|
|
71
|
-
name,
|
|
72
|
-
attributes,
|
|
73
|
-
setAttributes,
|
|
74
|
-
__unstableParentLayout,
|
|
75
|
-
} = props;
|
|
76
|
-
const settings = useBlockSettings( name, __unstableParentLayout );
|
|
69
|
+
function DimensionsPanelPure( { clientId, name, setAttributes, settings } ) {
|
|
77
70
|
const isEnabled = useHasDimensionsPanel( settings );
|
|
78
|
-
const value =
|
|
71
|
+
const value = useSelect(
|
|
72
|
+
( select ) =>
|
|
73
|
+
select( blockEditorStore ).getBlockAttributes( clientId )?.style,
|
|
74
|
+
[ clientId ]
|
|
75
|
+
);
|
|
79
76
|
const [ visualizedProperty, setVisualizedProperty ] = useVisualizer();
|
|
80
77
|
const onChange = ( newStyle ) => {
|
|
81
78
|
setAttributes( {
|
|
@@ -87,11 +84,11 @@ export function DimensionsPanel( props ) {
|
|
|
87
84
|
return null;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
|
-
const defaultDimensionsControls = getBlockSupport(
|
|
87
|
+
const defaultDimensionsControls = getBlockSupport( name, [
|
|
91
88
|
DIMENSIONS_SUPPORT_KEY,
|
|
92
89
|
'__experimentalDefaultControls',
|
|
93
90
|
] );
|
|
94
|
-
const defaultSpacingControls = getBlockSupport(
|
|
91
|
+
const defaultSpacingControls = getBlockSupport( name, [
|
|
95
92
|
SPACING_SUPPORT_KEY,
|
|
96
93
|
'__experimentalDefaultControls',
|
|
97
94
|
] );
|
|
@@ -114,19 +111,26 @@ export function DimensionsPanel( props ) {
|
|
|
114
111
|
{ !! settings?.spacing?.padding && (
|
|
115
112
|
<PaddingVisualizer
|
|
116
113
|
forceShow={ visualizedProperty === 'padding' }
|
|
117
|
-
{
|
|
114
|
+
clientId={ clientId }
|
|
115
|
+
value={ value }
|
|
118
116
|
/>
|
|
119
117
|
) }
|
|
120
118
|
{ !! settings?.spacing?.margin && (
|
|
121
119
|
<MarginVisualizer
|
|
122
120
|
forceShow={ visualizedProperty === 'margin' }
|
|
123
|
-
{
|
|
121
|
+
clientId={ clientId }
|
|
122
|
+
value={ value }
|
|
124
123
|
/>
|
|
125
124
|
) }
|
|
126
125
|
</>
|
|
127
126
|
);
|
|
128
127
|
}
|
|
129
128
|
|
|
129
|
+
// We don't want block controls to re-render when typing inside a block. `pure`
|
|
130
|
+
// will prevent re-renders unless props change, so only pass the needed props
|
|
131
|
+
// and not the whole attributes object.
|
|
132
|
+
export const DimensionsPanel = pure( DimensionsPanelPure );
|
|
133
|
+
|
|
130
134
|
/**
|
|
131
135
|
* @deprecated
|
|
132
136
|
*/
|