@wordpress/block-editor 13.1.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 +21 -17
- package/README.md +1 -2
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/modal.js +67 -67
- package/build/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +193 -127
- 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 +25 -9
- 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 +94 -0
- package/build/components/grid/grid-item-movers.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
- package/build/components/grid/grid-item-resizer.js.map +1 -0
- package/build/components/grid/grid-visualizer.js +305 -0
- package/build/components/grid/grid-visualizer.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/index.js +14 -0
- package/build/components/grid/index.js.map +1 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build/components/grid/use-grid-layout-sync.js +169 -0
- package/build/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build/components/grid/utils.js +145 -0
- package/build/components/grid/utils.js.map +1 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +14 -0
- package/build/components/rich-text/native/index.native.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 +195 -11
- 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 +65 -40
- 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 +5 -2
- 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 +92 -76
- package/build/layouts/grid.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +17 -1
- package/build/store/actions.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/modal.js +67 -67
- package/build-module/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +194 -128
- 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 +25 -9
- 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 +87 -0
- package/build-module/components/grid/grid-item-movers.js.map +1 -0
- package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
- package/build-module/components/grid/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid/grid-visualizer.js +297 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -0
- package/build-module/components/grid/index.js +5 -0
- package/build-module/components/grid/index.js.map +1 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build-module/components/grid/use-grid-layout-sync.js +162 -0
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build-module/components/grid/utils.js +131 -0
- package/build-module/components/grid/utils.js.map +1 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -5
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +14 -0
- package/build-module/components/rich-text/native/index.native.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 +193 -11
- 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 +63 -38
- 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 +5 -2
- 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 +92 -76
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.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/actions.js +17 -1
- package/build-module/store/actions.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 +238 -106
- package/build-style/style.css +238 -106
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/modal.js +95 -82
- package/src/components/block-lock/style.scss +11 -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 +37 -24
- 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 +4 -1
- 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 +243 -160
- 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/test/use-global-styles-output.js +38 -3
- 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 +25 -9
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +112 -0
- package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +15 -52
- package/src/components/grid/grid-visualizer.js +384 -0
- package/src/components/grid/index.js +4 -0
- package/src/components/grid/style.scss +98 -0
- package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
- package/src/components/grid/use-grid-layout-sync.js +170 -0
- package/src/components/grid/utils.js +178 -0
- package/src/components/iframe/content.scss +1 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/src/components/inner-blocks/index.js +4 -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/rich-text/event-listeners/input-rules.js +1 -1
- package/src/components/rich-text/index.native.js +10 -8
- package/src/components/rich-text/native/index.native.js +17 -0
- 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 +226 -9
- 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 +75 -39
- 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 +5 -1
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +175 -88
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +12 -1
- package/src/store/actions.js +21 -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 +2 -2
- 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/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build/components/grid-visualizer/grid-visualizer.js +0 -92
- package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build/components/grid-visualizer/index.js.map +0 -1
- package/build/components/grid-visualizer/utils.js +0 -10
- package/build/components/grid-visualizer/utils.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build-module/components/grid-visualizer/index.js +0 -3
- package/build-module/components/grid-visualizer/index.js.map +0 -1
- package/build-module/components/grid-visualizer/utils.js +0 -4
- package/build-module/components/grid-visualizer/utils.js.map +0 -1
- package/src/components/grid-visualizer/grid-visualizer.js +0 -101
- package/src/components/grid-visualizer/index.js +0 -2
- package/src/components/grid-visualizer/style.scss +0 -34
- package/src/components/grid-visualizer/utils.js +0 -5
- package/src/hooks/position.scss +0 -18
- /package/src/components/font-sizes/{README.MD → README.md} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
5
|
+
import { addFilter } from '@wordpress/hooks';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { GridVisualizer, useGridLayoutSync } from '../components/grid';
|
|
12
|
+
import { store as blockEditorStore } from '../store';
|
|
13
|
+
|
|
14
|
+
function GridLayoutSync( props ) {
|
|
15
|
+
useGridLayoutSync( props );
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function GridTools( { clientId, layout } ) {
|
|
19
|
+
const { isSelected, isDragging } = useSelect( ( select ) => {
|
|
20
|
+
const { isBlockSelected, isDraggingBlocks } =
|
|
21
|
+
select( blockEditorStore );
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
isSelected: isBlockSelected( clientId ),
|
|
25
|
+
isDragging: isDraggingBlocks(),
|
|
26
|
+
};
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
if ( ! isSelected && ! isDragging ) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
36
|
+
<GridLayoutSync clientId={ clientId } />
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
42
|
+
( BlockEdit ) => ( props ) => {
|
|
43
|
+
if ( props.attributes.layout?.type !== 'grid' ) {
|
|
44
|
+
return <BlockEdit { ...props } />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<GridTools
|
|
50
|
+
clientId={ props.clientId }
|
|
51
|
+
layout={ props.attributes.layout }
|
|
52
|
+
/>
|
|
53
|
+
<BlockEdit { ...props } />
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
'addGridVisualizerToBlockEdit'
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
addFilter(
|
|
61
|
+
'editor.BlockEdit',
|
|
62
|
+
'core/editor/grid-visualizer',
|
|
63
|
+
addGridVisualizerToBlockEdit
|
|
64
|
+
);
|
package/src/hooks/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import blockHooks from './block-hooks';
|
|
|
33
33
|
import blockBindingsPanel from './block-bindings';
|
|
34
34
|
import './block-renaming';
|
|
35
35
|
import './use-bindings-attributes';
|
|
36
|
+
import './grid-visualizer';
|
|
36
37
|
|
|
37
38
|
createBlockEditFilter(
|
|
38
39
|
[
|
|
@@ -87,4 +88,6 @@ export { getSpacingClassesAndStyles } from './use-spacing-props';
|
|
|
87
88
|
export { getTypographyClassesAndStyles } from './use-typography-props';
|
|
88
89
|
export { getGapCSSValue } from './gap';
|
|
89
90
|
export { useCachedTruthy } from './use-cached-truthy';
|
|
91
|
+
export { setBackgroundStyleDefaults } from './background';
|
|
90
92
|
export { useZoomOut } from './use-zoom-out';
|
|
93
|
+
export { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation';
|
|
@@ -11,7 +11,11 @@ import { useState } from '@wordpress/element';
|
|
|
11
11
|
import { store as blockEditorStore } from '../store';
|
|
12
12
|
import { useStyleOverride } from './utils';
|
|
13
13
|
import { useLayout } from '../components/block-list/layout';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
GridVisualizer,
|
|
16
|
+
GridItemResizer,
|
|
17
|
+
GridItemMovers,
|
|
18
|
+
} from '../components/grid';
|
|
15
19
|
|
|
16
20
|
function useBlockPropsChildLayoutStyles( { style } ) {
|
|
17
21
|
const shouldRenderChildLayoutStyles = useSelect( ( select ) => {
|
|
@@ -31,6 +35,23 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
31
35
|
const id = useInstanceId( useBlockPropsChildLayoutStyles );
|
|
32
36
|
const selector = `.wp-container-content-${ id }`;
|
|
33
37
|
|
|
38
|
+
// Check that the grid layout attributes are of the correct type, so that we don't accidentally
|
|
39
|
+
// write code that stores a string attribute instead of a number.
|
|
40
|
+
if ( process.env.NODE_ENV === 'development' ) {
|
|
41
|
+
if ( columnStart && typeof columnStart !== 'number' ) {
|
|
42
|
+
throw new Error( 'columnStart must be a number' );
|
|
43
|
+
}
|
|
44
|
+
if ( rowStart && typeof rowStart !== 'number' ) {
|
|
45
|
+
throw new Error( 'rowStart must be a number' );
|
|
46
|
+
}
|
|
47
|
+
if ( columnSpan && typeof columnSpan !== 'number' ) {
|
|
48
|
+
throw new Error( 'columnSpan must be a number' );
|
|
49
|
+
}
|
|
50
|
+
if ( rowSpan && typeof rowSpan !== 'number' ) {
|
|
51
|
+
throw new Error( 'rowSpan must be a number' );
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
34
55
|
let css = '';
|
|
35
56
|
if ( shouldRenderChildLayoutStyles ) {
|
|
36
57
|
if ( selfStretch === 'fixed' && flexSize ) {
|
|
@@ -55,6 +76,19 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
55
76
|
grid-column: span ${ columnSpan };
|
|
56
77
|
}`;
|
|
57
78
|
}
|
|
79
|
+
if ( rowStart && rowSpan ) {
|
|
80
|
+
css += `${ selector } {
|
|
81
|
+
grid-row: ${ rowStart } / span ${ rowSpan };
|
|
82
|
+
}`;
|
|
83
|
+
} else if ( rowStart ) {
|
|
84
|
+
css += `${ selector } {
|
|
85
|
+
grid-row: ${ rowStart };
|
|
86
|
+
}`;
|
|
87
|
+
} else if ( rowSpan ) {
|
|
88
|
+
css += `${ selector } {
|
|
89
|
+
grid-row: span ${ rowSpan };
|
|
90
|
+
}`;
|
|
91
|
+
}
|
|
58
92
|
/**
|
|
59
93
|
* If minimumColumnWidth is set on the parent, or if no
|
|
60
94
|
* columnCount is set, the grid is responsive so a
|
|
@@ -64,16 +98,6 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
64
98
|
( columnSpan || columnStart ) &&
|
|
65
99
|
( minimumColumnWidth || ! columnCount )
|
|
66
100
|
) {
|
|
67
|
-
// Check if columnSpan and columnStart are numbers so Math.max doesn't break.
|
|
68
|
-
const columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;
|
|
69
|
-
const columnStartNumber = columnStart
|
|
70
|
-
? parseInt( columnStart )
|
|
71
|
-
: null;
|
|
72
|
-
const highestNumber = Math.max(
|
|
73
|
-
columnSpanNumber,
|
|
74
|
-
columnStartNumber
|
|
75
|
-
);
|
|
76
|
-
|
|
77
101
|
let parentColumnValue = parseFloat( minimumColumnWidth );
|
|
78
102
|
/**
|
|
79
103
|
* 12rem is the default minimumColumnWidth value.
|
|
@@ -95,32 +119,29 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
95
119
|
parentColumnUnit = 'rem';
|
|
96
120
|
}
|
|
97
121
|
|
|
122
|
+
const highestNumber = Math.max( columnSpan, columnStart );
|
|
98
123
|
const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
|
|
99
124
|
const containerQueryValue =
|
|
100
125
|
highestNumber * parentColumnValue +
|
|
101
126
|
( highestNumber - 1 ) * defaultGapValue;
|
|
127
|
+
// For blocks that only span one column, we want to remove any rowStart values as
|
|
128
|
+
// the container reduces in size, so that blocks are still arranged in markup order.
|
|
129
|
+
const minimumContainerQueryValue =
|
|
130
|
+
parentColumnValue * 2 + defaultGapValue - 1;
|
|
102
131
|
// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.
|
|
103
|
-
const gridColumnValue =
|
|
132
|
+
const gridColumnValue =
|
|
133
|
+
columnSpan && columnSpan > 1 ? '1/-1' : 'auto';
|
|
104
134
|
|
|
105
|
-
css += `@container (max-width: ${
|
|
135
|
+
css += `@container (max-width: ${ Math.max(
|
|
136
|
+
containerQueryValue,
|
|
137
|
+
minimumContainerQueryValue
|
|
138
|
+
) }${ parentColumnUnit }) {
|
|
106
139
|
${ selector } {
|
|
107
140
|
grid-column: ${ gridColumnValue };
|
|
141
|
+
grid-row: auto;
|
|
108
142
|
}
|
|
109
143
|
}`;
|
|
110
144
|
}
|
|
111
|
-
if ( rowStart && rowSpan ) {
|
|
112
|
-
css += `${ selector } {
|
|
113
|
-
grid-row: ${ rowStart } / span ${ rowSpan };
|
|
114
|
-
}`;
|
|
115
|
-
} else if ( rowStart ) {
|
|
116
|
-
css += `${ selector } {
|
|
117
|
-
grid-row: ${ rowStart };
|
|
118
|
-
}`;
|
|
119
|
-
} else if ( rowSpan ) {
|
|
120
|
-
css += `${ selector } {
|
|
121
|
-
grid-row: span ${ rowSpan };
|
|
122
|
-
}`;
|
|
123
|
-
}
|
|
124
145
|
}
|
|
125
146
|
|
|
126
147
|
useStyleOverride( { css } );
|
|
@@ -135,10 +156,12 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
function ChildLayoutControlsPure( { clientId, style, setAttributes } ) {
|
|
159
|
+
const parentLayout = useLayout() || {};
|
|
138
160
|
const {
|
|
139
161
|
type: parentLayoutType = 'default',
|
|
140
162
|
allowSizingOnChildren = false,
|
|
141
|
-
|
|
163
|
+
isManualPlacement,
|
|
164
|
+
} = parentLayout;
|
|
142
165
|
|
|
143
166
|
const rootClientId = useSelect(
|
|
144
167
|
( select ) => {
|
|
@@ -154,31 +177,44 @@ function ChildLayoutControlsPure( { clientId, style, setAttributes } ) {
|
|
|
154
177
|
return null;
|
|
155
178
|
}
|
|
156
179
|
|
|
180
|
+
function updateLayout( layout ) {
|
|
181
|
+
setAttributes( {
|
|
182
|
+
style: {
|
|
183
|
+
...style,
|
|
184
|
+
layout: {
|
|
185
|
+
...style?.layout,
|
|
186
|
+
...layout,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
} );
|
|
190
|
+
}
|
|
191
|
+
|
|
157
192
|
return (
|
|
158
193
|
<>
|
|
159
194
|
<GridVisualizer
|
|
160
195
|
clientId={ rootClientId }
|
|
161
196
|
contentRef={ setResizerBounds }
|
|
197
|
+
parentLayout={ parentLayout }
|
|
162
198
|
/>
|
|
163
199
|
{ allowSizingOnChildren && (
|
|
164
200
|
<GridItemResizer
|
|
165
201
|
clientId={ clientId }
|
|
166
202
|
// Don't allow resizing beyond the grid visualizer.
|
|
167
203
|
bounds={ resizerBounds }
|
|
168
|
-
onChange={
|
|
169
|
-
|
|
170
|
-
style: {
|
|
171
|
-
...style,
|
|
172
|
-
layout: {
|
|
173
|
-
...style?.layout,
|
|
174
|
-
columnSpan,
|
|
175
|
-
rowSpan,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
} );
|
|
179
|
-
} }
|
|
204
|
+
onChange={ updateLayout }
|
|
205
|
+
parentLayout={ parentLayout }
|
|
180
206
|
/>
|
|
181
207
|
) }
|
|
208
|
+
{ isManualPlacement &&
|
|
209
|
+
window.__experimentalEnableGridInteractivity && (
|
|
210
|
+
<GridItemMovers
|
|
211
|
+
layout={ style?.layout }
|
|
212
|
+
parentLayout={ parentLayout }
|
|
213
|
+
onChange={ updateLayout }
|
|
214
|
+
gridClientId={ rootClientId }
|
|
215
|
+
blockClientId={ clientId }
|
|
216
|
+
/>
|
|
217
|
+
) }
|
|
182
218
|
</>
|
|
183
219
|
);
|
|
184
220
|
}
|
package/src/hooks/position.js
CHANGED
|
@@ -26,25 +26,22 @@ import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
|
26
26
|
import { unlock } from '../lock-unlock';
|
|
27
27
|
import { store as blockEditorStore } from '../store';
|
|
28
28
|
|
|
29
|
-
const { CustomSelectControl } = unlock(
|
|
29
|
+
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
30
|
+
componentsPrivateApis
|
|
31
|
+
);
|
|
30
32
|
|
|
31
33
|
const POSITION_SUPPORT_KEY = 'position';
|
|
32
34
|
|
|
33
|
-
const OPTION_CLASSNAME =
|
|
34
|
-
'block-editor-hooks__position-selection__select-control__option';
|
|
35
|
-
|
|
36
35
|
const DEFAULT_OPTION = {
|
|
37
36
|
key: 'default',
|
|
38
37
|
value: '',
|
|
39
38
|
name: __( 'Default' ),
|
|
40
|
-
className: OPTION_CLASSNAME,
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
const STICKY_OPTION = {
|
|
44
42
|
key: 'sticky',
|
|
45
43
|
value: 'sticky',
|
|
46
44
|
name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
|
|
47
|
-
className: OPTION_CLASSNAME,
|
|
48
45
|
__experimentalHint: __(
|
|
49
46
|
'The block will stick to the top of the window instead of scrolling.'
|
|
50
47
|
),
|
|
@@ -54,7 +51,6 @@ const FIXED_OPTION = {
|
|
|
54
51
|
key: 'fixed',
|
|
55
52
|
value: 'fixed',
|
|
56
53
|
name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
|
|
57
|
-
className: OPTION_CLASSNAME,
|
|
58
54
|
__experimentalHint: __(
|
|
59
55
|
'The block will not move when the page is scrolled.'
|
|
60
56
|
),
|
|
@@ -283,13 +279,11 @@ export function PositionPanelPure( {
|
|
|
283
279
|
options.length > 1 ? (
|
|
284
280
|
<InspectorControls group="position">
|
|
285
281
|
<BaseControl
|
|
286
|
-
className="block-editor-hooks__position-selection"
|
|
287
282
|
__nextHasNoMarginBottom
|
|
288
283
|
help={ stickyHelpText }
|
|
289
284
|
>
|
|
290
285
|
<CustomSelectControl
|
|
291
286
|
__next40pxDefaultSize
|
|
292
|
-
className="block-editor-hooks__position-selection__select-control"
|
|
293
287
|
label={ __( 'Position' ) }
|
|
294
288
|
hideLabelFromVision
|
|
295
289
|
describedBy={ sprintf(
|
|
@@ -299,7 +293,6 @@ export function PositionPanelPure( {
|
|
|
299
293
|
) }
|
|
300
294
|
options={ options }
|
|
301
295
|
value={ selectedOption }
|
|
302
|
-
__experimentalShowSelectedHint
|
|
303
296
|
onChange={ ( { selectedItem } ) => {
|
|
304
297
|
onChangeType( selectedItem.value );
|
|
305
298
|
} }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getVariationStylesWithRefValues } from '../block-style-variation';
|
|
5
|
+
|
|
6
|
+
describe( 'getVariationStylesWithRefValues', () => {
|
|
7
|
+
it( 'should resolve ref values correctly', () => {
|
|
8
|
+
const globalStyles = {
|
|
9
|
+
styles: {
|
|
10
|
+
color: { background: 'red' },
|
|
11
|
+
blocks: {
|
|
12
|
+
'core/heading': {
|
|
13
|
+
color: { text: 'blue' },
|
|
14
|
+
},
|
|
15
|
+
'core/group': {
|
|
16
|
+
variations: {
|
|
17
|
+
custom: {
|
|
18
|
+
color: {
|
|
19
|
+
text: { ref: 'styles.does-not-exist' },
|
|
20
|
+
background: {
|
|
21
|
+
ref: 'styles.color.background',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
blocks: {
|
|
25
|
+
'core/heading': {
|
|
26
|
+
color: {
|
|
27
|
+
text: {
|
|
28
|
+
ref: 'styles.blocks.core/heading.color.text',
|
|
29
|
+
},
|
|
30
|
+
background: { ref: '' },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
elements: {
|
|
35
|
+
link: {
|
|
36
|
+
color: {
|
|
37
|
+
text: {
|
|
38
|
+
ref: 'styles.elements.link.color.text',
|
|
39
|
+
},
|
|
40
|
+
background: { ref: undefined },
|
|
41
|
+
},
|
|
42
|
+
':hover': {
|
|
43
|
+
color: {
|
|
44
|
+
text: {
|
|
45
|
+
ref: 'styles.elements.link.:hover.color.text',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
elements: {
|
|
56
|
+
link: {
|
|
57
|
+
color: { text: 'green' },
|
|
58
|
+
':hover': {
|
|
59
|
+
color: { text: 'yellow' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
expect(
|
|
67
|
+
getVariationStylesWithRefValues(
|
|
68
|
+
globalStyles,
|
|
69
|
+
'core/group',
|
|
70
|
+
'custom'
|
|
71
|
+
)
|
|
72
|
+
).toEqual( {
|
|
73
|
+
color: { background: 'red' },
|
|
74
|
+
blocks: {
|
|
75
|
+
'core/heading': {
|
|
76
|
+
color: { text: 'blue' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
elements: {
|
|
80
|
+
link: {
|
|
81
|
+
color: {
|
|
82
|
+
text: 'green',
|
|
83
|
+
},
|
|
84
|
+
':hover': {
|
|
85
|
+
color: { text: 'yellow' },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
} );
|
|
90
|
+
} );
|
|
91
|
+
} );
|
|
@@ -97,6 +97,7 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
97
97
|
unlock( select( blocksStore ) ).getAllBlockBindingsSources()
|
|
98
98
|
);
|
|
99
99
|
const { name, clientId, context } = props;
|
|
100
|
+
const hasParentPattern = !! props.context[ 'pattern/overrides' ];
|
|
100
101
|
const hasPatternOverridesDefaultBinding =
|
|
101
102
|
props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]
|
|
102
103
|
?.source === 'core/pattern-overrides';
|
|
@@ -108,6 +109,11 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
108
109
|
),
|
|
109
110
|
[ props.attributes.metadata?.bindings, name ]
|
|
110
111
|
);
|
|
112
|
+
|
|
113
|
+
// While this hook doesn't directly call any selectors, `useSelect` is
|
|
114
|
+
// used purposely here to ensure `boundAttributes` is updated whenever
|
|
115
|
+
// there are attribute updates.
|
|
116
|
+
// `source.getValues` may also call a selector via `registry.select`.
|
|
111
117
|
const boundAttributes = useSelect( () => {
|
|
112
118
|
if ( ! bindings ) {
|
|
113
119
|
return;
|
|
@@ -216,13 +222,20 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
224
|
|
|
219
|
-
// Only apply normal attribute updates to blocks
|
|
220
|
-
// that have partial bindings. Currently this is
|
|
221
|
-
// only skipped for pattern overrides sources.
|
|
222
225
|
if (
|
|
223
|
-
|
|
226
|
+
// Don't update non-connected attributes if the block is using pattern overrides
|
|
227
|
+
// and the editing is happening while overriding the pattern (not editing the original).
|
|
228
|
+
! (
|
|
229
|
+
hasPatternOverridesDefaultBinding &&
|
|
230
|
+
hasParentPattern
|
|
231
|
+
) &&
|
|
224
232
|
Object.keys( keptAttributes ).length
|
|
225
233
|
) {
|
|
234
|
+
// Don't update caption and href until they are supported.
|
|
235
|
+
if ( hasPatternOverridesDefaultBinding ) {
|
|
236
|
+
delete keptAttributes?.caption;
|
|
237
|
+
delete keptAttributes?.href;
|
|
238
|
+
}
|
|
226
239
|
setAttributes( keptAttributes );
|
|
227
240
|
}
|
|
228
241
|
} );
|
|
@@ -236,6 +249,7 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
236
249
|
setAttributes,
|
|
237
250
|
sources,
|
|
238
251
|
hasPatternOverridesDefaultBinding,
|
|
252
|
+
hasParentPattern,
|
|
239
253
|
]
|
|
240
254
|
);
|
|
241
255
|
|
package/src/hooks/utils.js
CHANGED
|
@@ -140,6 +140,7 @@ export function useStyleOverride( {
|
|
|
140
140
|
css,
|
|
141
141
|
assets,
|
|
142
142
|
__unstableType,
|
|
143
|
+
variation,
|
|
143
144
|
clientId,
|
|
144
145
|
} = {} ) {
|
|
145
146
|
const { setStyleOverride, deleteStyleOverride } = unlock(
|
|
@@ -159,6 +160,7 @@ export function useStyleOverride( {
|
|
|
159
160
|
css,
|
|
160
161
|
assets,
|
|
161
162
|
__unstableType,
|
|
163
|
+
variation,
|
|
162
164
|
clientId,
|
|
163
165
|
};
|
|
164
166
|
// Batch updates to style overrides to avoid triggering cascading renders
|
|
@@ -582,6 +584,7 @@ export function createBlockListBlockFilter( features ) {
|
|
|
582
584
|
hasSupport,
|
|
583
585
|
attributeKeys = [],
|
|
584
586
|
useBlockProps,
|
|
587
|
+
isMatch,
|
|
585
588
|
} = feature;
|
|
586
589
|
|
|
587
590
|
const neededProps = {};
|
|
@@ -595,7 +598,8 @@ export function createBlockListBlockFilter( features ) {
|
|
|
595
598
|
// Skip rendering if none of the needed attributes are
|
|
596
599
|
// set.
|
|
597
600
|
! Object.keys( neededProps ).length ||
|
|
598
|
-
! hasSupport( props.name )
|
|
601
|
+
! hasSupport( props.name ) ||
|
|
602
|
+
( isMatch && ! isMatch( neededProps ) )
|
|
599
603
|
) {
|
|
600
604
|
return null;
|
|
601
605
|
}
|
|
@@ -24,6 +24,7 @@ import { getCSSRules } from '@wordpress/style-engine';
|
|
|
24
24
|
import { useSettings } from '../components/use-settings';
|
|
25
25
|
import { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';
|
|
26
26
|
import { getGapCSSValue } from '../hooks/gap';
|
|
27
|
+
import { BlockControls, JustifyContentControl } from '../components';
|
|
27
28
|
import { shouldSkipSerialization } from '../hooks/utils';
|
|
28
29
|
import { LAYOUT_DEFINITIONS } from './definitions';
|
|
29
30
|
|
|
@@ -146,8 +147,24 @@ export default {
|
|
|
146
147
|
</>
|
|
147
148
|
);
|
|
148
149
|
},
|
|
149
|
-
toolBarControls: function DefaultLayoutToolbarControls(
|
|
150
|
-
|
|
150
|
+
toolBarControls: function DefaultLayoutToolbarControls( {
|
|
151
|
+
layout = {},
|
|
152
|
+
onChange,
|
|
153
|
+
layoutBlockSupport,
|
|
154
|
+
} ) {
|
|
155
|
+
const { allowJustification = true } = layoutBlockSupport;
|
|
156
|
+
|
|
157
|
+
if ( ! allowJustification ) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return (
|
|
161
|
+
<BlockControls group="block" __experimentalShareWithChildBlocks>
|
|
162
|
+
<DefaultLayoutJustifyContentControl
|
|
163
|
+
layout={ layout }
|
|
164
|
+
onChange={ onChange }
|
|
165
|
+
/>
|
|
166
|
+
</BlockControls>
|
|
167
|
+
);
|
|
151
168
|
},
|
|
152
169
|
getLayoutStyle: function getLayoutStyle( {
|
|
153
170
|
selector,
|
|
@@ -278,3 +295,27 @@ export default {
|
|
|
278
295
|
return alignments;
|
|
279
296
|
},
|
|
280
297
|
};
|
|
298
|
+
|
|
299
|
+
const POPOVER_PROPS = {
|
|
300
|
+
placement: 'bottom-start',
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
function DefaultLayoutJustifyContentControl( { layout, onChange } ) {
|
|
304
|
+
const { justifyContent = 'center' } = layout;
|
|
305
|
+
const onJustificationChange = ( value ) => {
|
|
306
|
+
onChange( {
|
|
307
|
+
...layout,
|
|
308
|
+
justifyContent: value,
|
|
309
|
+
} );
|
|
310
|
+
};
|
|
311
|
+
const allowedControls = [ 'left', 'center', 'right' ];
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<JustifyContentControl
|
|
315
|
+
allowedControls={ allowedControls }
|
|
316
|
+
value={ justifyContent }
|
|
317
|
+
onChange={ onJustificationChange }
|
|
318
|
+
popoverProps={ POPOVER_PROPS }
|
|
319
|
+
/>
|
|
320
|
+
);
|
|
321
|
+
}
|