+ editor_instance = {
+ dom: []
+ iframe: document.createElement('iframe')
+ load_html: (html) ->
+ @dom = wheic_parser.parse html, parser_opts
+ as_html = wheic.dom_to_html @dom
+ as_html = as_html.substr(0, 5) + '<span class="peach_editor_cursor"></span>' + as_html.substr(5)
+ @iframe.contentDocument.body.innerHTML = as_html
+ }
+ el.parentNode.appendChild editor_instance.iframe
+ idoc = editor_instance.iframe.contentDocument
+ idoc.body.onkeypress = (e) ->
+ char = e.charCode ? e.keyCode ? e.which
+ el.value += String.fromCharCode char
+ editor_instance.load_html el.value
+ return false
+ if options.stylesheet # TODO test this
+ istyle = idoc.createElement 'style'
+ istyle.setAttribute 'src', options.stylesheet
+ idoc.head.appendChild istyle
+ icss = idoc.createElement 'style'
+ icss.appendChild idoc.createTextNode css
+ idoc.head.appendChild icss
+ editor_instance.load_html el.value
+ return editor_instance