@wordpress/block-editor 11.5.0 → 11.7.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 +4 -0
- package/build/components/block-list/block-html.js +1 -3
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -23
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/editor-styles/index.js +20 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +583 -0
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +8 -30
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +129 -0
- package/build/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build/components/global-styles/hooks.js +109 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +36 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +66 -45
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +180 -99
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-size-control/index.js +8 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/appender.js +105 -0
- package/build/components/list-view/appender.js.map +1 -0
- package/build/components/list-view/block.js +5 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +25 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +37 -13
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +13 -4
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +28 -3
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +5 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +9 -7
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -1
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/format-edit.js +2 -30
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/writing-flow/use-input.js +4 -8
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/hooks/border.js +90 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +92 -229
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +4 -2
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
- package/build/hooks/contrast-checker.js.map +1 -0
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +0 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +3 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +19 -22
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +2 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +23 -26
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +50 -75
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +165 -0
- package/build/layouts/grid.js.map +1 -0
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +19 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +76 -0
- package/build/utils/object.js.map +1 -0
- package/build/utils/parse-css-unit-to-px.js +15 -9
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-list/block-html.js +1 -3
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -22
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/editor-styles/index.js +19 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +554 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +7 -30
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +120 -0
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +104 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +65 -46
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +181 -100
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-size-control/index.js +8 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.js +15 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/appender.js +88 -0
- package/build-module/components/list-view/appender.js.map +1 -0
- package/build-module/components/list-view/block.js +5 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +22 -5
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -12
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +12 -4
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +28 -4
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +5 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +9 -7
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +3 -31
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +4 -8
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/hooks/border.js +92 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +90 -232
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +4 -2
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
- package/build-module/hooks/contrast-checker.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -2
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +19 -22
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +3 -3
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +23 -26
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +48 -72
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +151 -0
- package/build-module/layouts/grid.js.map +1 -0
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +10 -8
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +17 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +69 -0
- package/build-module/utils/object.js.map +1 -0
- package/build-module/utils/parse-css-unit-to-px.js +15 -9
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +32 -12
- package/build-style/style.css +32 -12
- package/package.json +31 -31
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
- package/src/components/block-preview/auto.js +2 -17
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
- package/src/components/colors-gradients/style.scss +8 -8
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/editor-styles/index.js +29 -1
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/color-panel.js +706 -0
- package/src/components/global-styles/dimensions-panel.js +13 -42
- package/src/components/global-styles/get-block-css-selector.js +129 -0
- package/src/components/global-styles/hooks.js +154 -1
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +31 -2
- package/src/components/global-styles/typography-panel.js +67 -45
- package/src/components/global-styles/use-global-styles-output.js +176 -93
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/image-size-control/index.js +4 -3
- package/src/components/image-size-control/test/index.js +2 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +3 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
- package/src/components/line-height-control/index.js +10 -1
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/style.scss +0 -4
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/appender.js +101 -0
- package/src/components/list-view/block.js +5 -4
- package/src/components/list-view/branch.js +30 -1
- package/src/components/list-view/index.js +43 -10
- package/src/components/list-view/style.scss +19 -0
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/media-replace-flow/index.js +36 -24
- package/src/components/media-replace-flow/style.scss +5 -2
- package/src/components/off-canvas-editor/appender.js +31 -5
- package/src/components/off-canvas-editor/branch.js +3 -1
- package/src/components/off-canvas-editor/index.js +7 -7
- package/src/components/off-canvas-editor/link-ui.js +0 -1
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/rich-text/format-edit.js +2 -32
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/url-popover/test/index.js +0 -2
- package/src/components/writing-flow/use-input.js +4 -5
- package/src/hooks/border.js +93 -225
- package/src/hooks/color.js +120 -296
- package/src/hooks/content-lock-ui.js +6 -2
- package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/dimensions.js +0 -1
- package/src/hooks/duotone.js +8 -5
- package/src/hooks/layout.js +19 -16
- package/src/hooks/position.js +3 -3
- package/src/hooks/style.js +29 -28
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/test/utils.js +0 -104
- package/src/hooks/typography.js +2 -1
- package/src/hooks/utils.js +63 -70
- package/src/layouts/constrained.js +23 -17
- package/src/layouts/grid.js +172 -0
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/grid.js +21 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +10 -8
- package/src/store/selectors.js +20 -3
- package/src/utils/object.js +69 -0
- package/src/utils/parse-css-unit-to-px.js +14 -9
- package/src/utils/test/object.js +107 -0
- package/src/utils/test/parse-css-unit-to-px.js +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build/hooks/color-panel.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/color-panel.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
package/src/hooks/layout.js
CHANGED
|
@@ -35,11 +35,12 @@ const layoutBlockSupportKey = '__experimentalLayout';
|
|
|
35
35
|
/**
|
|
36
36
|
* Generates the utility classnames for the given block's layout attributes.
|
|
37
37
|
*
|
|
38
|
-
* @param { Object }
|
|
38
|
+
* @param { Object } blockAttributes Block attributes.
|
|
39
|
+
* @param { string } blockName Block name.
|
|
39
40
|
*
|
|
40
41
|
* @return { Array } Array of CSS classname strings.
|
|
41
42
|
*/
|
|
42
|
-
export function useLayoutClasses(
|
|
43
|
+
export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
|
|
43
44
|
const rootPaddingAlignment = useSelect( ( select ) => {
|
|
44
45
|
const { getSettings } = select( blockEditorStore );
|
|
45
46
|
return getSettings().__experimentalFeatures
|
|
@@ -47,11 +48,10 @@ export function useLayoutClasses( block = {} ) {
|
|
|
47
48
|
}, [] );
|
|
48
49
|
const globalLayoutSettings = useSetting( 'layout' ) || {};
|
|
49
50
|
|
|
50
|
-
const {
|
|
51
|
-
const { layout } = attributes;
|
|
51
|
+
const { layout } = blockAttributes;
|
|
52
52
|
|
|
53
53
|
const { default: defaultBlockLayout } =
|
|
54
|
-
getBlockSupport(
|
|
54
|
+
getBlockSupport( blockName, layoutBlockSupportKey ) || {};
|
|
55
55
|
const usedLayout =
|
|
56
56
|
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
57
57
|
? { ...layout, type: 'constrained' }
|
|
@@ -63,10 +63,13 @@ export function useLayoutClasses( block = {} ) {
|
|
|
63
63
|
globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
|
|
64
64
|
?.className
|
|
65
65
|
) {
|
|
66
|
-
|
|
66
|
+
const baseClassName =
|
|
67
67
|
globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
|
|
68
|
-
?.className
|
|
69
|
-
|
|
68
|
+
?.className;
|
|
69
|
+
const compoundClassName = `wp-block-${ blockName
|
|
70
|
+
.split( '/' )
|
|
71
|
+
.pop() }-${ baseClassName }`;
|
|
72
|
+
layoutClassnames.push( baseClassName, compoundClassName );
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
if (
|
|
@@ -100,14 +103,14 @@ export function useLayoutClasses( block = {} ) {
|
|
|
100
103
|
/**
|
|
101
104
|
* Generates a CSS rule with the given block's layout styles.
|
|
102
105
|
*
|
|
103
|
-
* @param { Object }
|
|
104
|
-
* @param { string }
|
|
106
|
+
* @param { Object } blockAttributes Block attributes.
|
|
107
|
+
* @param { string } blockName Block name.
|
|
108
|
+
* @param { string } selector A selector to use in generating the CSS rule.
|
|
105
109
|
*
|
|
106
110
|
* @return { string } CSS rule.
|
|
107
111
|
*/
|
|
108
|
-
export function useLayoutStyles(
|
|
109
|
-
const {
|
|
110
|
-
const { layout = {}, style = {} } = attributes;
|
|
112
|
+
export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
|
|
113
|
+
const { layout = {}, style = {} } = blockAttributes;
|
|
111
114
|
// Update type for blocks using legacy layouts.
|
|
112
115
|
const usedLayout =
|
|
113
116
|
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
@@ -118,7 +121,7 @@ export function useLayoutStyles( block = {}, selector ) {
|
|
|
118
121
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
119
122
|
const hasBlockGapSupport = blockGapSupport !== null;
|
|
120
123
|
const css = fullLayoutType?.getLayoutStyle?.( {
|
|
121
|
-
blockName
|
|
124
|
+
blockName,
|
|
122
125
|
selector,
|
|
123
126
|
layout,
|
|
124
127
|
layoutDefinitions: globalLayoutSettings?.definitions,
|
|
@@ -351,7 +354,7 @@ export const withInspectorControls = createHigherOrderComponent(
|
|
|
351
354
|
*/
|
|
352
355
|
export const withLayoutStyles = createHigherOrderComponent(
|
|
353
356
|
( BlockListBlock ) => ( props ) => {
|
|
354
|
-
const { name, attributes
|
|
357
|
+
const { name, attributes } = props;
|
|
355
358
|
const hasLayoutBlockSupport = hasBlockSupport(
|
|
356
359
|
name,
|
|
357
360
|
layoutBlockSupportKey
|
|
@@ -373,7 +376,7 @@ export const withLayoutStyles = createHigherOrderComponent(
|
|
|
373
376
|
? { ...layout, type: 'constrained' }
|
|
374
377
|
: layout || defaultBlockLayout || {};
|
|
375
378
|
const layoutClasses = hasLayoutBlockSupport
|
|
376
|
-
? useLayoutClasses(
|
|
379
|
+
? useLayoutClasses( attributes, name )
|
|
377
380
|
: null;
|
|
378
381
|
// Higher specificity to override defaults from theme.json.
|
|
379
382
|
const selector = `.wp-container-${ id }.wp-container-${ id }`;
|
package/src/hooks/position.js
CHANGED
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
11
11
|
import {
|
|
12
12
|
BaseControl,
|
|
@@ -49,7 +49,7 @@ const DEFAULT_OPTION = {
|
|
|
49
49
|
const STICKY_OPTION = {
|
|
50
50
|
key: 'sticky',
|
|
51
51
|
value: 'sticky',
|
|
52
|
-
name:
|
|
52
|
+
name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
|
|
53
53
|
className: OPTION_CLASSNAME,
|
|
54
54
|
__experimentalHint: __(
|
|
55
55
|
'The block will stick to the top of the window instead of scrolling.'
|
|
@@ -59,7 +59,7 @@ const STICKY_OPTION = {
|
|
|
59
59
|
const FIXED_OPTION = {
|
|
60
60
|
key: 'fixed',
|
|
61
61
|
value: 'fixed',
|
|
62
|
-
name:
|
|
62
|
+
name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
|
|
63
63
|
className: OPTION_CLASSNAME,
|
|
64
64
|
__experimentalHint: __(
|
|
65
65
|
'The block will not move when the page is scrolled.'
|
package/src/hooks/style.js
CHANGED
|
@@ -384,39 +384,40 @@ const withElementsStyles = createHigherOrderComponent(
|
|
|
384
384
|
);
|
|
385
385
|
|
|
386
386
|
const styles = useMemo( () => {
|
|
387
|
-
|
|
387
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
388
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
389
|
+
// styles to override element styles because of higher specificity.
|
|
390
|
+
const elements = [
|
|
391
|
+
{
|
|
392
|
+
styles: ! skipLinkColorSerialization
|
|
393
|
+
? props.attributes.style?.elements?.link
|
|
394
|
+
: undefined,
|
|
395
|
+
selector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
styles: ! skipLinkColorSerialization
|
|
399
|
+
? props.attributes.style?.elements?.link?.[ ':hover' ]
|
|
400
|
+
: undefined,
|
|
401
|
+
selector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,
|
|
402
|
+
},
|
|
403
|
+
];
|
|
388
404
|
const elementCssRules = [];
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
Object.keys( rawElementsStyles ).length > 0
|
|
392
|
-
) {
|
|
393
|
-
// Remove values based on whether serialization has been skipped for a specific style.
|
|
394
|
-
const filteredElementsStyles = {
|
|
395
|
-
...rawElementsStyles,
|
|
396
|
-
link: {
|
|
397
|
-
...rawElementsStyles.link,
|
|
398
|
-
color: ! skipLinkColorSerialization
|
|
399
|
-
? rawElementsStyles.link?.color
|
|
400
|
-
: undefined,
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
for ( const [ elementName, elementStyles ] of Object.entries(
|
|
405
|
-
filteredElementsStyles
|
|
406
|
-
) ) {
|
|
405
|
+
for ( const { styles: elementStyles, selector } of elements ) {
|
|
406
|
+
if ( elementStyles ) {
|
|
407
407
|
const cssRule = compileCSS( elementStyles, {
|
|
408
|
-
|
|
409
|
-
// added to all other editor styles, not providing it causes reset and global
|
|
410
|
-
// styles to override element styles because of higher specificity.
|
|
411
|
-
selector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS[ elementName ] }`,
|
|
408
|
+
selector,
|
|
412
409
|
} );
|
|
413
|
-
|
|
414
|
-
elementCssRules.push( cssRule );
|
|
415
|
-
}
|
|
410
|
+
elementCssRules.push( cssRule );
|
|
416
411
|
}
|
|
417
412
|
}
|
|
418
|
-
return elementCssRules.length > 0
|
|
419
|
-
|
|
413
|
+
return elementCssRules.length > 0
|
|
414
|
+
? elementCssRules.join( '' )
|
|
415
|
+
: undefined;
|
|
416
|
+
}, [
|
|
417
|
+
props.attributes.style?.elements,
|
|
418
|
+
blockElementsContainerIdentifier,
|
|
419
|
+
skipLinkColorSerialization,
|
|
420
|
+
] );
|
|
420
421
|
|
|
421
422
|
const element = useContext( BlockList.__unstableElementContext );
|
|
422
423
|
|
package/src/hooks/supports.js
CHANGED
|
@@ -20,6 +20,11 @@ const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
|
20
20
|
* Key within block settings' support array indicating support for font weight.
|
|
21
21
|
*/
|
|
22
22
|
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
23
|
+
/**
|
|
24
|
+
* Key within block settings' supports array indicating support for text
|
|
25
|
+
* columns e.g. settings found in `block.json`.
|
|
26
|
+
*/
|
|
27
|
+
const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
|
|
23
28
|
/**
|
|
24
29
|
* Key within block settings' supports array indicating support for text
|
|
25
30
|
* decorations e.g. settings found in `block.json`.
|
|
@@ -42,6 +47,7 @@ const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
|
42
47
|
FONT_STYLE_SUPPORT_KEY,
|
|
43
48
|
FONT_WEIGHT_SUPPORT_KEY,
|
|
44
49
|
FONT_FAMILY_SUPPORT_KEY,
|
|
50
|
+
TEXT_COLUMNS_SUPPORT_KEY,
|
|
45
51
|
TEXT_DECORATION_SUPPORT_KEY,
|
|
46
52
|
TEXT_TRANSFORM_SUPPORT_KEY,
|
|
47
53
|
LETTER_SPACING_SUPPORT_KEY,
|
package/src/hooks/test/style.js
CHANGED
|
@@ -21,7 +21,7 @@ describe( 'getInlineStyles', () => {
|
|
|
21
21
|
expect(
|
|
22
22
|
getInlineStyles( {
|
|
23
23
|
color: { text: 'red', background: 'black' },
|
|
24
|
-
typography: { lineHeight: 1.5, fontSize: 10 },
|
|
24
|
+
typography: { lineHeight: 1.5, fontSize: 10, textColumns: 2 },
|
|
25
25
|
border: {
|
|
26
26
|
radius: '10px',
|
|
27
27
|
width: '1em',
|
|
@@ -44,6 +44,7 @@ describe( 'getInlineStyles', () => {
|
|
|
44
44
|
borderStyle: 'dotted',
|
|
45
45
|
borderWidth: '1em',
|
|
46
46
|
color: 'red',
|
|
47
|
+
columnCount: 2,
|
|
47
48
|
lineHeight: 1.5,
|
|
48
49
|
fontSize: 10,
|
|
49
50
|
marginBottom: '15px',
|
|
@@ -12,6 +12,7 @@ describe( 'getTypographyClassesAndStyles', () => {
|
|
|
12
12
|
typography: {
|
|
13
13
|
letterSpacing: '22px',
|
|
14
14
|
fontSize: '2rem',
|
|
15
|
+
textColumns: 3,
|
|
15
16
|
textTransform: 'uppercase',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
@@ -19,6 +20,7 @@ describe( 'getTypographyClassesAndStyles', () => {
|
|
|
19
20
|
expect( getTypographyClassesAndStyles( attributes ) ).toEqual( {
|
|
20
21
|
className: 'has-tofu-font-family has-large-font-size',
|
|
21
22
|
style: {
|
|
23
|
+
columnCount: 3,
|
|
22
24
|
letterSpacing: '22px',
|
|
23
25
|
fontSize: '2rem',
|
|
24
26
|
textTransform: 'uppercase',
|
package/src/hooks/test/utils.js
CHANGED
|
@@ -7,113 +7,9 @@ import { applyFilters } from '@wordpress/hooks';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import '../anchor';
|
|
10
|
-
import { immutableSet } from '../utils';
|
|
11
10
|
|
|
12
11
|
const noop = () => {};
|
|
13
12
|
|
|
14
|
-
describe( 'immutableSet', () => {
|
|
15
|
-
describe( 'handling falsy values properly', () => {
|
|
16
|
-
it( 'should create a new object if `undefined` is passed', () => {
|
|
17
|
-
const result = immutableSet( undefined, 'test', 1 );
|
|
18
|
-
|
|
19
|
-
expect( result ).toEqual( { test: 1 } );
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
it( 'should create a new object if `null` is passed', () => {
|
|
23
|
-
const result = immutableSet( null, 'test', 1 );
|
|
24
|
-
|
|
25
|
-
expect( result ).toEqual( { test: 1 } );
|
|
26
|
-
} );
|
|
27
|
-
|
|
28
|
-
it( 'should create a new object if `false` is passed', () => {
|
|
29
|
-
const result = immutableSet( false, 'test', 1 );
|
|
30
|
-
|
|
31
|
-
expect( result ).toEqual( { test: 1 } );
|
|
32
|
-
} );
|
|
33
|
-
|
|
34
|
-
it( 'should create a new object if `0` is passed', () => {
|
|
35
|
-
const result = immutableSet( 0, 'test', 1 );
|
|
36
|
-
|
|
37
|
-
expect( result ).toEqual( { test: 1 } );
|
|
38
|
-
} );
|
|
39
|
-
|
|
40
|
-
it( 'should create a new object if an empty string is passed', () => {
|
|
41
|
-
const result = immutableSet( '', 'test', 1 );
|
|
42
|
-
|
|
43
|
-
expect( result ).toEqual( { test: 1 } );
|
|
44
|
-
} );
|
|
45
|
-
|
|
46
|
-
it( 'should create a new object if a NaN is passed', () => {
|
|
47
|
-
const result = immutableSet( NaN, 'test', 1 );
|
|
48
|
-
|
|
49
|
-
expect( result ).toEqual( { test: 1 } );
|
|
50
|
-
} );
|
|
51
|
-
} );
|
|
52
|
-
|
|
53
|
-
describe( 'manages data assignment properly', () => {
|
|
54
|
-
it( 'assigns value properly when it does not exist', () => {
|
|
55
|
-
const result = immutableSet( {}, 'test', 1 );
|
|
56
|
-
|
|
57
|
-
expect( result ).toEqual( { test: 1 } );
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
it( 'overrides existing values', () => {
|
|
61
|
-
const result = immutableSet( { test: 1 }, 'test', 2 );
|
|
62
|
-
|
|
63
|
-
expect( result ).toEqual( { test: 2 } );
|
|
64
|
-
} );
|
|
65
|
-
|
|
66
|
-
describe( 'with array notation access', () => {
|
|
67
|
-
it( 'assigns values at deeper levels', () => {
|
|
68
|
-
const result = immutableSet( {}, [ 'foo', 'bar', 'baz' ], 5 );
|
|
69
|
-
|
|
70
|
-
expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
|
|
71
|
-
} );
|
|
72
|
-
|
|
73
|
-
it( 'overrides existing values at deeper levels', () => {
|
|
74
|
-
const result = immutableSet(
|
|
75
|
-
{ foo: { bar: { baz: 1 } } },
|
|
76
|
-
[ 'foo', 'bar', 'baz' ],
|
|
77
|
-
5
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
|
|
81
|
-
} );
|
|
82
|
-
|
|
83
|
-
it( 'keeps other properties intact', () => {
|
|
84
|
-
const result = immutableSet(
|
|
85
|
-
{ foo: { bar: { baz: 1 } } },
|
|
86
|
-
[ 'foo', 'bar', 'test' ],
|
|
87
|
-
5
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
expect( result ).toEqual( {
|
|
91
|
-
foo: { bar: { baz: 1, test: 5 } },
|
|
92
|
-
} );
|
|
93
|
-
} );
|
|
94
|
-
} );
|
|
95
|
-
} );
|
|
96
|
-
|
|
97
|
-
describe( 'does not mutate the original object', () => {
|
|
98
|
-
it( 'clones the object at the first level', () => {
|
|
99
|
-
const input = {};
|
|
100
|
-
const result = immutableSet( input, 'test', 1 );
|
|
101
|
-
|
|
102
|
-
expect( result ).not.toBe( input );
|
|
103
|
-
} );
|
|
104
|
-
|
|
105
|
-
it( 'clones the object at deeper levels', () => {
|
|
106
|
-
const input = { foo: { bar: { baz: 1 } } };
|
|
107
|
-
const result = immutableSet( input, [ 'foo', 'bar', 'baz' ], 2 );
|
|
108
|
-
|
|
109
|
-
expect( result ).not.toBe( input );
|
|
110
|
-
expect( result.foo ).not.toBe( input.foo );
|
|
111
|
-
expect( result.foo.bar ).not.toBe( input.foo.bar );
|
|
112
|
-
expect( result.foo.bar.baz ).not.toBe( input.foo.bar.baz );
|
|
113
|
-
} );
|
|
114
|
-
} );
|
|
115
|
-
} );
|
|
116
|
-
|
|
117
13
|
describe( 'anchor', () => {
|
|
118
14
|
const blockSettings = {
|
|
119
15
|
save: noop,
|
package/src/hooks/typography.js
CHANGED
|
@@ -27,6 +27,7 @@ function omit( object, keys ) {
|
|
|
27
27
|
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
28
28
|
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
29
29
|
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
30
|
+
const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
|
|
30
31
|
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
31
32
|
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
32
33
|
export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
|
@@ -36,6 +37,7 @@ export const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
|
36
37
|
FONT_STYLE_SUPPORT_KEY,
|
|
37
38
|
FONT_WEIGHT_SUPPORT_KEY,
|
|
38
39
|
FONT_FAMILY_SUPPORT_KEY,
|
|
40
|
+
TEXT_COLUMNS_SUPPORT_KEY,
|
|
39
41
|
TEXT_DECORATION_SUPPORT_KEY,
|
|
40
42
|
TEXT_TRANSFORM_SUPPORT_KEY,
|
|
41
43
|
LETTER_SPACING_SUPPORT_KEY,
|
|
@@ -136,7 +138,6 @@ export function TypographyPanel( {
|
|
|
136
138
|
<StylesTypographyPanel
|
|
137
139
|
as={ TypographyInspectorControl }
|
|
138
140
|
panelId={ clientId }
|
|
139
|
-
name={ name }
|
|
140
141
|
settings={ settings }
|
|
141
142
|
value={ value }
|
|
142
143
|
onChange={ onChange }
|
package/src/hooks/utils.js
CHANGED
|
@@ -14,6 +14,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import { useSetting } from '../components';
|
|
16
16
|
import { useSettingsForBlockElement } from '../components/global-styles/hooks';
|
|
17
|
+
import { immutableSet } from '../utils/object';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Removed falsy values from nested object.
|
|
@@ -37,76 +38,6 @@ export const cleanEmptyObject = ( object ) => {
|
|
|
37
38
|
return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
/**
|
|
41
|
-
* Converts a path to an array of its fragments.
|
|
42
|
-
* Supports strings, numbers and arrays:
|
|
43
|
-
*
|
|
44
|
-
* 'foo' => [ 'foo' ]
|
|
45
|
-
* 2 => [ '2' ]
|
|
46
|
-
* [ 'foo', 'bar' ] => [ 'foo', 'bar' ]
|
|
47
|
-
*
|
|
48
|
-
* @param {string|number|Array} path Path
|
|
49
|
-
* @return {Array} Normalized path.
|
|
50
|
-
*/
|
|
51
|
-
function normalizePath( path ) {
|
|
52
|
-
if ( Array.isArray( path ) ) {
|
|
53
|
-
return path;
|
|
54
|
-
} else if ( typeof path === 'number' ) {
|
|
55
|
-
return [ path.toString() ];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return [ path ];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Clones an object.
|
|
63
|
-
* Non-object values are returned unchanged.
|
|
64
|
-
*
|
|
65
|
-
* @param {*} object Object to clone.
|
|
66
|
-
* @return {*} Cloned object, or original literal non-object value.
|
|
67
|
-
*/
|
|
68
|
-
function cloneObject( object ) {
|
|
69
|
-
if ( typeof object === 'object' ) {
|
|
70
|
-
return {
|
|
71
|
-
...Object.fromEntries(
|
|
72
|
-
Object.entries( object ).map( ( [ key, value ] ) => [
|
|
73
|
-
key,
|
|
74
|
-
cloneObject( value ),
|
|
75
|
-
] )
|
|
76
|
-
),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return object;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Perform an immutable set.
|
|
85
|
-
* Handles nullish initial values.
|
|
86
|
-
* Clones all nested objects in the specified object.
|
|
87
|
-
*
|
|
88
|
-
* @param {Object} object Object to set a value in.
|
|
89
|
-
* @param {number|string|Array} path Path in the object to modify.
|
|
90
|
-
* @param {*} value New value to set.
|
|
91
|
-
* @return {Object} Cloned object with the new value set.
|
|
92
|
-
*/
|
|
93
|
-
export function immutableSet( object, path, value ) {
|
|
94
|
-
const normalizedPath = normalizePath( path );
|
|
95
|
-
const newObject = object ? cloneObject( object ) : {};
|
|
96
|
-
|
|
97
|
-
normalizedPath.reduce( ( acc, key, i ) => {
|
|
98
|
-
if ( acc[ key ] === undefined ) {
|
|
99
|
-
acc[ key ] = {};
|
|
100
|
-
}
|
|
101
|
-
if ( i === normalizedPath.length - 1 ) {
|
|
102
|
-
acc[ key ] = value;
|
|
103
|
-
}
|
|
104
|
-
return acc[ key ];
|
|
105
|
-
}, newObject );
|
|
106
|
-
|
|
107
|
-
return newObject;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
41
|
export function transformStyles(
|
|
111
42
|
activeSupports,
|
|
112
43
|
migrationPaths,
|
|
@@ -202,6 +133,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
202
133
|
const fontStyle = useSetting( 'typography.fontStyle' );
|
|
203
134
|
const fontWeight = useSetting( 'typography.fontWeight' );
|
|
204
135
|
const lineHeight = useSetting( 'typography.lineHeight' );
|
|
136
|
+
const textColumns = useSetting( 'typography.textColumns' );
|
|
205
137
|
const textDecoration = useSetting( 'typography.textDecoration' );
|
|
206
138
|
const textTransform = useSetting( 'typography.textTransform' );
|
|
207
139
|
const letterSpacing = useSetting( 'typography.letterSpacing' );
|
|
@@ -212,9 +144,45 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
212
144
|
const units = useSetting( 'spacing.units' );
|
|
213
145
|
const minHeight = useSetting( 'dimensions.minHeight' );
|
|
214
146
|
const layout = useSetting( 'layout' );
|
|
147
|
+
const borderColor = useSetting( 'border.color' );
|
|
148
|
+
const borderRadius = useSetting( 'border.radius' );
|
|
149
|
+
const borderStyle = useSetting( 'border.style' );
|
|
150
|
+
const borderWidth = useSetting( 'border.width' );
|
|
151
|
+
const customColorsEnabled = useSetting( 'color.custom' );
|
|
152
|
+
const customColors = useSetting( 'color.palette.custom' );
|
|
153
|
+
const themeColors = useSetting( 'color.palette.theme' );
|
|
154
|
+
const defaultColors = useSetting( 'color.palette.default' );
|
|
155
|
+
const defaultPalette = useSetting( 'color.defaultPalette' );
|
|
156
|
+
const userGradientPalette = useSetting( 'color.gradients.custom' );
|
|
157
|
+
const themeGradientPalette = useSetting( 'color.gradients.theme' );
|
|
158
|
+
const defaultGradientPalette = useSetting( 'color.gradients.default' );
|
|
159
|
+
const defaultGradients = useSetting( 'color.defaultGradients' );
|
|
160
|
+
const areCustomGradientsEnabled = useSetting( 'color.customGradient' );
|
|
161
|
+
const isBackgroundEnabled = useSetting( 'color.background' );
|
|
162
|
+
const isLinkEnabled = useSetting( 'color.link' );
|
|
163
|
+
const isTextEnabled = useSetting( 'color.text' );
|
|
215
164
|
|
|
216
165
|
const rawSettings = useMemo( () => {
|
|
217
166
|
return {
|
|
167
|
+
color: {
|
|
168
|
+
palette: {
|
|
169
|
+
custom: customColors,
|
|
170
|
+
theme: themeColors,
|
|
171
|
+
default: defaultColors,
|
|
172
|
+
},
|
|
173
|
+
gradients: {
|
|
174
|
+
custom: userGradientPalette,
|
|
175
|
+
theme: themeGradientPalette,
|
|
176
|
+
default: defaultGradientPalette,
|
|
177
|
+
},
|
|
178
|
+
defaultGradients,
|
|
179
|
+
defaultPalette,
|
|
180
|
+
custom: customColorsEnabled,
|
|
181
|
+
customGradient: areCustomGradientsEnabled,
|
|
182
|
+
background: isBackgroundEnabled,
|
|
183
|
+
link: isLinkEnabled,
|
|
184
|
+
text: isTextEnabled,
|
|
185
|
+
},
|
|
218
186
|
typography: {
|
|
219
187
|
fontFamilies: {
|
|
220
188
|
custom: fontFamilies,
|
|
@@ -226,6 +194,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
226
194
|
fontStyle,
|
|
227
195
|
fontWeight,
|
|
228
196
|
lineHeight,
|
|
197
|
+
textColumns,
|
|
229
198
|
textDecoration,
|
|
230
199
|
textTransform,
|
|
231
200
|
letterSpacing,
|
|
@@ -239,6 +208,12 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
239
208
|
blockGap,
|
|
240
209
|
units,
|
|
241
210
|
},
|
|
211
|
+
border: {
|
|
212
|
+
color: borderColor,
|
|
213
|
+
radius: borderRadius,
|
|
214
|
+
style: borderStyle,
|
|
215
|
+
width: borderWidth,
|
|
216
|
+
},
|
|
242
217
|
dimensions: {
|
|
243
218
|
minHeight,
|
|
244
219
|
},
|
|
@@ -252,6 +227,7 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
252
227
|
fontStyle,
|
|
253
228
|
fontWeight,
|
|
254
229
|
lineHeight,
|
|
230
|
+
textColumns,
|
|
255
231
|
textDecoration,
|
|
256
232
|
textTransform,
|
|
257
233
|
letterSpacing,
|
|
@@ -263,6 +239,23 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
263
239
|
minHeight,
|
|
264
240
|
layout,
|
|
265
241
|
parentLayout,
|
|
242
|
+
borderColor,
|
|
243
|
+
borderRadius,
|
|
244
|
+
borderStyle,
|
|
245
|
+
borderWidth,
|
|
246
|
+
customColorsEnabled,
|
|
247
|
+
customColors,
|
|
248
|
+
themeColors,
|
|
249
|
+
defaultColors,
|
|
250
|
+
defaultPalette,
|
|
251
|
+
userGradientPalette,
|
|
252
|
+
themeGradientPalette,
|
|
253
|
+
defaultGradientPalette,
|
|
254
|
+
defaultGradients,
|
|
255
|
+
areCustomGradientsEnabled,
|
|
256
|
+
isBackgroundEnabled,
|
|
257
|
+
isLinkEnabled,
|
|
258
|
+
isTextEnabled,
|
|
266
259
|
] );
|
|
267
260
|
|
|
268
261
|
return useSettingsForBlockElement( rawSettings, name );
|
|
@@ -32,8 +32,10 @@ export default {
|
|
|
32
32
|
inspectorControls: function DefaultLayoutInspectorControls( {
|
|
33
33
|
layout,
|
|
34
34
|
onChange,
|
|
35
|
+
layoutBlockSupport = {},
|
|
35
36
|
} ) {
|
|
36
37
|
const { wideSize, contentSize, justifyContent = 'center' } = layout;
|
|
38
|
+
const { allowJustification = true } = layoutBlockSupport;
|
|
37
39
|
const onJustificationChange = ( value ) => {
|
|
38
40
|
onChange( {
|
|
39
41
|
...layout,
|
|
@@ -117,23 +119,27 @@ export default {
|
|
|
117
119
|
'Customize the width for all elements that are assigned to the center or wide columns.'
|
|
118
120
|
) }
|
|
119
121
|
</p>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
122
|
+
{ allowJustification && (
|
|
123
|
+
<ToggleGroupControl
|
|
124
|
+
__nextHasNoMarginBottom
|
|
125
|
+
label={ __( 'Justification' ) }
|
|
126
|
+
value={ justifyContent }
|
|
127
|
+
onChange={ onJustificationChange }
|
|
128
|
+
>
|
|
129
|
+
{ justificationOptions.map(
|
|
130
|
+
( { value, icon, label } ) => {
|
|
131
|
+
return (
|
|
132
|
+
<ToggleGroupControlOptionIcon
|
|
133
|
+
key={ value }
|
|
134
|
+
value={ value }
|
|
135
|
+
icon={ icon }
|
|
136
|
+
label={ label }
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
) }
|
|
141
|
+
</ToggleGroupControl>
|
|
142
|
+
) }
|
|
137
143
|
</>
|
|
138
144
|
);
|
|
139
145
|
},
|