CodeMirror binder for defi.js
npm install codemirror-binder> CodeMirror binder creator for defi.js
The binder creator returns a binder which initializes and binds CodeMirror instance (created using `fromTextArea function) to a property.
``
npm i codemirror-binder
`js
import { bindNode } from 'defi';
import codeMirrorBinder from 'codemirror-binder';
// ...
bindNode(obj, 'code', textarea, codeMirrorBinder());
`
For non-CJS environment the bundle can be downloaded at gh-pages branch.
In the browser environment the script exports a global variable codeMirrorBinder.
`html`
-------------
The function accepts one argument: configuration object which is passed into the internal call of CodeMirror.fromTextArea. Read the CodeMirror documentation for more info.
`js``
bindNode(obj, 'code', textarea, codeMirror({
lineNumbers: true,
mode: 'htmlmixed'
}));