Package Exports
- @wisersolutions/aor-codemirror
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@wisersolutions/aor-codemirror) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Admin on Rest - CodeMirror
Wrapper around CodeMirror for react-admin.
Supported formats:
- html
- json
- sql
- javascript
Install
Install using npm: npm install @wisersolutions/aor-codemirror
Usage
The prop name will be mapped to source for react-admin.
JSON editor
We should to turn on validation for JSON.
import { CodeMirror, validJson } from 'aor-codemirror'
<CodeEditor label="My Label" name="fieldName" type="json" defaultValue="{}" required validate={validJson} />Output from the CodeMirrror will be JSON object (not string);
SQL editor
import { CodeMirror } from 'aor-codemirror'
<CodeMirror label="My Label" name="fieldName" type="sql" required />HTML editor
import { required } from 'react-admin'
import { CodeMirror } from 'aor-codemirror'
<CodeMirror label="My Label" name="fieldName" type="html" required validate={required} />Javascript editor
import { required } from 'react-admin'
import { CodeMirror } from 'aor-codemirror'
<CodeMirror label="My Label" name="fieldName" type="javascript" required validate={required} />