@wordpress/block-library
Version:
Block library for the WordPress editor.
31 lines (30 loc) • 1.09 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_block_editor = require("@wordpress/block-editor");
// packages/block-library/src/utils/migrate-font-family.js
const { cleanEmptyObject } = (0, require("../lock-unlock.cjs").unlock)(_wordpress_block_editor.privateApis);
/**
* 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.
*/
function migrate_font_family_default(attributes) {
if (!attributes?.style?.typography?.fontFamily) return attributes;
const { fontFamily, ...typography } = attributes.style.typography;
return {
...attributes,
style: cleanEmptyObject({
...attributes.style,
typography
}),
fontFamily: fontFamily.split("|").pop()
};
}
exports.default = migrate_font_family_default;
//# sourceMappingURL=migrate-font-family.cjs.map