JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
no scrollbars on @iframe (even when overflow-x)
[peach-html5-editor.git] / editor.coffee
index a5cd8d6..cda74ef 100644 (file)
@@ -197,6 +197,8 @@ outer_css = (args) ->
        ret += 'body {'
        ret +=     'margin: 0;'
        ret +=     'padding: 0;'
+       ret +=     'color: black;'
+       ret +=     'background: white;'
        ret += '}'
        ret += '#wrap1 {'
        ret +=     "border: #{occupy 1}px solid black;"
@@ -242,17 +244,19 @@ outer_css = (args) ->
        ret += '}'
        ret += '#cursor {'
        ret +=     'position: absolute;'
-       ret +=     'height: 1em;' # FIXME adjust for hight of text
        ret +=     'width: 2px;'
-       ret +=     'background: #444;'
-       ret +=     '-webkit-animation: blink 1s steps(2, start) infinite;'
-       ret +=     'animation: blink 1s steps(2, start) infinite;'
+       ret +=     'background: linear-gradient(0deg, rgba(0,0,0,1), rgba(255,255,255,1), rgba(0,0,0,1), rgba(255,255,255,1), rgba(0,0,0,1), rgba(255,255,255,1), rgba(0,0,0,1), rgba(255,255,255,1), rgba(0,0,0,1));'
+       ret +=     'background-size: 200% 200%;'
+       ret +=     '-webkit-animation: blink 1s linear normal infinite;'
+       ret +=     'animation: blink 1s linear normal infinite;'
        ret += '}'
        ret += '@-webkit-keyframes blink {'
-       ret +=     'to { visibility: hidden; }'
+       ret +=     '0%{background-position:0% 0%}'
+       ret +=     '100%{background-position:0% -100%}'
        ret += '}'
-       ret += '@keyframes blink {'
-       ret +=     'to { visibility: hidden; }'
+       ret += '@keyframes blink { '
+       ret +=     '0%{background-position:0% 0%}'
+       ret +=     '100%{background-position:0% -100%}'
        ret += '}'
        ret += '.ann_box {'
        ret +=     'z-index: 5;'
@@ -639,6 +643,7 @@ class PeachHTML5Editor
                        setTimeout (=> @init() unless @inited), 200 # firefox never fires this onload
                        @outer_idoc.body.appendChild(
                                domify @outer_idoc, div: id: 'wrap1', children: [
+                                       domify @outer_idoc, div: style: "position: absolute; top: 0; left: 1px; font-size: 10px", children: [ domify @outer_idoc, text: "Peach HTML5 Editor" ]
                                        @wrap2 = domify @outer_idoc, div: id: 'wrap2', children: [
                                                domify @outer_idoc, div: id: 'wrap3', children: [
                                                        @iframe
@@ -681,6 +686,7 @@ class PeachHTML5Editor
                if @options.css_file
                        # TODO test this
                        @idoc.head.appendChild domify @idoc, link: rel: 'stylesheet', type: 'text/css', href: @options.css_file
+               @idoc.head.appendChild domify @idoc, style: children: [domify @idoc, text: "body { overflow: hidden; }"]
                @load_html @in_el.value
                @inited = true
                if @options.on_init?