@wordpress/block-editor 16.0.0 → 16.1.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 +18 -0
- package/README.md +8 -0
- package/build/components/alignment-control/ui.cjs +2 -4
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +40 -10
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +5 -3
- package/build/components/block-alignment-control/ui.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +73 -46
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +4 -1
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +5 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +2 -3
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
- package/build/components/block-parent-selector/index.cjs +2 -2
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs +4 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-tools/empty-block-inserter.cjs +2 -7
- package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
- package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
- package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
- package/build/components/border-radius-control/utils.cjs +8 -58
- package/build/components/border-radius-control/utils.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +5 -3
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/dimension-control/index.cjs +30 -20
- package/build/components/dimension-control/index.cjs.map +3 -3
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/editor-styles/index.cjs +9 -1
- package/build/components/editor-styles/index.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +66 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +153 -55
- package/build/components/global-styles/border-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +63 -17
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +242 -64
- package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
- package/build/components/global-styles/filters-panel.cjs +59 -20
- package/build/components/global-styles/filters-panel.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +4 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +142 -0
- package/build/components/global-styles/inheritance/index.cjs.map +7 -0
- package/build/components/global-styles/inherited-value-context.cjs +173 -0
- package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
- package/build/components/global-styles/shadow-panel-components.cjs +38 -20
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +1 -1
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +271 -78
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/line-height-control/index.cjs +1 -1
- package/build/components/line-height-control/index.cjs.map +2 -2
- package/build/components/link-control/index.cjs +3 -1
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs +2 -1
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/block-refs-provider.cjs +8 -2
- package/build/components/provider/block-refs-provider.cjs.map +2 -2
- package/build/components/provider/index.cjs +1 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs +18 -6
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/provider/use-media-upload-settings.cjs +3 -1
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +23 -13
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/spacing-sizes-control/utils.cjs +6 -19
- package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
- package/build/components/text-indent-control/index.cjs +8 -2
- package/build/components/text-indent-control/index.cjs.map +2 -2
- package/build/components/url-input/index.cjs +303 -344
- package/build/components/url-input/index.cjs.map +3 -3
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs +24 -1
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-click-selection.cjs +28 -2
- package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
- package/build/components/writing-flow/use-editable-root.cjs +5 -42
- package/build/components/writing-flow/use-editable-root.cjs.map +2 -2
- package/build/components/writing-flow/use-home-end.cjs +1 -1
- package/build/components/writing-flow/use-home-end.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +17 -13
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/components/writing-flow/utils.cjs +3 -14
- package/build/components/writing-flow/utils.cjs.map +2 -2
- package/build/hooks/background.cjs +13 -10
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-style-variation.cjs +4 -45
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/border.cjs +19 -4
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +6 -2
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -4
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs +26 -14
- package/build/hooks/duotone.cjs.map +3 -3
- package/build/hooks/elements.cjs +14 -4
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/line-height.cjs +1 -2
- package/build/hooks/line-height.cjs.map +2 -2
- package/build/hooks/typography.cjs +13 -4
- package/build/hooks/typography.cjs.map +2 -2
- package/build/private-apis.cjs +9 -5
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +9 -4
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +28 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +6 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +23 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/native-undo.cjs +55 -0
- package/build/utils/native-undo.cjs.map +7 -0
- package/build-module/components/alignment-control/ui.mjs +2 -4
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +43 -10
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +5 -3
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +74 -46
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +4 -1
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +5 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +2 -3
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
- package/build-module/components/block-parent-selector/index.mjs +2 -2
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
- package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
- package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
- package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/border-radius-control/utils.mjs +11 -53
- package/build-module/components/border-radius-control/utils.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +5 -3
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/dimension-control/index.mjs +30 -20
- package/build-module/components/dimension-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/editor-styles/index.mjs +9 -1
- package/build-module/components/editor-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +71 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +157 -56
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +63 -17
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +64 -21
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +4 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +108 -0
- package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
- package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
- package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
- package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +1 -1
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +276 -79
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/line-height-control/index.mjs +1 -1
- package/build-module/components/line-height-control/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs +4 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -1
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/block-refs-provider.mjs +8 -2
- package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +1 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +18 -6
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +28 -14
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
- package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
- package/build-module/components/text-indent-control/index.mjs +8 -2
- package/build-module/components/text-indent-control/index.mjs.map +2 -2
- package/build-module/components/url-input/index.mjs +306 -353
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +24 -1
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs +28 -2
- package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
- package/build-module/components/writing-flow/use-editable-root.mjs +5 -37
- package/build-module/components/writing-flow/use-editable-root.mjs.map +2 -2
- package/build-module/components/writing-flow/use-home-end.mjs +1 -1
- package/build-module/components/writing-flow/use-home-end.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +18 -14
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/components/writing-flow/utils.mjs +2 -11
- package/build-module/components/writing-flow/utils.mjs.map +2 -2
- package/build-module/hooks/background.mjs +13 -10
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +8 -44
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/border.mjs +19 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +7 -3
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +15 -4
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs +20 -9
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +14 -4
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/line-height.mjs +1 -2
- package/build-module/hooks/line-height.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +13 -4
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -3
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +9 -4
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +29 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +6 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +23 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/native-undo.mjs +29 -0
- package/build-module/utils/native-undo.mjs.map +7 -0
- package/build-style/content-rtl.css +10 -18
- package/build-style/content.css +10 -18
- package/build-style/style-rtl.css +150 -7
- package/build-style/style.css +150 -7
- package/package.json +40 -41
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
- package/src/components/alignment-control/ui.js +2 -4
- package/src/components/background-image-control/index.js +74 -37
- package/src/components/background-image-control/style.scss +13 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-alignment-control/ui.js +4 -2
- package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-inspector/index.js +60 -31
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/content.scss +1 -11
- package/src/components/block-list/use-block-props/index.js +5 -1
- package/src/components/block-list/use-block-props/use-focus-handler.js +9 -8
- package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
- package/src/components/block-parent-selector/index.js +5 -2
- package/src/components/block-toolbar/switch-section-style.js +5 -2
- package/src/components/block-tools/empty-block-inserter.js +3 -7
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-vertical-alignment-control/test/index.js +18 -2
- package/src/components/block-vertical-alignment-control/ui.js +3 -5
- package/src/components/border-radius-control/test/utils.js +0 -41
- package/src/components/border-radius-control/utils.js +16 -107
- package/src/components/button-block-appender/content.scss +6 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +6 -3
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
- package/src/components/dimension-control/index.js +13 -1
- package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
- package/src/components/editor-styles/index.js +16 -1
- package/src/components/global-styles/background-panel.js +107 -34
- package/src/components/global-styles/border-panel.js +219 -48
- package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
- package/src/components/global-styles/color-panel.js +92 -11
- package/src/components/global-styles/dimensions-panel.js +422 -71
- package/src/components/global-styles/filters-panel.js +88 -28
- package/src/components/global-styles/hooks.js +8 -1
- package/src/components/global-styles/inheritance/index.js +204 -0
- package/src/components/global-styles/inheritance/style.scss +184 -0
- package/src/components/global-styles/inheritance/test/index.js +281 -0
- package/src/components/global-styles/inherited-value-context.js +271 -0
- package/src/components/global-styles/shadow-panel-components.js +48 -26
- package/src/components/global-styles/state-control.js +2 -2
- package/src/components/global-styles/test/background-panel.js +338 -1
- package/src/components/global-styles/test/border-panel.js +441 -0
- package/src/components/global-styles/test/color-panel.js +182 -2
- package/src/components/global-styles/test/dimensions-panel.js +753 -0
- package/src/components/global-styles/test/filters-panel.js +194 -0
- package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
- package/src/components/global-styles/test/inherited-value-context.js +454 -0
- package/src/components/global-styles/test/typography-panel-core.js +185 -0
- package/src/components/global-styles/test/typography-panel.js +849 -12
- package/src/components/global-styles/typography-panel.js +449 -100
- package/src/components/image-editor/style.scss +33 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/line-height-control/index.js +1 -1
- package/src/components/link-control/index.js +7 -2
- package/src/components/preset-input-control/index.js +4 -1
- package/src/components/provider/block-refs-provider.js +12 -2
- package/src/components/provider/index.js +2 -2
- package/src/components/provider/use-block-sync.js +18 -6
- package/src/components/provider/use-media-upload-settings.js +2 -0
- package/src/components/rich-text/index.js +37 -16
- package/src/components/spacing-sizes-control/test/utils.js +16 -5
- package/src/components/spacing-sizes-control/utils.js +11 -28
- package/src/components/text-indent-control/index.js +8 -0
- package/src/components/url-input/index.js +363 -431
- package/src/components/url-input/test/index.js +592 -0
- package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +51 -1
- package/src/components/writing-flow/use-click-selection.js +54 -3
- package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
- package/src/components/writing-flow/use-editable-root.js +7 -77
- package/src/components/writing-flow/use-home-end.js +17 -9
- package/src/components/writing-flow/use-selection-observer.js +32 -15
- package/src/components/writing-flow/utils.js +3 -24
- package/src/hooks/background.js +26 -21
- package/src/hooks/block-fields/rich-text/styles.scss +1 -1
- package/src/hooks/block-style-variation.js +8 -74
- package/src/hooks/border.js +19 -4
- package/src/hooks/custom-css.js +15 -6
- package/src/hooks/dimensions.js +17 -4
- package/src/hooks/duotone.js +26 -8
- package/src/hooks/elements.js +14 -3
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/test/inherited-value-wiring.js +411 -0
- package/src/hooks/test/preset-round-trip.js +456 -0
- package/src/hooks/typography.js +35 -23
- package/src/private-apis.js +11 -2
- package/src/store/actions.js +10 -4
- package/src/store/private-selectors.js +57 -1
- package/src/store/reducer.js +9 -9
- package/src/store/selectors.js +56 -8
- package/src/store/test/private-selectors.js +160 -1
- package/src/style.scss +2 -0
- package/src/utils/native-undo.js +56 -0
- package/build/components/duotone/utils.cjs +0 -87
- package/build/components/duotone/utils.cjs.map +0 -7
- package/build-module/components/duotone/utils.mjs +0 -59
- package/build-module/components/duotone/utils.mjs.map +0 -7
- package/src/components/duotone/utils.js +0 -90
- package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FontSizePicker,
|
|
6
6
|
__experimentalNumberControl as NumberControl,
|
|
7
7
|
__experimentalToolsPanel as ToolsPanel,
|
|
8
|
-
|
|
8
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
9
9
|
Notice,
|
|
10
10
|
ToggleControl,
|
|
11
11
|
} from '@wordpress/components';
|
|
@@ -38,10 +38,41 @@ import {
|
|
|
38
38
|
findNearestStyleAndWeight,
|
|
39
39
|
} from './typography-utils';
|
|
40
40
|
import { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';
|
|
41
|
+
import {
|
|
42
|
+
getInheritanceProps,
|
|
43
|
+
InheritanceToolsPanelItem,
|
|
44
|
+
isGlobalStylesInheritanceEnabled,
|
|
45
|
+
} from './inheritance';
|
|
41
46
|
|
|
42
47
|
const MIN_TEXT_COLUMNS = 1;
|
|
43
48
|
const MAX_TEXT_COLUMNS = 6;
|
|
44
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Whether a link color should follow a text color change.
|
|
52
|
+
*
|
|
53
|
+
* A link color tracks the text color (e.g. a Button's) unless it was set
|
|
54
|
+
* deliberately. Raw preset refs are compared rather than decoded hex, since
|
|
55
|
+
* distinct slots can share a hex (`dark-background`/`dark-text` both `#000`).
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} value Local block styles.
|
|
58
|
+
* @param {Object} inheritedValue Styles inherited from Global Styles.
|
|
59
|
+
* @return {boolean} Whether to sync the link color to the text color.
|
|
60
|
+
*/
|
|
61
|
+
function shouldSyncLinkColor( value, inheritedValue ) {
|
|
62
|
+
const localLinkColor = value?.elements?.link?.color?.text;
|
|
63
|
+
// A local link color keeps tracking only while it matches the text color;
|
|
64
|
+
// once it differs it was set deliberately and is left alone.
|
|
65
|
+
if ( localLinkColor !== undefined ) {
|
|
66
|
+
return localLinkColor === value?.color?.text;
|
|
67
|
+
}
|
|
68
|
+
// With none set, defer to the inherited values.
|
|
69
|
+
const inheritedLinkColor = inheritedValue?.elements?.link?.color?.text;
|
|
70
|
+
return (
|
|
71
|
+
inheritedLinkColor === undefined ||
|
|
72
|
+
inheritedValue?.color?.text === inheritedLinkColor
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
45
76
|
export function useHasTypographyPanel( settings ) {
|
|
46
77
|
const hasFontFamily = useHasFontFamilyControl( settings );
|
|
47
78
|
const hasLineHeight = useHasLineHeightControl( settings );
|
|
@@ -192,6 +223,29 @@ const DEFAULT_CONTROLS = {
|
|
|
192
223
|
textColumns: true,
|
|
193
224
|
};
|
|
194
225
|
|
|
226
|
+
const EMPTY_VALUES = [ undefined, null, '' ];
|
|
227
|
+
|
|
228
|
+
function hasValue( value ) {
|
|
229
|
+
return ! EMPTY_VALUES.includes( value );
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Extracts the numeric quantity from a raw CSS value so it can be used as a
|
|
234
|
+
* unit-control placeholder. The control's unit selector already reflects the
|
|
235
|
+
* inherited unit, so the placeholder must contain only the number (e.g.
|
|
236
|
+
* `1.5em` -> `1.5`) rather than the full unit string.
|
|
237
|
+
*
|
|
238
|
+
* @param {string|number|undefined} rawValue Inherited value to parse.
|
|
239
|
+
* @return {number|undefined} The numeric quantity, or `undefined` when absent.
|
|
240
|
+
*/
|
|
241
|
+
function getNumericPlaceholder( rawValue ) {
|
|
242
|
+
if ( ! hasValue( rawValue ) ) {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
const [ quantity ] = parseQuantityAndUnitFromRawValue( rawValue );
|
|
246
|
+
return quantity;
|
|
247
|
+
}
|
|
248
|
+
|
|
195
249
|
export default function TypographyPanel( {
|
|
196
250
|
as: Wrapper = TypographyToolsPanel,
|
|
197
251
|
value,
|
|
@@ -201,10 +255,19 @@ export default function TypographyPanel( {
|
|
|
201
255
|
panelId,
|
|
202
256
|
defaultControls = DEFAULT_CONTROLS,
|
|
203
257
|
isGlobalStyles = false,
|
|
258
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),
|
|
204
259
|
contrastWarning,
|
|
205
260
|
} ) {
|
|
206
261
|
const { colors, allColors, areCustomSolidsEnabled, decodeValue } =
|
|
207
262
|
useColorGradientSettings( settings );
|
|
263
|
+
// Always keep the layout className (e.g. `single-column`); only the
|
|
264
|
+
// inheritance treatment is gated on `showInheritanceLabelIndicators`.
|
|
265
|
+
const inheritanceProps = ( isInherited, hasLocalOverride, className ) =>
|
|
266
|
+
getInheritanceProps(
|
|
267
|
+
showInheritanceLabelIndicators && isInherited,
|
|
268
|
+
showInheritanceLabelIndicators && hasLocalOverride,
|
|
269
|
+
className
|
|
270
|
+
);
|
|
208
271
|
|
|
209
272
|
// Text color. Writes to `color.text` (unchanged storage path). The
|
|
210
273
|
// control is rendered here instead of the Color panel because text
|
|
@@ -220,19 +283,13 @@ export default function TypographyPanel( {
|
|
|
220
283
|
newSlug
|
|
221
284
|
);
|
|
222
285
|
let changedObject = setImmutably( value, [ 'color', 'text' ], encoded );
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
) {
|
|
286
|
+
// With the experiment off, keep the pre-inheritance comparison on
|
|
287
|
+
// `inheritedValue`.
|
|
288
|
+
const syncLinkColor = isGlobalStylesInheritanceEnabled()
|
|
289
|
+
? shouldSyncLinkColor( value, inheritedValue )
|
|
290
|
+
: inheritedValue?.color?.text ===
|
|
291
|
+
inheritedValue?.elements?.link?.color?.text;
|
|
292
|
+
if ( syncLinkColor ) {
|
|
236
293
|
changedObject = setImmutably(
|
|
237
294
|
changedObject,
|
|
238
295
|
[ 'elements', 'link', 'color', 'text' ],
|
|
@@ -245,7 +302,19 @@ export default function TypographyPanel( {
|
|
|
245
302
|
|
|
246
303
|
// Font Family
|
|
247
304
|
const hasFontFamilyEnabled = useHasFontFamilyControl( settings );
|
|
248
|
-
|
|
305
|
+
// Render the local value when set, otherwise the inherited value
|
|
306
|
+
// as the at-rest preselection. The placeholder boolean is computed
|
|
307
|
+
// from `value` directly (not from the merged `fontFamily`) so a
|
|
308
|
+
// locally-set value never trips the at-rest visual treatment, even
|
|
309
|
+
// when it equals the inherited value.
|
|
310
|
+
const inheritedFontFamily = decodeValue(
|
|
311
|
+
inheritedValue?.typography?.fontFamily
|
|
312
|
+
);
|
|
313
|
+
const fontFamily =
|
|
314
|
+
decodeValue( value?.typography?.fontFamily ) ?? inheritedFontFamily;
|
|
315
|
+
const isFontFamilyPlaceholder =
|
|
316
|
+
! hasValue( value?.typography?.fontFamily ) &&
|
|
317
|
+
hasValue( inheritedFontFamily );
|
|
249
318
|
const { fontFamilies, fontFamilyFaces } = useMemo( () => {
|
|
250
319
|
return getMergedFontFamiliesAndFontFamilyFaces( settings, fontFamily );
|
|
251
320
|
}, [ settings, fontFamily ] );
|
|
@@ -254,10 +323,13 @@ export default function TypographyPanel( {
|
|
|
254
323
|
const slug = fontFamilies?.find(
|
|
255
324
|
( { fontFamily: f } ) => f === newValue
|
|
256
325
|
)?.slug;
|
|
326
|
+
const nextFontFamily = slug
|
|
327
|
+
? `var:preset|font-family|${ slug }`
|
|
328
|
+
: newValue;
|
|
257
329
|
let updatedValue = setImmutably(
|
|
258
330
|
value,
|
|
259
331
|
[ 'typography', 'fontFamily' ],
|
|
260
|
-
|
|
332
|
+
hasValue( nextFontFamily ) ? nextFontFamily : undefined
|
|
261
333
|
);
|
|
262
334
|
|
|
263
335
|
// Check if current font style/weight are available in the new font family.
|
|
@@ -287,8 +359,12 @@ export default function TypographyPanel( {
|
|
|
287
359
|
...updatedValue,
|
|
288
360
|
typography: {
|
|
289
361
|
...updatedValue?.typography,
|
|
290
|
-
fontStyle: nearestFontStyle
|
|
291
|
-
|
|
362
|
+
fontStyle: hasValue( nearestFontStyle )
|
|
363
|
+
? nearestFontStyle
|
|
364
|
+
: undefined,
|
|
365
|
+
fontWeight: hasValue( nearestFontWeight )
|
|
366
|
+
? nearestFontWeight
|
|
367
|
+
: undefined,
|
|
292
368
|
},
|
|
293
369
|
};
|
|
294
370
|
} else if ( fontStyle || fontWeight ) {
|
|
@@ -306,7 +382,7 @@ export default function TypographyPanel( {
|
|
|
306
382
|
|
|
307
383
|
onChange( updatedValue );
|
|
308
384
|
};
|
|
309
|
-
const hasFontFamily = () =>
|
|
385
|
+
const hasFontFamily = () => hasValue( value?.typography?.fontFamily );
|
|
310
386
|
const resetFontFamily = () => setFontFamily( undefined );
|
|
311
387
|
|
|
312
388
|
// Font Size
|
|
@@ -314,20 +390,27 @@ export default function TypographyPanel( {
|
|
|
314
390
|
const disableCustomFontSizes = ! settings?.typography?.customFontSize;
|
|
315
391
|
const mergedFontSizes = getMergedFontSizes( settings );
|
|
316
392
|
|
|
317
|
-
|
|
393
|
+
// Local-then-inherited resolution for the rendered value. The slug
|
|
394
|
+
// extraction reads the same composite raw value so an inherited
|
|
395
|
+
// preset preselects its chip at rest while a local literal value
|
|
396
|
+
// renders as a literal in the custom-size input.
|
|
397
|
+
const rawLocalFontSize = value?.typography?.fontSize;
|
|
398
|
+
const rawInheritedFontSize = inheritedValue?.typography?.fontSize;
|
|
399
|
+
const rawFontSizeForDisplay = rawLocalFontSize ?? rawInheritedFontSize;
|
|
400
|
+
const fontSize = decodeValue( rawFontSizeForDisplay );
|
|
401
|
+
const inheritedFontSizeDecoded = decodeValue( rawInheritedFontSize );
|
|
402
|
+
const isFontSizePlaceholder =
|
|
403
|
+
! hasValue( rawLocalFontSize ) && hasValue( rawInheritedFontSize );
|
|
318
404
|
|
|
319
|
-
// Extract the slug from the CSS custom property if it exists
|
|
320
|
-
const
|
|
321
|
-
const rawValue = inheritedValue?.typography?.fontSize;
|
|
405
|
+
// Extract the slug from the CSS custom property if it exists.
|
|
406
|
+
const extractSlug = ( rawValue ) => {
|
|
322
407
|
if ( ! rawValue || typeof rawValue !== 'string' ) {
|
|
323
408
|
return undefined;
|
|
324
409
|
}
|
|
325
|
-
|
|
326
410
|
// Block supports use `var:preset` format.
|
|
327
411
|
if ( rawValue.startsWith( 'var:preset|font-size|' ) ) {
|
|
328
412
|
return rawValue.replace( 'var:preset|font-size|', '' );
|
|
329
413
|
}
|
|
330
|
-
|
|
331
414
|
// Global styles data uses `var(--wp--preset)` format.
|
|
332
415
|
const cssVarMatch = rawValue.match(
|
|
333
416
|
/^var\(--wp--preset--font-size--([^)]+)\)$/
|
|
@@ -335,9 +418,10 @@ export default function TypographyPanel( {
|
|
|
335
418
|
if ( cssVarMatch ) {
|
|
336
419
|
return cssVarMatch[ 1 ];
|
|
337
420
|
}
|
|
338
|
-
|
|
339
421
|
return undefined;
|
|
340
|
-
}
|
|
422
|
+
};
|
|
423
|
+
const currentFontSizeSlug = extractSlug( rawFontSizeForDisplay );
|
|
424
|
+
const inheritedFontSizeSlug = extractSlug( rawInheritedFontSize );
|
|
341
425
|
|
|
342
426
|
const setFontSize = ( newValue, metadata ) => {
|
|
343
427
|
const actualValue = !! metadata?.slug
|
|
@@ -348,11 +432,31 @@ export default function TypographyPanel( {
|
|
|
348
432
|
setImmutably(
|
|
349
433
|
value,
|
|
350
434
|
[ 'typography', 'fontSize' ],
|
|
351
|
-
actualValue
|
|
435
|
+
hasValue( actualValue ) ? actualValue : undefined
|
|
352
436
|
)
|
|
353
437
|
);
|
|
354
438
|
};
|
|
355
|
-
|
|
439
|
+
// Display-without-commit interceptor: at-rest, the inner
|
|
440
|
+
// `FontSizePickerToggleGroup` fires `onChange( undefined )` when the
|
|
441
|
+
// user activates the already-preselected (inherited) chip. Treat
|
|
442
|
+
// that as the user's "accept this inherited value" affordance and
|
|
443
|
+
// commit the inherited value to local. Once committed (no longer
|
|
444
|
+
// at-rest), the same `undefined` payload represents a normal
|
|
445
|
+
// deselect, so we let it pass through unchanged. The custom-size
|
|
446
|
+
// input does not emit `undefined` on focus or activation, so this
|
|
447
|
+
// hook is correctly scoped to the ToggleGroup activation path.
|
|
448
|
+
const setFontSizeWithInheritedCommit = ( newValue, metadata ) => {
|
|
449
|
+
if ( isFontSizePlaceholder && newValue === undefined && ! metadata ) {
|
|
450
|
+
if ( inheritedFontSizeSlug ) {
|
|
451
|
+
setFontSize( undefined, { slug: inheritedFontSizeSlug } );
|
|
452
|
+
} else {
|
|
453
|
+
setFontSize( inheritedFontSizeDecoded );
|
|
454
|
+
}
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
setFontSize( newValue, metadata );
|
|
458
|
+
};
|
|
459
|
+
const hasFontSize = () => hasValue( value?.typography?.fontSize );
|
|
356
460
|
const resetFontSize = () => setFontSize( undefined );
|
|
357
461
|
|
|
358
462
|
// Appearance
|
|
@@ -360,8 +464,22 @@ export default function TypographyPanel( {
|
|
|
360
464
|
const appearanceControlLabel = useAppearanceControlLabel( settings );
|
|
361
465
|
const hasFontStyles = settings?.typography?.fontStyle;
|
|
362
466
|
const hasFontWeights = settings?.typography?.fontWeight;
|
|
363
|
-
|
|
364
|
-
|
|
467
|
+
// Render local-then-inherited; placeholder fires only when both
|
|
468
|
+
// local leaves are unset and at least one inherited leaf exists.
|
|
469
|
+
const inheritedFontStyle = decodeValue(
|
|
470
|
+
inheritedValue?.typography?.fontStyle
|
|
471
|
+
);
|
|
472
|
+
const inheritedFontWeight = decodeValue(
|
|
473
|
+
inheritedValue?.typography?.fontWeight
|
|
474
|
+
);
|
|
475
|
+
const fontStyle =
|
|
476
|
+
decodeValue( value?.typography?.fontStyle ) ?? inheritedFontStyle;
|
|
477
|
+
const fontWeight =
|
|
478
|
+
decodeValue( value?.typography?.fontWeight ) ?? inheritedFontWeight;
|
|
479
|
+
const isFontAppearancePlaceholder =
|
|
480
|
+
! hasValue( value?.typography?.fontStyle ) &&
|
|
481
|
+
! hasValue( value?.typography?.fontWeight ) &&
|
|
482
|
+
( hasValue( inheritedFontStyle ) || hasValue( inheritedFontWeight ) );
|
|
365
483
|
const setFontAppearance = useCallback(
|
|
366
484
|
( { fontStyle: newFontStyle, fontWeight: newFontWeight } ) => {
|
|
367
485
|
// Only update the font style and weight if they have changed.
|
|
@@ -370,55 +488,115 @@ export default function TypographyPanel( {
|
|
|
370
488
|
...value,
|
|
371
489
|
typography: {
|
|
372
490
|
...value?.typography,
|
|
373
|
-
fontStyle: newFontStyle
|
|
374
|
-
|
|
491
|
+
fontStyle: hasValue( newFontStyle )
|
|
492
|
+
? newFontStyle
|
|
493
|
+
: undefined,
|
|
494
|
+
fontWeight: hasValue( newFontWeight )
|
|
495
|
+
? newFontWeight
|
|
496
|
+
: undefined,
|
|
375
497
|
},
|
|
376
498
|
} );
|
|
377
499
|
}
|
|
378
500
|
},
|
|
379
501
|
[ fontStyle, fontWeight, onChange, value ]
|
|
380
502
|
);
|
|
503
|
+
// Display-without-commit interceptor for FontAppearance: when the
|
|
504
|
+
// control is at rest (no local override, displaying the inherited
|
|
505
|
+
// font style/weight), activating the already-preselected option
|
|
506
|
+
// would otherwise be swallowed by the equality short-circuit in
|
|
507
|
+
// `setFontAppearance`. Treat that activation as the user's
|
|
508
|
+
// "accept this inherited value" affordance and commit the
|
|
509
|
+
// inherited values to local explicitly.
|
|
510
|
+
const setFontAppearanceWithInheritedCommit = useCallback(
|
|
511
|
+
( next ) => {
|
|
512
|
+
if (
|
|
513
|
+
isFontAppearancePlaceholder &&
|
|
514
|
+
next.fontStyle === fontStyle &&
|
|
515
|
+
next.fontWeight === fontWeight
|
|
516
|
+
) {
|
|
517
|
+
onChange( {
|
|
518
|
+
...value,
|
|
519
|
+
typography: {
|
|
520
|
+
...value?.typography,
|
|
521
|
+
fontStyle: hasValue( fontStyle )
|
|
522
|
+
? fontStyle
|
|
523
|
+
: undefined,
|
|
524
|
+
fontWeight: hasValue( fontWeight )
|
|
525
|
+
? fontWeight
|
|
526
|
+
: undefined,
|
|
527
|
+
},
|
|
528
|
+
} );
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
setFontAppearance( next );
|
|
532
|
+
},
|
|
533
|
+
[
|
|
534
|
+
isFontAppearancePlaceholder,
|
|
535
|
+
fontStyle,
|
|
536
|
+
fontWeight,
|
|
537
|
+
onChange,
|
|
538
|
+
value,
|
|
539
|
+
setFontAppearance,
|
|
540
|
+
]
|
|
541
|
+
);
|
|
381
542
|
const hasFontAppearance = () =>
|
|
382
|
-
|
|
543
|
+
hasValue( value?.typography?.fontStyle ) ||
|
|
544
|
+
hasValue( value?.typography?.fontWeight );
|
|
383
545
|
const resetFontAppearance = useCallback( () => {
|
|
384
546
|
setFontAppearance( {} );
|
|
385
547
|
}, [ setFontAppearance ] );
|
|
386
548
|
|
|
387
549
|
// Line Height
|
|
388
550
|
const hasLineHeightEnabled = useHasLineHeightControl( settings );
|
|
389
|
-
const
|
|
551
|
+
const localLineHeight = decodeValue( value?.typography?.lineHeight );
|
|
552
|
+
const inheritedLineHeight = decodeValue(
|
|
553
|
+
inheritedValue?.typography?.lineHeight
|
|
554
|
+
);
|
|
555
|
+
const isLineHeightPlaceholder =
|
|
556
|
+
! hasValue( value?.typography?.lineHeight ) &&
|
|
557
|
+
hasValue( inheritedLineHeight );
|
|
390
558
|
const setLineHeight = ( newValue ) => {
|
|
391
559
|
onChange(
|
|
392
560
|
setImmutably(
|
|
393
561
|
value,
|
|
394
562
|
[ 'typography', 'lineHeight' ],
|
|
395
|
-
newValue
|
|
563
|
+
hasValue( newValue ) ? newValue : undefined
|
|
396
564
|
)
|
|
397
565
|
);
|
|
398
566
|
};
|
|
399
|
-
const hasLineHeight = () => value?.typography?.lineHeight
|
|
567
|
+
const hasLineHeight = () => hasValue( value?.typography?.lineHeight );
|
|
400
568
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
401
569
|
|
|
402
570
|
// Letter Spacing
|
|
403
571
|
const hasLetterSpacingControl = useHasLetterSpacingControl( settings );
|
|
404
|
-
const
|
|
572
|
+
const localLetterSpacing = decodeValue( value?.typography?.letterSpacing );
|
|
573
|
+
const inheritedLetterSpacing = decodeValue(
|
|
405
574
|
inheritedValue?.typography?.letterSpacing
|
|
406
575
|
);
|
|
576
|
+
const isLetterSpacingPlaceholder =
|
|
577
|
+
! hasValue( value?.typography?.letterSpacing ) &&
|
|
578
|
+
hasValue( inheritedLetterSpacing );
|
|
407
579
|
const setLetterSpacing = ( newValue ) => {
|
|
408
580
|
onChange(
|
|
409
581
|
setImmutably(
|
|
410
582
|
value,
|
|
411
583
|
[ 'typography', 'letterSpacing' ],
|
|
412
|
-
newValue
|
|
584
|
+
hasValue( newValue ) ? newValue : undefined
|
|
413
585
|
)
|
|
414
586
|
);
|
|
415
587
|
};
|
|
416
|
-
const hasLetterSpacing = () =>
|
|
588
|
+
const hasLetterSpacing = () => hasValue( value?.typography?.letterSpacing );
|
|
417
589
|
const resetLetterSpacing = () => setLetterSpacing( undefined );
|
|
418
590
|
|
|
419
591
|
// Text Indent
|
|
420
592
|
const hasTextIndentControl = useHasTextIndentControl( settings );
|
|
421
|
-
const
|
|
593
|
+
const localTextIndent = decodeValue( value?.typography?.textIndent );
|
|
594
|
+
const inheritedTextIndent = decodeValue(
|
|
595
|
+
inheritedValue?.typography?.textIndent
|
|
596
|
+
);
|
|
597
|
+
const isTextIndentPlaceholder =
|
|
598
|
+
! hasValue( value?.typography?.textIndent ) &&
|
|
599
|
+
hasValue( inheritedTextIndent );
|
|
422
600
|
|
|
423
601
|
// Get the setting value - can be 'subsequent' (default), 'all', or false.
|
|
424
602
|
// The setting determines which CSS selector is used for the text-indent style.
|
|
@@ -430,7 +608,7 @@ export default function TypographyPanel( {
|
|
|
430
608
|
setImmutably(
|
|
431
609
|
value,
|
|
432
610
|
[ 'typography', 'textIndent' ],
|
|
433
|
-
newValue
|
|
611
|
+
hasValue( newValue ) ? newValue : undefined
|
|
434
612
|
)
|
|
435
613
|
);
|
|
436
614
|
};
|
|
@@ -448,7 +626,7 @@ export default function TypographyPanel( {
|
|
|
448
626
|
} );
|
|
449
627
|
};
|
|
450
628
|
|
|
451
|
-
const hasTextIndent = () =>
|
|
629
|
+
const hasTextIndent = () => hasValue( value?.typography?.textIndent );
|
|
452
630
|
const resetTextIndent = () => {
|
|
453
631
|
onChange(
|
|
454
632
|
setImmutably( value, [ 'typography', 'textIndent' ], undefined )
|
|
@@ -460,82 +638,151 @@ export default function TypographyPanel( {
|
|
|
460
638
|
|
|
461
639
|
// Text Columns
|
|
462
640
|
const hasTextColumnsControl = useHasTextColumnsControl( settings );
|
|
463
|
-
const
|
|
641
|
+
const localTextColumns = decodeValue( value?.typography?.textColumns );
|
|
642
|
+
const inheritedTextColumns = decodeValue(
|
|
643
|
+
inheritedValue?.typography?.textColumns
|
|
644
|
+
);
|
|
645
|
+
const isTextColumnsPlaceholder =
|
|
646
|
+
! hasValue( value?.typography?.textColumns ) &&
|
|
647
|
+
hasValue( inheritedTextColumns );
|
|
464
648
|
const setTextColumns = ( newValue ) => {
|
|
465
649
|
onChange(
|
|
466
650
|
setImmutably(
|
|
467
651
|
value,
|
|
468
652
|
[ 'typography', 'textColumns' ],
|
|
469
|
-
newValue
|
|
653
|
+
hasValue( newValue ) ? newValue : undefined
|
|
470
654
|
)
|
|
471
655
|
);
|
|
472
656
|
};
|
|
473
|
-
const hasTextColumns = () =>
|
|
657
|
+
const hasTextColumns = () => hasValue( value?.typography?.textColumns );
|
|
474
658
|
const resetTextColumns = () => setTextColumns( undefined );
|
|
475
659
|
|
|
476
660
|
// Text Transform
|
|
477
661
|
const hasTextTransformControl = useHasTextTransformControl( settings );
|
|
478
|
-
const
|
|
662
|
+
const inheritedTextTransform = decodeValue(
|
|
479
663
|
inheritedValue?.typography?.textTransform
|
|
480
664
|
);
|
|
665
|
+
const textTransform =
|
|
666
|
+
decodeValue( value?.typography?.textTransform ) ??
|
|
667
|
+
inheritedTextTransform;
|
|
668
|
+
const isTextTransformPlaceholder =
|
|
669
|
+
! hasValue( value?.typography?.textTransform ) &&
|
|
670
|
+
hasValue( inheritedTextTransform );
|
|
481
671
|
const setTextTransform = ( newValue ) => {
|
|
482
672
|
onChange(
|
|
483
673
|
setImmutably(
|
|
484
674
|
value,
|
|
485
675
|
[ 'typography', 'textTransform' ],
|
|
486
|
-
newValue
|
|
676
|
+
hasValue( newValue ) ? newValue : undefined
|
|
487
677
|
)
|
|
488
678
|
);
|
|
489
679
|
};
|
|
490
|
-
|
|
680
|
+
// Display-without-commit interceptor: when at-rest, the inner
|
|
681
|
+
// `ToggleGroupControl` fires `onChange( undefined )` if the user
|
|
682
|
+
// activates the already-preselected (inherited) option. We treat
|
|
683
|
+
// that activation as the user's "accept this inherited value"
|
|
684
|
+
// affordance and commit the inherited value to local. When
|
|
685
|
+
// committed (no longer at-rest), the same `undefined` payload
|
|
686
|
+
// represents a normal `isDeselectable` deselect, so we let it pass
|
|
687
|
+
// through unchanged.
|
|
688
|
+
const setTextTransformWithInheritedCommit = ( newValue ) => {
|
|
689
|
+
if ( isTextTransformPlaceholder && newValue === undefined ) {
|
|
690
|
+
setTextTransform( inheritedTextTransform );
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
setTextTransform( newValue );
|
|
694
|
+
};
|
|
695
|
+
const hasTextTransform = () => hasValue( value?.typography?.textTransform );
|
|
491
696
|
const resetTextTransform = () => setTextTransform( undefined );
|
|
492
697
|
|
|
493
698
|
// Text Decoration
|
|
494
699
|
const hasTextDecorationControl = useHasTextDecorationControl( settings );
|
|
495
|
-
const
|
|
700
|
+
const inheritedTextDecoration = decodeValue(
|
|
496
701
|
inheritedValue?.typography?.textDecoration
|
|
497
702
|
);
|
|
703
|
+
const textDecoration =
|
|
704
|
+
decodeValue( value?.typography?.textDecoration ) ??
|
|
705
|
+
inheritedTextDecoration;
|
|
706
|
+
const isTextDecorationPlaceholder =
|
|
707
|
+
! hasValue( value?.typography?.textDecoration ) &&
|
|
708
|
+
hasValue( inheritedTextDecoration );
|
|
498
709
|
const setTextDecoration = ( newValue ) => {
|
|
499
710
|
onChange(
|
|
500
711
|
setImmutably(
|
|
501
712
|
value,
|
|
502
713
|
[ 'typography', 'textDecoration' ],
|
|
503
|
-
newValue
|
|
714
|
+
hasValue( newValue ) ? newValue : undefined
|
|
504
715
|
)
|
|
505
716
|
);
|
|
506
717
|
};
|
|
507
|
-
const
|
|
718
|
+
const setTextDecorationWithInheritedCommit = ( newValue ) => {
|
|
719
|
+
if ( isTextDecorationPlaceholder && newValue === undefined ) {
|
|
720
|
+
setTextDecoration( inheritedTextDecoration );
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
setTextDecoration( newValue );
|
|
724
|
+
};
|
|
725
|
+
const hasTextDecoration = () =>
|
|
726
|
+
hasValue( value?.typography?.textDecoration );
|
|
508
727
|
const resetTextDecoration = () => setTextDecoration( undefined );
|
|
509
728
|
|
|
510
729
|
// Text Orientation
|
|
511
730
|
const hasWritingModeControl = useHasWritingModeControl( settings );
|
|
512
|
-
const
|
|
731
|
+
const inheritedWritingMode = decodeValue(
|
|
732
|
+
inheritedValue?.typography?.writingMode
|
|
733
|
+
);
|
|
734
|
+
const writingMode =
|
|
735
|
+
decodeValue( value?.typography?.writingMode ) ?? inheritedWritingMode;
|
|
736
|
+
const isWritingModePlaceholder =
|
|
737
|
+
! hasValue( value?.typography?.writingMode ) &&
|
|
738
|
+
hasValue( inheritedWritingMode );
|
|
513
739
|
const setWritingMode = ( newValue ) => {
|
|
514
740
|
onChange(
|
|
515
741
|
setImmutably(
|
|
516
742
|
value,
|
|
517
743
|
[ 'typography', 'writingMode' ],
|
|
518
|
-
newValue
|
|
744
|
+
hasValue( newValue ) ? newValue : undefined
|
|
519
745
|
)
|
|
520
746
|
);
|
|
521
747
|
};
|
|
522
|
-
const
|
|
748
|
+
const setWritingModeWithInheritedCommit = ( newValue ) => {
|
|
749
|
+
if ( isWritingModePlaceholder && newValue === undefined ) {
|
|
750
|
+
setWritingMode( inheritedWritingMode );
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
setWritingMode( newValue );
|
|
754
|
+
};
|
|
755
|
+
const hasWritingMode = () => hasValue( value?.typography?.writingMode );
|
|
523
756
|
const resetWritingMode = () => setWritingMode( undefined );
|
|
524
757
|
|
|
525
758
|
// Text Alignment
|
|
526
759
|
const hasTextAlignmentControl = useHasTextAlignmentControl( settings );
|
|
527
760
|
|
|
528
|
-
const
|
|
761
|
+
const inheritedTextAlign = decodeValue(
|
|
762
|
+
inheritedValue?.typography?.textAlign
|
|
763
|
+
);
|
|
764
|
+
const textAlign =
|
|
765
|
+
decodeValue( value?.typography?.textAlign ) ?? inheritedTextAlign;
|
|
766
|
+
const isTextAlignPlaceholder =
|
|
767
|
+
! hasValue( value?.typography?.textAlign ) &&
|
|
768
|
+
hasValue( inheritedTextAlign );
|
|
529
769
|
const setTextAlign = ( newValue ) => {
|
|
530
770
|
onChange(
|
|
531
771
|
setImmutably(
|
|
532
772
|
value,
|
|
533
773
|
[ 'typography', 'textAlign' ],
|
|
534
|
-
newValue
|
|
774
|
+
hasValue( newValue ) ? newValue : undefined
|
|
535
775
|
)
|
|
536
776
|
);
|
|
537
777
|
};
|
|
538
|
-
const
|
|
778
|
+
const setTextAlignWithInheritedCommit = ( newValue ) => {
|
|
779
|
+
if ( isTextAlignPlaceholder && newValue === undefined ) {
|
|
780
|
+
setTextAlign( inheritedTextAlign );
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
setTextAlign( newValue );
|
|
784
|
+
};
|
|
785
|
+
const hasTextAlign = () => hasValue( value?.typography?.textAlign );
|
|
539
786
|
const resetTextAlign = () => setTextAlign( undefined );
|
|
540
787
|
|
|
541
788
|
const resetAllFilter = useCallback(
|
|
@@ -571,8 +818,15 @@ export default function TypographyPanel( {
|
|
|
571
818
|
hasValue={ hasTextColorValue }
|
|
572
819
|
resetValue={ resetTextColor }
|
|
573
820
|
isShownByDefault={ defaultControls.textColor }
|
|
574
|
-
indicators={ [ textColor ] }
|
|
821
|
+
indicators={ [ userTextColor ?? textColor ] }
|
|
575
822
|
contrastWarning={ contrastWarning }
|
|
823
|
+
showInheritanceLabelIndicators={
|
|
824
|
+
showInheritanceLabelIndicators
|
|
825
|
+
}
|
|
826
|
+
isPlaceholder={
|
|
827
|
+
userTextColor === undefined && textColor !== undefined
|
|
828
|
+
}
|
|
829
|
+
hasInheritedValue={ textColor !== undefined }
|
|
576
830
|
tabs={ [
|
|
577
831
|
{
|
|
578
832
|
key: 'text',
|
|
@@ -582,8 +836,15 @@ export default function TypographyPanel( {
|
|
|
582
836
|
inheritedValue?.color?.text,
|
|
583
837
|
'color'
|
|
584
838
|
),
|
|
839
|
+
userSlug: extractPresetSlug(
|
|
840
|
+
value?.color?.text,
|
|
841
|
+
'color'
|
|
842
|
+
),
|
|
585
843
|
setValue: setTextColor,
|
|
586
844
|
userValue: userTextColor,
|
|
845
|
+
isPlaceholder:
|
|
846
|
+
userTextColor === undefined &&
|
|
847
|
+
textColor !== undefined,
|
|
587
848
|
},
|
|
588
849
|
] }
|
|
589
850
|
colorGradientControlSettings={ {
|
|
@@ -594,7 +855,11 @@ export default function TypographyPanel( {
|
|
|
594
855
|
/>
|
|
595
856
|
) }
|
|
596
857
|
{ hasFontFamilyEnabled && (
|
|
597
|
-
<
|
|
858
|
+
<InheritanceToolsPanelItem
|
|
859
|
+
{ ...inheritanceProps(
|
|
860
|
+
isFontFamilyPlaceholder,
|
|
861
|
+
hasFontFamily() && inheritedFontFamily !== undefined
|
|
862
|
+
) }
|
|
598
863
|
label={ __( 'Font' ) }
|
|
599
864
|
hasValue={ hasFontFamily }
|
|
600
865
|
onDeselect={ resetFontFamily }
|
|
@@ -606,12 +871,17 @@ export default function TypographyPanel( {
|
|
|
606
871
|
value={ fontFamily }
|
|
607
872
|
onChange={ setFontFamily }
|
|
608
873
|
/>
|
|
609
|
-
</
|
|
874
|
+
</InheritanceToolsPanelItem>
|
|
610
875
|
) }
|
|
611
876
|
{ hasFontSizeEnabled && (
|
|
612
|
-
<
|
|
877
|
+
<InheritanceToolsPanelItem
|
|
878
|
+
{ ...inheritanceProps(
|
|
879
|
+
isFontSizePlaceholder,
|
|
880
|
+
hasFontSize() && rawInheritedFontSize !== undefined
|
|
881
|
+
) }
|
|
613
882
|
label={ __( 'Size' ) }
|
|
614
883
|
hasValue={ hasFontSize }
|
|
884
|
+
hasInlineEndToggle
|
|
615
885
|
onDeselect={ resetFontSize }
|
|
616
886
|
isShownByDefault={ defaultControls.fontSize }
|
|
617
887
|
panelId={ panelId }
|
|
@@ -619,16 +889,22 @@ export default function TypographyPanel( {
|
|
|
619
889
|
<FontSizePicker
|
|
620
890
|
value={ currentFontSizeSlug || fontSize }
|
|
621
891
|
valueMode={ currentFontSizeSlug ? 'slug' : 'literal' }
|
|
622
|
-
onChange={
|
|
892
|
+
onChange={ setFontSizeWithInheritedCommit }
|
|
623
893
|
fontSizes={ mergedFontSizes }
|
|
624
894
|
disableCustomFontSizes={ disableCustomFontSizes }
|
|
625
895
|
withReset={ false }
|
|
626
896
|
withSlider
|
|
627
897
|
/>
|
|
628
|
-
</
|
|
898
|
+
</InheritanceToolsPanelItem>
|
|
629
899
|
) }
|
|
630
900
|
{ hasAppearanceControl && (
|
|
631
|
-
<
|
|
901
|
+
<InheritanceToolsPanelItem
|
|
902
|
+
{ ...inheritanceProps(
|
|
903
|
+
isFontAppearancePlaceholder,
|
|
904
|
+
hasFontAppearance() &&
|
|
905
|
+
( inheritedFontStyle !== undefined ||
|
|
906
|
+
inheritedFontWeight !== undefined )
|
|
907
|
+
) }
|
|
632
908
|
label={ appearanceControlLabel }
|
|
633
909
|
hasValue={ hasFontAppearance }
|
|
634
910
|
onDeselect={ resetFontAppearance }
|
|
@@ -640,16 +916,20 @@ export default function TypographyPanel( {
|
|
|
640
916
|
fontStyle,
|
|
641
917
|
fontWeight,
|
|
642
918
|
} }
|
|
643
|
-
onChange={
|
|
919
|
+
onChange={ setFontAppearanceWithInheritedCommit }
|
|
644
920
|
hasFontStyles={ hasFontStyles }
|
|
645
921
|
hasFontWeights={ hasFontWeights }
|
|
646
922
|
fontFamilyFaces={ fontFamilyFaces }
|
|
647
923
|
/>
|
|
648
|
-
</
|
|
924
|
+
</InheritanceToolsPanelItem>
|
|
649
925
|
) }
|
|
650
926
|
{ hasLineHeightEnabled && (
|
|
651
|
-
<
|
|
652
|
-
|
|
927
|
+
<InheritanceToolsPanelItem
|
|
928
|
+
{ ...inheritanceProps(
|
|
929
|
+
isLineHeightPlaceholder,
|
|
930
|
+
hasLineHeight() && inheritedLineHeight !== undefined,
|
|
931
|
+
'single-column'
|
|
932
|
+
) }
|
|
653
933
|
label={ __( 'Line height' ) }
|
|
654
934
|
hasValue={ hasLineHeight }
|
|
655
935
|
onDeselect={ resetLineHeight }
|
|
@@ -658,14 +938,31 @@ export default function TypographyPanel( {
|
|
|
658
938
|
>
|
|
659
939
|
<LineHeightControl
|
|
660
940
|
__unstableInputWidth="auto"
|
|
661
|
-
value={
|
|
941
|
+
value={ localLineHeight ?? inheritedLineHeight }
|
|
662
942
|
onChange={ setLineHeight }
|
|
943
|
+
// Only override the placeholder when there is an
|
|
944
|
+
// inherited value to surface. Passing `undefined` would
|
|
945
|
+
// clobber `LineHeightControl`'s own `BASE_DEFAULT_VALUE`
|
|
946
|
+
// (1.5) placeholder.
|
|
947
|
+
{ ...( isLineHeightPlaceholder
|
|
948
|
+
? {
|
|
949
|
+
placeholder:
|
|
950
|
+
getNumericPlaceholder(
|
|
951
|
+
inheritedLineHeight
|
|
952
|
+
),
|
|
953
|
+
}
|
|
954
|
+
: {} ) }
|
|
663
955
|
/>
|
|
664
|
-
</
|
|
956
|
+
</InheritanceToolsPanelItem>
|
|
665
957
|
) }
|
|
666
958
|
{ hasLetterSpacingControl && (
|
|
667
|
-
<
|
|
668
|
-
|
|
959
|
+
<InheritanceToolsPanelItem
|
|
960
|
+
{ ...inheritanceProps(
|
|
961
|
+
isLetterSpacingPlaceholder,
|
|
962
|
+
hasLetterSpacing() &&
|
|
963
|
+
inheritedLetterSpacing !== undefined,
|
|
964
|
+
'single-column'
|
|
965
|
+
) }
|
|
669
966
|
label={ __( 'Letter spacing' ) }
|
|
670
967
|
hasValue={ hasLetterSpacing }
|
|
671
968
|
onDeselect={ resetLetterSpacing }
|
|
@@ -673,14 +970,32 @@ export default function TypographyPanel( {
|
|
|
673
970
|
panelId={ panelId }
|
|
674
971
|
>
|
|
675
972
|
<LetterSpacingControl
|
|
676
|
-
value
|
|
973
|
+
// Local-then-inherited: render the inherited value as
|
|
974
|
+
// the control's value at rest so the unit parses from
|
|
975
|
+
// it (e.g. "0.02em" keeps the em unit rather than the
|
|
976
|
+
// value string sitting behind a default px unit). It is
|
|
977
|
+
// only written to local on user change. Matches the
|
|
978
|
+
// ToggleGroup/FontSize controls rather than the
|
|
979
|
+
// native-placeholder pattern.
|
|
980
|
+
value={ localLetterSpacing ?? inheritedLetterSpacing }
|
|
677
981
|
onChange={ setLetterSpacing }
|
|
678
982
|
__unstableInputWidth="auto"
|
|
983
|
+
placeholder={
|
|
984
|
+
isLetterSpacingPlaceholder
|
|
985
|
+
? getNumericPlaceholder(
|
|
986
|
+
inheritedLetterSpacing
|
|
987
|
+
)
|
|
988
|
+
: undefined
|
|
989
|
+
}
|
|
679
990
|
/>
|
|
680
|
-
</
|
|
991
|
+
</InheritanceToolsPanelItem>
|
|
681
992
|
) }
|
|
682
993
|
{ hasTextIndentControl && (
|
|
683
|
-
<
|
|
994
|
+
<InheritanceToolsPanelItem
|
|
995
|
+
{ ...inheritanceProps(
|
|
996
|
+
isTextIndentPlaceholder,
|
|
997
|
+
hasTextIndent() && inheritedTextIndent !== undefined
|
|
998
|
+
) }
|
|
684
999
|
label={ __( 'Line indent' ) }
|
|
685
1000
|
hasValue={ hasTextIndent }
|
|
686
1001
|
onDeselect={ resetTextIndent }
|
|
@@ -688,11 +1003,22 @@ export default function TypographyPanel( {
|
|
|
688
1003
|
panelId={ panelId }
|
|
689
1004
|
>
|
|
690
1005
|
<TextIndentControl
|
|
691
|
-
value
|
|
1006
|
+
// Local-then-inherited: render the inherited value as
|
|
1007
|
+
// the control's value at rest so the UnitControl parses
|
|
1008
|
+
// and shows the inherited unit (e.g. `1.5em` selects the
|
|
1009
|
+
// `em` unit) instead of a raw string in the placeholder
|
|
1010
|
+
// while the unit stays at the default `px`. Written to
|
|
1011
|
+
// local only on user change.
|
|
1012
|
+
value={ localTextIndent ?? inheritedTextIndent }
|
|
692
1013
|
onChange={ setTextIndentValue }
|
|
693
1014
|
__unstableInputWidth="auto"
|
|
694
1015
|
withSlider
|
|
695
1016
|
hasBottomMargin={ isGlobalStyles }
|
|
1017
|
+
placeholder={
|
|
1018
|
+
isTextIndentPlaceholder
|
|
1019
|
+
? getNumericPlaceholder( inheritedTextIndent )
|
|
1020
|
+
: undefined
|
|
1021
|
+
}
|
|
696
1022
|
/>
|
|
697
1023
|
{ isGlobalStyles && (
|
|
698
1024
|
<ToggleControl
|
|
@@ -702,11 +1028,15 @@ export default function TypographyPanel( {
|
|
|
702
1028
|
help={ textIndentHelp }
|
|
703
1029
|
/>
|
|
704
1030
|
) }
|
|
705
|
-
</
|
|
1031
|
+
</InheritanceToolsPanelItem>
|
|
706
1032
|
) }
|
|
707
1033
|
{ hasTextColumnsControl && (
|
|
708
|
-
<
|
|
709
|
-
|
|
1034
|
+
<InheritanceToolsPanelItem
|
|
1035
|
+
{ ...inheritanceProps(
|
|
1036
|
+
isTextColumnsPlaceholder,
|
|
1037
|
+
hasTextColumns() && inheritedTextColumns !== undefined,
|
|
1038
|
+
'single-column'
|
|
1039
|
+
) }
|
|
710
1040
|
label={ __( 'Columns' ) }
|
|
711
1041
|
hasValue={ hasTextColumns }
|
|
712
1042
|
onDeselect={ resetTextColumns }
|
|
@@ -718,15 +1048,25 @@ export default function TypographyPanel( {
|
|
|
718
1048
|
max={ MAX_TEXT_COLUMNS }
|
|
719
1049
|
min={ MIN_TEXT_COLUMNS }
|
|
720
1050
|
onChange={ setTextColumns }
|
|
1051
|
+
placeholder={
|
|
1052
|
+
isTextColumnsPlaceholder
|
|
1053
|
+
? inheritedTextColumns
|
|
1054
|
+
: undefined
|
|
1055
|
+
}
|
|
721
1056
|
spinControls="custom"
|
|
722
|
-
value={
|
|
1057
|
+
value={ localTextColumns }
|
|
723
1058
|
initialPosition={ 1 }
|
|
724
1059
|
/>
|
|
725
|
-
</
|
|
1060
|
+
</InheritanceToolsPanelItem>
|
|
726
1061
|
) }
|
|
727
1062
|
{ hasTextDecorationControl && (
|
|
728
|
-
<
|
|
729
|
-
|
|
1063
|
+
<InheritanceToolsPanelItem
|
|
1064
|
+
{ ...inheritanceProps(
|
|
1065
|
+
isTextDecorationPlaceholder,
|
|
1066
|
+
hasTextDecoration() &&
|
|
1067
|
+
inheritedTextDecoration !== undefined,
|
|
1068
|
+
'single-column'
|
|
1069
|
+
) }
|
|
730
1070
|
label={ __( 'Decoration' ) }
|
|
731
1071
|
hasValue={ hasTextDecoration }
|
|
732
1072
|
onDeselect={ resetTextDecoration }
|
|
@@ -735,15 +1075,18 @@ export default function TypographyPanel( {
|
|
|
735
1075
|
>
|
|
736
1076
|
<TextDecorationControl
|
|
737
1077
|
value={ textDecoration }
|
|
738
|
-
onChange={
|
|
739
|
-
size="__unstable-large"
|
|
1078
|
+
onChange={ setTextDecorationWithInheritedCommit }
|
|
740
1079
|
__unstableInputWidth="auto"
|
|
741
1080
|
/>
|
|
742
|
-
</
|
|
1081
|
+
</InheritanceToolsPanelItem>
|
|
743
1082
|
) }
|
|
744
1083
|
{ hasWritingModeControl && (
|
|
745
|
-
<
|
|
746
|
-
|
|
1084
|
+
<InheritanceToolsPanelItem
|
|
1085
|
+
{ ...inheritanceProps(
|
|
1086
|
+
isWritingModePlaceholder,
|
|
1087
|
+
hasWritingMode() && inheritedWritingMode !== undefined,
|
|
1088
|
+
'single-column'
|
|
1089
|
+
) }
|
|
747
1090
|
label={ __( 'Orientation' ) }
|
|
748
1091
|
hasValue={ hasWritingMode }
|
|
749
1092
|
onDeselect={ resetWritingMode }
|
|
@@ -752,13 +1095,17 @@ export default function TypographyPanel( {
|
|
|
752
1095
|
>
|
|
753
1096
|
<WritingModeControl
|
|
754
1097
|
value={ writingMode }
|
|
755
|
-
onChange={
|
|
756
|
-
size="__unstable-large"
|
|
1098
|
+
onChange={ setWritingModeWithInheritedCommit }
|
|
757
1099
|
/>
|
|
758
|
-
</
|
|
1100
|
+
</InheritanceToolsPanelItem>
|
|
759
1101
|
) }
|
|
760
1102
|
{ hasTextTransformControl && (
|
|
761
|
-
<
|
|
1103
|
+
<InheritanceToolsPanelItem
|
|
1104
|
+
{ ...inheritanceProps(
|
|
1105
|
+
isTextTransformPlaceholder,
|
|
1106
|
+
hasTextTransform() &&
|
|
1107
|
+
inheritedTextTransform !== undefined
|
|
1108
|
+
) }
|
|
762
1109
|
label={ __( 'Letter case' ) }
|
|
763
1110
|
hasValue={ hasTextTransform }
|
|
764
1111
|
onDeselect={ resetTextTransform }
|
|
@@ -767,15 +1114,18 @@ export default function TypographyPanel( {
|
|
|
767
1114
|
>
|
|
768
1115
|
<TextTransformControl
|
|
769
1116
|
value={ textTransform }
|
|
770
|
-
onChange={
|
|
1117
|
+
onChange={ setTextTransformWithInheritedCommit }
|
|
771
1118
|
showNone
|
|
772
1119
|
isBlock
|
|
773
|
-
size="__unstable-large"
|
|
774
1120
|
/>
|
|
775
|
-
</
|
|
1121
|
+
</InheritanceToolsPanelItem>
|
|
776
1122
|
) }
|
|
777
1123
|
{ hasTextAlignmentControl && (
|
|
778
|
-
<
|
|
1124
|
+
<InheritanceToolsPanelItem
|
|
1125
|
+
{ ...inheritanceProps(
|
|
1126
|
+
isTextAlignPlaceholder,
|
|
1127
|
+
hasTextAlign() && inheritedTextAlign !== undefined
|
|
1128
|
+
) }
|
|
779
1129
|
label={ __( 'Text alignment' ) }
|
|
780
1130
|
hasValue={ hasTextAlign }
|
|
781
1131
|
onDeselect={ resetTextAlign }
|
|
@@ -784,9 +1134,8 @@ export default function TypographyPanel( {
|
|
|
784
1134
|
>
|
|
785
1135
|
<TextAlignmentControl
|
|
786
1136
|
value={ textAlign }
|
|
787
|
-
onChange={
|
|
1137
|
+
onChange={ setTextAlignWithInheritedCommit }
|
|
788
1138
|
options={ [ 'left', 'center', 'right', 'justify' ] }
|
|
789
|
-
size="__unstable-large"
|
|
790
1139
|
/>
|
|
791
1140
|
|
|
792
1141
|
{ textAlign === 'justify' && (
|
|
@@ -798,7 +1147,7 @@ export default function TypographyPanel( {
|
|
|
798
1147
|
</Notice>
|
|
799
1148
|
</div>
|
|
800
1149
|
) }
|
|
801
|
-
</
|
|
1150
|
+
</InheritanceToolsPanelItem>
|
|
802
1151
|
) }
|
|
803
1152
|
</Wrapper>
|
|
804
1153
|
);
|