@wordpress/block-library
Version:
Block library for the WordPress editor.
28 lines (27 loc) • 819 B
JavaScript
/**
* WordPress dependencies
*/
import { RichText, useBlockProps } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import { escape } from './utils';
import { jsx as _jsx } from "react/jsx-runtime";
export default function save({
attributes
}) {
return /*#__PURE__*/_jsx("pre", {
...useBlockProps.save(),
children: /*#__PURE__*/_jsx(RichText.Content, {
tagName: "code"
// To do: `escape` encodes characters in shortcodes and URLs to
// prevent embedding in PHP. Ideally checks for the code block,
// or pre/code tags, should be made on the PHP side?
,
value: escape(typeof attributes.content === 'string' ? attributes.content : attributes.content.toHTMLString({
preserveWhiteSpace: true
}))
})
});
}
//# sourceMappingURL=save.js.map