X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=blobdiff_plain;f=editor.coffee;h=7c57510ef1bbbcd1d2dcf5339dcecec6bbc921ee;hp=e32d6623cc6dded2b53c8193294b2346ddd8ea2a;hb=928527c2ae6efd3536d39f1cf066f5ee44209212;hpb=c5c3490bada2ec19ebc300e28e1b180e5f4979de 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