UNPKG

@fakel/rest-admin

Version:

An application that makes it easier to work with your API

32 lines (31 loc) 1.46 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import React from 'react'; import AceEditor from 'react-ace'; import CoreInput from './Input'; import 'ace-builds/src-noconflict/mode-html'; import 'ace-builds/src-noconflict/theme-monokai'; var CodeInput = function (props) { var handleChange = function (form, value) { form.setFieldValue(props.name, value); }; return (React.createElement(CoreInput, __assign({}, props, { style: { minWidth: 200 } }), function (form, field) { return (React.createElement(AceEditor, { defaultValue: field.value, value: field.value, placeholder: props.placeholder || props.label, mode: "html", style: { width: '100%' }, maxLines: 4, minLines: 4, theme: "monokai", name: props.name, onChange: function (value) { return handleChange(form, value); }, fontSize: 16, highlightActiveLine: true, setOptions: { enableBasicAutocompletion: false, enableLiveAutocompletion: false, enableSnippets: false, showLineNumbers: true, tabSize: 2, } })); })); }; export default CodeInput;