0.0.5 • Published 7 years ago

matreshka-binder-codemirror v0.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

matreshka-binder-codemirror npm version Build Status Coverage Status

CodeMirror binder creator for Matreshka.js

The binder creator returns a binder which initializes and binds CodeMirror instance created with fromTextArea function to a property.

Usage

In browser environment (or whatever environment where Matreshka is global variable) Matreshka.binders namespace is extended.

<script src="path/to/matreshka-binder-codemirror.min.js"></script>
const { codeMirror } = Matreshka.binders;
this.bindNode('code', textarea, codeMirror());

// if you don't want to create the variable
this.bindNode('code', textarea, Matreshka.binders.codeMirror());

obj.code = 'alert("Hello World!");';

The bundle can be downloaded at gh-pages branch


In CJS environment Matreshka.binders is not extended.

npm install --save matreshka-binder-codemirror
const codeMirror = require('matreshka-binder-codemirror');

// ...

this.bindNode('code', textarea, codeMirror());

Configuration

The function accepts one argument: configuration object which is passed into internal call of CodeMirror.fromTextArea. Read the CodeMirror documentation for more info.

this.bindNode('code', textarea, codeMirror({
    lineNumbers: true,
    mode: 'htmlmixed'
}));
0.0.5

7 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago