JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
preview in iframe, load_html method
[peach-html5-editor.git] / editor_tests.coffee
index 4b995bb..5777244 100644 (file)
@@ -1,9 +1,13 @@
 in_el = document.getElementById 'in'
 out_el = document.getElementById 'out'
 button = document.getElementById 'button'
-button.onclick = ->
-       editor = wheic.wysiwyg in_el
-       out_el.value = wheic.dom_to_html editor.dom
+editor = null
+button.onclick = in_el.onchange = in_el.onkeyup = ->
+       if editor?
+               editor.load_html in_el
+       else
+               editor = wheic.wysiwyg in_el
+       editor.iframe.contentDocument.body.innerHTML = out_el.value = wheic.dom_to_html editor.dom
        return false
 button.value="Cleanup"
 button.removeAttribute 'disabled'