@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
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
14
|
-
import { getValueFromVariable } from '@wordpress/global-styles-engine';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
@@ -25,8 +24,15 @@ import TextTransformControl from '../text-transform-control';
|
|
|
25
24
|
import TextDecorationControl from '../text-decoration-control';
|
|
26
25
|
import TextIndentControl from '../text-indent-control';
|
|
27
26
|
import WritingModeControl from '../writing-mode-control';
|
|
27
|
+
import ColorGradientDropdownItem from './color-gradient-dropdown-item';
|
|
28
|
+
import { useHasTextPanel } from './color-panel';
|
|
29
|
+
import { useColorGradientSettings } from './hooks';
|
|
28
30
|
import { useToolsPanelDropdownMenuProps } from './utils';
|
|
29
31
|
import { setImmutably } from '../../utils/object';
|
|
32
|
+
import {
|
|
33
|
+
extractPresetSlug,
|
|
34
|
+
encodeColorValueWithPalette,
|
|
35
|
+
} from '../../utils/color-values';
|
|
30
36
|
import {
|
|
31
37
|
getMergedFontFamiliesAndFontFamilyFaces,
|
|
32
38
|
findNearestStyleAndWeight,
|
|
@@ -48,6 +54,7 @@ export function useHasTypographyPanel( settings ) {
|
|
|
48
54
|
const hasWritingMode = useHasWritingModeControl( settings );
|
|
49
55
|
const hasTextColumns = useHasTextColumnsControl( settings );
|
|
50
56
|
const hasFontSize = useHasFontSizeControl( settings );
|
|
57
|
+
const hasTextColor = useHasTextPanel( settings );
|
|
51
58
|
|
|
52
59
|
return (
|
|
53
60
|
hasFontFamily ||
|
|
@@ -60,7 +67,8 @@ export function useHasTypographyPanel( settings ) {
|
|
|
60
67
|
hasTextDecoration ||
|
|
61
68
|
hasTextIndent ||
|
|
62
69
|
hasWritingMode ||
|
|
63
|
-
hasTextColumns
|
|
70
|
+
hasTextColumns ||
|
|
71
|
+
hasTextColor
|
|
64
72
|
);
|
|
65
73
|
}
|
|
66
74
|
|
|
@@ -143,7 +151,7 @@ function getMergedFontSizes( settings ) {
|
|
|
143
151
|
];
|
|
144
152
|
}
|
|
145
153
|
|
|
146
|
-
function TypographyToolsPanel( {
|
|
154
|
+
export function TypographyToolsPanel( {
|
|
147
155
|
resetAllFilter,
|
|
148
156
|
onChange,
|
|
149
157
|
value,
|
|
@@ -161,6 +169,7 @@ function TypographyToolsPanel( {
|
|
|
161
169
|
label={ __( 'Typography' ) }
|
|
162
170
|
resetAll={ resetAll }
|
|
163
171
|
panelId={ panelId }
|
|
172
|
+
__experimentalFirstVisibleItemClass="first"
|
|
164
173
|
dropdownMenuProps={ dropdownMenuProps }
|
|
165
174
|
>
|
|
166
175
|
{ children }
|
|
@@ -169,6 +178,7 @@ function TypographyToolsPanel( {
|
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
const DEFAULT_CONTROLS = {
|
|
181
|
+
textColor: true,
|
|
172
182
|
fontFamily: true,
|
|
173
183
|
fontSize: true,
|
|
174
184
|
fontAppearance: true,
|
|
@@ -191,9 +201,47 @@ export default function TypographyPanel( {
|
|
|
191
201
|
panelId,
|
|
192
202
|
defaultControls = DEFAULT_CONTROLS,
|
|
193
203
|
isGlobalStyles = false,
|
|
204
|
+
contrastWarning,
|
|
194
205
|
} ) {
|
|
195
|
-
const
|
|
196
|
-
|
|
206
|
+
const { colors, allColors, areCustomSolidsEnabled, decodeValue } =
|
|
207
|
+
useColorGradientSettings( settings );
|
|
208
|
+
|
|
209
|
+
// Text color. Writes to `color.text` (unchanged storage path). The
|
|
210
|
+
// control is rendered here instead of the Color panel because text
|
|
211
|
+
// color is a typographic concern.
|
|
212
|
+
const hasTextColorEnabled = useHasTextPanel( settings );
|
|
213
|
+
const textColor = decodeValue( inheritedValue?.color?.text );
|
|
214
|
+
const userTextColor = decodeValue( value?.color?.text );
|
|
215
|
+
const hasTextColorValue = () => !! value?.color?.text;
|
|
216
|
+
const setTextColor = ( newColor, newSlug ) => {
|
|
217
|
+
const encoded = encodeColorValueWithPalette(
|
|
218
|
+
allColors,
|
|
219
|
+
newColor,
|
|
220
|
+
newSlug
|
|
221
|
+
);
|
|
222
|
+
let changedObject = setImmutably( value, [ 'color', 'text' ], encoded );
|
|
223
|
+
// Keep an in-sync link color following the text color (e.g. a
|
|
224
|
+
// Button's link color tracks its text color). Compare raw encoded
|
|
225
|
+
// references (e.g. `var:preset|color|slug`), not decoded hex values.
|
|
226
|
+
// Two palette entries can share the same hex but carry different
|
|
227
|
+
// slugs (e.g. `var:preset|color|dark-background` and
|
|
228
|
+
// `var:preset|color|dark-text` both resolving to `#000`); comparing
|
|
229
|
+
// decoded values would conflate them and incorrectly force the link
|
|
230
|
+
// color to follow the text color even when the user deliberately
|
|
231
|
+
// chose a different palette slot.
|
|
232
|
+
if (
|
|
233
|
+
inheritedValue?.color?.text ===
|
|
234
|
+
inheritedValue?.elements?.link?.color?.text
|
|
235
|
+
) {
|
|
236
|
+
changedObject = setImmutably(
|
|
237
|
+
changedObject,
|
|
238
|
+
[ 'elements', 'link', 'color', 'text' ],
|
|
239
|
+
encoded
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
onChange( changedObject );
|
|
243
|
+
};
|
|
244
|
+
const resetTextColor = () => setTextColor( undefined );
|
|
197
245
|
|
|
198
246
|
// Font Family
|
|
199
247
|
const hasFontFamilyEnabled = useHasFontFamilyControl( settings );
|
|
@@ -490,12 +538,25 @@ export default function TypographyPanel( {
|
|
|
490
538
|
const hasTextAlign = () => !! value?.typography?.textAlign;
|
|
491
539
|
const resetTextAlign = () => setTextAlign( undefined );
|
|
492
540
|
|
|
493
|
-
const resetAllFilter = useCallback(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
541
|
+
const resetAllFilter = useCallback(
|
|
542
|
+
( previousValue ) => {
|
|
543
|
+
if ( ! hasTextColorEnabled ) {
|
|
544
|
+
return {
|
|
545
|
+
...previousValue,
|
|
546
|
+
typography: {},
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
...previousValue,
|
|
551
|
+
typography: {},
|
|
552
|
+
color: {
|
|
553
|
+
...previousValue?.color,
|
|
554
|
+
text: undefined,
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
[ hasTextColorEnabled ]
|
|
559
|
+
);
|
|
499
560
|
|
|
500
561
|
return (
|
|
501
562
|
<Wrapper
|
|
@@ -504,6 +565,34 @@ export default function TypographyPanel( {
|
|
|
504
565
|
onChange={ onChange }
|
|
505
566
|
panelId={ panelId }
|
|
506
567
|
>
|
|
568
|
+
{ hasTextColorEnabled && (
|
|
569
|
+
<ColorGradientDropdownItem
|
|
570
|
+
label={ __( 'Color' ) }
|
|
571
|
+
hasValue={ hasTextColorValue }
|
|
572
|
+
resetValue={ resetTextColor }
|
|
573
|
+
isShownByDefault={ defaultControls.textColor }
|
|
574
|
+
indicators={ [ textColor ] }
|
|
575
|
+
contrastWarning={ contrastWarning }
|
|
576
|
+
tabs={ [
|
|
577
|
+
{
|
|
578
|
+
key: 'text',
|
|
579
|
+
label: __( 'Color' ),
|
|
580
|
+
inheritedValue: textColor,
|
|
581
|
+
inheritedSlug: extractPresetSlug(
|
|
582
|
+
inheritedValue?.color?.text,
|
|
583
|
+
'color'
|
|
584
|
+
),
|
|
585
|
+
setValue: setTextColor,
|
|
586
|
+
userValue: userTextColor,
|
|
587
|
+
},
|
|
588
|
+
] }
|
|
589
|
+
colorGradientControlSettings={ {
|
|
590
|
+
colors,
|
|
591
|
+
disableCustomColors: ! areCustomSolidsEnabled,
|
|
592
|
+
} }
|
|
593
|
+
panelId={ panelId }
|
|
594
|
+
/>
|
|
595
|
+
) }
|
|
507
596
|
{ hasFontFamilyEnabled && (
|
|
508
597
|
<ToolsPanelItem
|
|
509
598
|
label={ __( 'Font' ) }
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
+
import { version as reactVersion } from 'react';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -102,6 +103,12 @@ function getIframeSrc( resolvedAssets ) {
|
|
|
102
103
|
return src;
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
let body = '';
|
|
107
|
+
if ( reactVersion.split( '.' )[ 0 ] === '18' ) {
|
|
108
|
+
body =
|
|
109
|
+
'<body><script>document.currentScript.parentElement.remove()</script></body>';
|
|
110
|
+
}
|
|
111
|
+
|
|
105
112
|
// Correct doctype is required to enable rendering in standards mode.
|
|
106
113
|
// Also preload the styles to avoid a flash of unstyled content.
|
|
107
114
|
const html = `<!doctype html>
|
|
@@ -125,9 +132,7 @@ function getIframeSrc( resolvedAssets ) {
|
|
|
125
132
|
${ resolvedAssets.styles ?? '' }
|
|
126
133
|
${ resolvedAssets.scripts ?? '' }
|
|
127
134
|
</head>
|
|
128
|
-
|
|
129
|
-
<script>document.currentScript.parentElement.remove()</script>
|
|
130
|
-
</body>
|
|
135
|
+
${ body }
|
|
131
136
|
</html>`;
|
|
132
137
|
|
|
133
138
|
src = URL.createObjectURL( new Blob( [ html ], { type: 'text/html' } ) );
|
|
@@ -27,7 +27,6 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
27
27
|
import { isBlobURL } from '@wordpress/blob';
|
|
28
28
|
import { getFilename } from '@wordpress/url';
|
|
29
29
|
|
|
30
|
-
// 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.
|
|
31
30
|
import { Tooltip } from '@wordpress/ui';
|
|
32
31
|
|
|
33
32
|
/**
|
|
@@ -114,7 +114,6 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
|
|
|
114
114
|
/>
|
|
115
115
|
|
|
116
116
|
<TextControl
|
|
117
|
-
__next40pxDefaultSize
|
|
118
117
|
label="Text Field"
|
|
119
118
|
help="Additional help text"
|
|
120
119
|
value={ textField }
|
|
@@ -204,7 +203,6 @@ function MyBlockEdit( { attributes, setAttributes } ) {
|
|
|
204
203
|
</InspectorControls>
|
|
205
204
|
<InspectorAdvancedControls>
|
|
206
205
|
<TextControl
|
|
207
|
-
__next40pxDefaultSize
|
|
208
206
|
label="HTML anchor"
|
|
209
207
|
value={ attributes.anchor }
|
|
210
208
|
onChange={ ( nextValue ) => {
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
import { ListViewContentFill } from './list-view-content-popover';
|
|
27
27
|
|
|
28
28
|
const PATTERN_EDITING_GROUPS = [ 'content', 'list' ];
|
|
29
|
-
const TEMPLATE_PART_GROUPS = [ 'default', 'settings', 'advanced' ];
|
|
30
29
|
|
|
31
30
|
export default function InspectorControlsFill( {
|
|
32
31
|
children,
|
|
@@ -56,17 +55,16 @@ export default function InspectorControlsFill( {
|
|
|
56
55
|
|
|
57
56
|
// During pattern editing:
|
|
58
57
|
// - All blocks can show pattern editing groups (content, list).
|
|
59
|
-
// - Template parts can show
|
|
58
|
+
// - Template parts can show any inspector group.
|
|
60
59
|
// - Other blocks cannot show a settings tab.
|
|
61
60
|
if ( context[ mayDisplayPatternEditingControlsKey ] ) {
|
|
62
|
-
// Template parts
|
|
63
|
-
//
|
|
61
|
+
// Template parts have also historically supported
|
|
62
|
+
// any block inspector groups for extenders. The settings
|
|
63
|
+
// tab is also used by core for the 'Design' panel. Specifically
|
|
64
|
+
// for that block the restrictions on allowed groups are lessened.
|
|
64
65
|
const isTemplatePart = context.name === 'core/template-part';
|
|
65
|
-
const isTemplatePartGroup = TEMPLATE_PART_GROUPS.includes( group );
|
|
66
66
|
const isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes( group );
|
|
67
|
-
|
|
68
|
-
const canShowGroup =
|
|
69
|
-
( isTemplatePart && isTemplatePartGroup ) || isPatternEditingGroup;
|
|
67
|
+
const canShowGroup = isTemplatePart || isPatternEditingGroup;
|
|
70
68
|
|
|
71
69
|
if ( ! canShowGroup ) {
|
|
72
70
|
return null;
|
|
@@ -16,6 +16,7 @@ const InspectorControlsDimensions = createSlotFill(
|
|
|
16
16
|
'InspectorControlsDimensions'
|
|
17
17
|
);
|
|
18
18
|
const InspectorControlsLayout = createSlotFill( 'InspectorControlsLayout' );
|
|
19
|
+
const InspectorControlsElements = createSlotFill( 'InspectorControlsElements' );
|
|
19
20
|
const InspectorControlsPosition = createSlotFill( 'InspectorControlsPosition' );
|
|
20
21
|
const InspectorControlsTypography = createSlotFill(
|
|
21
22
|
'InspectorControlsTypography'
|
|
@@ -35,6 +36,7 @@ const groups = {
|
|
|
35
36
|
content: InspectorControlsContent,
|
|
36
37
|
dimensions: InspectorControlsDimensions,
|
|
37
38
|
effects: InspectorControlsEffects,
|
|
39
|
+
elements: InspectorControlsElements,
|
|
38
40
|
filter: InspectorControlsFilter,
|
|
39
41
|
layout: InspectorControlsLayout,
|
|
40
42
|
list: InspectorControlsListView,
|
|
@@ -9,7 +9,6 @@ import { useEffect, useState, useRef } from '@wordpress/element';
|
|
|
9
9
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
|
|
12
|
-
// 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.
|
|
13
12
|
import { Tooltip } from '@wordpress/ui';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -13,14 +14,22 @@ import PositionControls from './position-controls-panel';
|
|
|
13
14
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
14
15
|
import { useBlockSettings } from '../../hooks/utils';
|
|
15
16
|
import { store as blockEditorStore } from '../../store';
|
|
16
|
-
import {
|
|
17
|
+
import { ElementsEdit } from '../../hooks/elements';
|
|
18
|
+
import { TypographyPanel } from '../../hooks/typography';
|
|
19
|
+
import { BackgroundImagePanel } from '../../hooks/background';
|
|
17
20
|
import { ColorToolsPanel } from '../global-styles/color-panel';
|
|
21
|
+
import { TypographyToolsPanel } from '../global-styles/typography-panel';
|
|
22
|
+
import { BackgroundToolsPanel } from '../global-styles/background-panel';
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
// Section blocks present a curated subset of the normal block style panels.
|
|
25
|
+
// Their block-support fills are gated off by editing mode (see
|
|
26
|
+
// `BlockStyleControls` in hooks/style.js), so each panel is direct-rendered
|
|
27
|
+
// here rather than via the inspector slots, with settings restricted to the
|
|
28
|
+
// supports a section should expose:
|
|
29
|
+
// - Typography: text color only (font controls disabled).
|
|
30
|
+
// - Background: color + gradient only (image controls disabled).
|
|
31
|
+
// - Elements: link/heading/button/caption colors (unchanged).
|
|
32
|
+
function SectionStyleControls( { blockName, clientId, contentClientIds } ) {
|
|
24
33
|
const settings = useBlockSettings( blockName );
|
|
25
34
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
26
35
|
|
|
@@ -42,21 +51,51 @@ function SectionBlockColorControls( {
|
|
|
42
51
|
updateBlockAttributes( clientId, newAttributes );
|
|
43
52
|
};
|
|
44
53
|
|
|
54
|
+
const typographySettings = useMemo(
|
|
55
|
+
() => ( { ...settings, typography: {} } ),
|
|
56
|
+
[ settings ]
|
|
57
|
+
);
|
|
58
|
+
const backgroundSettings = useMemo(
|
|
59
|
+
() => ( {
|
|
60
|
+
...settings,
|
|
61
|
+
background: {
|
|
62
|
+
...settings.background,
|
|
63
|
+
backgroundImage: false,
|
|
64
|
+
backgroundSize: false,
|
|
65
|
+
},
|
|
66
|
+
} ),
|
|
67
|
+
[ settings ]
|
|
68
|
+
);
|
|
69
|
+
|
|
45
70
|
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
<>
|
|
72
|
+
<TypographyPanel
|
|
73
|
+
clientId={ clientId }
|
|
74
|
+
name={ blockName }
|
|
75
|
+
settings={ typographySettings }
|
|
76
|
+
setAttributes={ setAttributes }
|
|
77
|
+
asWrapper={ TypographyToolsPanel }
|
|
78
|
+
/>
|
|
79
|
+
<BackgroundImagePanel
|
|
80
|
+
clientId={ clientId }
|
|
81
|
+
name={ blockName }
|
|
82
|
+
settings={ backgroundSettings }
|
|
83
|
+
setAttributes={ setAttributes }
|
|
84
|
+
asWrapper={ BackgroundToolsPanel }
|
|
85
|
+
/>
|
|
86
|
+
<ElementsEdit
|
|
87
|
+
clientId={ clientId }
|
|
88
|
+
name={ blockName }
|
|
89
|
+
settings={ settings }
|
|
90
|
+
setAttributes={ setAttributes }
|
|
91
|
+
asWrapper={ ColorToolsPanel }
|
|
92
|
+
label={ __( 'Elements' ) }
|
|
93
|
+
defaultControls={ {
|
|
94
|
+
button: hasButtons,
|
|
95
|
+
heading: hasHeading,
|
|
96
|
+
} }
|
|
97
|
+
/>
|
|
98
|
+
</>
|
|
60
99
|
);
|
|
61
100
|
}
|
|
62
101
|
|
|
@@ -72,15 +111,25 @@ const StylesTab = ( {
|
|
|
72
111
|
return (
|
|
73
112
|
<>
|
|
74
113
|
{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }
|
|
75
|
-
{ isSectionBlock && (
|
|
76
|
-
<
|
|
114
|
+
{ isSectionBlock && blockName !== 'core/template-part' && (
|
|
115
|
+
<SectionStyleControls
|
|
77
116
|
blockName={ blockName }
|
|
78
117
|
clientId={ clientId }
|
|
79
118
|
contentClientIds={ contentClientIds }
|
|
80
119
|
/>
|
|
81
120
|
) }
|
|
82
|
-
{
|
|
121
|
+
{
|
|
122
|
+
// Extenders have in the past always been allowed to add controls to group
|
|
123
|
+
// the restrictions are lessened for that block. Template parts are
|
|
124
|
+
// excluded from the curated section controls above and fall through
|
|
125
|
+
// to the full panel set here.
|
|
126
|
+
}
|
|
127
|
+
{ ( ! isSectionBlock || blockName === 'core/template-part' ) && (
|
|
83
128
|
<>
|
|
129
|
+
<InspectorControls.Slot
|
|
130
|
+
group="typography"
|
|
131
|
+
label={ __( 'Typography' ) }
|
|
132
|
+
/>
|
|
84
133
|
<InspectorControls.Slot
|
|
85
134
|
group="color"
|
|
86
135
|
label={ __( 'Color' ) }
|
|
@@ -88,14 +137,10 @@ const StylesTab = ( {
|
|
|
88
137
|
/>
|
|
89
138
|
<InspectorControls.Slot
|
|
90
139
|
group="background"
|
|
91
|
-
label={ __( 'Background
|
|
140
|
+
label={ __( 'Background' ) }
|
|
92
141
|
className="background-block-support-panel__inner-wrapper"
|
|
93
142
|
/>
|
|
94
143
|
<InspectorControls.Slot group="filter" />
|
|
95
|
-
<InspectorControls.Slot
|
|
96
|
-
group="typography"
|
|
97
|
-
label={ __( 'Typography' ) }
|
|
98
|
-
/>
|
|
99
144
|
<InspectorControls.Slot
|
|
100
145
|
group="layout"
|
|
101
146
|
label={ __( 'Layout' ) }
|
|
@@ -108,6 +153,11 @@ const StylesTab = ( {
|
|
|
108
153
|
group="border"
|
|
109
154
|
label={ borderPanelLabel }
|
|
110
155
|
/>
|
|
156
|
+
<InspectorControls.Slot
|
|
157
|
+
group="elements"
|
|
158
|
+
label={ __( 'Elements' ) }
|
|
159
|
+
className="elements-block-support-panel__inner-wrapper"
|
|
160
|
+
/>
|
|
111
161
|
<PositionControls />
|
|
112
162
|
<InspectorControls.Slot group="styles" />
|
|
113
163
|
</>
|
|
@@ -1731,7 +1731,7 @@ describe( 'Selecting links', () => {
|
|
|
1731
1731
|
);
|
|
1732
1732
|
};
|
|
1733
1733
|
|
|
1734
|
-
|
|
1734
|
+
render( <LinkControlConsumer /> );
|
|
1735
1735
|
|
|
1736
1736
|
// Search Input UI.
|
|
1737
1737
|
const searchInput = screen.getByRole( 'combobox', {
|
|
@@ -1804,8 +1804,7 @@ describe( 'Selecting links', () => {
|
|
|
1804
1804
|
} );
|
|
1805
1805
|
|
|
1806
1806
|
// Make sure focus is retained after submission.
|
|
1807
|
-
|
|
1808
|
-
expect( container.firstChild ).toHaveFocus();
|
|
1807
|
+
expect( currentLinkAnchor ).toHaveFocus();
|
|
1809
1808
|
|
|
1810
1809
|
expect( currentLink ).toBeVisible();
|
|
1811
1810
|
expect(
|
|
@@ -12,17 +12,9 @@ import {
|
|
|
12
12
|
privateApis as componentsPrivateApis,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { forwardRef } from '@wordpress/element';
|
|
15
|
-
import {
|
|
16
|
-
Icon,
|
|
17
|
-
lockSmall as lock,
|
|
18
|
-
pinSmall,
|
|
19
|
-
unseen,
|
|
20
|
-
symbol,
|
|
21
|
-
} from '@wordpress/icons';
|
|
15
|
+
import { Icon, lockSmall as lock, pinSmall, unseen } from '@wordpress/icons';
|
|
22
16
|
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
23
|
-
import { useSelect } from '@wordpress/data';
|
|
24
17
|
|
|
25
|
-
// 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.
|
|
26
18
|
import { Tooltip } from '@wordpress/ui';
|
|
27
19
|
|
|
28
20
|
/**
|
|
@@ -34,7 +26,6 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
|
34
26
|
import ListViewExpander from './expander';
|
|
35
27
|
import { useBlockLock } from '../block-lock';
|
|
36
28
|
import useListViewImages from './use-list-view-images';
|
|
37
|
-
import { store as blockEditorStore } from '../../store';
|
|
38
29
|
import { unlock } from '../../lock-unlock';
|
|
39
30
|
|
|
40
31
|
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
@@ -64,13 +55,6 @@ function ListViewBlockSelectButton(
|
|
|
64
55
|
context: 'list-view',
|
|
65
56
|
} );
|
|
66
57
|
const { isLocked } = useBlockLock( clientId );
|
|
67
|
-
const hasPatternName = useSelect(
|
|
68
|
-
( select ) => {
|
|
69
|
-
const { getBlockAttributes } = unlock( select( blockEditorStore ) );
|
|
70
|
-
return !! getBlockAttributes( clientId )?.metadata?.patternName;
|
|
71
|
-
},
|
|
72
|
-
[ clientId ]
|
|
73
|
-
);
|
|
74
58
|
|
|
75
59
|
const shouldShowLockIcon = isLocked;
|
|
76
60
|
const isSticky = blockInformation?.positionType === 'sticky';
|
|
@@ -116,7 +100,7 @@ function ListViewBlockSelectButton(
|
|
|
116
100
|
>
|
|
117
101
|
<ListViewExpander onClick={ onToggleExpanded } />
|
|
118
102
|
<BlockIcon
|
|
119
|
-
icon={
|
|
103
|
+
icon={ blockInformation?.icon }
|
|
120
104
|
showColors
|
|
121
105
|
context="list-view"
|
|
122
106
|
/>
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
__experimentalUnitControl as UnitControl,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
|
|
9
|
-
// 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.
|
|
10
9
|
import { Tooltip } from '@wordpress/ui';
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -252,6 +252,7 @@ export default function useBlockSync( {
|
|
|
252
252
|
cloneBlockWithMapping( block, idMappingRef.current )
|
|
253
253
|
);
|
|
254
254
|
|
|
255
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
255
256
|
setHasControlledInnerBlocks( clientId, true );
|
|
256
257
|
|
|
257
258
|
if ( subscribedRef.current ) {
|
|
@@ -278,12 +279,13 @@ export default function useBlockSync( {
|
|
|
278
279
|
// Clean up the changes made by setControlledBlocks() when the component
|
|
279
280
|
// containing useBlockSync() unmounts.
|
|
280
281
|
const unsetControlledBlocks = () => {
|
|
281
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
282
282
|
if ( clientId ) {
|
|
283
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
283
284
|
setHasControlledInnerBlocks( clientId, false );
|
|
284
285
|
__unstableMarkNextChangeAsNotPersistent();
|
|
285
286
|
replaceInnerBlocks( clientId, [] );
|
|
286
287
|
} else {
|
|
288
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
287
289
|
resetBlocks( [] );
|
|
288
290
|
}
|
|
289
291
|
};
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// Use opacity to work in various editor styles.
|
|
11
11
|
// We don't specify the color here, because blocks or editor styles might provide their own.
|
|
12
12
|
opacity: 0.62;
|
|
13
|
+
// Reset the text shadow from the global styles.
|
|
14
|
+
text-shadow: none;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
&:focus {
|
|
@@ -233,7 +233,6 @@ const ImageURLInputUI = ( {
|
|
|
233
233
|
checked={ linkTarget === '_blank' }
|
|
234
234
|
/>
|
|
235
235
|
<TextControl
|
|
236
|
-
__next40pxDefaultSize
|
|
237
236
|
label={ __( 'Link relation' ) }
|
|
238
237
|
value={ rel ?? '' }
|
|
239
238
|
onChange={ onSetLinkRel }
|
|
@@ -249,7 +248,6 @@ const ImageURLInputUI = ( {
|
|
|
249
248
|
) }
|
|
250
249
|
/>
|
|
251
250
|
<TextControl
|
|
252
|
-
__next40pxDefaultSize
|
|
253
251
|
label={ __( 'Link CSS class' ) }
|
|
254
252
|
value={ linkClass || '' }
|
|
255
253
|
onChange={ onSetLinkClass }
|
|
@@ -15,6 +15,8 @@ import { symbol } from '@wordpress/icons';
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
import { isIsolatedEditorKey } from '../../store/private-keys';
|
|
18
20
|
|
|
19
21
|
/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */
|
|
20
22
|
|
|
@@ -72,11 +74,13 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
72
74
|
if ( ! clientId ) {
|
|
73
75
|
return null;
|
|
74
76
|
}
|
|
77
|
+
const blockEditorSelect = select( blockEditorStore );
|
|
75
78
|
const {
|
|
76
79
|
getBlockName,
|
|
77
80
|
getBlockAttributes,
|
|
78
81
|
__experimentalGetParsedPattern,
|
|
79
|
-
|
|
82
|
+
getSettings,
|
|
83
|
+
} = blockEditorSelect;
|
|
80
84
|
const { getBlockType, getActiveBlockVariation } =
|
|
81
85
|
select( blocksStore );
|
|
82
86
|
const blockName = getBlockName( clientId );
|
|
@@ -85,11 +89,20 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
85
89
|
return null;
|
|
86
90
|
}
|
|
87
91
|
const attributes = getBlockAttributes( clientId );
|
|
92
|
+
const { isWithinEditedContentOnlySection } =
|
|
93
|
+
unlock( blockEditorSelect );
|
|
94
|
+
const isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];
|
|
88
95
|
|
|
89
96
|
// Check if this block is a pattern
|
|
90
97
|
const patternName = attributes?.metadata?.patternName;
|
|
98
|
+
const isEditedContentOnlySection =
|
|
99
|
+
isWithinEditedContentOnlySection( clientId );
|
|
91
100
|
|
|
92
|
-
if (
|
|
101
|
+
if (
|
|
102
|
+
patternName &&
|
|
103
|
+
! isEditedContentOnlySection &&
|
|
104
|
+
! isIsolatedEditor
|
|
105
|
+
) {
|
|
93
106
|
const pattern = __experimentalGetParsedPattern( patternName );
|
|
94
107
|
const positionLabel = getPositionTypeLabel( attributes );
|
|
95
108
|
return {
|