Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
peach-html5-editor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8c92788
)
adjust to size of content after css loads
author
Jason Woofenden
<jason@jasonwoof.com>
Tue, 15 Mar 2016 19:03:25 +0000
(15:03 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Tue, 15 Mar 2016 19:03:25 +0000
(15:03 -0400)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
cda74ef
..
5dbc566
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-684,8
+684,10
@@
class PeachHTML5Editor
# so add a <base> tag
@idoc.head.appendChild domify @idoc, base: href: this_url_sans_path()
if @options.css_file
# so add a <base> tag
@idoc.head.appendChild domify @idoc, base: href: this_url_sans_path()
if @options.css_file
- # TODO test this
- @idoc.head.appendChild domify @idoc, link: rel: 'stylesheet', type: 'text/css', href: @options.css_file
+ istyle = domify @idoc, link: rel: 'stylesheet', type: 'text/css', href: @options.css_file + '?foo=baz'
+ istyle.onload = =>
+ @adjust_iframe_height()
+ @idoc.head.appendChild istyle
@idoc.head.appendChild domify @idoc, style: children: [domify @idoc, text: "body { overflow: hidden; }"]
@load_html @in_el.value
@inited = true
@idoc.head.appendChild domify @idoc, style: children: [domify @idoc, text: "body { overflow: hidden; }"]
@load_html @in_el.value
@inited = true
@@
-813,6
+815,8
@@
class PeachHTML5Editor
@in_el.value = @pretty_html @tree
@in_el.onchange = =>
@load_html @in_el.value
@in_el.value = @pretty_html @tree
@in_el.onchange = =>
@load_html @in_el.value
+ @adjust_iframe_height()
+ adjust_iframe_height: ->
@iframe.style.height = "0"
@iframe.style.height = "#{@idoc.body.scrollHeight}px"
kill_cursor: -> # remove it, forget where it was
@iframe.style.height = "0"
@iframe.style.height = "#{@idoc.body.scrollHeight}px"
kill_cursor: -> # remove it, forget where it was