Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -11,11 +11,13 @@ |
12 | 12 | this.render(); |
13 | 13 | |
14 | 14 | this.$.mousedown(function(e) { |
15 | | - // what block is that? (from $(e.target).closest('.editSurface-block')) |
16 | | - // what offset is that? |
17 | | - // block.getOffset( |
18 | | - // new Position(e.pageX - $e.target).offset().left, e.pageY - $e.target).offset().top) |
19 | | - // ) |
| 15 | + var $target = $( e.target ); |
| 16 | + $block = $target.is( '.editSurface-block' ) ? $target : $target.closest( '.editSurface-block' ), |
| 17 | + block = $block.data( 'block' ); |
| 18 | + var position = new Position(e.pageX - $(e.target).offset().left, $(e.target).offset().top); |
| 19 | + var offest = block.flow.getOffset( position ); |
| 20 | + block.insertContent(offest, '___!___'); |
| 21 | + |
20 | 22 | // setCursor(new Location(block, offset)) |
21 | 23 | }); |
22 | 24 | } |