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