@wordpress/block-editor 15.11.0 → 15.12.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-breadcrumb/index.cjs +10 -2
- package/build/components/block-breadcrumb/index.cjs.map +2 -2
- package/build/components/block-controls/index.cjs +1 -1
- package/build/components/block-controls/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +8 -21
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/block.cjs +6 -3
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/index.cjs +26 -18
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +39 -19
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-list/use-in-between-inserter.cjs +4 -4
- package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +11 -16
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +2 -2
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +2 -26
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +1 -2
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +7 -9
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +18 -103
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +1 -1
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +5 -1
- package/build/components/block-visibility/utils.cjs.map +2 -2
- package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
- package/build/components/color-palette/with-color-context.cjs +1 -1
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/color-style-selector/index.cjs +1 -1
- package/build/components/color-style-selector/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +5 -3
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +1 -1
- package/build/components/colors-gradients/dropdown.cjs.map +2 -2
- package/build/components/editable-text/index.cjs +5 -1
- package/build/components/editable-text/index.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs +5 -3
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +26 -13
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +1 -1
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/gradients/with-gradient.cjs +1 -1
- package/build/components/gradients/with-gradient.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +12 -2
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/index.cjs +1 -1
- package/build/components/inspector-controls/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +3 -3
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +8 -16
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +29 -34
- package/build/components/list-view/block.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +3 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +2 -2
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +7 -8
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/with-registry-provider.cjs +1 -1
- package/build/components/provider/with-registry-provider.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +2 -34
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +1 -1
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-drag-selection.cjs +2 -1
- package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
- package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
- package/build/hooks/block-renaming.cjs +1 -1
- package/build/hooks/block-renaming.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +1 -1
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +141 -0
- package/build/hooks/custom-css.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +14 -7
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/index.cjs +4 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout.cjs +10 -4
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +9 -5
- package/build/hooks/list-view.cjs.map +3 -3
- package/build/hooks/utils.cjs +2 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs +12 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/store/actions.cjs +5 -0
- package/build/store/actions.cjs.map +2 -2
- package/build/store/defaults.cjs +3 -0
- package/build/store/defaults.cjs.map +2 -2
- package/build/store/private-selectors.cjs +46 -38
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +5 -7
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +15 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +18 -4
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-breadcrumb/index.mjs +10 -2
- package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
- package/build-module/components/block-controls/index.mjs +1 -1
- package/build-module/components/block-controls/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +8 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +6 -3
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/index.mjs +26 -18
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +39 -19
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
- package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +12 -17
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +3 -3
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +2 -26
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +1 -2
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +6 -9
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +18 -103
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +5 -1
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
- package/build-module/components/color-palette/with-color-context.mjs +1 -1
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/color-style-selector/index.mjs +1 -1
- package/build-module/components/color-style-selector/index.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs +5 -3
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +1 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/editable-text/index.mjs +5 -1
- package/build-module/components/editable-text/index.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +22 -13
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +1 -1
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/gradients/with-gradient.mjs +1 -1
- package/build-module/components/gradients/with-gradient.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +12 -2
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/index.mjs +1 -1
- package/build-module/components/inspector-controls/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +3 -3
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +8 -16
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +31 -36
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +3 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +2 -2
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +7 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/with-registry-provider.mjs +1 -1
- package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +3 -37
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +1 -1
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
- package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
- package/build-module/hooks/block-renaming.mjs +1 -1
- package/build-module/hooks/block-renaming.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +1 -1
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +112 -0
- package/build-module/hooks/custom-css.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +14 -7
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +10 -4
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -6
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +2 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +12 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/store/actions.mjs +5 -0
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/defaults.mjs +3 -0
- package/build-module/store/defaults.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +43 -41
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -7
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +15 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +18 -4
- package/build-module/utils/fit-text-utils.mjs.map +2 -2
- package/build-style/content-rtl.css +10 -0
- package/build-style/content.css +10 -0
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +39 -39
- package/src/components/block-breadcrumb/index.js +6 -1
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-controls/test/index.js +1 -0
- package/src/components/block-edit/test/edit.js +10 -0
- package/src/components/block-inspector/index.js +15 -36
- package/src/components/block-list/block.js +5 -2
- package/src/components/block-list/content.scss +11 -0
- package/src/components/block-list/index.js +25 -17
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +51 -36
- package/src/components/block-list/use-in-between-inserter.js +8 -6
- package/src/components/block-preview/test/index.js +11 -7
- package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
- package/src/components/block-settings-menu-controls/index.js +16 -18
- package/src/components/block-switcher/test/index.js +2 -0
- package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
- package/src/components/block-switcher/test/utils.js +2 -0
- package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
- package/src/components/block-toolbar/index.js +3 -9
- package/src/components/block-tools/index.js +2 -29
- package/src/components/block-variation-transforms/index.js +1 -4
- package/src/components/block-visibility/index.js +3 -19
- package/src/components/block-visibility/modal.js +16 -14
- package/src/components/block-visibility/test/use-block-visibility.js +27 -25
- package/src/components/block-visibility/test/utils.js +24 -8
- package/src/components/block-visibility/use-block-visibility.js +1 -4
- package/src/components/block-visibility/utils.js +9 -1
- package/src/components/block-visibility/viewport-menu-item.js +11 -5
- package/src/components/block-visibility/viewport-toolbar.js +5 -6
- package/src/components/block-visibility/viewport-visibility-info.js +131 -0
- package/src/components/color-palette/with-color-context.js +1 -1
- package/src/components/color-style-selector/index.js +2 -3
- package/src/components/colors/with-colors.js +23 -20
- package/src/components/colors-gradients/dropdown.js +2 -3
- package/src/components/editable-text/index.js +5 -1
- package/src/components/font-sizes/with-font-sizes.js +13 -10
- package/src/components/global-styles/advanced-panel.js +35 -16
- package/src/components/global-styles/filters-panel.js +2 -3
- package/src/components/global-styles/shadow-panel-components.js +1 -1
- package/src/components/global-styles/style.scss +9 -5
- package/src/components/gradients/with-gradient.js +7 -4
- package/src/components/inner-blocks/test/index.js +2 -0
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/stories/index.story.jsx +31 -24
- package/src/components/inspector-controls/fill.js +25 -5
- package/src/components/inspector-controls/index.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +6 -2
- package/src/components/inspector-controls-tabs/styles-tab.js +7 -8
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
- package/src/components/link-control/test/index.js +6 -1
- package/src/components/list-view/block-select-button.js +16 -25
- package/src/components/list-view/block.js +38 -43
- package/src/components/list-view/utils.js +4 -2
- package/src/components/media-replace-flow/index.js +3 -3
- package/src/components/media-replace-flow/test/index.js +13 -11
- package/src/components/provider/index.js +11 -10
- package/src/components/provider/test/use-block-sync.js +1 -0
- package/src/components/provider/with-registry-provider.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/use-block-commands/index.js +0 -41
- package/src/components/use-block-display-information/index.js +1 -5
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +5 -0
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
- package/src/hooks/block-renaming.js +5 -2
- package/src/hooks/cross-origin-isolation.js +19 -18
- package/src/hooks/custom-css.js +176 -0
- package/src/hooks/fit-text.js +20 -5
- package/src/hooks/grid-visualizer.js +15 -14
- package/src/hooks/index.js +4 -2
- package/src/hooks/layout.js +55 -43
- package/src/hooks/list-view.js +10 -6
- package/src/hooks/test/align.js +1 -0
- package/src/hooks/test/allowed-blocks.js +8 -0
- package/src/hooks/test/auto-inspector-controls.js +4 -0
- package/src/hooks/test/font-size.js +1 -0
- package/src/hooks/test/metadata.js +4 -0
- package/src/hooks/test/text-align.js +1 -0
- package/src/hooks/utils.js +123 -119
- package/src/layouts/grid.js +19 -3
- package/src/layouts/test/grid.js +1 -1
- package/src/store/actions.js +7 -0
- package/src/store/defaults.js +4 -0
- package/src/store/private-selectors.js +94 -64
- package/src/store/reducer.js +11 -18
- package/src/store/selectors.js +25 -0
- package/src/store/test/actions.js +7 -0
- package/src/store/test/private-selectors.js +116 -119
- package/src/store/test/reducer.js +262 -266
- package/src/store/test/registry-selectors.js +2 -0
- package/src/store/test/selectors.js +19 -0
- package/src/utils/fit-text-utils.js +31 -5
- package/build/components/block-visibility/block-visibility-info.cjs +0 -63
- package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
- package/build/components/block-visibility/menu-item.cjs +0 -109
- package/build/components/block-visibility/menu-item.cjs.map +0 -7
- package/build/components/block-visibility/toolbar.cjs +0 -92
- package/build/components/block-visibility/toolbar.cjs.map +0 -7
- package/build/components/content-lock/index.cjs +0 -31
- package/build/components/content-lock/index.cjs.map +0 -7
- package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
- package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
- package/build/hooks/content-lock-ui.cjs +0 -68
- package/build/hooks/content-lock-ui.cjs.map +0 -7
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
- package/build-module/components/block-visibility/menu-item.mjs +0 -88
- package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
- package/build-module/components/block-visibility/toolbar.mjs +0 -71
- package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
- package/build-module/components/content-lock/index.mjs +0 -6
- package/build-module/components/content-lock/index.mjs.map +0 -7
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
- package/build-module/hooks/content-lock-ui.mjs +0 -47
- package/build-module/hooks/content-lock-ui.mjs.map +0 -7
- package/src/components/block-visibility/block-visibility-info.js +0 -62
- package/src/components/block-visibility/menu-item.js +0 -96
- package/src/components/block-visibility/toolbar.js +0 -88
- package/src/components/content-lock/index.js +0 -1
- package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
- package/src/hooks/content-lock-ui.js +0 -76
package/src/hooks/layout.js
CHANGED
|
@@ -30,6 +30,7 @@ import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
|
30
30
|
import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
|
|
31
31
|
import { useBlockSettings, useStyleOverride } from './utils';
|
|
32
32
|
import { unlock } from '../lock-unlock';
|
|
33
|
+
import { globalStylesDataKey } from '../store/private-keys';
|
|
33
34
|
|
|
34
35
|
const layoutBlockSupportKey = 'layout';
|
|
35
36
|
const { kebabCase } = unlock( componentsPrivateApis );
|
|
@@ -367,6 +368,7 @@ function BlockWithLayoutStyles( {
|
|
|
367
368
|
block: BlockListBlock,
|
|
368
369
|
props,
|
|
369
370
|
blockGapSupport,
|
|
371
|
+
globalBlockGapValue,
|
|
370
372
|
layoutClasses,
|
|
371
373
|
} ) {
|
|
372
374
|
const { name, attributes } = props;
|
|
@@ -393,6 +395,7 @@ function BlockWithLayoutStyles( {
|
|
|
393
395
|
layout: usedLayout,
|
|
394
396
|
style: attributes?.style,
|
|
395
397
|
hasBlockGapSupport,
|
|
398
|
+
globalBlockGapValue,
|
|
396
399
|
} );
|
|
397
400
|
|
|
398
401
|
// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
|
|
@@ -421,56 +424,65 @@ function BlockWithLayoutStyles( {
|
|
|
421
424
|
* @return {Function} Wrapped component.
|
|
422
425
|
*/
|
|
423
426
|
export const withLayoutStyles = createHigherOrderComponent(
|
|
424
|
-
( BlockListBlock ) =>
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const { getSettings, getBlockSettings } = unlock(
|
|
436
|
-
select( blockEditorStore )
|
|
437
|
-
);
|
|
438
|
-
const { disableLayoutStyles } = getSettings();
|
|
427
|
+
( BlockListBlock ) =>
|
|
428
|
+
function WithLayoutStyles( props ) {
|
|
429
|
+
const { clientId, name, attributes } = props;
|
|
430
|
+
const blockSupportsLayout = hasLayoutBlockSupport( name );
|
|
431
|
+
const layoutClasses = useLayoutClasses( attributes, name );
|
|
432
|
+
const extraProps = useSelect(
|
|
433
|
+
( select ) => {
|
|
434
|
+
// The callback returns early to avoid block editor subscription.
|
|
435
|
+
if ( ! blockSupportsLayout ) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
439
438
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
439
|
+
const { getSettings, getBlockSettings } = unlock(
|
|
440
|
+
select( blockEditorStore )
|
|
441
|
+
);
|
|
442
|
+
const settings = getSettings();
|
|
443
|
+
const { disableLayoutStyles } = settings;
|
|
443
444
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
);
|
|
445
|
+
if ( disableLayoutStyles ) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
448
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
const [ blockGapSupport ] = getBlockSettings(
|
|
450
|
+
clientId,
|
|
451
|
+
'spacing.blockGap'
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
// Get default blockGap value from global styles for use in layouts like grid.
|
|
455
|
+
// Check block-specific styles first, then fall back to root styles.
|
|
456
|
+
const globalStyles = settings[ globalStylesDataKey ];
|
|
457
|
+
const globalBlockGapValue =
|
|
458
|
+
globalStyles?.blocks?.[ name ]?.spacing?.blockGap ??
|
|
459
|
+
globalStyles?.spacing?.blockGap;
|
|
460
|
+
|
|
461
|
+
return { blockGapSupport, globalBlockGapValue };
|
|
462
|
+
},
|
|
463
|
+
[ blockSupportsLayout, clientId ]
|
|
464
|
+
);
|
|
465
|
+
|
|
466
|
+
if ( ! extraProps ) {
|
|
467
|
+
return (
|
|
468
|
+
<BlockListBlock
|
|
469
|
+
{ ...props }
|
|
470
|
+
__unstableLayoutClassNames={
|
|
471
|
+
blockSupportsLayout ? layoutClasses : undefined
|
|
472
|
+
}
|
|
473
|
+
/>
|
|
474
|
+
);
|
|
475
|
+
}
|
|
453
476
|
|
|
454
|
-
if ( ! extraProps ) {
|
|
455
477
|
return (
|
|
456
|
-
<
|
|
457
|
-
{
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
478
|
+
<BlockWithLayoutStyles
|
|
479
|
+
block={ BlockListBlock }
|
|
480
|
+
props={ props }
|
|
481
|
+
layoutClasses={ layoutClasses }
|
|
482
|
+
{ ...extraProps }
|
|
461
483
|
/>
|
|
462
484
|
);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
return (
|
|
466
|
-
<BlockWithLayoutStyles
|
|
467
|
-
block={ BlockListBlock }
|
|
468
|
-
props={ props }
|
|
469
|
-
layoutClasses={ layoutClasses }
|
|
470
|
-
{ ...extraProps }
|
|
471
|
-
/>
|
|
472
|
-
);
|
|
473
|
-
},
|
|
485
|
+
},
|
|
474
486
|
'withLayoutStyles'
|
|
475
487
|
);
|
|
476
488
|
|
package/src/hooks/list-view.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { PanelBody } from '@wordpress/components';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import {
|
|
7
|
+
import { hasBlockSupport } from '@wordpress/blocks';
|
|
8
8
|
import { useContext } from '@wordpress/element';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -14,6 +14,7 @@ import { store as blockEditorStore } from '../store';
|
|
|
14
14
|
import { PrivateListView } from '../components/list-view';
|
|
15
15
|
import InspectorControls from '../components/inspector-controls/fill';
|
|
16
16
|
import { PrivateBlockContext } from '../components/block-list/private-block-context';
|
|
17
|
+
import useBlockDisplayTitle from '../components/block-title/use-block-display-title';
|
|
17
18
|
|
|
18
19
|
export const LIST_VIEW_SUPPORT_KEY = 'listView';
|
|
19
20
|
|
|
@@ -39,7 +40,7 @@ export function ListViewPanel( { clientId, name } ) {
|
|
|
39
40
|
const { isSelectionWithinCurrentSection } =
|
|
40
41
|
useContext( PrivateBlockContext );
|
|
41
42
|
const isEnabled = hasListViewSupport( name );
|
|
42
|
-
const { hasChildren,
|
|
43
|
+
const { hasChildren, isNestedListView } = useSelect(
|
|
43
44
|
( select ) => {
|
|
44
45
|
const { getBlockCount, getBlockParents, getBlockName } =
|
|
45
46
|
select( blockEditorStore );
|
|
@@ -64,12 +65,15 @@ export function ListViewPanel( { clientId, name } ) {
|
|
|
64
65
|
|
|
65
66
|
return {
|
|
66
67
|
hasChildren: !! getBlockCount( clientId ),
|
|
67
|
-
blockTitle: select( blocksStore ).getBlockType( name )?.title,
|
|
68
68
|
isNestedListView: _isNestedListView,
|
|
69
69
|
};
|
|
70
70
|
},
|
|
71
|
-
[ clientId,
|
|
71
|
+
[ clientId, isSelectionWithinCurrentSection ]
|
|
72
72
|
);
|
|
73
|
+
const title = useBlockDisplayTitle( {
|
|
74
|
+
clientId,
|
|
75
|
+
context: 'list-view',
|
|
76
|
+
} );
|
|
73
77
|
|
|
74
78
|
if ( ! isEnabled || isNestedListView ) {
|
|
75
79
|
return null;
|
|
@@ -79,7 +83,7 @@ export function ListViewPanel( { clientId, name } ) {
|
|
|
79
83
|
|
|
80
84
|
return (
|
|
81
85
|
<InspectorControls group="list">
|
|
82
|
-
<PanelBody title={ showBlockTitle ?
|
|
86
|
+
<PanelBody title={ showBlockTitle ? title : undefined }>
|
|
83
87
|
{ ! hasChildren && (
|
|
84
88
|
<p className="block-editor-block-inspector__no-blocks">
|
|
85
89
|
{ __( 'No items yet.' ) }
|
|
@@ -88,7 +92,7 @@ export function ListViewPanel( { clientId, name } ) {
|
|
|
88
92
|
<PrivateListView
|
|
89
93
|
rootClientId={ clientId }
|
|
90
94
|
isExpanded
|
|
91
|
-
description={
|
|
95
|
+
description={ title }
|
|
92
96
|
showAppender
|
|
93
97
|
/>
|
|
94
98
|
</PanelBody>
|
package/src/hooks/test/align.js
CHANGED
|
@@ -22,6 +22,7 @@ describe( 'allowedBlocks', () => {
|
|
|
22
22
|
describe( 'addTransforms()', () => {
|
|
23
23
|
it( 'should not preserve allowedBlocks in wrapping transforms', () => {
|
|
24
24
|
registerBlockType( 'core/bar', {
|
|
25
|
+
apiVersion: 3,
|
|
25
26
|
title: 'Bar',
|
|
26
27
|
supports: { allowedBlocks: true },
|
|
27
28
|
} );
|
|
@@ -53,6 +54,7 @@ describe( 'allowedBlocks', () => {
|
|
|
53
54
|
|
|
54
55
|
it( 'should not preserve allowedBlocks in one-to-many transforms', () => {
|
|
55
56
|
registerBlockType( 'core/bar', {
|
|
57
|
+
apiVersion: 3,
|
|
56
58
|
title: 'Bar',
|
|
57
59
|
supports: { allowedBlocks: true },
|
|
58
60
|
} );
|
|
@@ -83,6 +85,7 @@ describe( 'allowedBlocks', () => {
|
|
|
83
85
|
|
|
84
86
|
it( 'should not preserve allowedBlocks in many-to-one transforms', () => {
|
|
85
87
|
registerBlockType( 'core/bar', {
|
|
88
|
+
apiVersion: 3,
|
|
86
89
|
title: 'Bar',
|
|
87
90
|
supports: { allowedBlocks: true },
|
|
88
91
|
} );
|
|
@@ -114,6 +117,7 @@ describe( 'allowedBlocks', () => {
|
|
|
114
117
|
|
|
115
118
|
it( 'should not preserve allowedBlocks in many-to-many transforms with different counts', () => {
|
|
116
119
|
registerBlockType( 'core/bar', {
|
|
120
|
+
apiVersion: 3,
|
|
117
121
|
title: 'Bar',
|
|
118
122
|
supports: { allowedBlocks: true },
|
|
119
123
|
} );
|
|
@@ -155,6 +159,7 @@ describe( 'allowedBlocks', () => {
|
|
|
155
159
|
|
|
156
160
|
it( 'should preserve allowedBlocks in many-to-many transforms with same counts', () => {
|
|
157
161
|
registerBlockType( 'core/bar', {
|
|
162
|
+
apiVersion: 3,
|
|
158
163
|
title: 'Bar',
|
|
159
164
|
supports: { allowedBlocks: true },
|
|
160
165
|
} );
|
|
@@ -194,6 +199,7 @@ describe( 'allowedBlocks', () => {
|
|
|
194
199
|
|
|
195
200
|
it( "should filter allowedBlocks based on destination block's allowedBlocks", () => {
|
|
196
201
|
registerBlockType( 'core/bar', {
|
|
202
|
+
apiVersion: 3,
|
|
197
203
|
title: 'Bar',
|
|
198
204
|
supports: { allowedBlocks: true },
|
|
199
205
|
allowedBlocks: [ 'core/paragraph' ],
|
|
@@ -227,6 +233,7 @@ describe( 'allowedBlocks', () => {
|
|
|
227
233
|
|
|
228
234
|
it( 'should not override existing allowedBlocks in target block', () => {
|
|
229
235
|
registerBlockType( 'core/bar', {
|
|
236
|
+
apiVersion: 3,
|
|
230
237
|
title: 'Bar',
|
|
231
238
|
supports: { allowedBlocks: true },
|
|
232
239
|
} );
|
|
@@ -253,6 +260,7 @@ describe( 'allowedBlocks', () => {
|
|
|
253
260
|
|
|
254
261
|
it( 'should not preserve allowedBlocks when target block does not support allowedBlocks', () => {
|
|
255
262
|
registerBlockType( 'core/bar', {
|
|
263
|
+
apiVersion: 3,
|
|
256
264
|
title: 'Bar',
|
|
257
265
|
} );
|
|
258
266
|
|
|
@@ -24,6 +24,7 @@ describe( 'auto-inspector-controls', () => {
|
|
|
24
24
|
describe( 'hasSupport()', () => {
|
|
25
25
|
it( 'should return false for blocks without __experimentalAutoInspectorControl markers', () => {
|
|
26
26
|
registerBlockType( blockName, {
|
|
27
|
+
apiVersion: 3,
|
|
27
28
|
title: 'Test Block',
|
|
28
29
|
category: 'text',
|
|
29
30
|
attributes: {
|
|
@@ -42,6 +43,7 @@ describe( 'auto-inspector-controls', () => {
|
|
|
42
43
|
|
|
43
44
|
it( 'should return true for blocks with __experimentalAutoInspectorControl markers', () => {
|
|
44
45
|
registerBlockType( blockName, {
|
|
46
|
+
apiVersion: 3,
|
|
45
47
|
title: 'Test Block',
|
|
46
48
|
category: 'text',
|
|
47
49
|
attributes: {
|
|
@@ -71,6 +73,7 @@ describe( 'auto-inspector-controls', () => {
|
|
|
71
73
|
|
|
72
74
|
it( 'should return false for blocks with no attributes', () => {
|
|
73
75
|
registerBlockType( blockName, {
|
|
76
|
+
apiVersion: 3,
|
|
74
77
|
title: 'Test Block',
|
|
75
78
|
category: 'text',
|
|
76
79
|
edit: () => null,
|
|
@@ -84,6 +87,7 @@ describe( 'auto-inspector-controls', () => {
|
|
|
84
87
|
|
|
85
88
|
it( 'should return true when at least one attribute has __experimentalAutoInspectorControl', () => {
|
|
86
89
|
registerBlockType( blockName, {
|
|
90
|
+
apiVersion: 3,
|
|
87
91
|
title: 'Test Block',
|
|
88
92
|
category: 'text',
|
|
89
93
|
attributes: {
|
|
@@ -174,6 +174,7 @@ describe( 'metadata', () => {
|
|
|
174
174
|
|
|
175
175
|
it( 'should preserve custom name metadata', () => {
|
|
176
176
|
registerBlockType( 'core/bar', {
|
|
177
|
+
apiVersion: 3,
|
|
177
178
|
title: 'Bar',
|
|
178
179
|
} );
|
|
179
180
|
const source = [
|
|
@@ -199,6 +200,7 @@ describe( 'metadata', () => {
|
|
|
199
200
|
|
|
200
201
|
it( 'should not preserve custom name metadata when target block does not support renaming', () => {
|
|
201
202
|
registerBlockType( 'core/bar', {
|
|
203
|
+
apiVersion: 3,
|
|
202
204
|
title: 'Bar',
|
|
203
205
|
supports: {
|
|
204
206
|
renaming: false,
|
|
@@ -226,6 +228,7 @@ describe( 'metadata', () => {
|
|
|
226
228
|
|
|
227
229
|
it( 'should preserve block visibility metadata', () => {
|
|
228
230
|
registerBlockType( 'core/bar', {
|
|
231
|
+
apiVersion: 3,
|
|
229
232
|
title: 'Bar',
|
|
230
233
|
} );
|
|
231
234
|
|
|
@@ -252,6 +255,7 @@ describe( 'metadata', () => {
|
|
|
252
255
|
|
|
253
256
|
it( 'should not preserve block visibility metadata when target block does not support it', () => {
|
|
254
257
|
registerBlockType( 'core/bar', {
|
|
258
|
+
apiVersion: 3,
|
|
255
259
|
title: 'Bar',
|
|
256
260
|
supports: {
|
|
257
261
|
visibility: false,
|
package/src/hooks/utils.js
CHANGED
|
@@ -522,63 +522,66 @@ export function createBlockEditFilter( features ) {
|
|
|
522
522
|
return { ...settings, Edit: memo( settings.edit ) };
|
|
523
523
|
} );
|
|
524
524
|
const withBlockEditHooks = createHigherOrderComponent(
|
|
525
|
-
( OriginalBlockEdit ) =>
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
525
|
+
( OriginalBlockEdit ) =>
|
|
526
|
+
function WithBlockEditHooks( props ) {
|
|
527
|
+
const context = useBlockEditContext();
|
|
528
|
+
// CAUTION: code added before this line will be executed for all
|
|
529
|
+
// blocks, not just those that support the feature! Code added
|
|
530
|
+
// above this line should be carefully evaluated for its impact on
|
|
531
|
+
// performance.
|
|
532
|
+
return [
|
|
533
|
+
...features.map( ( feature, i ) => {
|
|
534
|
+
const {
|
|
535
|
+
Edit,
|
|
536
|
+
hasSupport,
|
|
537
|
+
attributeKeys = [],
|
|
538
|
+
shareWithChildBlocks,
|
|
539
|
+
supportsPatternEditing,
|
|
540
|
+
} = feature;
|
|
541
|
+
const shouldDisplayControls =
|
|
542
|
+
( supportsPatternEditing &&
|
|
543
|
+
context[
|
|
544
|
+
mayDisplayPatternEditingControlsKey
|
|
545
|
+
] ) ||
|
|
546
|
+
context[ mayDisplayControlsKey ] ||
|
|
547
|
+
( context[ mayDisplayParentControlsKey ] &&
|
|
548
|
+
shareWithChildBlocks );
|
|
546
549
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
const neededProps = {};
|
|
555
|
-
for ( const key of attributeKeys ) {
|
|
556
|
-
if ( props.attributes[ key ] ) {
|
|
557
|
-
neededProps[ key ] = props.attributes[ key ];
|
|
550
|
+
if (
|
|
551
|
+
! shouldDisplayControls ||
|
|
552
|
+
! hasSupport( props.name )
|
|
553
|
+
) {
|
|
554
|
+
return null;
|
|
558
555
|
}
|
|
559
|
-
}
|
|
560
556
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
key={ i }
|
|
566
|
-
name={ props.name }
|
|
567
|
-
isSelected={ props.isSelected }
|
|
568
|
-
clientId={ props.clientId }
|
|
569
|
-
setAttributes={ props.setAttributes }
|
|
570
|
-
__unstableParentLayout={
|
|
571
|
-
props.__unstableParentLayout
|
|
557
|
+
const neededProps = {};
|
|
558
|
+
for ( const key of attributeKeys ) {
|
|
559
|
+
if ( props.attributes[ key ] ) {
|
|
560
|
+
neededProps[ key ] = props.attributes[ key ];
|
|
572
561
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return (
|
|
565
|
+
<Edit
|
|
566
|
+
// We can use the index because the array length
|
|
567
|
+
// is fixed per page load right now.
|
|
568
|
+
key={ i }
|
|
569
|
+
name={ props.name }
|
|
570
|
+
isSelected={ props.isSelected }
|
|
571
|
+
clientId={ props.clientId }
|
|
572
|
+
setAttributes={ props.setAttributes }
|
|
573
|
+
__unstableParentLayout={
|
|
574
|
+
props.__unstableParentLayout
|
|
575
|
+
}
|
|
576
|
+
// This component is pure, so only pass needed
|
|
577
|
+
// props!!!
|
|
578
|
+
{ ...neededProps }
|
|
579
|
+
/>
|
|
580
|
+
);
|
|
581
|
+
} ),
|
|
582
|
+
<OriginalBlockEdit key="edit" { ...props } />,
|
|
583
|
+
];
|
|
584
|
+
},
|
|
582
585
|
'withBlockEditHooks'
|
|
583
586
|
);
|
|
584
587
|
addFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );
|
|
@@ -614,76 +617,77 @@ const BlockPropsPure = memo( BlockProps );
|
|
|
614
617
|
|
|
615
618
|
export function createBlockListBlockFilter( features ) {
|
|
616
619
|
const withBlockListBlockHooks = createHigherOrderComponent(
|
|
617
|
-
( BlockListBlock ) =>
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
620
|
+
( BlockListBlock ) =>
|
|
621
|
+
function WithBlockListBlockHooks( props ) {
|
|
622
|
+
const [ allWrapperProps, setAllWrapperProps ] = useState(
|
|
623
|
+
Array( features.length ).fill( undefined )
|
|
624
|
+
);
|
|
625
|
+
return [
|
|
626
|
+
...features.map( ( feature, i ) => {
|
|
627
|
+
const {
|
|
628
|
+
hasSupport,
|
|
629
|
+
attributeKeys = [],
|
|
630
|
+
useBlockProps,
|
|
631
|
+
isMatch,
|
|
632
|
+
} = feature;
|
|
629
633
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
+
const neededProps = {};
|
|
635
|
+
for ( const key of attributeKeys ) {
|
|
636
|
+
if ( props.attributes[ key ] ) {
|
|
637
|
+
neededProps[ key ] = props.attributes[ key ];
|
|
638
|
+
}
|
|
634
639
|
}
|
|
635
|
-
}
|
|
636
640
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
641
|
+
if (
|
|
642
|
+
// Skip rendering if none of the needed attributes are
|
|
643
|
+
// set.
|
|
644
|
+
! Object.keys( neededProps ).length ||
|
|
645
|
+
! hasSupport( props.name ) ||
|
|
646
|
+
( isMatch && ! isMatch( neededProps ) )
|
|
647
|
+
) {
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
646
650
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
651
|
+
return (
|
|
652
|
+
<BlockPropsPure
|
|
653
|
+
// We can use the index because the array length
|
|
654
|
+
// is fixed per page load right now.
|
|
655
|
+
key={ i }
|
|
656
|
+
index={ i }
|
|
657
|
+
useBlockProps={ useBlockProps }
|
|
658
|
+
// This component is pure, so we must pass a stable
|
|
659
|
+
// function reference.
|
|
660
|
+
setAllWrapperProps={ setAllWrapperProps }
|
|
661
|
+
name={ props.name }
|
|
662
|
+
clientId={ props.clientId }
|
|
663
|
+
// This component is pure, so only pass needed
|
|
664
|
+
// props!!!
|
|
665
|
+
{ ...neededProps }
|
|
666
|
+
/>
|
|
667
|
+
);
|
|
668
|
+
} ),
|
|
669
|
+
<BlockListBlock
|
|
670
|
+
key="edit"
|
|
671
|
+
{ ...props }
|
|
672
|
+
wrapperProps={ allWrapperProps
|
|
673
|
+
.filter( Boolean )
|
|
674
|
+
.reduce( ( acc, wrapperProps ) => {
|
|
675
|
+
return {
|
|
676
|
+
...acc,
|
|
677
|
+
...wrapperProps,
|
|
678
|
+
className: clsx(
|
|
679
|
+
acc.className,
|
|
680
|
+
wrapperProps.className
|
|
681
|
+
),
|
|
682
|
+
style: {
|
|
683
|
+
...acc.style,
|
|
684
|
+
...wrapperProps.style,
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
}, props.wrapperProps || {} ) }
|
|
688
|
+
/>,
|
|
689
|
+
];
|
|
690
|
+
},
|
|
687
691
|
'withBlockListBlockHooks'
|
|
688
692
|
);
|
|
689
693
|
addFilter(
|
package/src/layouts/grid.js
CHANGED
|
@@ -113,6 +113,7 @@ export default {
|
|
|
113
113
|
style,
|
|
114
114
|
blockName,
|
|
115
115
|
hasBlockGapSupport,
|
|
116
|
+
globalBlockGapValue,
|
|
116
117
|
layoutDefinitions = LAYOUT_DEFINITIONS,
|
|
117
118
|
} ) {
|
|
118
119
|
const {
|
|
@@ -146,13 +147,28 @@ export default {
|
|
|
146
147
|
? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )
|
|
147
148
|
: undefined;
|
|
148
149
|
|
|
150
|
+
// Use the global blockGap value for grid column calculations when available
|
|
151
|
+
// If the gap value has both top and left (separated by space), use the left value for horizontal calculations
|
|
152
|
+
let fallbackGapValue = '1.2rem';
|
|
153
|
+
if ( globalBlockGapValue ) {
|
|
154
|
+
const processedGap = getGapCSSValue( globalBlockGapValue, '0.5em' );
|
|
155
|
+
const gapParts = processedGap.split( ' ' );
|
|
156
|
+
fallbackGapValue =
|
|
157
|
+
gapParts.length > 1 ? gapParts[ 1 ] : gapParts[ 0 ];
|
|
158
|
+
}
|
|
159
|
+
|
|
149
160
|
let output = '';
|
|
150
161
|
const rules = [];
|
|
151
162
|
|
|
152
163
|
if ( minimumColumnWidth && columnCount > 0 ) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
let blockGapToUse = blockGapValue || fallbackGapValue;
|
|
165
|
+
// Ensure 0 values have a unit so they work in calc().
|
|
166
|
+
if ( blockGapToUse === '0' || blockGapToUse === 0 ) {
|
|
167
|
+
blockGapToUse = '0px';
|
|
168
|
+
}
|
|
169
|
+
const maxValue = `max(min( ${ minimumColumnWidth }, 100%), ( 100% - (${ blockGapToUse }*${
|
|
170
|
+
columnCount - 1
|
|
171
|
+
}) ) / ${ columnCount })`;
|
|
156
172
|
rules.push(
|
|
157
173
|
`grid-template-columns: repeat(auto-fill, minmax(${ maxValue }, 1fr))`,
|
|
158
174
|
`container-type: inline-size`
|
package/src/layouts/test/grid.js
CHANGED
|
@@ -33,7 +33,7 @@ describe( 'getLayoutStyle', () => {
|
|
|
33
33
|
expect( result ).toBe( expected );
|
|
34
34
|
} );
|
|
35
35
|
it( 'should return `grid-template-columns` with max() function if both minimumColumnWidth and columnCount are provided', () => {
|
|
36
|
-
const expected = `.my-container { grid-template-columns: repeat(auto-fill, minmax(max(12rem, ( 100% - (1.2rem*2) ) / 3), 1fr)); container-type: inline-size; }`;
|
|
36
|
+
const expected = `.my-container { grid-template-columns: repeat(auto-fill, minmax(max(min( 12rem, 100%), ( 100% - (1.2rem*2) ) / 3), 1fr)); container-type: inline-size; }`;
|
|
37
37
|
|
|
38
38
|
const result = grid.getLayoutStyle( {
|
|
39
39
|
selector: '.my-container',
|