Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | this.$ = $container; |
10 | 10 | this.document = document; |
11 | 11 | this.rendered = false; |
| 12 | + this.cursorInitialized = false; |
12 | 13 | this.location = null; |
13 | 14 | this.render(); |
14 | 15 | |
— | — | @@ -18,9 +19,6 @@ |
19 | 20 | return surface.onMouseDown( e ); |
20 | 21 | } |
21 | 22 | }); |
22 | | - |
23 | | - this.$cursor = $( '<div class="editSurface-cursor"></div>' ); |
24 | | - this.$.after( this.$cursor ); |
25 | 23 | } |
26 | 24 | |
27 | 25 | Surface.prototype.onMouseDown = function( e ) { |
— | — | @@ -32,8 +30,8 @@ |
33 | 31 | return false; |
34 | 32 | } |
35 | 33 | |
36 | | - var position = new Position(e.pageX - $block.offset().left, |
37 | | - e.pageY - $block.offset().top); |
| 34 | + var position = new Position( e.pageX - $block.offset().left, |
| 35 | + e.pageY - $block.offset().top ); |
38 | 36 | var offset = block.flow.getOffset( position ); |
39 | 37 | this.setCursor( new Location( block, offset ) ); |
40 | 38 | }; |
— | — | @@ -48,6 +46,17 @@ |
49 | 47 | |
50 | 48 | var position = this.location.block.getPosition( this.location.offset ); |
51 | 49 | var offset = this.location.block.$.offset(); |
| 50 | + |
| 51 | + if( !this.cursorInitialized ) { |
| 52 | + this.$cursor = $( '<div class="editSurface-cursor"></div>' ); |
| 53 | + this.$.after( this.$cursor ); |
| 54 | + |
| 55 | + setInterval( function( surface ) { |
| 56 | + surface.$cursor.css('display') == 'block' ? surface.$cursor.hide() : surface.$cursor.show(); |
| 57 | + }, 500, this ); |
| 58 | + |
| 59 | + this.cursorInitialized = true; |
| 60 | + } |
52 | 61 | |
53 | 62 | this.$cursor.css({ |
54 | 63 | 'left': position.left + offset.left, |