@wordpress/block-editor 12.20.0 → 12.21.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/build/components/block-actions/index.js +45 -32
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
- package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build/components/block-edit/context.js +2 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +8 -3
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +21 -10
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/global-styles/border-panel.js +21 -8
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +80 -23
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +4 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +10 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +2 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +46 -26
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +3 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/index.js +3 -3
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +2 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/utils.js +23 -6
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +34 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/border.js +6 -4
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -0
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-bindings-attributes.js +171 -48
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +6 -2
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +42 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -55
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -8
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +3 -20
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-actions/index.js +45 -32
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -4
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +21 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +22 -10
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +82 -24
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +5 -2
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +11 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +3 -2
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +47 -28
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +3 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +22 -7
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +34 -8
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/border.js +7 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -0
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-bindings-attributes.js +172 -49
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +6 -2
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +42 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -54
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +3 -20
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +8 -2
- package/build-style/content.css +8 -2
- package/build-style/default-editor-styles-rtl.css +1 -0
- package/build-style/default-editor-styles.css +1 -0
- package/build-style/style-rtl.css +113 -22
- package/build-style/style.css +113 -22
- package/package.json +31 -31
- package/src/components/block-actions/index.js +57 -47
- package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
- package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +5 -1
- package/src/components/block-inspector/index.js +7 -5
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-list/use-block-props/index.js +12 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +19 -15
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +1 -1
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/global-styles/border-panel.js +35 -24
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +92 -23
- package/src/components/global-styles/style.scss +33 -10
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/link-preview.js +9 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/style.scss +9 -0
- package/src/components/list-view/block-select-button.js +16 -2
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/list-view/style.scss +8 -0
- package/src/components/list-view/use-clipboard-handler.js +3 -2
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/index.js +76 -53
- package/src/components/rich-text/use-enter.js +4 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/url-popover/index.js +5 -5
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/writing-flow/use-clipboard-handler.js +3 -2
- package/src/components/writing-flow/utils.js +31 -16
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +47 -9
- package/src/hooks/block-hooks.scss +6 -0
- package/src/hooks/border.js +16 -4
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +38 -0
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-bindings-attributes.js +215 -65
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +8 -3
- package/src/private-apis.js +6 -2
- package/src/store/actions.js +56 -18
- package/src/store/private-actions.js +34 -79
- package/src/store/private-selectors.js +0 -8
- package/src/store/reducer.js +2 -23
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -4
- package/src/style.scss +3 -1
- package/src/utils/calculate-scale.js +20 -0
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -226,7 +226,7 @@ export default function SpacingInputControl( {
|
|
|
226
226
|
placeholder={ allPlaceholder }
|
|
227
227
|
disableUnits={ isMixed }
|
|
228
228
|
label={ ariaLabel }
|
|
229
|
-
hideLabelFromVision
|
|
229
|
+
hideLabelFromVision
|
|
230
230
|
className="spacing-sizes-control__custom-value-input"
|
|
231
231
|
size={ '__unstable-large' }
|
|
232
232
|
/>
|
|
@@ -272,8 +272,8 @@ export default function SpacingInputControl( {
|
|
|
272
272
|
max={ spacingSizes.length - 1 }
|
|
273
273
|
marks={ marks }
|
|
274
274
|
label={ ariaLabel }
|
|
275
|
-
hideLabelFromVision
|
|
276
|
-
__nextHasNoMarginBottom
|
|
275
|
+
hideLabelFromVision
|
|
276
|
+
__nextHasNoMarginBottom
|
|
277
277
|
onFocus={ onMouseOver }
|
|
278
278
|
onBlur={ onMouseOut }
|
|
279
279
|
/>
|
|
@@ -296,7 +296,7 @@ export default function SpacingInputControl( {
|
|
|
296
296
|
} }
|
|
297
297
|
options={ options }
|
|
298
298
|
label={ ariaLabel }
|
|
299
|
-
hideLabelFromVision
|
|
299
|
+
hideLabelFromVision
|
|
300
300
|
size={ '__unstable-large' }
|
|
301
301
|
onMouseOver={ onMouseOver }
|
|
302
302
|
onMouseOut={ onMouseOut }
|
|
@@ -92,12 +92,12 @@ const URLPopover = forwardRef(
|
|
|
92
92
|
/>
|
|
93
93
|
) }
|
|
94
94
|
</div>
|
|
95
|
-
{ showSettings && (
|
|
96
|
-
<div className="block-editor-url-popover__row block-editor-url-popover__settings">
|
|
97
|
-
{ renderSettings() }
|
|
98
|
-
</div>
|
|
99
|
-
) }
|
|
100
95
|
</div>
|
|
96
|
+
{ showSettings && (
|
|
97
|
+
<div className="block-editor-url-popover__settings">
|
|
98
|
+
{ renderSettings() }
|
|
99
|
+
</div>
|
|
100
|
+
) }
|
|
101
101
|
{ additionalControls && ! showSettings && (
|
|
102
102
|
<div className="block-editor-url-popover__additional-controls">
|
|
103
103
|
{ additionalControls }
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
text-overflow: ellipsis;
|
|
59
59
|
white-space: nowrap;
|
|
60
60
|
margin-right: $grid-unit-10;
|
|
61
|
+
min-width: 150px;
|
|
61
62
|
// Avoids the popover from growing too wide when the URL is long.
|
|
62
63
|
// See https://github.com/WordPress/gutenberg/issues/58599
|
|
63
64
|
max-width: $modal-min-width;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
documentHasSelection,
|
|
6
6
|
documentHasUncollapsedSelection,
|
|
7
7
|
} from '@wordpress/dom';
|
|
8
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
|
|
9
9
|
import { useRefEffect } from '@wordpress/compose';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -16,6 +16,7 @@ import { useNotifyCopy } from '../../utils/use-notify-copy';
|
|
|
16
16
|
import { getPasteBlocks, setClipboardBlocks } from './utils';
|
|
17
17
|
|
|
18
18
|
export default function useClipboardHandler() {
|
|
19
|
+
const registry = useRegistry();
|
|
19
20
|
const {
|
|
20
21
|
getBlocksByClientId,
|
|
21
22
|
getSelectedBlockClientIds,
|
|
@@ -104,7 +105,7 @@ export default function useClipboardHandler() {
|
|
|
104
105
|
blocks = [ head, ...inBetweenBlocks, tail ];
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
setClipboardBlocks( event, blocks );
|
|
108
|
+
setClipboardBlocks( event, blocks, registry );
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -8,36 +8,51 @@ import {
|
|
|
8
8
|
pasteHandler,
|
|
9
9
|
findTransform,
|
|
10
10
|
getBlockTransforms,
|
|
11
|
+
store as blocksStore,
|
|
11
12
|
} from '@wordpress/blocks';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
import { getPasteEventData } from '../../utils/pasting';
|
|
18
|
+
import { store as blockEditorStore } from '../../store';
|
|
19
|
+
|
|
20
|
+
export const requiresWrapperOnCopy = Symbol( 'requiresWrapperOnCopy' );
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* Sets the clipboard data for the provided blocks, with both HTML and plain
|
|
20
24
|
* text representations.
|
|
21
25
|
*
|
|
22
|
-
* @param {ClipboardEvent} event
|
|
23
|
-
* @param {WPBlock[]} blocks
|
|
26
|
+
* @param {ClipboardEvent} event Clipboard event.
|
|
27
|
+
* @param {WPBlock[]} blocks Blocks to set as clipboard data.
|
|
28
|
+
* @param {Object} registry The registry to select from.
|
|
24
29
|
*/
|
|
25
|
-
export function setClipboardBlocks( event, blocks ) {
|
|
30
|
+
export function setClipboardBlocks( event, blocks, registry ) {
|
|
26
31
|
let _blocks = blocks;
|
|
27
|
-
const wrapperBlockName = event.clipboardData.getData(
|
|
28
|
-
'__unstableWrapperBlockName'
|
|
29
|
-
);
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
const [ firstBlock ] = blocks;
|
|
34
|
+
|
|
35
|
+
if ( firstBlock ) {
|
|
36
|
+
const firstBlockType = registry
|
|
37
|
+
.select( blocksStore )
|
|
38
|
+
.getBlockType( firstBlock.name );
|
|
39
|
+
|
|
40
|
+
if ( firstBlockType[ requiresWrapperOnCopy ] ) {
|
|
41
|
+
const { getBlockRootClientId, getBlockName, getBlockAttributes } =
|
|
42
|
+
registry.select( blockEditorStore );
|
|
43
|
+
const wrapperBlockClientId = getBlockRootClientId(
|
|
44
|
+
firstBlock.clientId
|
|
45
|
+
);
|
|
46
|
+
const wrapperBlockName = getBlockName( wrapperBlockClientId );
|
|
47
|
+
|
|
48
|
+
if ( wrapperBlockName ) {
|
|
49
|
+
_blocks = createBlock(
|
|
50
|
+
wrapperBlockName,
|
|
51
|
+
getBlockAttributes( wrapperBlockClientId ),
|
|
52
|
+
_blocks
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
const serialized = serialize( _blocks );
|
package/src/hooks/background.js
CHANGED
|
@@ -526,7 +526,7 @@ function BackgroundSizePanelItem( {
|
|
|
526
526
|
label={ __( 'Size' ) }
|
|
527
527
|
value={ currentValueForToggle }
|
|
528
528
|
onChange={ updateBackgroundSize }
|
|
529
|
-
isBlock
|
|
529
|
+
isBlock
|
|
530
530
|
help={ backgroundSizeHelpText( sizeValue ) }
|
|
531
531
|
>
|
|
532
532
|
<ToggleGroupControlOption
|
package/src/hooks/block-hooks.js
CHANGED
|
@@ -19,28 +19,38 @@ import { store as blockEditorStore } from '../store';
|
|
|
19
19
|
|
|
20
20
|
const EMPTY_OBJECT = {};
|
|
21
21
|
|
|
22
|
-
function BlockHooksControlPure( {
|
|
22
|
+
function BlockHooksControlPure( {
|
|
23
|
+
name,
|
|
24
|
+
clientId,
|
|
25
|
+
metadata: { ignoredHookedBlocks = [] } = {},
|
|
26
|
+
} ) {
|
|
23
27
|
const blockTypes = useSelect(
|
|
24
28
|
( select ) => select( blocksStore ).getBlockTypes(),
|
|
25
29
|
[]
|
|
26
30
|
);
|
|
27
31
|
|
|
32
|
+
// A hooked block added via a filter will not be exposed through a block
|
|
33
|
+
// type's `blockHooks` property; however, if the containing layout has been
|
|
34
|
+
// modified, it will be present in the anchor block's `ignoredHookedBlocks`
|
|
35
|
+
// metadata.
|
|
28
36
|
const hookedBlocksForCurrentBlock = useMemo(
|
|
29
37
|
() =>
|
|
30
38
|
blockTypes?.filter(
|
|
31
|
-
( { blockHooks } ) =>
|
|
39
|
+
( { name: blockName, blockHooks } ) =>
|
|
40
|
+
( blockHooks && name in blockHooks ) ||
|
|
41
|
+
ignoredHookedBlocks.includes( blockName )
|
|
32
42
|
),
|
|
33
|
-
[ blockTypes, name ]
|
|
43
|
+
[ blockTypes, name, ignoredHookedBlocks ]
|
|
34
44
|
);
|
|
35
45
|
|
|
36
46
|
const { blockIndex, rootClientId, innerBlocksLength } = useSelect(
|
|
37
47
|
( select ) => {
|
|
38
|
-
const {
|
|
48
|
+
const { getBlocks, getBlockIndex, getBlockRootClientId } =
|
|
39
49
|
select( blockEditorStore );
|
|
40
50
|
|
|
41
51
|
return {
|
|
42
52
|
blockIndex: getBlockIndex( clientId ),
|
|
43
|
-
innerBlocksLength:
|
|
53
|
+
innerBlocksLength: getBlocks( clientId )?.length,
|
|
44
54
|
rootClientId: getBlockRootClientId( clientId ),
|
|
45
55
|
};
|
|
46
56
|
},
|
|
@@ -49,7 +59,7 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
49
59
|
|
|
50
60
|
const hookedBlockClientIds = useSelect(
|
|
51
61
|
( select ) => {
|
|
52
|
-
const {
|
|
62
|
+
const { getBlocks, getGlobalBlockCount } =
|
|
53
63
|
select( blockEditorStore );
|
|
54
64
|
|
|
55
65
|
const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(
|
|
@@ -69,7 +79,7 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
69
79
|
// Any of the current block's siblings (with the right block type) qualifies
|
|
70
80
|
// as a hooked block (inserted `before` or `after` the current one), as the block
|
|
71
81
|
// might've been automatically inserted and then moved around a bit by the user.
|
|
72
|
-
candidates =
|
|
82
|
+
candidates = getBlocks( rootClientId );
|
|
73
83
|
break;
|
|
74
84
|
|
|
75
85
|
case 'first_child':
|
|
@@ -77,7 +87,17 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
77
87
|
// Any of the current block's child blocks (with the right block type) qualifies
|
|
78
88
|
// as a hooked first or last child block, as the block might've been automatically
|
|
79
89
|
// inserted and then moved around a bit by the user.
|
|
80
|
-
candidates =
|
|
90
|
+
candidates = getBlocks( clientId );
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case undefined:
|
|
94
|
+
// If we haven't found a blockHooks field with a relative position for the hooked
|
|
95
|
+
// block, it means that it was added by a filter. In this case, we look for the block
|
|
96
|
+
// both among the current block's siblings and its children.
|
|
97
|
+
candidates = [
|
|
98
|
+
...getBlocks( rootClientId ),
|
|
99
|
+
...getBlocks( clientId ),
|
|
100
|
+
];
|
|
81
101
|
break;
|
|
82
102
|
}
|
|
83
103
|
|
|
@@ -151,6 +171,18 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
151
171
|
false
|
|
152
172
|
);
|
|
153
173
|
break;
|
|
174
|
+
|
|
175
|
+
case undefined:
|
|
176
|
+
// If we do not know the relative position, it is because the block was
|
|
177
|
+
// added via a filter. In this case, we default to inserting it after the
|
|
178
|
+
// current block.
|
|
179
|
+
insertBlock(
|
|
180
|
+
block,
|
|
181
|
+
blockIndex + 1,
|
|
182
|
+
rootClientId, // Insert as a child of the current block's parent
|
|
183
|
+
false
|
|
184
|
+
);
|
|
185
|
+
break;
|
|
154
186
|
}
|
|
155
187
|
};
|
|
156
188
|
|
|
@@ -159,8 +191,13 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
159
191
|
<PanelBody
|
|
160
192
|
className="block-editor-hooks__block-hooks"
|
|
161
193
|
title={ __( 'Plugins' ) }
|
|
162
|
-
initialOpen
|
|
194
|
+
initialOpen
|
|
163
195
|
>
|
|
196
|
+
<p className="block-editor-hooks__block-hooks-helptext">
|
|
197
|
+
{ __(
|
|
198
|
+
'Manage the inclusion of blocks added automatically by plugins.'
|
|
199
|
+
) }
|
|
200
|
+
</p>
|
|
164
201
|
{ Object.keys( groupedHookedBlocks ).map( ( vendor ) => {
|
|
165
202
|
return (
|
|
166
203
|
<Fragment key={ vendor }>
|
|
@@ -214,6 +251,7 @@ function BlockHooksControlPure( { name, clientId } ) {
|
|
|
214
251
|
|
|
215
252
|
export default {
|
|
216
253
|
edit: BlockHooksControlPure,
|
|
254
|
+
attributeKeys: [ 'metadata' ],
|
|
217
255
|
hasSupport() {
|
|
218
256
|
return true;
|
|
219
257
|
},
|
package/src/hooks/border.js
CHANGED
|
@@ -18,9 +18,14 @@ import { useSelect } from '@wordpress/data';
|
|
|
18
18
|
import { getColorClassName } from '../components/colors';
|
|
19
19
|
import InspectorControls from '../components/inspector-controls';
|
|
20
20
|
import useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
cleanEmptyObject,
|
|
23
|
+
shouldSkipSerialization,
|
|
24
|
+
useBlockSettings,
|
|
25
|
+
} from './utils';
|
|
22
26
|
import {
|
|
23
27
|
useHasBorderPanel,
|
|
28
|
+
useHasBorderPanelControls,
|
|
24
29
|
BorderPanel as StylesBorderPanel,
|
|
25
30
|
} from '../components/global-styles';
|
|
26
31
|
import { store as blockEditorStore } from '../store';
|
|
@@ -220,14 +225,21 @@ export function hasShadowSupport( blockName ) {
|
|
|
220
225
|
return hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );
|
|
221
226
|
}
|
|
222
227
|
|
|
223
|
-
export function
|
|
228
|
+
export function useBorderPanelLabel( {
|
|
224
229
|
blockName,
|
|
225
230
|
hasBorderControl,
|
|
226
231
|
hasShadowControl,
|
|
227
232
|
} = {} ) {
|
|
233
|
+
const settings = useBlockSettings( blockName );
|
|
234
|
+
const controls = useHasBorderPanelControls( settings );
|
|
235
|
+
|
|
228
236
|
if ( ! hasBorderControl && ! hasShadowControl && blockName ) {
|
|
229
|
-
hasBorderControl =
|
|
230
|
-
|
|
237
|
+
hasBorderControl =
|
|
238
|
+
controls?.hasBorderColor ||
|
|
239
|
+
controls?.hasBorderStyle ||
|
|
240
|
+
controls?.hasBorderWidth ||
|
|
241
|
+
controls?.hasBorderRadius;
|
|
242
|
+
hasShadowControl = controls?.hasShadow;
|
|
231
243
|
}
|
|
232
244
|
|
|
233
245
|
if ( hasBorderControl && hasShadowControl ) {
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -19,8 +19,7 @@ import {
|
|
|
19
19
|
DimensionsPanel as StylesDimensionsPanel,
|
|
20
20
|
useHasDimensionsPanel,
|
|
21
21
|
} from '../components/global-styles';
|
|
22
|
-
import { MarginVisualizer } from './
|
|
23
|
-
import { PaddingVisualizer } from './padding';
|
|
22
|
+
import { MarginVisualizer, PaddingVisualizer } from './spacing-visualizer';
|
|
24
23
|
import { store as blockEditorStore } from '../store';
|
|
25
24
|
import { unlock } from '../lock-unlock';
|
|
26
25
|
import { cleanEmptyObject, shouldSkipSerialization } from './utils';
|
package/src/hooks/font-size.js
CHANGED
|
@@ -21,10 +21,7 @@ import {
|
|
|
21
21
|
shouldSkipSerialization,
|
|
22
22
|
} from './utils';
|
|
23
23
|
import { useSettings } from '../components/use-settings';
|
|
24
|
-
import {
|
|
25
|
-
getTypographyFontSizeValue,
|
|
26
|
-
getFluidTypographyOptionsFromSettings,
|
|
27
|
-
} from '../components/global-styles/typography-utils';
|
|
24
|
+
import { getTypographyFontSizeValue } from '../components/global-styles/typography-utils';
|
|
28
25
|
|
|
29
26
|
export const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
|
|
30
27
|
|
|
@@ -173,18 +170,16 @@ function useBlockProps( { name, fontSize, style } ) {
|
|
|
173
170
|
let props;
|
|
174
171
|
|
|
175
172
|
if ( style?.typography?.fontSize ) {
|
|
176
|
-
const fluidSettings = getFluidTypographyOptionsFromSettings( {
|
|
177
|
-
typography: {
|
|
178
|
-
fluid: fluidTypographySettings,
|
|
179
|
-
},
|
|
180
|
-
layout: layoutSettings,
|
|
181
|
-
} );
|
|
182
|
-
|
|
183
173
|
props = {
|
|
184
174
|
style: {
|
|
185
175
|
fontSize: getTypographyFontSizeValue(
|
|
186
176
|
{ size: style.typography.fontSize },
|
|
187
|
-
|
|
177
|
+
{
|
|
178
|
+
typography: {
|
|
179
|
+
fluid: fluidTypographySettings,
|
|
180
|
+
},
|
|
181
|
+
layout: layoutSettings,
|
|
182
|
+
}
|
|
188
183
|
),
|
|
189
184
|
},
|
|
190
185
|
};
|
package/src/hooks/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
import { store as blockEditorStore } from '../store';
|
|
11
11
|
import { useStyleOverride } from './utils';
|
|
12
12
|
import { useLayout } from '../components/block-list/layout';
|
|
13
|
+
import { GridVisualizer, GridItemResizer } from '../components/grid-visualizer';
|
|
13
14
|
|
|
14
15
|
function useBlockPropsChildLayoutStyles( { style } ) {
|
|
15
16
|
const shouldRenderChildLayoutStyles = useSelect( ( select ) => {
|
|
@@ -96,8 +97,45 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
96
97
|
return { className: `wp-container-content-${ id }` };
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
function ChildLayoutControlsPure( { clientId, style, setAttributes } ) {
|
|
101
|
+
const parentLayout = useLayout() || {};
|
|
102
|
+
const rootClientId = useSelect(
|
|
103
|
+
( select ) => {
|
|
104
|
+
return select( blockEditorStore ).getBlockRootClientId( clientId );
|
|
105
|
+
},
|
|
106
|
+
[ clientId ]
|
|
107
|
+
);
|
|
108
|
+
if ( parentLayout.type !== 'grid' ) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if ( ! window.__experimentalEnableGridInteractivity ) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return (
|
|
115
|
+
<>
|
|
116
|
+
<GridVisualizer clientId={ rootClientId } />
|
|
117
|
+
<GridItemResizer
|
|
118
|
+
clientId={ clientId }
|
|
119
|
+
onChange={ ( { columnSpan, rowSpan } ) => {
|
|
120
|
+
setAttributes( {
|
|
121
|
+
style: {
|
|
122
|
+
...style,
|
|
123
|
+
layout: {
|
|
124
|
+
...style?.layout,
|
|
125
|
+
columnSpan,
|
|
126
|
+
rowSpan,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
} );
|
|
130
|
+
} }
|
|
131
|
+
/>
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
99
136
|
export default {
|
|
100
137
|
useBlockProps: useBlockPropsChildLayoutStyles,
|
|
138
|
+
edit: ChildLayoutControlsPure,
|
|
101
139
|
attributeKeys: [ 'style' ],
|
|
102
140
|
hasSupport() {
|
|
103
141
|
return true;
|
package/src/hooks/layout.js
CHANGED
|
@@ -135,7 +135,12 @@ export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
|
|
|
135
135
|
return css;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
function LayoutPanelPure( {
|
|
138
|
+
function LayoutPanelPure( {
|
|
139
|
+
layout,
|
|
140
|
+
setAttributes,
|
|
141
|
+
name: blockName,
|
|
142
|
+
clientId,
|
|
143
|
+
} ) {
|
|
139
144
|
const settings = useBlockSettings( blockName );
|
|
140
145
|
// Block settings come from theme.json under settings.[blockName].
|
|
141
146
|
const { layout: layoutSettings } = settings;
|
|
@@ -266,6 +271,8 @@ function LayoutPanelPure( { layout, setAttributes, name: blockName } ) {
|
|
|
266
271
|
layout={ usedLayout }
|
|
267
272
|
onChange={ onChangeLayout }
|
|
268
273
|
layoutBlockSupport={ blockSupportAndThemeSettings }
|
|
274
|
+
name={ blockName }
|
|
275
|
+
clientId={ clientId }
|
|
269
276
|
/>
|
|
270
277
|
) }
|
|
271
278
|
{ constrainedType && displayControlsForLegacyLayouts && (
|
|
@@ -273,6 +280,8 @@ function LayoutPanelPure( { layout, setAttributes, name: blockName } ) {
|
|
|
273
280
|
layout={ usedLayout }
|
|
274
281
|
onChange={ onChangeLayout }
|
|
275
282
|
layoutBlockSupport={ blockSupportAndThemeSettings }
|
|
283
|
+
name={ blockName }
|
|
284
|
+
clientId={ clientId }
|
|
276
285
|
/>
|
|
277
286
|
) }
|
|
278
287
|
</PanelBody>
|
|
@@ -282,6 +291,8 @@ function LayoutPanelPure( { layout, setAttributes, name: blockName } ) {
|
|
|
282
291
|
layout={ usedLayout }
|
|
283
292
|
onChange={ onChangeLayout }
|
|
284
293
|
layoutBlockSupport={ layoutBlockSupport }
|
|
294
|
+
name={ blockName }
|
|
295
|
+
clientId={ clientId }
|
|
285
296
|
/>
|
|
286
297
|
) }
|
|
287
298
|
</>
|
package/src/hooks/line-height.js
CHANGED
|
@@ -39,7 +39,7 @@ export function LineHeightEdit( props ) {
|
|
|
39
39
|
return (
|
|
40
40
|
<LineHeightControl
|
|
41
41
|
__unstableInputWidth="100%"
|
|
42
|
-
__nextHasNoMarginBottom
|
|
42
|
+
__nextHasNoMarginBottom
|
|
43
43
|
value={ style?.typography?.lineHeight }
|
|
44
44
|
onChange={ onChange }
|
|
45
45
|
size="__unstable-large"
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
useState,
|
|
6
|
+
useRef,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useEffect,
|
|
9
|
+
useReducer,
|
|
10
|
+
} from '@wordpress/element';
|
|
11
|
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import BlockPopoverCover from '../components/block-popover/cover';
|
|
17
|
+
import { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
18
|
+
|
|
19
|
+
function SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {
|
|
20
|
+
const blockElement = useBlockElement( clientId );
|
|
21
|
+
const [ style, updateStyle ] = useReducer( () =>
|
|
22
|
+
computeStyle( blockElement )
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
useLayoutEffect( () => {
|
|
26
|
+
if ( ! blockElement ) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// It's not sufficient to read the computed spacing value when value.spacing changes as
|
|
30
|
+
// useEffect may run before the browser recomputes CSS. We therefore combine
|
|
31
|
+
// useLayoutEffect and two rAF calls to ensure that we read the spacing after the current
|
|
32
|
+
// paint but before the next paint.
|
|
33
|
+
// See https://github.com/WordPress/gutenberg/pull/59227.
|
|
34
|
+
window.requestAnimationFrame( () =>
|
|
35
|
+
window.requestAnimationFrame( updateStyle )
|
|
36
|
+
);
|
|
37
|
+
}, [ blockElement, value ] );
|
|
38
|
+
|
|
39
|
+
const previousValue = useRef( value );
|
|
40
|
+
const [ isActive, setIsActive ] = useState( false );
|
|
41
|
+
|
|
42
|
+
useEffect( () => {
|
|
43
|
+
if ( isShallowEqual( value, previousValue.current ) || forceShow ) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setIsActive( true );
|
|
48
|
+
previousValue.current = value;
|
|
49
|
+
|
|
50
|
+
const timeout = setTimeout( () => {
|
|
51
|
+
setIsActive( false );
|
|
52
|
+
}, 400 );
|
|
53
|
+
|
|
54
|
+
return () => {
|
|
55
|
+
setIsActive( false );
|
|
56
|
+
clearTimeout( timeout );
|
|
57
|
+
};
|
|
58
|
+
}, [ value, forceShow ] );
|
|
59
|
+
|
|
60
|
+
if ( ! isActive && ! forceShow ) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<BlockPopoverCover
|
|
66
|
+
clientId={ clientId }
|
|
67
|
+
__unstablePopoverSlot="block-toolbar"
|
|
68
|
+
>
|
|
69
|
+
<div className="block-editor__spacing-visualizer" style={ style } />
|
|
70
|
+
</BlockPopoverCover>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getComputedCSS( element, property ) {
|
|
75
|
+
return element.ownerDocument.defaultView
|
|
76
|
+
.getComputedStyle( element )
|
|
77
|
+
.getPropertyValue( property );
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function MarginVisualizer( { clientId, value, forceShow } ) {
|
|
81
|
+
return (
|
|
82
|
+
<SpacingVisualizer
|
|
83
|
+
clientId={ clientId }
|
|
84
|
+
value={ value?.spacing?.margin }
|
|
85
|
+
computeStyle={ ( blockElement ) => {
|
|
86
|
+
const top = getComputedCSS( blockElement, 'margin-top' );
|
|
87
|
+
const right = getComputedCSS( blockElement, 'margin-right' );
|
|
88
|
+
const bottom = getComputedCSS( blockElement, 'margin-bottom' );
|
|
89
|
+
const left = getComputedCSS( blockElement, 'margin-left' );
|
|
90
|
+
return {
|
|
91
|
+
borderTopWidth: top,
|
|
92
|
+
borderRightWidth: right,
|
|
93
|
+
borderBottomWidth: bottom,
|
|
94
|
+
borderLeftWidth: left,
|
|
95
|
+
top: top ? `-${ top }` : 0,
|
|
96
|
+
right: right ? `-${ right }` : 0,
|
|
97
|
+
bottom: bottom ? `-${ bottom }` : 0,
|
|
98
|
+
left: left ? `-${ left }` : 0,
|
|
99
|
+
};
|
|
100
|
+
} }
|
|
101
|
+
forceShow={ forceShow }
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function PaddingVisualizer( { clientId, value, forceShow } ) {
|
|
107
|
+
return (
|
|
108
|
+
<SpacingVisualizer
|
|
109
|
+
clientId={ clientId }
|
|
110
|
+
value={ value?.spacing?.padding }
|
|
111
|
+
computeStyle={ ( blockElement ) => ( {
|
|
112
|
+
borderTopWidth: getComputedCSS( blockElement, 'padding-top' ),
|
|
113
|
+
borderRightWidth: getComputedCSS(
|
|
114
|
+
blockElement,
|
|
115
|
+
'padding-right'
|
|
116
|
+
),
|
|
117
|
+
borderBottomWidth: getComputedCSS(
|
|
118
|
+
blockElement,
|
|
119
|
+
'padding-bottom'
|
|
120
|
+
),
|
|
121
|
+
borderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),
|
|
122
|
+
} ) }
|
|
123
|
+
forceShow={ forceShow }
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
}
|