r91686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91685‎ | r91686 | r91687 >
Date:21:05, 7 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added code for location tracking between clicks. Removed getPosition on surface, we won't need that.
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Surface.css (modified) (history)
  • /trunk/parsers/wikidom/lib/es/es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Surface.css
@@ -18,7 +18,8 @@
1919
2020 .editSurface-paragraph {
2121 background-color: #eeeeee;
22 - margin: 2em;
 22+ margin: 1em;
 23+ margin-bottom: 0;
2324 }
2425
2526 .editSurface-line {
Index: trunk/parsers/wikidom/lib/es/es.Surface.js
@@ -72,8 +72,9 @@
7373 ? $target : $target.closest( '.editSurface-block' );
7474 // Not a block or child of a block? Find the nearest block...
7575 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() {
7879 var top = $(this).offset().top,
7980 bottom = top + $(this).height();
8081 // Inside test
@@ -88,6 +89,9 @@
8990 $block = $(this);
9091 }
9192 } );
 93+ if ( !$block.length ) {
 94+ $block = $blocks.first();
 95+ }
9296 }
9397 var block = $block.data( 'block' )
9498 blockOffset = $block.offset()
@@ -96,6 +100,7 @@
97101 cursorPosition = block.flow.getPosition( nearestOffset );
98102
99103 this.cursor.show( cursorPosition, blockOffset );
 104+ this.location = new Location( block, nearestOffset );
100105
101106 this.$input.focus();
102107 return false;
@@ -136,20 +141,10 @@
137142 * @returns {Location}
138143 */
139144 Surface.prototype.getLocation = function( position ) {
140 - // return location
 145+ return this.location;
141146 };
142147
143148 /**
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 -/**
154149 * Moves the cursor to the nearest location directly above the current flowed line.
155150 */
156151 Surface.prototype.moveCursorUp = function() {

Status & tagging log