@wordpress/block-editor 13.2.0 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -1
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +57 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +26 -18
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +10 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +26 -61
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +178 -116
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +8 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +50 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +50 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +23 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +11 -14
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +116 -36
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +29 -22
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +169 -4
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +65 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -22
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +2 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +16 -6
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +2 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +44 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +90 -51
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +48 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +27 -19
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +11 -3
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -63
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +181 -119
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +8 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +52 -14
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +48 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +23 -8
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +11 -14
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +117 -37
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +29 -22
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +168 -4
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +64 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -22
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +2 -9
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +16 -6
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +2 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +90 -51
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +8 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +207 -96
- package/build-style/style.css +207 -96
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +18 -0
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +1 -0
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +15 -0
- package/src/components/block-tools/use-show-block-tools.js +14 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/src/components/block-tools/zoom-out-popover.js +49 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +41 -23
- package/src/components/date-format-picker/index.js +10 -1
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +29 -83
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +249 -170
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +9 -0
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +105 -20
- package/src/components/global-styles/test/typography-utils.js +269 -0
- package/src/components/global-styles/typography-panel.js +49 -12
- package/src/components/global-styles/typography-utils.js +63 -0
- package/src/components/global-styles/use-global-styles-output.js +23 -8
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +11 -27
- package/src/components/grid/grid-item-resizer.js +3 -2
- package/src/components/grid/grid-visualizer.js +171 -54
- package/src/components/grid/style.scss +43 -8
- package/src/components/grid/use-grid-layout-sync.js +31 -28
- package/src/components/iframe/content.scss +1 -0
- package/src/components/inner-blocks/index.js +2 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +1 -49
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/index.js +3 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +202 -3
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +64 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +53 -37
- package/src/hooks/position.js +3 -10
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +18 -4
- package/src/hooks/utils.js +2 -0
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +146 -51
- package/src/private-apis.js +12 -1
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/style.scss +1 -1
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/hooks/position.scss +0 -18
|
@@ -31,6 +31,7 @@ import { GlobalStylesContext } from './context';
|
|
|
31
31
|
import { useGlobalSetting } from './hooks';
|
|
32
32
|
import { getDuotoneFilter } from '../duotone/utils';
|
|
33
33
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
34
|
+
import { setBackgroundStyleDefaults } from '../../hooks/background';
|
|
34
35
|
import { store as blockEditorStore } from '../../store';
|
|
35
36
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
36
37
|
import { getValueFromObjectPath, setImmutably } from '../../utils/object';
|
|
@@ -387,6 +388,20 @@ export function getStylesDeclarations(
|
|
|
387
388
|
[]
|
|
388
389
|
);
|
|
389
390
|
|
|
391
|
+
/*
|
|
392
|
+
* Set background defaults.
|
|
393
|
+
* Applies to all background styles except the top-level site background.
|
|
394
|
+
*/
|
|
395
|
+
if ( ! isRoot && !! blockStyles.background ) {
|
|
396
|
+
blockStyles = {
|
|
397
|
+
...blockStyles,
|
|
398
|
+
background: {
|
|
399
|
+
...blockStyles.background,
|
|
400
|
+
...setBackgroundStyleDefaults( blockStyles.background ),
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
390
405
|
// The goal is to move everything to server side generated engine styles
|
|
391
406
|
// This is temporary as we absorb more and more styles into the engine.
|
|
392
407
|
const extraRules = getCSSRules( blockStyles );
|
|
@@ -656,7 +671,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
656
671
|
}
|
|
657
672
|
const variationSelector =
|
|
658
673
|
blockSelectors[ blockName ]
|
|
659
|
-
|
|
674
|
+
?.styleVariationSelectors?.[ variationName ];
|
|
660
675
|
|
|
661
676
|
// Process the variation's inner element styles.
|
|
662
677
|
// This comes before the inner block styles so the
|
|
@@ -685,18 +700,18 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
685
700
|
const variationBlockSelector = scopeSelector(
|
|
686
701
|
variationSelector,
|
|
687
702
|
blockSelectors[ variationBlockName ]
|
|
688
|
-
|
|
703
|
+
?.selector
|
|
689
704
|
);
|
|
690
705
|
const variationDuotoneSelector = scopeSelector(
|
|
691
706
|
variationSelector,
|
|
692
707
|
blockSelectors[ variationBlockName ]
|
|
693
|
-
|
|
708
|
+
?.duotoneSelector
|
|
694
709
|
);
|
|
695
710
|
const variationFeatureSelectors =
|
|
696
711
|
scopeFeatureSelectors(
|
|
697
712
|
variationSelector,
|
|
698
713
|
blockSelectors[ variationBlockName ]
|
|
699
|
-
|
|
714
|
+
?.featureSelectors
|
|
700
715
|
);
|
|
701
716
|
|
|
702
717
|
const variationBlockStyleNodes =
|
|
@@ -713,10 +728,10 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
713
728
|
featureSelectors: variationFeatureSelectors,
|
|
714
729
|
fallbackGapValue:
|
|
715
730
|
blockSelectors[ variationBlockName ]
|
|
716
|
-
|
|
731
|
+
?.fallbackGapValue,
|
|
717
732
|
hasLayoutSupport:
|
|
718
733
|
blockSelectors[ variationBlockName ]
|
|
719
|
-
|
|
734
|
+
?.hasLayoutSupport,
|
|
720
735
|
styles: variationBlockStyleNodes,
|
|
721
736
|
} );
|
|
722
737
|
|
|
@@ -924,8 +939,8 @@ export const toStyles = (
|
|
|
924
939
|
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
925
940
|
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
926
941
|
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
927
|
-
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull
|
|
928
|
-
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull
|
|
942
|
+
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
|
|
943
|
+
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
|
|
929
944
|
`;
|
|
930
945
|
}
|
|
931
946
|
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
@@ -136,12 +141,18 @@ export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
|
|
|
136
141
|
'typography.fontFamily': 'fontFamily',
|
|
137
142
|
};
|
|
138
143
|
|
|
139
|
-
export
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
export function useToolsPanelDropdownMenuProps() {
|
|
145
|
+
const isMobile = useViewportMatch( 'medium', '<' );
|
|
146
|
+
return ! isMobile
|
|
147
|
+
? {
|
|
148
|
+
popoverProps: {
|
|
149
|
+
placement: 'left-start',
|
|
150
|
+
// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
|
|
151
|
+
offset: 259,
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
: {};
|
|
155
|
+
}
|
|
145
156
|
|
|
146
157
|
function findInPresetsBy(
|
|
147
158
|
features,
|
|
@@ -32,13 +32,9 @@ export function GridItemMovers( {
|
|
|
32
32
|
const columnCount = parentLayout?.columnCount;
|
|
33
33
|
const rowCount = parentLayout?.rowCount;
|
|
34
34
|
|
|
35
|
-
const columnCountNumber = parseInt( columnCount, 10 );
|
|
36
|
-
const rowStartNumber = parseInt( rowStart, 10 );
|
|
37
|
-
const columnStartNumber = parseInt( columnStart, 10 );
|
|
38
|
-
|
|
39
35
|
const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
|
|
40
36
|
gridClientId,
|
|
41
|
-
|
|
37
|
+
columnCount
|
|
42
38
|
);
|
|
43
39
|
|
|
44
40
|
return (
|
|
@@ -46,7 +42,7 @@ export function GridItemMovers( {
|
|
|
46
42
|
<ToolbarButton
|
|
47
43
|
icon={ arrowUp }
|
|
48
44
|
label={ __( 'Move block up' ) }
|
|
49
|
-
|
|
45
|
+
disabled={ rowStart <= 1 }
|
|
50
46
|
onClick={ () => {
|
|
51
47
|
onChange( {
|
|
52
48
|
rowStart: rowStart - 1,
|
|
@@ -56,17 +52,14 @@ export function GridItemMovers( {
|
|
|
56
52
|
[ blockClientId ],
|
|
57
53
|
gridClientId,
|
|
58
54
|
gridClientId,
|
|
59
|
-
getNumberOfBlocksBeforeCell(
|
|
60
|
-
columnStartNumber,
|
|
61
|
-
rowStartNumber - 1
|
|
62
|
-
)
|
|
55
|
+
getNumberOfBlocksBeforeCell( columnStart, rowStart - 1 )
|
|
63
56
|
);
|
|
64
57
|
} }
|
|
65
58
|
/>
|
|
66
59
|
<ToolbarButton
|
|
67
60
|
icon={ arrowDown }
|
|
68
61
|
label={ __( 'Move block down' ) }
|
|
69
|
-
|
|
62
|
+
disabled={ rowCount && rowEnd >= rowCount }
|
|
70
63
|
onClick={ () => {
|
|
71
64
|
onChange( {
|
|
72
65
|
rowStart: rowStart + 1,
|
|
@@ -76,50 +69,41 @@ export function GridItemMovers( {
|
|
|
76
69
|
[ blockClientId ],
|
|
77
70
|
gridClientId,
|
|
78
71
|
gridClientId,
|
|
79
|
-
getNumberOfBlocksBeforeCell(
|
|
80
|
-
columnStartNumber,
|
|
81
|
-
rowStartNumber + 1
|
|
82
|
-
)
|
|
72
|
+
getNumberOfBlocksBeforeCell( columnStart, rowStart + 1 )
|
|
83
73
|
);
|
|
84
74
|
} }
|
|
85
75
|
/>
|
|
86
76
|
<ToolbarButton
|
|
87
77
|
icon={ arrowLeft }
|
|
88
78
|
label={ __( 'Move block left' ) }
|
|
89
|
-
|
|
79
|
+
disabled={ columnStart <= 1 }
|
|
90
80
|
onClick={ () => {
|
|
91
81
|
onChange( {
|
|
92
|
-
columnStart:
|
|
82
|
+
columnStart: columnStart - 1,
|
|
93
83
|
} );
|
|
94
84
|
__unstableMarkNextChangeAsNotPersistent();
|
|
95
85
|
moveBlocksToPosition(
|
|
96
86
|
[ blockClientId ],
|
|
97
87
|
gridClientId,
|
|
98
88
|
gridClientId,
|
|
99
|
-
getNumberOfBlocksBeforeCell(
|
|
100
|
-
columnStartNumber - 1,
|
|
101
|
-
rowStartNumber
|
|
102
|
-
)
|
|
89
|
+
getNumberOfBlocksBeforeCell( columnStart - 1, rowStart )
|
|
103
90
|
);
|
|
104
91
|
} }
|
|
105
92
|
/>
|
|
106
93
|
<ToolbarButton
|
|
107
94
|
icon={ arrowRight }
|
|
108
95
|
label={ __( 'Move block right' ) }
|
|
109
|
-
|
|
96
|
+
disabled={ columnCount && columnEnd >= columnCount }
|
|
110
97
|
onClick={ () => {
|
|
111
98
|
onChange( {
|
|
112
|
-
columnStart:
|
|
99
|
+
columnStart: columnStart + 1,
|
|
113
100
|
} );
|
|
114
101
|
__unstableMarkNextChangeAsNotPersistent();
|
|
115
102
|
moveBlocksToPosition(
|
|
116
103
|
[ blockClientId ],
|
|
117
104
|
gridClientId,
|
|
118
105
|
gridClientId,
|
|
119
|
-
getNumberOfBlocksBeforeCell(
|
|
120
|
-
columnStartNumber + 1,
|
|
121
|
-
rowStartNumber
|
|
122
|
-
)
|
|
106
|
+
getNumberOfBlocksBeforeCell( columnStart + 1, rowStart )
|
|
123
107
|
);
|
|
124
108
|
} }
|
|
125
109
|
/>
|
|
@@ -19,7 +19,7 @@ export function GridItemResizer( {
|
|
|
19
19
|
} ) {
|
|
20
20
|
const blockElement = useBlockElement( clientId );
|
|
21
21
|
const rootBlockElement = blockElement?.parentElement;
|
|
22
|
-
const {
|
|
22
|
+
const { isManualPlacement } = parentLayout;
|
|
23
23
|
|
|
24
24
|
if ( ! blockElement || ! rootBlockElement ) {
|
|
25
25
|
return null;
|
|
@@ -33,7 +33,8 @@ export function GridItemResizer( {
|
|
|
33
33
|
rootBlockElement={ rootBlockElement }
|
|
34
34
|
onChange={ onChange }
|
|
35
35
|
isManualGrid={
|
|
36
|
-
|
|
36
|
+
isManualPlacement &&
|
|
37
|
+
window.__experimentalEnableGridInteractivity
|
|
37
38
|
}
|
|
38
39
|
/>
|
|
39
40
|
);
|
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useState, useEffect, forwardRef } from '@wordpress/element';
|
|
9
|
+
import { useState, useEffect, forwardRef, useMemo } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { __experimentalUseDropZone as useDropZone } from '@wordpress/compose';
|
|
12
12
|
|
|
@@ -18,6 +18,7 @@ import BlockPopoverCover from '../block-popover/cover';
|
|
|
18
18
|
import { range, GridRect, getGridInfo } from './utils';
|
|
19
19
|
import { store as blockEditorStore } from '../../store';
|
|
20
20
|
import { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';
|
|
21
|
+
import ButtonBlockAppender from '../button-block-appender';
|
|
21
22
|
|
|
22
23
|
export function GridVisualizer( { clientId, contentRef, parentLayout } ) {
|
|
23
24
|
const isDistractionFree = useSelect(
|
|
@@ -32,11 +33,11 @@ export function GridVisualizer( { clientId, contentRef, parentLayout } ) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const isManualGrid =
|
|
35
|
-
parentLayout?.
|
|
36
|
+
parentLayout?.isManualPlacement &&
|
|
36
37
|
window.__experimentalEnableGridInteractivity;
|
|
37
38
|
return (
|
|
38
39
|
<GridVisualizerGrid
|
|
39
|
-
|
|
40
|
+
gridClientId={ clientId }
|
|
40
41
|
gridElement={ gridElement }
|
|
41
42
|
isManualGrid={ isManualGrid }
|
|
42
43
|
ref={ contentRef }
|
|
@@ -45,12 +46,11 @@ export function GridVisualizer( { clientId, contentRef, parentLayout } ) {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const GridVisualizerGrid = forwardRef(
|
|
48
|
-
( {
|
|
49
|
+
( { gridClientId, gridElement, isManualGrid }, ref ) => {
|
|
49
50
|
const [ gridInfo, setGridInfo ] = useState( () =>
|
|
50
51
|
getGridInfo( gridElement )
|
|
51
52
|
);
|
|
52
53
|
const [ isDroppingAllowed, setIsDroppingAllowed ] = useState( false );
|
|
53
|
-
const [ highlightedRect, setHighlightedRect ] = useState( null );
|
|
54
54
|
|
|
55
55
|
useEffect( () => {
|
|
56
56
|
const observers = [];
|
|
@@ -88,7 +88,7 @@ const GridVisualizerGrid = forwardRef(
|
|
|
88
88
|
className={ clsx( 'block-editor-grid-visualizer', {
|
|
89
89
|
'is-dropping-allowed': isDroppingAllowed,
|
|
90
90
|
} ) }
|
|
91
|
-
clientId={
|
|
91
|
+
clientId={ gridClientId }
|
|
92
92
|
__unstablePopoverSlot="block-toolbar"
|
|
93
93
|
>
|
|
94
94
|
<div
|
|
@@ -96,51 +96,102 @@ const GridVisualizerGrid = forwardRef(
|
|
|
96
96
|
className="block-editor-grid-visualizer__grid"
|
|
97
97
|
style={ gridInfo.style }
|
|
98
98
|
>
|
|
99
|
-
{ isManualGrid
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
highlightedRect={
|
|
113
|
-
highlightedRect
|
|
114
|
-
}
|
|
115
|
-
setHighlightedRect={
|
|
116
|
-
setHighlightedRect
|
|
117
|
-
}
|
|
118
|
-
/>
|
|
119
|
-
</GridVisualizerCell>
|
|
120
|
-
)
|
|
121
|
-
)
|
|
122
|
-
)
|
|
123
|
-
: Array.from(
|
|
124
|
-
{ length: gridInfo.numItems },
|
|
125
|
-
( _, i ) => (
|
|
126
|
-
<GridVisualizerCell
|
|
127
|
-
key={ i }
|
|
128
|
-
color={ gridInfo.currentColor }
|
|
129
|
-
/>
|
|
130
|
-
)
|
|
131
|
-
) }
|
|
99
|
+
{ isManualGrid ? (
|
|
100
|
+
<ManualGridVisualizer
|
|
101
|
+
gridClientId={ gridClientId }
|
|
102
|
+
gridInfo={ gridInfo }
|
|
103
|
+
/>
|
|
104
|
+
) : (
|
|
105
|
+
Array.from( { length: gridInfo.numItems }, ( _, i ) => (
|
|
106
|
+
<GridVisualizerCell
|
|
107
|
+
key={ i }
|
|
108
|
+
color={ gridInfo.currentColor }
|
|
109
|
+
/>
|
|
110
|
+
) )
|
|
111
|
+
) }
|
|
132
112
|
</div>
|
|
133
113
|
</BlockPopoverCover>
|
|
134
114
|
);
|
|
135
115
|
}
|
|
136
116
|
);
|
|
137
117
|
|
|
138
|
-
function
|
|
118
|
+
function ManualGridVisualizer( { gridClientId, gridInfo } ) {
|
|
119
|
+
const [ highlightedRect, setHighlightedRect ] = useState( null );
|
|
120
|
+
|
|
121
|
+
const gridItems = useSelect(
|
|
122
|
+
( select ) => select( blockEditorStore ).getBlocks( gridClientId ),
|
|
123
|
+
[ gridClientId ]
|
|
124
|
+
);
|
|
125
|
+
const occupiedRects = useMemo( () => {
|
|
126
|
+
const rects = [];
|
|
127
|
+
for ( const block of gridItems ) {
|
|
128
|
+
const {
|
|
129
|
+
columnStart,
|
|
130
|
+
rowStart,
|
|
131
|
+
columnSpan = 1,
|
|
132
|
+
rowSpan = 1,
|
|
133
|
+
} = block.attributes.style?.layout || {};
|
|
134
|
+
if ( ! columnStart || ! rowStart ) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
rects.push(
|
|
138
|
+
new GridRect( {
|
|
139
|
+
columnStart,
|
|
140
|
+
rowStart,
|
|
141
|
+
columnSpan,
|
|
142
|
+
rowSpan,
|
|
143
|
+
} )
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
return rects;
|
|
147
|
+
}, [ gridItems ] );
|
|
148
|
+
|
|
149
|
+
return range( 1, gridInfo.numRows ).map( ( row ) =>
|
|
150
|
+
range( 1, gridInfo.numColumns ).map( ( column ) => {
|
|
151
|
+
const isCellOccupied = occupiedRects.some( ( rect ) =>
|
|
152
|
+
rect.contains( column, row )
|
|
153
|
+
);
|
|
154
|
+
const isHighlighted =
|
|
155
|
+
highlightedRect?.contains( column, row ) ?? false;
|
|
156
|
+
return (
|
|
157
|
+
<GridVisualizerCell
|
|
158
|
+
key={ `${ row }-${ column }` }
|
|
159
|
+
color={ gridInfo.currentColor }
|
|
160
|
+
className={ isHighlighted && 'is-highlighted' }
|
|
161
|
+
>
|
|
162
|
+
{ isCellOccupied ? (
|
|
163
|
+
<GridVisualizerDropZone
|
|
164
|
+
column={ column }
|
|
165
|
+
row={ row }
|
|
166
|
+
gridClientId={ gridClientId }
|
|
167
|
+
gridInfo={ gridInfo }
|
|
168
|
+
setHighlightedRect={ setHighlightedRect }
|
|
169
|
+
/>
|
|
170
|
+
) : (
|
|
171
|
+
<GridVisualizerAppender
|
|
172
|
+
column={ column }
|
|
173
|
+
row={ row }
|
|
174
|
+
gridClientId={ gridClientId }
|
|
175
|
+
gridInfo={ gridInfo }
|
|
176
|
+
setHighlightedRect={ setHighlightedRect }
|
|
177
|
+
/>
|
|
178
|
+
) }
|
|
179
|
+
</GridVisualizerCell>
|
|
180
|
+
);
|
|
181
|
+
} )
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function GridVisualizerCell( { color, children, className } ) {
|
|
139
186
|
return (
|
|
140
187
|
<div
|
|
141
|
-
className=
|
|
188
|
+
className={ clsx(
|
|
189
|
+
'block-editor-grid-visualizer__cell',
|
|
190
|
+
className
|
|
191
|
+
) }
|
|
142
192
|
style={ {
|
|
143
193
|
boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${ color } 20%, #0000)`,
|
|
194
|
+
color,
|
|
144
195
|
} }
|
|
145
196
|
>
|
|
146
197
|
{ children }
|
|
@@ -148,15 +199,15 @@ function GridVisualizerCell( { color, children } ) {
|
|
|
148
199
|
);
|
|
149
200
|
}
|
|
150
201
|
|
|
151
|
-
function
|
|
202
|
+
function useGridVisualizerDropZone(
|
|
152
203
|
column,
|
|
153
204
|
row,
|
|
154
205
|
gridClientId,
|
|
155
206
|
gridInfo,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
207
|
+
setHighlightedRect
|
|
208
|
+
) {
|
|
209
|
+
const { getBlockAttributes, getBlockRootClientId } =
|
|
210
|
+
useSelect( blockEditorStore );
|
|
160
211
|
const {
|
|
161
212
|
updateBlockAttributes,
|
|
162
213
|
moveBlocksToPosition,
|
|
@@ -168,7 +219,7 @@ function GridVisualizerDropZone( {
|
|
|
168
219
|
gridInfo.numColumns
|
|
169
220
|
);
|
|
170
221
|
|
|
171
|
-
|
|
222
|
+
return useDropZoneWithValidation( {
|
|
172
223
|
validateDrag( srcClientId ) {
|
|
173
224
|
const attributes = getBlockAttributes( srcClientId );
|
|
174
225
|
const rect = new GridRect( {
|
|
@@ -221,21 +272,87 @@ function GridVisualizerDropZone( {
|
|
|
221
272
|
__unstableMarkNextChangeAsNotPersistent();
|
|
222
273
|
moveBlocksToPosition(
|
|
223
274
|
[ srcClientId ],
|
|
224
|
-
|
|
275
|
+
getBlockRootClientId( srcClientId ),
|
|
225
276
|
gridClientId,
|
|
226
277
|
getNumberOfBlocksBeforeCell( column, row )
|
|
227
278
|
);
|
|
228
279
|
},
|
|
229
280
|
} );
|
|
281
|
+
}
|
|
230
282
|
|
|
231
|
-
|
|
232
|
-
|
|
283
|
+
function GridVisualizerDropZone( {
|
|
284
|
+
column,
|
|
285
|
+
row,
|
|
286
|
+
gridClientId,
|
|
287
|
+
gridInfo,
|
|
288
|
+
setHighlightedRect,
|
|
289
|
+
} ) {
|
|
233
290
|
return (
|
|
234
291
|
<div
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
292
|
+
className="block-editor-grid-visualizer__drop-zone"
|
|
293
|
+
ref={ useGridVisualizerDropZone(
|
|
294
|
+
column,
|
|
295
|
+
row,
|
|
296
|
+
gridClientId,
|
|
297
|
+
gridInfo,
|
|
298
|
+
setHighlightedRect
|
|
299
|
+
) }
|
|
300
|
+
/>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function GridVisualizerAppender( {
|
|
305
|
+
column,
|
|
306
|
+
row,
|
|
307
|
+
gridClientId,
|
|
308
|
+
gridInfo,
|
|
309
|
+
setHighlightedRect,
|
|
310
|
+
} ) {
|
|
311
|
+
const {
|
|
312
|
+
updateBlockAttributes,
|
|
313
|
+
moveBlocksToPosition,
|
|
314
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
315
|
+
} = useDispatch( blockEditorStore );
|
|
316
|
+
|
|
317
|
+
const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
|
|
318
|
+
gridClientId,
|
|
319
|
+
gridInfo.numColumns
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<ButtonBlockAppender
|
|
324
|
+
rootClientId={ gridClientId }
|
|
325
|
+
className="block-editor-grid-visualizer__appender"
|
|
326
|
+
ref={ useGridVisualizerDropZone(
|
|
327
|
+
column,
|
|
328
|
+
row,
|
|
329
|
+
gridClientId,
|
|
330
|
+
gridInfo,
|
|
331
|
+
setHighlightedRect
|
|
332
|
+
) }
|
|
333
|
+
style={ {
|
|
334
|
+
color: gridInfo.currentColor,
|
|
335
|
+
} }
|
|
336
|
+
onSelect={ ( block ) => {
|
|
337
|
+
if ( ! block ) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
updateBlockAttributes( block.clientId, {
|
|
341
|
+
style: {
|
|
342
|
+
layout: {
|
|
343
|
+
columnStart: column,
|
|
344
|
+
rowStart: row,
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
} );
|
|
348
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
349
|
+
moveBlocksToPosition(
|
|
350
|
+
[ block.clientId ],
|
|
351
|
+
gridClientId,
|
|
352
|
+
gridClientId,
|
|
353
|
+
getNumberOfBlocksBeforeCell( column, row )
|
|
354
|
+
);
|
|
355
|
+
} }
|
|
239
356
|
/>
|
|
240
357
|
);
|
|
241
358
|
}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
pointer-events: all;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
.block-editor-inserter * {
|
|
16
|
+
pointer-events: auto;
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
|
|
@@ -20,24 +23,55 @@
|
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.block-editor-grid-visualizer__cell {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
display: grid;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
.block-editor-inserter {
|
|
30
|
+
color: inherit;
|
|
31
|
+
z-index: 32;
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
right: 0;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
|
|
39
|
+
.block-editor-grid-visualizer__appender {
|
|
40
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 20%, #0000);
|
|
41
|
+
color: inherit;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
height: 100%;
|
|
44
|
+
width: 100%;
|
|
45
|
+
padding: 0 !important;
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.is-highlighted {
|
|
52
|
+
.block-editor-inserter,
|
|
53
|
+
.block-editor-grid-visualizer__drop-zone {
|
|
54
|
+
background: var(--wp-admin-theme-color);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:hover .block-editor-grid-visualizer__appender,
|
|
59
|
+
.block-editor-grid-visualizer__appender:focus {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
background-color: color-mix(in srgb, currentColor 20%, #0000);
|
|
62
|
+
}
|
|
26
63
|
}
|
|
27
64
|
|
|
28
65
|
.block-editor-grid-visualizer__drop-zone {
|
|
29
66
|
background: rgba($gray-400, 0.1);
|
|
30
|
-
border: $border-width dotted $gray-300;
|
|
31
67
|
width: 100%;
|
|
32
68
|
height: 100%;
|
|
69
|
+
grid-column: 1;
|
|
70
|
+
grid-row: 1;
|
|
33
71
|
|
|
34
72
|
// Make drop zone 8x8 at minimum so that it's easier to drag into. This will overflow the parent.
|
|
35
73
|
min-width: $grid-unit-10;
|
|
36
74
|
min-height: $grid-unit-10;
|
|
37
|
-
|
|
38
|
-
&.is-highlighted {
|
|
39
|
-
background: var(--wp-admin-theme-color);
|
|
40
|
-
}
|
|
41
75
|
}
|
|
42
76
|
|
|
43
77
|
.block-editor-grid-item-resizer {
|
|
@@ -61,3 +95,4 @@
|
|
|
61
95
|
}
|
|
62
96
|
}
|
|
63
97
|
}
|
|
98
|
+
|