-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation for the site-tagline block
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import cleanEmptyObject from '../utils/clean-empty-object'; | ||
|
||
/** | ||
* Migrates the current style.typography.fontFamily attribute, | ||
* whose value was "var:preset|font-family|helvetica-arial", | ||
* to the style.fontFamily attribute, whose value will be "helvetica-arial". | ||
* | ||
* @param {Object} attributes The current attributes | ||
* @return {Object} The updated attributes. | ||
*/ | ||
const oldFontFamilyMigration = ( attributes ) => { | ||
if ( ! attributes?.style?.typography?.fontFamily ) { | ||
return attributes; | ||
} | ||
|
||
const fontFamily = attributes.style.typography.fontFamily | ||
.split( '|' ) | ||
.pop(); | ||
delete attributes.style.typography.fontFamily; | ||
attributes.style = cleanEmptyObject( attributes.style ); | ||
|
||
return { | ||
...attributes, | ||
fontFamily, | ||
}; | ||
}; | ||
|
||
const deprecated = [ | ||
{ | ||
attributes: { | ||
textAlign: { | ||
type: 'string', | ||
}, | ||
}, | ||
supports: { | ||
html: false, | ||
color: { | ||
gradients: true, | ||
}, | ||
spacing: { | ||
margin: true, | ||
padding: true, | ||
}, | ||
typography: { | ||
fontSize: true, | ||
lineHeight: true, | ||
__experimentalFontFamily: true, | ||
__experimentalFontWeight: true, | ||
__experimentalTextTransform: true, | ||
__experimentalLetterSpacing: true, | ||
}, | ||
}, | ||
save() { | ||
return null; | ||
}, | ||
migrate: oldFontFamilyMigration, | ||
isEligible( { style } ) { | ||
return style?.typography?.fontFamily; | ||
}, | ||
}, | ||
]; | ||
|
||
export default deprecated; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters