JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
cursor hight fits text size
authorJason Woofenden <jason@jasonwoof.com>
Sun, 13 Mar 2016 18:03:14 +0000 (14:03 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Sun, 13 Mar 2016 18:03:14 +0000 (14:03 -0400)
editor.coffee
editor_tests_compiled.html

index b78f6a0..92fc1e0 100644 (file)
@@ -794,7 +794,12 @@ class PeachHTML5Editor
                @overlay.appendChild @cursor_el
                @cursor_visible = true
                @cursor_el.style.left = "#{loc.x + overlay_padding - 1}px"
-               @cursor_el.style.top = "#{loc.y + overlay_padding}px"
+               if loc.h < 5
+                       height = 12
+               else
+                       height = loc.h
+               @cursor_el.style.top = "#{loc.y + overlay_padding + Math.round(height * .07)}px"
+               @cursor_el.style.height = "#{Math.round height * 0.82}px"
                @matt cursor[0]
        matt: (n) ->
                while @matting.length > 0
index 276faa7..cff5d6f 100644 (file)
@@ -22,7 +22,7 @@
        <h1>Peach HTML5 Editor test page (compiled version)</h1>
        <p>This version of the editor test page requires that you've compiled all the source files. (Just run <code>make</code>).</p>
        <form action="#" method="get">
-       <p>HTML view. Changes here propagate when you remove your cursor (press tab or click outside)<br><textarea name="in" id="in">&lt;p&gt;  a b c      
+       <p>HTML view. Changes here propagate when you remove your cursor (press tab or click outside)<br><textarea name="in" id="in">&lt;H1>Headline!&lt;/h1>&lt;p&gt;  a b c      
        d e f&lt;br>g   &lt;br>  h i j <a href="http://example.com">Click me!</a> o p q r&lt;/p>
        &lt;p> y z     &lt;strong&gt;Bold &lt;em&gt; Italic + Bold&lt;/strong&gt; Italic &lt;/em&gt; Normal&lt;/p&gt;
 &lt;p style="white-space: pre-wrap"&gt;this &amp;lt;p&amp;gt; has     white-space: pre-wrap&lt;/p&gt;