@wordpress/block-library
Version:
Block library for the WordPress editor.
41 lines (40 loc) • 967 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { RichText, useBlockProps } from '@wordpress/block-editor';
export default function PreformattedEdit(_ref) {
let {
attributes,
mergeBlocks,
setAttributes,
onRemove,
style
} = _ref;
const {
content
} = attributes;
const blockProps = useBlockProps({
style
});
return createElement(RichText, _extends({
tagName: "pre",
identifier: "content",
preserveWhiteSpace: true,
value: content,
onChange: nextContent => {
setAttributes({
content: nextContent
});
},
onRemove: onRemove,
"aria-label": __('Preformatted text'),
placeholder: __('Write preformatted text…'),
onMerge: mergeBlocks
}, blockProps, {
__unstablePastePlainText: true
}));
}
//# sourceMappingURL=edit.js.map