PromucFlow_constructor/app/client/src/components/fields/JSONEditorField.tsx

21 lines
498 B
TypeScript
Raw Normal View History

2019-10-21 15:12:45 +00:00
import React from "react";
import { Field } from "redux-form";
import CodeEditor from "../editor/CodeEditor";
2019-10-21 15:12:45 +00:00
const JSONEditorField = (props: { name: string }) => {
return (
<Field
name={props.name}
component={CodeEditor}
height={500}
language={"json"}
2019-10-21 15:12:45 +00:00
format={(value: string | object) =>
typeof value === "string" ? value : JSON.stringify(value, null, 2)
2019-10-21 15:12:45 +00:00
}
placeholder="Input post body here"
2019-10-21 15:12:45 +00:00
/>
);
};
export default JSONEditorField;