JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
page to test editor html cleanup and serialization
[peach-html5-editor.git] / editor.coffee
index 32c1d4d..b608e6b 100644 (file)
@@ -65,14 +65,18 @@ dom_to_html = (dom) ->
                                        ret += " \"#{el.system_identifier}\""
        return ret
 
-make_wysiwyg = (el, options = {}) ->
+wysiwyg = (el, options = {}) ->
        opt_fragment = options.fragment ? true
        parser_opts = {}
        if opt_fragment
                parser_opts.fragment = 'body'
-       dom = wheic_parser.parse(el.value, parser_opts)
-       el.value = dom_to_html dom
+       editor_instance = dom: wheic_parser.parse(el.value, parser_opts)
+       # el.value = dom_to_html dom
+       return editor_instance
 
-window.wheic = make_wysiwyg
+window.wheic = {
+       wysiwyg: wysiwyg
+       dom_to_html: dom_to_html
+}
 
 # test in browser: wheic(document.getElementsByTagName('textarea')[0])