r91693 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91692‎ | r91693 | r91694 >
Date:22:08, 7 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Hide input behind document, and move it with cursor to prevent scrolling-to-input issues.
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Surface.css (modified) (history)
  • /trunk/parsers/wikidom/lib/es/es.Surface.js (modified) (history)
  • /trunk/parsers/wikidom/lib/es/es.TextFlow.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Surface.css
@@ -7,19 +7,35 @@
88 overflow-y: scroll;
99 }
1010
11 -.editSurface-document {
 11+.editSurface {
1212 border: solid 1px silver;
13 - background-color: #dddddd;
14 - cursor: text;
1513 margin-left: 12.5%;
1614 margin-top: 1em;
1715 width: 75%;
1816 }
1917
20 -.editSurface-paragraph {
 18+.editSurface-input {
 19+ position: absolute;
 20+ z-index: -1;
 21+ color: white;
 22+ background-color: white;
 23+ border: none;
 24+}
 25+
 26+.editSurface-input:focus {
 27+ outline: none;
 28+}
 29+
 30+.editSurface-document {
 31+ background-color: #dddddd;
 32+ cursor: text;
 33+ margin-top: 1em;
 34+}
 35+
 36+.editSurface-block {
2137 background-color: #eeeeee;
2238 margin: 1em;
23 - margin-bottom: 0;
 39+ margin-top: 0;
2440 }
2541
2642 .editSurface-line {
Index: trunk/parsers/wikidom/lib/es/es.Surface.js
@@ -19,7 +19,7 @@
2020 * @returns {Surface}
2121 */
2222 function Surface( $container, document ) {
23 - this.$ = $container;
 23+ this.$ = $container.addClass( 'editSurface' );
2424 this.document = document;
2525 this.rendered = false;
2626 this.location = null;
@@ -51,8 +51,8 @@
5252 this.$.after( this.cursor.$ );
5353
5454 // Hidden input
55 - this.$input = $( '<input/>' );
56 - this.$.before( this.$input );
 55+ this.$input = $( '<input class="editSurface-input" />' );
 56+ this.$.prepend( this.$input );
5757 this.$input.bind({
5858 'keydown' : function( e ) {
5959 return surface.onKeyDown( e );
@@ -105,6 +105,7 @@
106106 cursorPosition = block.flow.getPosition( nearestOffset );
107107
108108 this.cursor.show( cursorPosition, blockPosition );
 109+ this.$input.css( 'top', cursorPosition.top );
109110 this.location = new Location( block, nearestOffset );
110111
111112 this.state.selection = {
Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js
@@ -163,7 +163,9 @@
164164 if ( this.lines[line].start < offset ) {
165165 var $ruler = $( '<div class="editSurface-line"></div>' ).appendTo( this.$ ),
166166 ruler = $ruler[0];
167 - ruler.innerHTML = this.escape( this.lines[line].text.substring( 0, offset - this.lines[line].start ) );
 167+ ruler.innerHTML = this.escape(
 168+ this.lines[line].text.substring( 0, offset - this.lines[line].start )
 169+ );
168170 position.left = ruler.clientWidth;
169171 $ruler.remove();
170172 }

Status & tagging log