PDA

View Full Version : [FIXED-202] A new bug with the form HtmlEditor



meroy
11 Feb 2010, 8:55 PM
Clicking on the source-edit button multiple times increases the height of the text-area box.

It can be seen with both htmleditor examples in form/dynamic.html and Firefox 3.6.0 / Safari 4.0.4 on Leopard.

This is new and coming from this change made recently to widgets/form/HtmlEditor.js



diff -r svn.ext-6037/src/widgets/form/HtmlEditor.js svn.ext-6054/src/widgets/form/HtmlEditor.js

...

565a567,568
> // grab the height of the containing panel before we hide the iframe
> var ls = this.getSize();
571a575
> this.setSize(ls);
582,586d585
< var lastSize = this.lastSize;
< if(lastSize){< delete this.lastSize;
< this.setSize(lastSize);
< }

meroy
11 Feb 2010, 9:19 PM
It increases the height by 3 pixels when going back to HTML edit mode.

I've done the following in toggleSourceEdit. Previously, before the recent change for addressing the scrollbar appearing, the bottom of the scrollbar was not flushed with the bottom of the text area box. Perhaps, there's a 3 pixel miscalculation somewhere.



if(this.sourceEditMode){
// grab the height of the containing panel before we hide the iframe
var ls = this.getSize();
this.disableItems(true);
this.syncValue();
this.iframe.className = 'x-hidden';
this.el.removeClass('x-hidden');
this.el.dom.removeAttribute('tabIndex');
this.el.focus();
this.setSize(ls);
}else{
var ls = this.lastSize;
if(this.initialized){
this.disableItems(this.readOnly);
}
this.pushValue();
this.iframe.className = '';
this.el.addClass('x-hidden');
this.el.dom.setAttribute('tabIndex', -1);
this.deferFocus();
if(ls){
ls.height = ls.height - 3;
delete this.lastSize;
this.setSize(ls);
}
}

meroy
11 Feb 2010, 9:54 PM
The fix above isn't a good fix. The reason why is that the fix addresses the issue with the dynamic.html example, but not good for an actual application using the HtmlEditor.

Jamie, the problem isn't present with the test-case-5 tool. I only see the increasing height with both HtmlEditors in examples/form/dynamic.html demo.

Jamie Avins
12 Feb 2010, 11:34 AM
Fixed in svn 6059.

meroy
12 Feb 2010, 12:46 PM
Thanks Jamie.

meroy
12 Feb 2010, 4:13 PM
Unfortunately, there's several problems now.
Tested against SVN 3.1.x branch 6064.

Using the examples/form/dynamic.html demo (this has 2 Html Editors).

Test: click on the source edit button multiple times

1. The text area height shrinks for the first Html Editor in this sample
2. The text area height expands on the 2nd Html Editor (last form)
3. The height shrinks for the html editor form in the test-case-5 tool and this is based on the 2nd above and that one expanded

:)

Happy Friday,
Mario

Jamie Avins
12 Feb 2010, 4:22 PM
What browser are you using? I only see the 2nd issue.

meroy
12 Feb 2010, 4:32 PM
Running on Leopard:

Safari 4.0.4 fails on all 3
Firefox 3.6.0 fails on the 3rd only (test-case-5 tool) -- shrinks.

meroy
12 Feb 2010, 4:40 PM
Running on Windows XP and IE 7:
This one shrinks for a 3 cases.

Click the source edit button 5+ times.

meroy
12 Feb 2010, 6:00 PM
I've kept my HtmlEditor.js as such so that it's somewhat stable with all cases and IE, FF, Safari. I undid the recent changes made here and added back the code in red below.



if(this.sourceEditMode){
this.disableItems(true);
this.syncValue();
this.iframe.className = 'x-hidden';
this.el.removeClass('x-hidden');
this.el.dom.removeAttribute('tabIndex');
this.el.focus();
}else{
if(this.initialized){
this.disableItems(this.readOnly);
}
this.pushValue();
this.iframe.className = '';
this.el.addClass('x-hidden');
this.el.dom.setAttribute('tabIndex', -1);
this.deferFocus();
}
var lastSize = this.lastSize;
if(lastSize){
delete this.lastSize;
this.setSize(lastSize);
}
this.fireEvent('editmodechange', this, this.sourceEditMode);

Jamie Avins
15 Feb 2010, 10:20 AM
Additional changes were made to the toggleSourceEdit. Looks perfect outside a frame. There is a 1 pixel bounce within a frame, but the existing code was off by 4-5 pixels.

meroy
15 Feb 2010, 1:59 PM
Thanks.