Skip to content

Commit

Permalink
Renamed skipSerialization method to reflect the closure context (Elem…
Browse files Browse the repository at this point in the history
…ents API)

Added a dev comment to warn about future changes (if any) to the Elements API
  • Loading branch information
ramonjd committed Mar 11, 2022
1 parent fde7c1c commit fa4a95c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,17 @@ const withElementsStyles = createHigherOrderComponent(
BlockListBlock
) }`;

const skipSerialization = shouldSkipSerialization(
const skipLinkColorSerialization = shouldSkipSerialization(
props.name,
COLOR_SUPPORT_KEY,
'link'
);

const elements = skipSerialization
// The Elements API only supports link colors for now,
// hence the specific omission of `link` in the elements styles.
// This might need to be refactored or removed if the Elements API
// changes or `link` supports styles beyond `color`.
const elements = skipLinkColorSerialization
? omit( props.attributes.style?.elements, [ 'link' ] )
: props.attributes.style?.elements;

Expand Down

0 comments on commit fa4a95c

Please sign in to comment.