r68010 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68009‎ | r68010 | r68011 >
Date:17:55, 14 June 2010
Author:neilk
Status:deferred
Tags:
Comment:
growing text areas -- do resize event correctly
Modified paths:
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -2353,18 +2353,18 @@
23542354 $j('<p/>').append(
23552355 gM( 'mwe-upwiz-thanks-wikitext' ),
23562356 $j( '<br />' ),
2357 - $j( '<textarea class="mwe-long-textarea" rows="1"/>' )
 2357+ $j( '<textarea class="mwe-long-textarea" rows="2"/>' )
23582358 .growTextArea()
23592359 .append( thumbWikiText )
2360 - .trigger('change')
 2360+ .trigger('resizeEvent')
23612361 ),
23622362 $j('<p/>').append(
23632363 gM( 'mwe-upwiz-thanks-url' ),
23642364 $j( '<br />' ),
2365 - $j( '<textarea class="mwe-long-textarea" rows="1"/>' )
 2365+ $j( '<textarea class="mwe-long-textarea" rows="2"/>' )
23662366 .growTextArea()
23672367 .append( upload.imageinfo.descriptionurl )
2368 - .trigger('change')
 2368+ .trigger('resizeEvent')
23692369 )
23702370 )
23712371 );
@@ -2990,13 +2990,19 @@
29912991
29922992 var resizeIfNeeded = function() {
29932993 // this is the dom element
2994 - while (this.scrollHeight > this.offsetHeight) {
 2994+ // is there a better way to do this?
 2995+ if (this.scrollHeight >= this.offsetHeight) {
29952996 this.rows++;
 2997+ while (this.scrollHeight > this.offsetHeight) {
 2998+ this.rows++;
 2999+ }
29963000 }
29973001 return this;
29983002 };
29993003
30003004 this.addClass( 'mwe-grow-textarea' );
 3005+
 3006+ this.bind( 'resizeEvent', resizeIfNeeded );
30013007
30023008 this.keyup( resizeIfNeeded );
30033009 this.change( resizeIfNeeded );

Status & tagging log