You are here: Foswiki>Tasks Web>Item11541 (11 Apr 2012, GeorgeClark)Edit Attach

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

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component:
Branches: Release01x01 trunk
Reported By: FlorianSchlichting
Waiting For:
Last Change By: GeorgeClark
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 distro:d5ddd0ee2b40 distro:5a95e6236a35
TargetRelease patch
ReleasedIn 1.1.5
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:5a95e6236a35
Release01x01Checkins distro:d5ddd0ee2b40
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 Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy