PDA

View Full Version : [FIXED][2.x/3.x] HtmlEditor has problematic initial value



prometheus
1 May 2009, 7:42 AM
Hi, I know this bug is not a hot topic (or not a real bug), but I think that it is a usability issue. All you know that HtmlEditor has an initial value   what user must delete all before editing - my propose is use ‍ instead of   because ‍ works like a hidden character.

My patch is:

Ext.override(Ext.form.HtmlEditor, {
pushValue : function(){
if(this.initialized){
var v = this.el.dom.value;
if(!this.activated && v.length < 1){
v = '&zwj;';
}
if(this.fireEvent('beforepush', this, v) !== false){
this.getEditorBody().innerHTML = v;
this.fireEvent('push', this, v);
}
}
}
});I'm tested this on FF3 only, results of test in other browsers or any replies would be nice. Thanks!

MD
1 May 2009, 12:29 PM
Very clever! Could potentially even use &zwsp; (Zero Width Space).

prometheus
2 May 2009, 7:46 AM
Oh thanks :) But gods bless the "zero-width`ed" entites too :)

aconran
4 May 2009, 10:35 AM
We'll take a look at testing this in multiple configurations as well as providing a configuration to allow the user to configure what the initial value in the editor is.

Thanks for the suggestions,

evant
5 May 2009, 10:17 PM
Fixed,

Using:



defaultValue: Ext.isOpera ? '&nbsp;' : '​& # 8 2 0 3', //spaced so you can see it.


The nbsp in Opera doesn't require you to backspace it, all of the other characters mess up the caret in Opera.

prometheus
6 May 2009, 12:12 PM
Cool, thanks for fast response/fix. Regards.

castilhor
2 May 2010, 5:25 AM
I think that using zwsp to solve a focus problem is no longer necessary (goodbye IE6) :D.

This caused me a huge problem. When using IE7 and IE8 to post using HtmlEditor, the zwsp in the string was changed to a quotation mark at the beginning of the string (probably because of the collation latin1 on mysql :-/. Not tested yet as utf-8.)

http://castilho.biz/blog/2010/05/02/my-labor-day

Is written in ExtJS API Documentation > HtmlEditor > defaultValue that:


A default value to be put into the editor to resolve focus issues (defaults to (Non-breaking space) in Opera and IE6, ​ (Zero-width space) in all other browsers).

but rather, the zwsp is default in IE and nbsp in FF.