Skip to content

Commit

Permalink
Theme.json: fix some outline properties doesn't work properly on the …
Browse files Browse the repository at this point in the history
…editor (#44504)
  • Loading branch information
t-hamano authored and michalczaplinski committed Oct 3, 2022
1 parent 4a0fbe0 commit 4b92996
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,14 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {

const pickStyleKeys = ( treeToPickFrom ) =>
pickBy( treeToPickFrom, ( value, key ) =>
[ 'border', 'color', 'spacing', 'typography', 'filter' ].includes(
key
)
[
'border',
'color',
'spacing',
'typography',
'filter',
'outline',
].includes( key )
);

// Top-level.
Expand Down Expand Up @@ -605,12 +610,12 @@ export const toStyles = (
}

if ( useRootPaddingAlign ) {
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/style-engine/src/styles/outline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const offset = {
style: Style,
options: StyleOptions,
path: string[] = [ 'outline', 'offset' ],
ruleKey: string = 'outlineColor'
ruleKey: string = 'outlineOffset'
): GeneratedCSSRule[] => {
return generateRule( style, options, path, ruleKey );
},
Expand Down

0 comments on commit 4b92996

Please sign in to comment.