Index: trunk/parsers/wikidom/lib/es/es.Surface.css |
— | — | @@ -18,7 +18,8 @@ |
19 | 19 | |
20 | 20 | .editSurface-paragraph { |
21 | 21 | background-color: #eeeeee; |
22 | | - margin: 2em; |
| 22 | + margin: 1em; |
| 23 | + margin-bottom: 0; |
23 | 24 | } |
24 | 25 | |
25 | 26 | .editSurface-line { |
Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -72,8 +72,9 @@ |
73 | 73 | ? $target : $target.closest( '.editSurface-block' ); |
74 | 74 | // Not a block or child of a block? Find the nearest block... |
75 | 75 | if( !$block.length ) { |
76 | | - var minDistance; |
77 | | - this.$.find( '> .editSurface-document .editSurface-block' ).each( function() { |
| 76 | + var minDistance, |
| 77 | + $blocks = this.$.find( '> .editSurface-document .editSurface-block' ); |
| 78 | + $blocks.each( function() { |
78 | 79 | var top = $(this).offset().top, |
79 | 80 | bottom = top + $(this).height(); |
80 | 81 | // Inside test |
— | — | @@ -88,6 +89,9 @@ |
89 | 90 | $block = $(this); |
90 | 91 | } |
91 | 92 | } ); |
| 93 | + if ( !$block.length ) { |
| 94 | + $block = $blocks.first(); |
| 95 | + } |
92 | 96 | } |
93 | 97 | var block = $block.data( 'block' ) |
94 | 98 | blockOffset = $block.offset() |
— | — | @@ -96,6 +100,7 @@ |
97 | 101 | cursorPosition = block.flow.getPosition( nearestOffset ); |
98 | 102 | |
99 | 103 | this.cursor.show( cursorPosition, blockOffset ); |
| 104 | + this.location = new Location( block, nearestOffset ); |
100 | 105 | |
101 | 106 | this.$input.focus(); |
102 | 107 | return false; |
— | — | @@ -136,20 +141,10 @@ |
137 | 142 | * @returns {Location} |
138 | 143 | */ |
139 | 144 | Surface.prototype.getLocation = function( position ) { |
140 | | - // return location |
| 145 | + return this.location; |
141 | 146 | }; |
142 | 147 | |
143 | 148 | /** |
144 | | - * Gets the position of a location. |
145 | | - * |
146 | | - * @param location {Location} Location to translate |
147 | | - * @returns {Position} |
148 | | - */ |
149 | | -Surface.prototype.getPosition = function( location ) { |
150 | | - // return position |
151 | | -}; |
152 | | - |
153 | | -/** |
154 | 149 | * Moves the cursor to the nearest location directly above the current flowed line. |
155 | 150 | */ |
156 | 151 | Surface.prototype.moveCursorUp = function() { |