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:
bf21f4d
)
don't scroll to top when content height changes
author
Jason Woofenden
<jason@jasonwoof.com>
Tue, 15 Mar 2016 19:18:02 +0000
(15:18 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Tue, 15 Mar 2016 19:18:02 +0000
(15:18 -0400)
editor.coffee
patch
|
blob
|
history
diff --git
a/editor.coffee
b/editor.coffee
index
5dbc566
..
0a02396
100644
(file)
--- a/
editor.coffee
+++ b/
editor.coffee
@@
-622,6
+622,7
@@
class PeachHTML5Editor
@cursor_visible = false
@poll_for_blur_timeout = null
@iframe_offset = null
@cursor_visible = false
@poll_for_blur_timeout = null
@iframe_offset = null
+ @iframe_height = null
opt_fragment = @options.fragment ? true
@parser_opts = {}
if opt_fragment
opt_fragment = @options.fragment ? true
@parser_opts = {}
if opt_fragment
@@
-817,8
+818,13
@@
class PeachHTML5Editor
@load_html @in_el.value
@adjust_iframe_height()
adjust_iframe_height: ->
@load_html @in_el.value
@adjust_iframe_height()
adjust_iframe_height: ->
- @iframe.style.height = "0"
- @iframe.style.height = "#{@idoc.body.scrollHeight}px"
+ 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
kill_cursor: -> # remove it, forget where it was
if @cursor_visible
@cursor_el.parentNode.removeChild @cursor_el
kill_cursor: -> # remove it, forget where it was
if @cursor_visible
@cursor_el.parentNode.removeChild @cursor_el