UNPKG

@wordpress/block-library

Version:
58 lines (56 loc) 1.41 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement, Fragment } from "@wordpress/element"; /** * External dependencies */ import classnames from 'classnames'; /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { RichText, BlockControls, AlignmentToolbar, useBlockProps } from '@wordpress/block-editor'; export default function VerseEdit(_ref) { let { attributes, setAttributes, mergeBlocks, onRemove, style } = _ref; const { textAlign, content } = attributes; const blockProps = useBlockProps({ className: classnames({ [`has-text-align-${textAlign}`]: textAlign }), style }); return createElement(Fragment, null, createElement(BlockControls, null, createElement(AlignmentToolbar, { value: textAlign, onChange: nextAlign => { setAttributes({ textAlign: nextAlign }); } })), createElement(RichText, _extends({ tagName: "pre", identifier: "content", preserveWhiteSpace: true, value: content, onChange: nextContent => { setAttributes({ content: nextContent }); }, "aria-label": __('Verse text'), placeholder: __('Write verse…'), onRemove: onRemove, onMerge: mergeBlocks, textAlign: textAlign }, blockProps, { __unstablePastePlainText: true }))); } //# sourceMappingURL=edit.js.map