@wordpress/block-editor 13.3.0 → 14.0.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 +13 -0
- package/README.md +11 -5
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +3 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -2
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +26 -27
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/index.js +1 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-popover/cover.js +1 -1
- package/build/components/block-popover/cover.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +5 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +7 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +35 -36
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +2 -1
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +1 -2
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/child-layout-control/index.js +3 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -11
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/dimensions-tool/scale-tool.js +1 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -7
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +12 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +63 -52
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +1 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -59
- package/build/components/global-styles/theme-file-uri-utils.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +26 -44
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +78 -7
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +82 -44
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +96 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +93 -44
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +14 -15
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +2 -2
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +93 -45
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/iframe/index.js +4 -8
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +1 -9
- package/build/components/index.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/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +29 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +3 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/line-height-control/index.js +0 -15
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +1 -0
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -2
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/button.js +0 -1
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +1 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +0 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +30 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +3 -6
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -3
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -1
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/block-bindings.js +248 -36
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -0
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +6 -6
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +3 -3
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +5 -8
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/index.js +7 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +9 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/line-height.js +0 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +3 -7
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +85 -50
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +1 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +20 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +27 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +17 -5
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-editor-region.js +1 -1
- package/build/utils/get-editor-region.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +1 -1
- package/build/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +3 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +27 -30
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-popover/cover.js +1 -1
- package/build-module/components/block-popover/cover.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +5 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +7 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +37 -38
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +1 -2
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +3 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -12
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/scale-tool.js +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -6
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +11 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +63 -52
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -58
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +27 -45
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +76 -7
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +81 -43
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +92 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +96 -46
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +14 -15
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +2 -2
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +94 -46
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.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/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +30 -3
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +3 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/line-height-control/index.js +0 -14
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +1 -0
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +5 -3
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/button.js +0 -1
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +0 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +30 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -6
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -3
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/block-bindings.js +253 -40
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +1 -0
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +3 -3
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +7 -7
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +5 -8
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +9 -2
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/position.js +3 -7
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +84 -51
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +1 -1
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +19 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +1 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +24 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +14 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-editor-region.js +1 -1
- package/build-module/utils/get-editor-region.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-style/content-rtl.css +11 -18
- package/build-style/content.css +11 -18
- package/build-style/default-editor-styles-rtl.css +3 -0
- package/build-style/default-editor-styles.css +3 -0
- package/build-style/style-rtl.css +242 -136
- package/build-style/style.css +242 -136
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/autocompleters/style.scss +4 -0
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-breadcrumb/index.js +4 -2
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-draggable/index.js +3 -3
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +30 -30
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-mover/index.js +5 -2
- package/src/components/block-patterns-paging/style.scss +0 -23
- package/src/components/block-popover/cover.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +1 -1
- package/src/components/block-removal-warning-modal/index.js +10 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-toolbar/shuffle.js +8 -1
- package/src/components/block-tools/block-selection-button.js +1 -2
- package/src/components/block-tools/index.js +5 -6
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/use-show-block-tools.js +12 -9
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +48 -42
- package/src/components/block-tools/zoom-out-popover.js +1 -0
- package/src/components/block-tools/zoom-out-toolbar.js +1 -2
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/index.js +2 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/colors-gradients/test/control.js +3 -2
- package/src/components/date-format-picker/index.js +2 -11
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-appearance-control/index.js +1 -5
- package/src/components/font-family/README.md +8 -0
- package/src/components/font-family/index.js +16 -0
- package/src/components/font-family/stories/index.story.js +54 -0
- package/src/components/global-styles/background-panel.js +90 -62
- package/src/components/global-styles/hooks.js +5 -1
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/style.scss +11 -9
- package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
- package/src/components/global-styles/test/typography-utils.js +325 -0
- package/src/components/global-styles/test/use-global-styles-output.js +52 -5
- package/src/components/global-styles/test/utils.js +120 -0
- package/src/components/global-styles/theme-file-uri-utils.js +0 -59
- package/src/components/global-styles/typography-panel.js +36 -45
- package/src/components/global-styles/typography-utils.js +103 -7
- package/src/components/global-styles/use-global-styles-output.js +89 -50
- package/src/components/global-styles/utils.js +112 -0
- package/src/components/grid/grid-item-movers.js +141 -69
- package/src/components/grid/grid-item-resizer.js +11 -17
- package/src/components/grid/grid-visualizer.js +2 -2
- package/src/components/grid/style.scss +164 -0
- package/src/components/grid/use-grid-layout-sync.js +133 -40
- package/src/components/iframe/content.scss +3 -3
- package/src/components/iframe/index.js +3 -7
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +3 -3
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/style.scss +66 -47
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- package/src/components/line-height-control/README.md +0 -8
- package/src/components/line-height-control/index.js +1 -21
- package/src/components/line-height-control/stories/index.story.js +0 -1
- package/src/components/line-height-control/test/index.js +1 -7
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +3 -1
- package/src/components/resolution-tool/index.js +1 -0
- package/src/components/responsive-block-control/test/index.js +5 -1
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -7
- package/src/components/tabbed-sidebar/style.scss +1 -19
- package/src/components/url-input/README.md +0 -5
- package/src/components/url-input/button.js +0 -1
- package/src/components/url-input/index.js +1 -15
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/url-popover/link-editor.js +0 -1
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/use-block-drop-zone/index.js +66 -14
- package/src/components/use-on-block-drop/index.js +1 -9
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +2 -1
- package/src/hooks/block-bindings.js +303 -52
- package/src/hooks/block-bindings.scss +13 -2
- package/src/hooks/block-hooks.js +1 -0
- package/src/hooks/block-hooks.scss +1 -0
- package/src/hooks/block-style-variation.js +3 -3
- package/src/hooks/contrast-checker.js +7 -7
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/grid-visualizer.js +5 -7
- package/src/hooks/index.js +2 -1
- package/src/hooks/layout-child.js +12 -3
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/position.js +3 -13
- package/src/hooks/spacing-visualizer.js +1 -1
- package/src/hooks/use-bindings-attributes.js +93 -59
- package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
- package/src/hooks/use-zoom-out.js +1 -1
- package/src/hooks/utils.js +14 -1
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +10 -2
- package/src/layouts/grid.js +2 -0
- package/src/private-apis.js +1 -8
- package/src/store/actions.js +28 -5
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +14 -4
- package/src/style.scss +1 -1
- package/src/utils/get-editor-region.js +1 -1
- package/src/utils/get-px-from-css-unit.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
package/src/hooks/block-hooks.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* we need to right-align the toggle.
|
|
5
5
|
*/
|
|
6
6
|
.components-toggle-control .components-h-stack {
|
|
7
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
|
|
7
8
|
flex-direction: row-reverse;
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
toStyles,
|
|
14
14
|
getBlockSelectors,
|
|
15
15
|
} from '../components/global-styles';
|
|
16
|
-
import {
|
|
16
|
+
import { usePrivateStyleOverride } from './utils';
|
|
17
17
|
import { getValueFromObjectPath } from '../utils/object';
|
|
18
18
|
import { store as blockEditorStore } from '../store';
|
|
19
19
|
import { globalStylesDataKey } from '../store/private-keys';
|
|
@@ -63,7 +63,7 @@ function getVariationNameFromClass( className, registeredStyles = [] ) {
|
|
|
63
63
|
|
|
64
64
|
// A helper component to apply a style override using the useStyleOverride hook.
|
|
65
65
|
function OverrideStyles( { override } ) {
|
|
66
|
-
|
|
66
|
+
usePrivateStyleOverride( override );
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -351,7 +351,7 @@ function useBlockProps( { name, className, clientId } ) {
|
|
|
351
351
|
);
|
|
352
352
|
}, [ variation, settings, styles, getBlockStyles, clientId ] );
|
|
353
353
|
|
|
354
|
-
|
|
354
|
+
usePrivateStyleOverride( {
|
|
355
355
|
id: `variation-${ clientId }`,
|
|
356
356
|
css: variationStyles,
|
|
357
357
|
__unstableType: 'variation',
|
|
@@ -7,7 +7,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import ContrastChecker from '../components/contrast-checker';
|
|
10
|
-
import {
|
|
10
|
+
import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
11
11
|
|
|
12
12
|
function getComputedStyle( node ) {
|
|
13
13
|
return node.ownerDocument.defaultView.getComputedStyle( node );
|
|
@@ -17,23 +17,23 @@ export default function BlockColorContrastChecker( { clientId } ) {
|
|
|
17
17
|
const [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();
|
|
18
18
|
const [ detectedColor, setDetectedColor ] = useState();
|
|
19
19
|
const [ detectedLinkColor, setDetectedLinkColor ] = useState();
|
|
20
|
-
const
|
|
20
|
+
const blockEl = useBlockElement( clientId );
|
|
21
21
|
|
|
22
22
|
// There are so many things that can change the color of a block
|
|
23
23
|
// So we perform this check on every render.
|
|
24
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
25
|
useEffect( () => {
|
|
26
|
-
if ( !
|
|
26
|
+
if ( ! blockEl ) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
setDetectedColor( getComputedStyle(
|
|
29
|
+
setDetectedColor( getComputedStyle( blockEl ).color );
|
|
30
30
|
|
|
31
|
-
const firstLinkElement =
|
|
31
|
+
const firstLinkElement = blockEl.querySelector( 'a' );
|
|
32
32
|
if ( firstLinkElement && !! firstLinkElement.innerText ) {
|
|
33
33
|
setDetectedLinkColor( getComputedStyle( firstLinkElement ).color );
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
let backgroundColorNode =
|
|
36
|
+
let backgroundColorNode = blockEl;
|
|
37
37
|
let backgroundColor =
|
|
38
38
|
getComputedStyle( backgroundColorNode ).backgroundColor;
|
|
39
39
|
while (
|
|
@@ -48,7 +48,7 @@ export default function BlockColorContrastChecker( { clientId } ) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
setDetectedBackgroundColor( backgroundColor );
|
|
51
|
-
} );
|
|
51
|
+
}, [ blockEl ] );
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
54
|
<ContrastChecker
|
package/src/hooks/duotone.js
CHANGED
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
} from '../components/duotone/utils';
|
|
33
33
|
import { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';
|
|
34
34
|
import { scopeSelector } from '../components/global-styles/utils';
|
|
35
|
-
import { useBlockSettings,
|
|
35
|
+
import { useBlockSettings, usePrivateStyleOverride } from './utils';
|
|
36
36
|
import { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';
|
|
37
37
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
38
|
-
import {
|
|
38
|
+
import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
39
39
|
|
|
40
40
|
const EMPTY_ARRAY = [];
|
|
41
41
|
|
|
@@ -265,7 +265,7 @@ function useDuotoneStyles( {
|
|
|
265
265
|
|
|
266
266
|
const isValidFilter = Array.isArray( colors ) || colors === 'unset';
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
usePrivateStyleOverride(
|
|
269
269
|
isValidFilter
|
|
270
270
|
? {
|
|
271
271
|
css:
|
|
@@ -276,7 +276,7 @@ function useDuotoneStyles( {
|
|
|
276
276
|
}
|
|
277
277
|
: undefined
|
|
278
278
|
);
|
|
279
|
-
|
|
279
|
+
usePrivateStyleOverride(
|
|
280
280
|
isValidFilter
|
|
281
281
|
? {
|
|
282
282
|
assets:
|
|
@@ -26,14 +26,12 @@ function GridTools( { clientId, layout } ) {
|
|
|
26
26
|
};
|
|
27
27
|
} );
|
|
28
28
|
|
|
29
|
-
if ( ! isSelected && ! isDragging ) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
return (
|
|
34
30
|
<>
|
|
35
|
-
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
36
31
|
<GridLayoutSync clientId={ clientId } />
|
|
32
|
+
{ ( isSelected || isDragging ) && (
|
|
33
|
+
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
34
|
+
) }
|
|
37
35
|
</>
|
|
38
36
|
);
|
|
39
37
|
}
|
|
@@ -41,7 +39,7 @@ function GridTools( { clientId, layout } ) {
|
|
|
41
39
|
const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
42
40
|
( BlockEdit ) => ( props ) => {
|
|
43
41
|
if ( props.attributes.layout?.type !== 'grid' ) {
|
|
44
|
-
return <BlockEdit { ...props } />;
|
|
42
|
+
return <BlockEdit key="edit" { ...props } />;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
return (
|
|
@@ -50,7 +48,7 @@ const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
|
50
48
|
clientId={ props.clientId }
|
|
51
49
|
layout={ props.attributes.layout }
|
|
52
50
|
/>
|
|
53
|
-
<BlockEdit { ...props } />
|
|
51
|
+
<BlockEdit key="edit" { ...props } />
|
|
54
52
|
</>
|
|
55
53
|
);
|
|
56
54
|
},
|
package/src/hooks/index.js
CHANGED
|
@@ -37,7 +37,6 @@ import './grid-visualizer';
|
|
|
37
37
|
|
|
38
38
|
createBlockEditFilter(
|
|
39
39
|
[
|
|
40
|
-
blockBindingsPanel,
|
|
41
40
|
align,
|
|
42
41
|
textAlign,
|
|
43
42
|
anchor,
|
|
@@ -48,6 +47,7 @@ createBlockEditFilter(
|
|
|
48
47
|
layout,
|
|
49
48
|
contentLockUI,
|
|
50
49
|
blockHooks,
|
|
50
|
+
blockBindingsPanel,
|
|
51
51
|
childLayout,
|
|
52
52
|
].filter( Boolean )
|
|
53
53
|
);
|
|
@@ -91,3 +91,4 @@ export { useCachedTruthy } from './use-cached-truthy';
|
|
|
91
91
|
export { setBackgroundStyleDefaults } from './background';
|
|
92
92
|
export { useZoomOut } from './use-zoom-out';
|
|
93
93
|
export { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation';
|
|
94
|
+
export { useStyleOverride } from './utils';
|
|
@@ -119,11 +119,20 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
119
119
|
parentColumnUnit = 'rem';
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
let numColsToBreakAt = 2;
|
|
123
|
+
|
|
124
|
+
if ( columnSpan && columnStart ) {
|
|
125
|
+
numColsToBreakAt = columnSpan + columnStart - 1;
|
|
126
|
+
} else if ( columnSpan ) {
|
|
127
|
+
numColsToBreakAt = columnSpan;
|
|
128
|
+
} else {
|
|
129
|
+
numColsToBreakAt = columnStart;
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
|
|
124
133
|
const containerQueryValue =
|
|
125
|
-
|
|
126
|
-
(
|
|
134
|
+
numColsToBreakAt * parentColumnValue +
|
|
135
|
+
( numColsToBreakAt - 1 ) * defaultGapValue;
|
|
127
136
|
// For blocks that only span one column, we want to remove any rowStart values as
|
|
128
137
|
// the container reduces in size, so that blocks are still arranged in markup order.
|
|
129
138
|
const minimumContainerQueryValue =
|
package/src/hooks/line-height.js
CHANGED
package/src/hooks/position.js
CHANGED
|
@@ -8,10 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
11
|
-
import {
|
|
12
|
-
BaseControl,
|
|
13
|
-
privateApis as componentsPrivateApis,
|
|
14
|
-
} from '@wordpress/components';
|
|
11
|
+
import { BaseControl, CustomSelectControl } from '@wordpress/components';
|
|
15
12
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
13
|
import { useSelect } from '@wordpress/data';
|
|
17
14
|
import { useMemo, Platform } from '@wordpress/element';
|
|
@@ -23,13 +20,8 @@ import { useSettings } from '../components/use-settings';
|
|
|
23
20
|
import InspectorControls from '../components/inspector-controls';
|
|
24
21
|
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
25
22
|
import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
26
|
-
import { unlock } from '../lock-unlock';
|
|
27
23
|
import { store as blockEditorStore } from '../store';
|
|
28
24
|
|
|
29
|
-
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
30
|
-
componentsPrivateApis
|
|
31
|
-
);
|
|
32
|
-
|
|
33
25
|
const POSITION_SUPPORT_KEY = 'position';
|
|
34
26
|
|
|
35
27
|
const DEFAULT_OPTION = {
|
|
@@ -42,7 +34,7 @@ const STICKY_OPTION = {
|
|
|
42
34
|
key: 'sticky',
|
|
43
35
|
value: 'sticky',
|
|
44
36
|
name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
|
|
45
|
-
|
|
37
|
+
hint: __(
|
|
46
38
|
'The block will stick to the top of the window instead of scrolling.'
|
|
47
39
|
),
|
|
48
40
|
};
|
|
@@ -51,9 +43,7 @@ const FIXED_OPTION = {
|
|
|
51
43
|
key: 'fixed',
|
|
52
44
|
value: 'fixed',
|
|
53
45
|
name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
|
|
54
|
-
|
|
55
|
-
'The block will not move when the page is scrolled.'
|
|
56
|
-
),
|
|
46
|
+
hint: __( 'The block will not move when the page is scrolled.' ),
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
const POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];
|
|
@@ -14,7 +14,7 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import BlockPopoverCover from '../components/block-popover/cover';
|
|
17
|
-
import {
|
|
17
|
+
import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
18
18
|
|
|
19
19
|
function SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {
|
|
20
20
|
const blockElement = useBlockElement( clientId );
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
5
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
6
6
|
import { useRegistry, useSelect } from '@wordpress/data';
|
|
7
|
-
import { useCallback, useMemo } from '@wordpress/element';
|
|
7
|
+
import { useCallback, useMemo, useContext } from '@wordpress/element';
|
|
8
8
|
import { addFilter } from '@wordpress/hooks';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { unlock } from '../lock-unlock';
|
|
14
|
+
import BlockContext from '../components/block-context';
|
|
14
15
|
|
|
15
16
|
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
|
|
16
17
|
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
|
|
@@ -90,18 +91,23 @@ export function canBindAttribute( blockName, attributeName ) {
|
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
export function getBindableAttributes( blockName ) {
|
|
95
|
+
return BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];
|
|
96
|
+
}
|
|
97
|
+
|
|
93
98
|
export const withBlockBindingSupport = createHigherOrderComponent(
|
|
94
99
|
( BlockEdit ) => ( props ) => {
|
|
95
100
|
const registry = useRegistry();
|
|
101
|
+
const blockContext = useContext( BlockContext );
|
|
96
102
|
const sources = useSelect( ( select ) =>
|
|
97
103
|
unlock( select( blocksStore ) ).getAllBlockBindingsSources()
|
|
98
104
|
);
|
|
99
|
-
const { name, clientId
|
|
105
|
+
const { name, clientId } = props;
|
|
100
106
|
const hasParentPattern = !! props.context[ 'pattern/overrides' ];
|
|
101
107
|
const hasPatternOverridesDefaultBinding =
|
|
102
108
|
props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ]
|
|
103
109
|
?.source === 'core/pattern-overrides';
|
|
104
|
-
const
|
|
110
|
+
const blockBindings = useMemo(
|
|
105
111
|
() =>
|
|
106
112
|
replacePatternOverrideDefaultBindings(
|
|
107
113
|
name,
|
|
@@ -115,110 +121,138 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
115
121
|
// there are attribute updates.
|
|
116
122
|
// `source.getValues` may also call a selector via `registry.select`.
|
|
117
123
|
const boundAttributes = useSelect( () => {
|
|
118
|
-
if ( !
|
|
124
|
+
if ( ! blockBindings ) {
|
|
119
125
|
return;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
const attributes = {};
|
|
123
129
|
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
const blockBindingsBySource = new Map();
|
|
131
|
+
|
|
132
|
+
for ( const [ attributeName, binding ] of Object.entries(
|
|
133
|
+
blockBindings
|
|
126
134
|
) ) {
|
|
127
|
-
const source
|
|
135
|
+
const { source: sourceName, args: sourceArgs } = binding;
|
|
136
|
+
const source = sources[ sourceName ];
|
|
128
137
|
if (
|
|
129
|
-
! source?.
|
|
138
|
+
! source?.getValues ||
|
|
130
139
|
! canBindAttribute( name, attributeName )
|
|
131
140
|
) {
|
|
132
141
|
continue;
|
|
133
142
|
}
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
blockBindingsBySource.set( source, {
|
|
145
|
+
...blockBindingsBySource.get( source ),
|
|
146
|
+
[ attributeName ]: {
|
|
147
|
+
args: sourceArgs,
|
|
148
|
+
},
|
|
149
|
+
} );
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ( blockBindingsBySource.size ) {
|
|
153
|
+
for ( const [ source, bindings ] of blockBindingsBySource ) {
|
|
154
|
+
// Populate context.
|
|
155
|
+
const context = {};
|
|
156
|
+
|
|
157
|
+
if ( source.usesContext?.length ) {
|
|
158
|
+
for ( const key of source.usesContext ) {
|
|
159
|
+
context[ key ] = blockContext[ key ];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Get values in batch if the source supports it.
|
|
164
|
+
const values = source.getValues( {
|
|
165
|
+
registry,
|
|
166
|
+
context,
|
|
167
|
+
clientId,
|
|
168
|
+
bindings,
|
|
169
|
+
} );
|
|
170
|
+
for ( const [ attributeName, value ] of Object.entries(
|
|
171
|
+
values
|
|
172
|
+
) ) {
|
|
173
|
+
// Use placeholder when value is undefined.
|
|
174
|
+
if ( value === undefined ) {
|
|
175
|
+
if ( attributeName === 'url' ) {
|
|
176
|
+
attributes[ attributeName ] = null;
|
|
177
|
+
} else {
|
|
178
|
+
attributes[ attributeName ] =
|
|
179
|
+
source.getPlaceholder?.( {
|
|
180
|
+
registry,
|
|
181
|
+
context,
|
|
182
|
+
clientId,
|
|
183
|
+
attributeName,
|
|
184
|
+
args: bindings[ attributeName ].args,
|
|
185
|
+
} );
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
attributes[ attributeName ] = value;
|
|
189
|
+
}
|
|
151
190
|
}
|
|
152
191
|
}
|
|
153
192
|
}
|
|
154
193
|
|
|
155
194
|
return attributes;
|
|
156
|
-
}, [
|
|
195
|
+
}, [ blockBindings, name, clientId, blockContext, registry, sources ] );
|
|
157
196
|
|
|
158
197
|
const { setAttributes } = props;
|
|
159
198
|
|
|
160
199
|
const _setAttributes = useCallback(
|
|
161
200
|
( nextAttributes ) => {
|
|
162
201
|
registry.batch( () => {
|
|
163
|
-
if ( !
|
|
202
|
+
if ( ! blockBindings ) {
|
|
164
203
|
setAttributes( nextAttributes );
|
|
165
204
|
return;
|
|
166
205
|
}
|
|
167
206
|
|
|
168
207
|
const keptAttributes = { ...nextAttributes };
|
|
169
|
-
const
|
|
208
|
+
const blockBindingsBySource = new Map();
|
|
170
209
|
|
|
171
210
|
// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.
|
|
172
211
|
for ( const [ attributeName, newValue ] of Object.entries(
|
|
173
212
|
keptAttributes
|
|
174
213
|
) ) {
|
|
175
214
|
if (
|
|
176
|
-
!
|
|
215
|
+
! blockBindings[ attributeName ] ||
|
|
177
216
|
! canBindAttribute( name, attributeName )
|
|
178
217
|
) {
|
|
179
218
|
continue;
|
|
180
219
|
}
|
|
181
220
|
|
|
182
|
-
const binding =
|
|
221
|
+
const binding = blockBindings[ attributeName ];
|
|
183
222
|
const source = sources[ binding?.source ];
|
|
184
|
-
if ( ! source?.
|
|
223
|
+
if ( ! source?.setValues ) {
|
|
185
224
|
continue;
|
|
186
225
|
}
|
|
187
|
-
|
|
188
|
-
...
|
|
189
|
-
[ attributeName ]:
|
|
226
|
+
blockBindingsBySource.set( source, {
|
|
227
|
+
...blockBindingsBySource.get( source ),
|
|
228
|
+
[ attributeName ]: {
|
|
229
|
+
args: binding.args,
|
|
230
|
+
newValue,
|
|
231
|
+
},
|
|
190
232
|
} );
|
|
191
233
|
delete keptAttributes[ attributeName ];
|
|
192
234
|
}
|
|
193
235
|
|
|
194
|
-
if (
|
|
236
|
+
if ( blockBindingsBySource.size ) {
|
|
195
237
|
for ( const [
|
|
196
238
|
source,
|
|
197
|
-
|
|
198
|
-
] of
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
} );
|
|
206
|
-
} else {
|
|
207
|
-
for ( const [
|
|
208
|
-
attributeName,
|
|
209
|
-
value,
|
|
210
|
-
] of Object.entries( attributes ) ) {
|
|
211
|
-
const binding = bindings[ attributeName ];
|
|
212
|
-
source.setValue( {
|
|
213
|
-
registry,
|
|
214
|
-
context,
|
|
215
|
-
clientId,
|
|
216
|
-
attributeName,
|
|
217
|
-
args: binding.args,
|
|
218
|
-
value,
|
|
219
|
-
} );
|
|
239
|
+
bindings,
|
|
240
|
+
] of blockBindingsBySource ) {
|
|
241
|
+
// Populate context.
|
|
242
|
+
const context = {};
|
|
243
|
+
|
|
244
|
+
if ( source.usesContext?.length ) {
|
|
245
|
+
for ( const key of source.usesContext ) {
|
|
246
|
+
context[ key ] = blockContext[ key ];
|
|
220
247
|
}
|
|
221
248
|
}
|
|
249
|
+
|
|
250
|
+
source.setValues( {
|
|
251
|
+
registry,
|
|
252
|
+
context,
|
|
253
|
+
clientId,
|
|
254
|
+
bindings,
|
|
255
|
+
} );
|
|
222
256
|
}
|
|
223
257
|
}
|
|
224
258
|
|
|
@@ -242,10 +276,10 @@ export const withBlockBindingSupport = createHigherOrderComponent(
|
|
|
242
276
|
},
|
|
243
277
|
[
|
|
244
278
|
registry,
|
|
245
|
-
|
|
279
|
+
blockBindings,
|
|
246
280
|
name,
|
|
247
281
|
clientId,
|
|
248
|
-
|
|
282
|
+
blockContext,
|
|
249
283
|
setAttributes,
|
|
250
284
|
sources,
|
|
251
285
|
hasPatternOverridesDefaultBinding,
|
|
@@ -49,5 +49,5 @@ export function useZoomOut( zoomOut = true ) {
|
|
|
49
49
|
) {
|
|
50
50
|
__unstableSetEditorMode( originalEditingMode.current );
|
|
51
51
|
}
|
|
52
|
-
}, [ __unstableSetEditorMode, zoomOut
|
|
52
|
+
}, [ __unstableGetEditorMode, __unstableSetEditorMode, zoomOut ] ); // Mode is deliberately excluded from the dependencies so that the effect does not run when mode changes.
|
|
53
53
|
}
|
package/src/hooks/utils.js
CHANGED
|
@@ -135,7 +135,20 @@ export function shouldSkipSerialization(
|
|
|
135
135
|
|
|
136
136
|
const pendingStyleOverrides = new WeakMap();
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Override a block editor settings style. Leave the ID blank to create a new
|
|
140
|
+
* style.
|
|
141
|
+
*
|
|
142
|
+
* @param {Object} override Override object.
|
|
143
|
+
* @param {?string} override.id Id of the style override, leave blank to create
|
|
144
|
+
* a new style.
|
|
145
|
+
* @param {string} override.css CSS to apply.
|
|
146
|
+
*/
|
|
147
|
+
export function useStyleOverride( { id, css } ) {
|
|
148
|
+
return usePrivateStyleOverride( { id, css } );
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function usePrivateStyleOverride( {
|
|
139
152
|
id,
|
|
140
153
|
css,
|
|
141
154
|
assets,
|
package/src/index.js
CHANGED
|
@@ -234,15 +234,23 @@ export default {
|
|
|
234
234
|
const paddingValues = getCSSRules( style );
|
|
235
235
|
paddingValues.forEach( ( rule ) => {
|
|
236
236
|
if ( rule.key === 'paddingRight' ) {
|
|
237
|
+
// Add unit if 0, to avoid calc(0 * -1) which is invalid.
|
|
238
|
+
const paddingRightValue =
|
|
239
|
+
rule.value === '0' ? '0px' : rule.value;
|
|
240
|
+
|
|
237
241
|
output += `
|
|
238
242
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
239
|
-
margin-right: calc(${
|
|
243
|
+
margin-right: calc(${ paddingRightValue } * -1);
|
|
240
244
|
}
|
|
241
245
|
`;
|
|
242
246
|
} else if ( rule.key === 'paddingLeft' ) {
|
|
247
|
+
// Add unit if 0, to avoid calc(0 * -1) which is invalid.
|
|
248
|
+
const paddingLeftValue =
|
|
249
|
+
rule.value === '0' ? '0px' : rule.value;
|
|
250
|
+
|
|
243
251
|
output += `
|
|
244
252
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
245
|
-
margin-left: calc(${
|
|
253
|
+
margin-left: calc(${ paddingLeftValue } * -1);
|
|
246
254
|
}
|
|
247
255
|
`;
|
|
248
256
|
}
|
package/src/layouts/grid.js
CHANGED
|
@@ -264,6 +264,7 @@ function GridLayoutMinimumWidthControl( { layout, onChange } ) {
|
|
|
264
264
|
</FlexItem>
|
|
265
265
|
<FlexItem isBlock>
|
|
266
266
|
<RangeControl
|
|
267
|
+
__nextHasNoMarginBottom
|
|
267
268
|
onChange={ handleSliderChange }
|
|
268
269
|
value={ quantity || 0 }
|
|
269
270
|
min={ 0 }
|
|
@@ -367,6 +368,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
367
368
|
/>
|
|
368
369
|
) : (
|
|
369
370
|
<RangeControl
|
|
371
|
+
__nextHasNoMarginBottom
|
|
370
372
|
value={ columnCount ?? 0 }
|
|
371
373
|
onChange={ ( value ) =>
|
|
372
374
|
onChange( {
|
package/src/private-apis.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { PrivateListView } from './components/list-view';
|
|
17
17
|
import BlockInfo from './components/block-info-slot-fill';
|
|
18
18
|
import { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';
|
|
19
|
-
import { cleanEmptyObject
|
|
19
|
+
import { cleanEmptyObject } from './hooks/utils';
|
|
20
20
|
import BlockQuickNavigation from './components/block-quick-navigation';
|
|
21
21
|
import { LayoutStyle } from './components/block-list/layout';
|
|
22
22
|
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
|
|
@@ -29,10 +29,6 @@ import {
|
|
|
29
29
|
import DimensionsTool from './components/dimensions-tool';
|
|
30
30
|
import ResolutionTool from './components/resolution-tool';
|
|
31
31
|
import TextAlignmentControl from './components/text-alignment-control';
|
|
32
|
-
import {
|
|
33
|
-
default as ReusableBlocksRenameHint,
|
|
34
|
-
useReusableBlocksRenameHint,
|
|
35
|
-
} from './components/inserter/reusable-block-rename-hint';
|
|
36
32
|
import { usesContextKey } from './components/rich-text/format-edit';
|
|
37
33
|
import { ExperimentalBlockCanvas } from './components/block-canvas';
|
|
38
34
|
import { getDuotoneFilter } from './components/duotone/utils';
|
|
@@ -72,7 +68,6 @@ lock( privateApis, {
|
|
|
72
68
|
BlockInfo,
|
|
73
69
|
useHasBlockToolbar,
|
|
74
70
|
cleanEmptyObject,
|
|
75
|
-
useStyleOverride,
|
|
76
71
|
BlockQuickNavigation,
|
|
77
72
|
LayoutStyle,
|
|
78
73
|
BlockRemovalWarningModal,
|
|
@@ -82,8 +77,6 @@ lock( privateApis, {
|
|
|
82
77
|
ResolutionTool,
|
|
83
78
|
TabbedSidebar,
|
|
84
79
|
TextAlignmentControl,
|
|
85
|
-
ReusableBlocksRenameHint,
|
|
86
|
-
useReusableBlocksRenameHint,
|
|
87
80
|
usesContextKey,
|
|
88
81
|
useFlashEditableBlocks,
|
|
89
82
|
globalStylesDataKey,
|