From: Jason Woofenden Date: Sun, 20 Mar 2016 00:52:04 +0000 (-0400) Subject: chrome bugfix: cursor at end in pre-wrap X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=commitdiff_plain;h=928527c2ae6efd3536d39f1cf066f5ee44209212 chrome bugfix: cursor at end in pre-wrap --- diff --git a/editor.coffee b/editor.coffee index e32d662..7c57510 100644 --- a/editor.coffee +++ b/editor.coffee @@ -121,7 +121,13 @@ text_range_bounds = (el, start, end) -> range.setEnd el, end rects = range.getClientRects() if rects.length > 0 - rect = rects[0] + if rects.length > 1 + if rects[1].width > rects[0].width + rect = rects[1] + else + rect = rects[0] + else + rect = rects[0] else return null doc = el.ownerDocument.documentElement