Skip to content

Commit

Permalink
Add a comment describing the upgrade process, and allow for the class…
Browse files Browse the repository at this point in the history
…Name attribute not being set in the old block.
  • Loading branch information
pento committed Mar 26, 2020
1 parent f3be18f commit 285323a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions extensions/blocks/map/deprecated/v1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ const attributes = {
export default {
attributes,
migrate: oldAttributes => {
// If the old block has classNames set, clean up any old "is-style-*" classes
// that will clash with the new one we're adding.
const className =
oldAttributes.className.replace( /is-style-[^ ]+/, '' ) +
`is-style-${ oldAttributes.mapStyle }`;
( oldAttributes.className || '' ).replace( /is-style-[^ ]+/, '' ) +
` is-style-${ oldAttributes.mapStyle }`;
return {
...omit( oldAttributes, 'mapStyle' ),
className,
Expand Down

0 comments on commit 285323a

Please sign in to comment.