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:
5130d7e
)
workaround for shrinking content height on chrome
author
Jason Woofenden
<jason@jasonwoof.com>
Thu, 24 Mar 2016 02:03:05 +0000
(22:03 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Thu, 24 Mar 2016 02:03:05 +0000
(22:03 -0400)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
dfcf6d2
..
012079c
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-977,13
+977,14
@@
class PeachHTML5Editor
@load_html @in_el.value
@adjust_iframe_height()
adjust_iframe_height: ->
@load_html @in_el.value
@adjust_iframe_height()
adjust_iframe_height: ->
+ s = @wrap2.scrollTop
+ # when the content gets shorter, the idoc's body tag will continue to
+ # report the old (too big) height in Chrome. The workaround is to
+ # shrink the iframe before the content height:
+ @iframe.style.height = "10px"
h = parseInt(@idoc.body.scrollHeight, 10)
h = parseInt(@idoc.body.scrollHeight, 10)
- if @iframe_height isnt h
- @iframe_height = h
- s = @wrap2.scrollTop
- @iframe.style.height = "0"
- @iframe.style.height = "#{h}px"
- @wrap2.scrollTop = s
+ @iframe.style.height = "#{h}px"
+ @wrap2.scrollTop = s
# does this node have whitespace that would be collapsed by white-space: normal?
# note: this checks direct text children, and does _not_ recurse into child tags
# tag is a node with type:"tag"
# does this node have whitespace that would be collapsed by white-space: normal?
# note: this checks direct text children, and does _not_ recurse into child tags
# tag is a node with type:"tag"