Foswiki on GitHub is open for business! Next release meeting: Monday September 29, 1300Z

Item11541: Resizing EditBox broken: enlarges a lot, shrink doesn't work

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Urgent Closed Engine    
For some reason, the "Enlarge edit box" / "Shrink edit box" icons stopped working correctly. Enlarge would make the edit box a lot bigger, while Shrink is unable to make it smaller again. This behaviour is consistent accross Firefox 10.0.2 and Opera 11.61, but unfortunately I'm unable to say since when.

Investigating the issue, it turns out that instead of (mathematically) adding or substracting 4 from the amount of rows, a "4" or "-1" is string-concatenated to the rows value. That is, after hitting Enlarge twice and then Shrink twice, the HTML says: rows="2244-4-4"

Looking at pub/System/JavascriptFiles/foswiki_edit_src.js, it seems that rowCount is a String now, and needs to be converted to an int in order to work properly again. The following patch has been tested, works, and shouldn't have any side-effects (yet I don't know how to properly generate the minified and gzipped versions, so would like to leave the checkin to somebody else).

--- a/pub/System/JavascriptFiles/foswiki_edit_src.js
+++ b/pub/System/JavascriptFiles/foswiki_edit_src.js
@@ -95,6 +95,7 @@ var EDITBOX_FONTSTYLE_PROPORTIONAL_STYLE = "foswikiEditboxStyleProportional";
      */
     foswiki.Edit.changeEditBox = function(inDirection) {
         var rowCount = $('#' +  EDITBOX_ID).attr('rows');
+        rowCount = parseInt(rowCount);
         rowCount += (inDirection * EDITBOX_CHANGE_STEP_SIZE);
         rowCount = (rowCount < EDITBOX_MIN_ROWCOUNT)
         ? EDITBOX_MIN_ROWCOUNT : rowCount;

-- FlorianSchlichting - 20 Feb 2012

Fixed in Release01x01 and trunk. Thanks, Florian!

-- CrawfordCurrie - 20 Feb 2012
 

ItemTemplate edit

Summary Resizing EditBox broken: enlarges a lot, shrink doesn't work
ReportedBy FlorianSchlichting
Codebase 1.1.4
SVN Range
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins Foswikirev:14036 Foswikirev:14037
TargetRelease patch
ReleasedIn 1.1.5
CheckinsOnBranches Release01x01 trunk
trunkCheckins Foswikirev:14037
Release01x01Checkins Foswikirev:14036
Topic revision: r6 - 11 Apr 2012, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License