var CodeMirror = require('codemirror')
  , bindCodemirror = require('gulf-codemirror')

module.exports = setup
module.exports.consumes = ['editor']
module.exports.provides = []
function setup(plugin, imports, register) {
  var editor = imports.editor

  var cmCssLink = document.createElement('link')
  cmCssLink.setAttribute('rel', "stylesheet")
  cmCssLink.setAttribute('href', "/static/hive-editor-text-codemirror/static/codemirror.css")
  document.head.appendChild(cmCssLink)

  editor.registerEditor('text', function*() {
    var editor = document.querySelector('#editor')
    var cm = CodeMirror(function(el) {
      editor.appendChild(el)
      
      el.style['height'] = '100%'
      el.style['width'] = '100%'
    })

    editor.style['height'] = '100%'
    document.body.style['position'] = 'absolute'
    document.body.style['bottom'] =
    document.body.style['top'] =
    document.body.style['left'] =
    document.body.style['right'] = '0'

    return bindCodemirror(cm)
  })
  register()
}

@@ -503,79 +503,97 @@
 or('
-text', function*() %7B%0A    var editor = document.querySelector('#
+CodeMirror', 'text', 'An extensible and performant code editor'%0A  , function*(
 editor
-')
+El) %7B
 %0A   
@@ -640,16 +640,18 @@
   editor
+El
 .appendC
@@ -659,22 +659,16 @@
 ild(el)%0A
-      
 %0A      e
@@ -735,16 +735,16 @@
     %7D)%0A%0A
-
     edit
@@ -745,16 +745,18 @@
   editor
+El
 .style%5B'

Upgrade to ew editor API