X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=editor.coffee;h=4805550979a69b215dfc4c6aa99f2ac92751165d;hb=8709cb94761099e91b480781b64323b169130d3a;hp=f4b78451b15478c7f49c5e9725b490ad0f533514;hpb=be45d613a601143205ac93a5359d2340983efdf5;p=peach-html5-editor.git diff --git a/editor.coffee b/editor.coffee index f4b7845..4805550 100644 --- a/editor.coffee +++ b/editor.coffee @@ -76,8 +76,18 @@ wysiwyg = (el, options = {}) -> parser_opts = {} if opt_fragment parser_opts.fragment = 'body' - editor_instance = dom: wheic_parser.parse(el.value, parser_opts) - # el.value = dom_to_html dom + editor_instance = { + dom: wheic_parser.parse el.value, parser_opts + iframe: document.createElement('iframe') + load_html: (html) -> + @dom = wheic_parser.parse el.value, parser_opts + } + idoc = editor_instance.iframe.contentDocument + if options.stylesheet # TODO test this + istyle = idoc.createElement 'style' + istyle.setAttribute 'src', options.stylesheet + idoc.head.appendChild istyle + el.parentNode.appendChild editor_instance.iframe return editor_instance window.wheic = {