r89753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89752‎ | r89753 | r89754 >
Date:22:47, 8 June 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Enabled starting selection within paragraph but outside line element boundaries.
Modified paths:
  • /trunk/parsers/wikidom/lib/jquery.editSurface.js (modified) (history)
  • /trunk/parsers/wikidom/lib/jquery.flow.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/jquery.flow.js
@@ -5,6 +5,7 @@
66 $.flow = { 'widthCache': {} };
77
88 $.fn.flow = function( text ) {
 9+ console.time( 'flow' );
910
1011 function encodeHtml( c ) {
1112 return c.replace( /&/g, '&' )
@@ -83,12 +84,9 @@
8485
8586 line++;
8687 }
87 -
88 - return $this;
8988
90 - // the end
91 -
92 -
93 -
 89+ console.timeEnd( 'flow' );
 90+
 91+ return $this;
9492 };
9593
Index: trunk/parsers/wikidom/lib/jquery.editSurface.js
@@ -20,14 +20,18 @@
2121
2222 $(document)
2323 .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' ) ) {
2529 return;
2630 }
2731 sel = {
2832 'active': true,
2933 'from': null,
3034 'to': null,
31 - 'start': getCursorPosition( e.pageX, e.pageY, $( e.target ) ),
 35+ 'start': getCursorPosition( e.pageX, e.pageY, $target ),
3236 'end': null
3337 };
3438 cursor.show();
@@ -110,9 +114,6 @@
111115 return text;
112116 }
113117 function getCursorPosition( x, y, $target ) {
114 - if ( $target === undefined ) {
115 - var $target = $( '.editSurface-line' ).closestToOffset( { 'left': x, 'top': y } );
116 - }
117118 var metrics = $target.data( 'metrics' );
118119 var text = $target.data( 'text' );
119120 var line = $target.data( 'line' );

Status & tagging log