Index: trunk/parsers/wikidom/lib/jquery.flow.js |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | $.flow = { 'widthCache': {} }; |
7 | 7 | |
8 | 8 | $.fn.flow = function( text ) { |
| 9 | + console.time( 'flow' ); |
9 | 10 | |
10 | 11 | function encodeHtml( c ) { |
11 | 12 | return c.replace( /&/g, '&' ) |
— | — | @@ -83,12 +84,9 @@ |
84 | 85 | |
85 | 86 | line++; |
86 | 87 | } |
87 | | - |
88 | | - return $this; |
89 | 88 | |
90 | | - // the end |
91 | | - |
92 | | - |
93 | | - |
| 89 | + console.timeEnd( 'flow' ); |
| 90 | + |
| 91 | + return $this; |
94 | 92 | }; |
95 | 93 | |
Index: trunk/parsers/wikidom/lib/jquery.editSurface.js |
— | — | @@ -20,14 +20,18 @@ |
21 | 21 | |
22 | 22 | $(document) |
23 | 23 | .mousedown( function( e ) { |
24 | | - if ( !$( e.target ).is( '.editSurface-line' ) ) { |
| 24 | + var $target = $( e.target ); |
| 25 | + if ( $target.is( '.editSurface-paragraph' ) ) { |
| 26 | + $target = $target.children().closestToOffset( { 'left': e.pageX, 'top': e.pageY } ); |
| 27 | + } |
| 28 | + if ( !$target.is( '.editSurface-line' ) ) { |
25 | 29 | return; |
26 | 30 | } |
27 | 31 | sel = { |
28 | 32 | 'active': true, |
29 | 33 | 'from': null, |
30 | 34 | 'to': null, |
31 | | - 'start': getCursorPosition( e.pageX, e.pageY, $( e.target ) ), |
| 35 | + 'start': getCursorPosition( e.pageX, e.pageY, $target ), |
32 | 36 | 'end': null |
33 | 37 | }; |
34 | 38 | cursor.show(); |
— | — | @@ -110,9 +114,6 @@ |
111 | 115 | return text; |
112 | 116 | } |
113 | 117 | function getCursorPosition( x, y, $target ) { |
114 | | - if ( $target === undefined ) { |
115 | | - var $target = $( '.editSurface-line' ).closestToOffset( { 'left': x, 'top': y } ); |
116 | | - } |
117 | 118 | var metrics = $target.data( 'metrics' ); |
118 | 119 | var text = $target.data( 'text' ); |
119 | 120 | var line = $target.data( 'line' ); |