docbrown/app/javascript/article-form/components/EditorBody.jsx
Nick Taylor 653ec12300
Upgrade to Preact 10.4.4 (#8739)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-06-18 10:07:17 -04:00

38 lines
1 KiB
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
import Textarea from 'preact-textarea-autosize';
import { Toolbar } from './Toolbar';
export const EditorBody = ({
onChange,
defaultValue,
switchHelpContext,
version,
}) => {
return (
<div data-testid="article-form__body" className="crayons-article-form__body text-padding">
<Toolbar version={version} />
<Textarea
className="crayons-textfield crayons-textfield--ghost crayons-article-form__body__field"
id="article_body_markdown"
placeholder="Write your post content here..."
value={defaultValue}
onInput={onChange}
onFocus={(_event) => {
switchHelpContext(_event);
}}
name="body_markdown"
/>
</div>
);
};
EditorBody.propTypes = {
onChange: PropTypes.func.isRequired,
defaultValue: PropTypes.string.isRequired,
switchHelpContext: PropTypes.func.isRequired,
version: PropTypes.string.isRequired,
};
EditorBody.displayName = 'EditorBody';