UNPKG

@wordpress/block-library

Version:
116 lines (111 loc) 2.29 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _clsx = _interopRequireDefault(require("clsx")); var _blockEditor = require("@wordpress/block-editor"); var _migrateFontFamily = _interopRequireDefault(require("../utils/migrate-font-family")); var _jsxRuntime = require("react/jsx-runtime"); /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const v1 = { attributes: { content: { type: 'string', source: 'html', selector: 'pre', default: '' }, textAlign: { type: 'string' } }, save({ attributes }) { const { textAlign, content } = attributes; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText.Content, { tagName: "pre", style: { textAlign }, value: content }); } }; const v2 = { attributes: { content: { type: 'string', source: 'html', selector: 'pre', default: '', __unstablePreserveWhiteSpace: true, role: 'content' }, textAlign: { type: 'string' } }, supports: { anchor: true, color: { gradients: true, link: true }, typography: { fontSize: true, __experimentalFontFamily: true }, spacing: { padding: true } }, save({ attributes }) { const { textAlign, content } = attributes; const className = (0, _clsx.default)({ [`has-text-align-${textAlign}`]: textAlign }); return /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", { ..._blockEditor.useBlockProps.save({ className }), children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText.Content, { value: content }) }); }, migrate: _migrateFontFamily.default, isEligible({ style }) { return 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 = exports.default = [v2, v1]; //# sourceMappingURL=deprecated.js.map