@wordpress/block-library
Version:
Block library for the WordPress editor.
53 lines (50 loc) • 1.18 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _blocks = require("@wordpress/blocks");
/**
* WordPress dependencies
*/
const transforms = {
from: [{
type: 'block',
blocks: ['core/code', 'core/paragraph'],
transform: _ref => {
let {
content,
anchor
} = _ref;
return (0, _blocks.createBlock)('core/preformatted', {
content,
anchor
});
}
}, {
type: 'raw',
isMatch: node => node.nodeName === 'PRE' && !(node.children.length === 1 && node.firstChild.nodeName === 'CODE'),
schema: _ref2 => {
let {
phrasingContentSchema
} = _ref2;
return {
pre: {
children: phrasingContentSchema
}
};
}
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: attributes => (0, _blocks.createBlock)('core/paragraph', attributes)
}, {
type: 'block',
blocks: ['core/code'],
transform: attributes => (0, _blocks.createBlock)('core/code', attributes)
}]
};
var _default = transforms;
exports.default = _default;
//# sourceMappingURL=transforms.js.map
;