@wordpress/block-library
Version:
Block library for the WordPress editor.
130 lines (113 loc) • 2.53 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _element = require("@wordpress/element");
var _classnames = _interopRequireDefault(require("classnames"));
var _blockEditor = require("@wordpress/block-editor");
var _migrateFontFamily = _interopRequireDefault(require("../utils/migrate-font-family"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const v1 = {
attributes: {
content: {
type: 'string',
source: 'html',
selector: 'pre',
default: ''
},
textAlign: {
type: 'string'
}
},
save(_ref) {
let {
attributes
} = _ref;
const {
textAlign,
content
} = attributes;
return (0, _element.createElement)(_blockEditor.RichText.Content, {
tagName: "pre",
style: {
textAlign
},
value: content
});
}
};
const v2 = {
attributes: {
content: {
type: 'string',
source: 'html',
selector: 'pre',
default: '',
__unstablePreserveWhiteSpace: true,
__experimentalRole: 'content'
},
textAlign: {
type: 'string'
}
},
supports: {
anchor: true,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
__experimentalFontFamily: true
},
spacing: {
padding: true
}
},
save(_ref2) {
let {
attributes
} = _ref2;
const {
textAlign,
content
} = attributes;
const className = (0, _classnames.default)({
[`has-text-align-${textAlign}`]: textAlign
});
return (0, _element.createElement)("pre", _blockEditor.useBlockProps.save({
className
}), (0, _element.createElement)(_blockEditor.RichText.Content, {
value: content
}));
},
migrate: _migrateFontFamily.default,
isEligible(_ref3) {
var _style$typography;
let {
style
} = _ref3;
return style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
var _default = [v2, v1];
exports.default = _default;
//# sourceMappingURL=deprecated.js.map
;