UNPKG

@fakel/rest-admin

Version:

An application that makes it easier to work with your API

32 lines (31 loc) 1.23 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 Card from 'antd/lib/card'; import EditorJs from 'react-editor-js'; import CoreInput from '../Input'; import { EDITOR_JS_TOOLS } from './tools'; var TextEditor = function (props) { var handleChange = function (form, data) { form.setFieldValue(props.name, { blocks: data }); }; return (React.createElement(CoreInput, __assign({}, props, { style: { width: '100%' } }), function (form) { return (React.createElement(Card, { style: { width: '80vw' } }, React.createElement(EditorJs, { data: form.values[props.name], // @ts-ignore onChange: function (_, _a) { var blocks = _a.blocks; return handleChange(form, blocks); }, tools: EDITOR_JS_TOOLS }))); })); }; export default TextEditor;