@wordpress/block-editor 15.21.1 → 15.22.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 +6 -0
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +153 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +1 -4
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +1 -10
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +3 -1
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +1 -2
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -162
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +65 -10
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs.map +1 -1
- package/build/store/private-selectors.cjs +19 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs.map +1 -1
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +3 -2
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/utils/transform-styles/types.cjs +19 -0
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +155 -27
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +1 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +2 -17
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +3 -1
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +1 -2
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -175
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +12 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +68 -10
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/private-selectors.mjs +18 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs.map +1 -1
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +3 -2
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +2 -0
- package/build-style/content.css +2 -0
- package/build-style/style-rtl.css +34 -41
- package/build-style/style.css +34 -41
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +46 -40
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +22 -20
- package/src/components/block-patterns-list/index.js +0 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/background-panel.js +201 -34
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +1 -5
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/iframe/index.js +8 -3
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +2 -18
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/hooks/anchor.js +0 -1
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/color.js +2 -205
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/dimensions.js +14 -3
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/private-selectors.js +47 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +61 -10
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -18,6 +18,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
|
|
|
18
18
|
>
|
|
19
19
|
<svg
|
|
20
20
|
aria-hidden="true"
|
|
21
|
+
fill="currentColor"
|
|
21
22
|
focusable="false"
|
|
22
23
|
height="24"
|
|
23
24
|
viewBox="0 0 24 24"
|
|
@@ -41,6 +42,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
|
|
|
41
42
|
>
|
|
42
43
|
<svg
|
|
43
44
|
aria-hidden="true"
|
|
45
|
+
fill="currentColor"
|
|
44
46
|
focusable="false"
|
|
45
47
|
height="24"
|
|
46
48
|
viewBox="0 0 24 24"
|
|
@@ -73,6 +75,7 @@ exports[`AlignmentUI should match snapshot when controls are hidden 1`] = `
|
|
|
73
75
|
>
|
|
74
76
|
<svg
|
|
75
77
|
aria-hidden="true"
|
|
78
|
+
fill="currentColor"
|
|
76
79
|
focusable="false"
|
|
77
80
|
height="24"
|
|
78
81
|
viewBox="0 0 24 24"
|
|
@@ -106,6 +109,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
106
109
|
>
|
|
107
110
|
<svg
|
|
108
111
|
aria-hidden="true"
|
|
112
|
+
fill="currentColor"
|
|
109
113
|
focusable="false"
|
|
110
114
|
height="24"
|
|
111
115
|
viewBox="0 0 24 24"
|
|
@@ -129,6 +133,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
129
133
|
>
|
|
130
134
|
<svg
|
|
131
135
|
aria-hidden="true"
|
|
136
|
+
fill="currentColor"
|
|
132
137
|
focusable="false"
|
|
133
138
|
height="24"
|
|
134
139
|
viewBox="0 0 24 24"
|
|
@@ -152,6 +157,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
152
157
|
>
|
|
153
158
|
<svg
|
|
154
159
|
aria-hidden="true"
|
|
160
|
+
fill="currentColor"
|
|
155
161
|
focusable="false"
|
|
156
162
|
height="24"
|
|
157
163
|
viewBox="0 0 24 24"
|
|
@@ -16,6 +16,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are hidden 1`] = `
|
|
|
16
16
|
>
|
|
17
17
|
<svg
|
|
18
18
|
aria-hidden="true"
|
|
19
|
+
fill="currentColor"
|
|
19
20
|
focusable="false"
|
|
20
21
|
height="24"
|
|
21
22
|
viewBox="0 0 24 24"
|
|
@@ -48,6 +49,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
48
49
|
>
|
|
49
50
|
<svg
|
|
50
51
|
aria-hidden="true"
|
|
52
|
+
fill="currentColor"
|
|
51
53
|
focusable="false"
|
|
52
54
|
height="24"
|
|
53
55
|
viewBox="0 0 24 24"
|
|
@@ -70,6 +72,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
70
72
|
>
|
|
71
73
|
<svg
|
|
72
74
|
aria-hidden="true"
|
|
75
|
+
fill="currentColor"
|
|
73
76
|
focusable="false"
|
|
74
77
|
height="24"
|
|
75
78
|
viewBox="0 0 24 24"
|
|
@@ -92,6 +95,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
92
95
|
>
|
|
93
96
|
<svg
|
|
94
97
|
aria-hidden="true"
|
|
98
|
+
fill="currentColor"
|
|
95
99
|
focusable="false"
|
|
96
100
|
height="24"
|
|
97
101
|
viewBox="0 0 24 24"
|
|
@@ -114,6 +118,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
114
118
|
>
|
|
115
119
|
<svg
|
|
116
120
|
aria-hidden="true"
|
|
121
|
+
fill="currentColor"
|
|
117
122
|
focusable="false"
|
|
118
123
|
height="24"
|
|
119
124
|
viewBox="0 0 24 24"
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
arrowRight,
|
|
22
22
|
arrowLeft,
|
|
23
23
|
} from '@wordpress/icons';
|
|
24
|
-
import { getBlockType
|
|
24
|
+
import { getBlockType } from '@wordpress/blocks';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
@@ -110,20 +110,14 @@ function BlockCard( {
|
|
|
110
110
|
if ( parentClientId || isChild || ! allowParentNavigation ) {
|
|
111
111
|
return {};
|
|
112
112
|
}
|
|
113
|
-
const { getBlockParents, getBlockName } =
|
|
114
|
-
select( blockEditorStore );
|
|
113
|
+
const { getBlockParents, getBlockName, shouldRenderBlockListView } =
|
|
114
|
+
unlock( select( blockEditorStore ) );
|
|
115
115
|
|
|
116
|
-
// Find the top-most parent block that
|
|
117
|
-
// 1. A navigation block (special case for ad-hoc list view support)
|
|
118
|
-
// 2. Any block with listView support
|
|
116
|
+
// Find the top-most parent block that participates in List View.
|
|
119
117
|
const parents = getBlockParents( clientId, false );
|
|
120
|
-
const foundParentId = parents.find( ( parentId ) =>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
parentName === 'core/navigation' ||
|
|
124
|
-
hasBlockSupport( parentName, 'listView' )
|
|
125
|
-
);
|
|
126
|
-
} );
|
|
118
|
+
const foundParentId = parents.find( ( parentId ) =>
|
|
119
|
+
shouldRenderBlockListView( parentId )
|
|
120
|
+
);
|
|
127
121
|
|
|
128
122
|
return {
|
|
129
123
|
parentBlockClientId: foundParentId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect,
|
|
4
|
+
import { useSelect, useRegistry } from '@wordpress/data';
|
|
5
5
|
import { useEffect } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -50,8 +50,7 @@ import {
|
|
|
50
50
|
export function useBlockEditingMode( mode ) {
|
|
51
51
|
const context = useBlockEditContext();
|
|
52
52
|
const { clientId = '' } = context;
|
|
53
|
-
const
|
|
54
|
-
useDispatch( blockEditorStore );
|
|
53
|
+
const registry = useRegistry();
|
|
55
54
|
const globalBlockEditingMode = useSelect(
|
|
56
55
|
( select ) =>
|
|
57
56
|
// Avoid adding the subscription if not needed!
|
|
@@ -59,14 +58,23 @@ export function useBlockEditingMode( mode ) {
|
|
|
59
58
|
[ clientId ]
|
|
60
59
|
);
|
|
61
60
|
useEffect( () => {
|
|
62
|
-
if ( mode ) {
|
|
63
|
-
|
|
61
|
+
if ( ! mode ) {
|
|
62
|
+
return;
|
|
64
63
|
}
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
setBlockEditingMode,
|
|
67
|
+
unsetBlockEditingMode,
|
|
68
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
69
|
+
} = registry.dispatch( blockEditorStore );
|
|
70
|
+
|
|
71
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
72
|
+
setBlockEditingMode( clientId, mode );
|
|
73
|
+
|
|
65
74
|
return () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
75
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
76
|
+
unsetBlockEditingMode( clientId );
|
|
69
77
|
};
|
|
70
|
-
}, [ clientId, mode
|
|
78
|
+
}, [ registry, clientId, mode ] );
|
|
71
79
|
return clientId ? context[ blockEditingModeKey ] : globalBlockEditingMode;
|
|
72
80
|
}
|
|
@@ -5,7 +5,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import {
|
|
6
6
|
getBlockType,
|
|
7
7
|
getUnregisteredTypeHandlerName,
|
|
8
|
-
hasBlockSupport,
|
|
9
8
|
store as blocksStore,
|
|
10
9
|
} from '@wordpress/blocks';
|
|
11
10
|
import {
|
|
@@ -58,6 +57,10 @@ function StyleInspectorSlots( {
|
|
|
58
57
|
return (
|
|
59
58
|
<>
|
|
60
59
|
<InspectorControls.Slot />
|
|
60
|
+
<InspectorControls.Slot
|
|
61
|
+
group="typography"
|
|
62
|
+
label={ __( 'Typography' ) }
|
|
63
|
+
/>
|
|
61
64
|
<InspectorControls.Slot
|
|
62
65
|
group="color"
|
|
63
66
|
label={ __( 'Color' ) }
|
|
@@ -65,19 +68,20 @@ function StyleInspectorSlots( {
|
|
|
65
68
|
/>
|
|
66
69
|
<InspectorControls.Slot
|
|
67
70
|
group="background"
|
|
68
|
-
label={ __( 'Background
|
|
71
|
+
label={ __( 'Background' ) }
|
|
69
72
|
className="background-block-support-panel__inner-wrapper"
|
|
70
73
|
/>
|
|
71
|
-
<InspectorControls.Slot
|
|
72
|
-
group="typography"
|
|
73
|
-
label={ __( 'Typography' ) }
|
|
74
|
-
/>
|
|
75
74
|
<InspectorControls.Slot group="layout" label={ __( 'Layout' ) } />
|
|
76
75
|
<InspectorControls.Slot
|
|
77
76
|
group="dimensions"
|
|
78
77
|
label={ __( 'Dimensions' ) }
|
|
79
78
|
/>
|
|
80
79
|
<InspectorControls.Slot group="border" label={ borderPanelLabel } />
|
|
80
|
+
<InspectorControls.Slot
|
|
81
|
+
group="elements"
|
|
82
|
+
label={ __( 'Elements' ) }
|
|
83
|
+
className="elements-block-support-panel__inner-wrapper"
|
|
84
|
+
/>
|
|
81
85
|
{ showPositionControls && <PositionControls /> }
|
|
82
86
|
<InspectorControls.Slot group="styles" />
|
|
83
87
|
{ showBindingsControls && (
|
|
@@ -99,6 +103,10 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
|
|
|
99
103
|
! hasPseudoBlockStyleState( selectedBlockStyleState );
|
|
100
104
|
return (
|
|
101
105
|
<>
|
|
106
|
+
<InspectorControls.Slot
|
|
107
|
+
group="typography"
|
|
108
|
+
label={ __( 'Typography' ) }
|
|
109
|
+
/>
|
|
102
110
|
<InspectorControls.Slot
|
|
103
111
|
group="color"
|
|
104
112
|
label={ __( 'Color' ) }
|
|
@@ -106,13 +114,9 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
|
|
|
106
114
|
/>
|
|
107
115
|
<InspectorControls.Slot
|
|
108
116
|
group="background"
|
|
109
|
-
label={ __( 'Background
|
|
117
|
+
label={ __( 'Background' ) }
|
|
110
118
|
className="background-block-support-panel__inner-wrapper"
|
|
111
119
|
/>
|
|
112
|
-
<InspectorControls.Slot
|
|
113
|
-
group="typography"
|
|
114
|
-
label={ __( 'Typography' ) }
|
|
115
|
-
/>
|
|
116
120
|
{ showLayoutControls && (
|
|
117
121
|
<InspectorControls.Slot
|
|
118
122
|
group="layout"
|
|
@@ -124,6 +128,11 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
|
|
|
124
128
|
label={ __( 'Dimensions' ) }
|
|
125
129
|
/>
|
|
126
130
|
<InspectorControls.Slot group="border" label={ borderPanelLabel } />
|
|
131
|
+
<InspectorControls.Slot
|
|
132
|
+
group="elements"
|
|
133
|
+
label={ __( 'Elements' ) }
|
|
134
|
+
className="elements-block-support-panel__inner-wrapper"
|
|
135
|
+
/>
|
|
127
136
|
</>
|
|
128
137
|
);
|
|
129
138
|
}
|
|
@@ -208,8 +217,8 @@ function BlockInspector() {
|
|
|
208
217
|
|
|
209
218
|
const {
|
|
210
219
|
getClientIdsOfDescendants,
|
|
211
|
-
getBlockName,
|
|
212
220
|
getBlockEditingMode,
|
|
221
|
+
shouldRenderBlockListView,
|
|
213
222
|
} = unlock( select( blockEditorStore ) );
|
|
214
223
|
|
|
215
224
|
const descendants = getClientIdsOfDescendants(
|
|
@@ -220,14 +229,7 @@ function BlockInspector() {
|
|
|
220
229
|
// List View tab.
|
|
221
230
|
const listViewDescendants = new Set();
|
|
222
231
|
descendants.forEach( ( clientId ) => {
|
|
223
|
-
|
|
224
|
-
// Navigation block doesn't have List View block support, but
|
|
225
|
-
// it does have a custom implementation that is shown within
|
|
226
|
-
// patterns, so it's included in this condition.
|
|
227
|
-
if (
|
|
228
|
-
blockName === 'core/navigation' ||
|
|
229
|
-
hasBlockSupport( blockName, 'listView' )
|
|
230
|
-
) {
|
|
232
|
+
if ( shouldRenderBlockListView( clientId ) ) {
|
|
231
233
|
const listViewChildren =
|
|
232
234
|
getClientIdsOfDescendants( clientId );
|
|
233
235
|
listViewChildren.forEach( ( childId ) =>
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
Composite,
|
|
13
13
|
__experimentalHStack as HStack,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
|
-
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
16
15
|
import { VisuallyHidden, Text, Tooltip } from '@wordpress/ui';
|
|
17
16
|
import { useInstanceId } from '@wordpress/compose';
|
|
18
17
|
import { __ } from '@wordpress/i18n';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { getBlockType } from '@wordpress/blocks';
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
@@ -20,6 +20,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
20
20
|
import BlockIcon from '../block-icon';
|
|
21
21
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
22
22
|
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
23
|
+
import { unlock } from '../../lock-unlock';
|
|
23
24
|
|
|
24
25
|
export default function BlockQuickNavigation( {
|
|
25
26
|
clientIds,
|
|
@@ -52,7 +53,7 @@ function BlockQuickNavigationItem( {
|
|
|
52
53
|
hasListViewTab,
|
|
53
54
|
} ) {
|
|
54
55
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
55
|
-
const { isSelected, childBlocks,
|
|
56
|
+
const { isSelected, childBlocks, shouldRenderListView, blockName } =
|
|
56
57
|
useSelect(
|
|
57
58
|
( select ) => {
|
|
58
59
|
const {
|
|
@@ -60,7 +61,8 @@ function BlockQuickNavigationItem( {
|
|
|
60
61
|
hasSelectedInnerBlock,
|
|
61
62
|
getBlockOrder,
|
|
62
63
|
getBlockName,
|
|
63
|
-
|
|
64
|
+
shouldRenderBlockListView,
|
|
65
|
+
} = unlock( select( blockEditorStore ) );
|
|
64
66
|
|
|
65
67
|
const _blockName = getBlockName( clientId );
|
|
66
68
|
|
|
@@ -69,9 +71,7 @@ function BlockQuickNavigationItem( {
|
|
|
69
71
|
isBlockSelected( clientId ) ||
|
|
70
72
|
hasSelectedInnerBlock( clientId, /* deep: */ true ),
|
|
71
73
|
childBlocks: getBlockOrder( clientId ),
|
|
72
|
-
|
|
73
|
-
_blockName === 'core/navigation' ||
|
|
74
|
-
hasBlockSupport( _blockName, 'listView' ),
|
|
74
|
+
shouldRenderListView: shouldRenderBlockListView( clientId ),
|
|
75
75
|
blockName: _blockName,
|
|
76
76
|
};
|
|
77
77
|
},
|
|
@@ -88,7 +88,7 @@ function BlockQuickNavigationItem( {
|
|
|
88
88
|
|
|
89
89
|
const hasChildren = childBlocks && childBlocks.length > 0;
|
|
90
90
|
const canNavigateToListView =
|
|
91
|
-
hasChildren && hasListViewTab &&
|
|
91
|
+
hasChildren && hasListViewTab && shouldRenderListView;
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
94
|
<Button
|
|
@@ -19,6 +19,7 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
|
19
19
|
import { store as blockEditorStore } from '../../store';
|
|
20
20
|
import { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';
|
|
21
21
|
import { unlock } from '../../lock-unlock';
|
|
22
|
+
import { isIsolatedEditorKey } from '../../store/private-keys';
|
|
22
23
|
|
|
23
24
|
function getBlockIconVariant( { select, clientIds } ) {
|
|
24
25
|
const {
|
|
@@ -29,8 +30,11 @@ function getBlockIconVariant( { select, clientIds } ) {
|
|
|
29
30
|
getTemplateLock,
|
|
30
31
|
getBlockEditingMode,
|
|
31
32
|
canEditBlock,
|
|
33
|
+
isWithinEditedContentOnlySection,
|
|
34
|
+
getSettings,
|
|
32
35
|
} = unlock( select( blockEditorStore ) );
|
|
33
36
|
const { getBlockStyles } = select( blocksStore );
|
|
37
|
+
const isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];
|
|
34
38
|
|
|
35
39
|
const hasTemplateLock = clientIds.some(
|
|
36
40
|
( id ) => getTemplateLock( id ) === 'contentOnly'
|
|
@@ -42,7 +46,10 @@ function getBlockIconVariant( { select, clientIds } ) {
|
|
|
42
46
|
const hasBlockStyles =
|
|
43
47
|
isSingleBlock && !! getBlockStyles( blockName )?.length;
|
|
44
48
|
const hasPatternNameInSelection = clientIds.some(
|
|
45
|
-
( id ) =>
|
|
49
|
+
( id ) =>
|
|
50
|
+
!! getBlockAttributes( id )?.metadata?.patternName &&
|
|
51
|
+
! isWithinEditedContentOnlySection( id ) &&
|
|
52
|
+
! isIsolatedEditor
|
|
46
53
|
);
|
|
47
54
|
const hasPatternOverrides = clientIds.every( ( clientId ) =>
|
|
48
55
|
hasPatternOverridesDefaultBinding(
|
|
@@ -86,20 +93,29 @@ function getBlockIconVariant( { select, clientIds } ) {
|
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
function getBlockIcon( { select, clientIds } ) {
|
|
89
|
-
const {
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
const {
|
|
97
|
+
getBlockName,
|
|
98
|
+
getBlockAttributes,
|
|
99
|
+
isWithinEditedContentOnlySection,
|
|
100
|
+
getSettings,
|
|
101
|
+
} = unlock( select( blockEditorStore ) );
|
|
102
|
+
const isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];
|
|
92
103
|
|
|
93
104
|
const _isSingleBlock = clientIds.length === 1;
|
|
94
105
|
const firstClientId = clientIds[ 0 ];
|
|
106
|
+
|
|
95
107
|
const blockAttributes = getBlockAttributes( firstClientId );
|
|
96
|
-
if (
|
|
108
|
+
if (
|
|
109
|
+
_isSingleBlock &&
|
|
110
|
+
blockAttributes?.metadata?.patternName &&
|
|
111
|
+
! isWithinEditedContentOnlySection( firstClientId ) &&
|
|
112
|
+
! isIsolatedEditor
|
|
113
|
+
) {
|
|
97
114
|
return symbol;
|
|
98
115
|
}
|
|
99
116
|
|
|
100
117
|
const blockName = getBlockName( firstClientId );
|
|
101
118
|
const blockType = getBlockType( blockName );
|
|
102
|
-
|
|
103
119
|
if ( _isSingleBlock ) {
|
|
104
120
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
105
121
|
const match = getActiveBlockVariation( blockName, blockAttributes );
|
|
@@ -13,11 +13,33 @@ import { paragraph } from '@wordpress/icons';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import BlockToolbarIcon from '../block-toolbar-icon';
|
|
16
|
+
import { isIsolatedEditorKey } from '../../../store/private-keys';
|
|
16
17
|
|
|
18
|
+
jest.mock( '@wordpress/blocks', () => {
|
|
19
|
+
const actualImplementation = jest.requireActual( '@wordpress/blocks' );
|
|
20
|
+
return {
|
|
21
|
+
...actualImplementation,
|
|
22
|
+
getBlockType: ( name ) => ( {
|
|
23
|
+
name,
|
|
24
|
+
title: name === 'core/template-part' ? 'Template Part' : 'Group',
|
|
25
|
+
icon: `${ name }-icon`,
|
|
26
|
+
} ),
|
|
27
|
+
};
|
|
28
|
+
} );
|
|
17
29
|
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
30
|
+
jest.mock( '../../../lock-unlock', () => ( {
|
|
31
|
+
unlock: ( value ) => ( {
|
|
32
|
+
registerPrivateActions: jest.fn(),
|
|
33
|
+
registerPrivateSelectors: jest.fn(),
|
|
34
|
+
...value,
|
|
35
|
+
} ),
|
|
36
|
+
} ) );
|
|
18
37
|
jest.mock( '../../block-title/use-block-display-title', () =>
|
|
19
38
|
jest.fn().mockReturnValue( 'Block Name' )
|
|
20
39
|
);
|
|
40
|
+
jest.mock( '../../block-icon', () =>
|
|
41
|
+
jest.fn( ( { icon } ) => <span data-testid="block-icon">{ icon }</span> )
|
|
42
|
+
);
|
|
21
43
|
jest.mock( '../../block-switcher', () =>
|
|
22
44
|
jest.fn( ( { children } ) => (
|
|
23
45
|
<div data-testid="block-switcher">{ children }</div>
|
|
@@ -38,6 +60,34 @@ describe( 'BlockToolbarIcon', () => {
|
|
|
38
60
|
clientIds: [ 'test-client-id' ],
|
|
39
61
|
isSynced: false,
|
|
40
62
|
};
|
|
63
|
+
const setupToolbarSelectors = ( {
|
|
64
|
+
attributes = {
|
|
65
|
+
metadata: {
|
|
66
|
+
patternName: 'theme/hero',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
blockName = 'core/group',
|
|
70
|
+
getActiveBlockVariation = () => null,
|
|
71
|
+
settings = {},
|
|
72
|
+
isWithinEditedSection = false,
|
|
73
|
+
} = {} ) => {
|
|
74
|
+
useSelect.mockImplementation( ( mapSelect ) =>
|
|
75
|
+
mapSelect( () => ( {
|
|
76
|
+
get: () => false,
|
|
77
|
+
getBlockName: () => blockName,
|
|
78
|
+
getBlockAttributes: () => attributes,
|
|
79
|
+
getSettings: () => settings,
|
|
80
|
+
getBlockParentsByBlockName: () => [],
|
|
81
|
+
canRemoveBlocks: () => true,
|
|
82
|
+
getTemplateLock: () => undefined,
|
|
83
|
+
getBlockEditingMode: () => 'default',
|
|
84
|
+
canEditBlock: () => true,
|
|
85
|
+
getBlockStyles: () => [ {} ],
|
|
86
|
+
getActiveBlockVariation,
|
|
87
|
+
isWithinEditedContentOnlySection: () => isWithinEditedSection,
|
|
88
|
+
} ) )
|
|
89
|
+
);
|
|
90
|
+
};
|
|
41
91
|
|
|
42
92
|
beforeEach( () => {
|
|
43
93
|
jest.clearAllMocks();
|
|
@@ -144,6 +194,55 @@ describe( 'BlockToolbarIcon', () => {
|
|
|
144
194
|
} );
|
|
145
195
|
} );
|
|
146
196
|
|
|
197
|
+
describe( 'pattern sections', () => {
|
|
198
|
+
it( 'should not show the block switcher before the section is being edited', () => {
|
|
199
|
+
setupToolbarSelectors();
|
|
200
|
+
|
|
201
|
+
render( <BlockToolbarIcon { ...defaultProps } /> );
|
|
202
|
+
|
|
203
|
+
expect(
|
|
204
|
+
screen.queryByTestId( 'block-switcher' )
|
|
205
|
+
).not.toBeInTheDocument();
|
|
206
|
+
expect( screen.getByRole( 'button' ) ).toHaveAttribute(
|
|
207
|
+
'aria-disabled',
|
|
208
|
+
'true'
|
|
209
|
+
);
|
|
210
|
+
} );
|
|
211
|
+
|
|
212
|
+
it( 'should show the block switcher when the section is being edited', () => {
|
|
213
|
+
setupToolbarSelectors( { isWithinEditedSection: true } );
|
|
214
|
+
|
|
215
|
+
render( <BlockToolbarIcon { ...defaultProps } /> );
|
|
216
|
+
|
|
217
|
+
expect(
|
|
218
|
+
screen.getByTestId( 'block-switcher' )
|
|
219
|
+
).toBeInTheDocument();
|
|
220
|
+
} );
|
|
221
|
+
|
|
222
|
+
it( 'should show the block icon for pattern wrappers in isolated editors', () => {
|
|
223
|
+
setupToolbarSelectors( {
|
|
224
|
+
attributes: {
|
|
225
|
+
metadata: {
|
|
226
|
+
name: 'Header',
|
|
227
|
+
patternName: 'theme/header-wrapper',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
settings: {
|
|
231
|
+
[ isIsolatedEditorKey ]: true,
|
|
232
|
+
},
|
|
233
|
+
} );
|
|
234
|
+
|
|
235
|
+
render( <BlockToolbarIcon { ...defaultProps } /> );
|
|
236
|
+
|
|
237
|
+
expect(
|
|
238
|
+
screen.getByTestId( 'block-switcher' )
|
|
239
|
+
).toBeInTheDocument();
|
|
240
|
+
expect( screen.getByTestId( 'block-icon' ) ).toHaveTextContent(
|
|
241
|
+
'core/group-icon'
|
|
242
|
+
);
|
|
243
|
+
} );
|
|
244
|
+
} );
|
|
245
|
+
|
|
147
246
|
describe( 'label calculation', () => {
|
|
148
247
|
it( 'should use block title for single block', () => {
|
|
149
248
|
useSelect.mockImplementation( () => ( {
|
|
@@ -157,7 +157,13 @@ export default function useBlockToolbarPopoverProps( {
|
|
|
157
157
|
isSticky
|
|
158
158
|
)
|
|
159
159
|
),
|
|
160
|
-
[
|
|
160
|
+
[
|
|
161
|
+
contentElement,
|
|
162
|
+
selectedBlockElement,
|
|
163
|
+
scrollContainer,
|
|
164
|
+
toolbarHeight,
|
|
165
|
+
isSticky,
|
|
166
|
+
]
|
|
161
167
|
);
|
|
162
168
|
|
|
163
169
|
// Update props when the block is moved. This also ensures the props are
|
|
@@ -173,18 +179,18 @@ export default function useBlockToolbarPopoverProps( {
|
|
|
173
179
|
|
|
174
180
|
// Update the toolbar props on viewport resize.
|
|
175
181
|
const contentView = contentElement?.ownerDocument?.defaultView;
|
|
176
|
-
contentView?.
|
|
182
|
+
contentView?.addEventListener?.( 'resize', updateProps );
|
|
177
183
|
|
|
178
184
|
// Update the toolbar props on block resize.
|
|
179
185
|
let resizeObserver;
|
|
180
186
|
const blockView = selectedBlockElement?.ownerDocument?.defaultView;
|
|
181
|
-
if ( blockView
|
|
187
|
+
if ( blockView?.ResizeObserver ) {
|
|
182
188
|
resizeObserver = new blockView.ResizeObserver( updateProps );
|
|
183
189
|
resizeObserver.observe( selectedBlockElement );
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
return () => {
|
|
187
|
-
contentView?.
|
|
193
|
+
contentView?.removeEventListener?.( 'resize', updateProps );
|
|
188
194
|
|
|
189
195
|
if ( resizeObserver ) {
|
|
190
196
|
resizeObserver.disconnect();
|
|
@@ -16,6 +16,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden
|
|
|
16
16
|
>
|
|
17
17
|
<svg
|
|
18
18
|
aria-hidden="true"
|
|
19
|
+
fill="currentColor"
|
|
19
20
|
focusable="false"
|
|
20
21
|
height="24"
|
|
21
22
|
viewBox="0 0 24 24"
|
|
@@ -48,6 +49,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
48
49
|
>
|
|
49
50
|
<svg
|
|
50
51
|
aria-hidden="true"
|
|
52
|
+
fill="currentColor"
|
|
51
53
|
focusable="false"
|
|
52
54
|
height="24"
|
|
53
55
|
viewBox="0 0 24 24"
|
|
@@ -70,6 +72,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
70
72
|
>
|
|
71
73
|
<svg
|
|
72
74
|
aria-hidden="true"
|
|
75
|
+
fill="currentColor"
|
|
73
76
|
focusable="false"
|
|
74
77
|
height="24"
|
|
75
78
|
viewBox="0 0 24 24"
|
|
@@ -92,6 +95,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
92
95
|
>
|
|
93
96
|
<svg
|
|
94
97
|
aria-hidden="true"
|
|
98
|
+
fill="currentColor"
|
|
95
99
|
focusable="false"
|
|
96
100
|
height="24"
|
|
97
101
|
viewBox="0 0 24 24"
|