d-codemirror

0.2.5 • Public • Published

d-codemirror

Example CodeMirror Derby component.

Usage

Example usage

In your template

<Head:>
  <view name="d-codemirror:includes" static="/cm"></view>
<Body:>
  <view name="d-codemirror" text={{_page.text}} options="{{ { tabSize: 2 } }}"></view>

Your data

model.set("_page.text", "Hello World");

Your CodeMirror

You can serve the CodeMirror files from your public folder. If you install them through NPM you will have to add an extra static route to your Express app:

var expressApp = express()
  (…)
  .use('/cm', serveStatic(process.cwd() + '/node_modules/d-codemirror/node_modules/codemirror/'))
  (…)

See the derby-examples repo for an example using real-time data subscriptions to power multi-player editing.

Package Sidebar

Install

npm i d-codemirror

Weekly Downloads

5

Version

0.2.5

License

MIT

Last publish

Collaborators

  • enjalot