Skip to content

Instantly share code, notes, and snippets.

@de314
Created April 25, 2019 05:03
Show Gist options
  • Save de314/ad5752b88c326b91596fd25eeb840a25 to your computer and use it in GitHub Desktop.
Save de314/ad5752b88c326b91596fd25eeb840a25 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Field } from 'formik';
import AceEditor from 'react-ace';
import 'brace/mode/ejs';
import 'brace/theme/textmate';
export const EjsForm = ({ name }) => (
<Field name={name}>
{({ field }) => (
<React.Fragment>
<AceEditor
mode="ejs"
theme="textmate"
onChange={value => {
field.onChange(name)(value);
}}
tabSize={2}
editorProps={{ $blockScrolling: true }}
value={field.value}
width="100%"
/>
</React.Fragment>
)}
</Field>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment