if @options.editor_id?
@outer_iframe.setAttribute 'id', @options.editor_id
@outer_iframe.onload = =>
+ console.log 'outer onload'
@outer_idoc = @outer_iframe.contentDocument
icss = domify @outer_idoc, style: children: [
domify @outer_idoc, text: css
@iframe = domify @outer_idoc, iframe: {}
@iframe.onload = =>
@init()
+ setTimeout (=> @init()), 200 # firefox never fires this onload
@outer_idoc.body.appendChild(
domify @outer_idoc, div: id: 'wrap1', children: [
domify @outer_idoc, div: id: 'wrap2', children: [
@outer_iframe.setAttribute 'style', outer_iframe_style
css = outer_css w: outer_bounds.w, h: outer_bounds.h
outer_wrap.appendChild @outer_iframe
- init: -> # called by @iframe's onload
+ init: -> # called by @iframe's onload (or timeout on firefox)
+ return if @initialized # ignore timeout for non-broken browsers
@idoc = @iframe.contentDocument
@overlay.onclick = (e) =>
return @onclick e