PDA

View Full Version : Disabling spellcheck in htmleditor



cnicolas
9 Sep 2010, 1:18 AM
Hi,

With Firefox, a spellchecking is by default activated in textareas, and so in HtmlEditor

In a standard TextArea, in can disable spellcheck by adding spellsheck:false in the autoCreate config option :

var MyForm = new Ext.form.TextArea({
autoCreate:{tag: "textarea", style: "width:100px;height:60px;", autocomplete: "off", spellcheck:false}
});But there is no autoCreate option for Ext.from.HtmlEditor.
How I can do that ?

Thank for your help

Animal
9 Sep 2010, 2:02 AM
Set it on the DOM after render.

cnicolas
9 Sep 2010, 4:15 AM
Set it on the DOM after render.

Can you be more explicit please ? I am not an expert in ExtJS. An example would be a good idea.

Thank for your help

Animal
9 Sep 2010, 5:05 AM
add a render listener

Condor
9 Sep 2010, 5:56 AM
To disable spellcheck in Source Edit mode you can use:

var editor = new Ext.form.HTMLEditor({
autoCreate: {
tag: "textarea",
style: "width:500px;height:300px;",
autocomplete: "off"
spellcheck: "false"
}
});
I don't even know if you can even set this flag on the editable IFRAME used for HTML Edit mode.
If you can then you can't use the 'render' event, because it fires to early. You need to do an inline override of initEditor for that.

cnicolas
9 Sep 2010, 6:29 AM
Thank's Condor, but spellcheck=false doesn't work whith htmleditor :

var editor = new Ext.form.HtmlEditor({
renderTo:Ext.getBody(),
autoCreate: {
tag: "textarea",
style: "width:500px;height:300px;",
spellcheck: "false"
}
});Test:
22306
The red underline is still present...

Condor
9 Sep 2010, 6:41 AM
Read my comment again: This only disables spellchecking in SOURCE MODE.

For HTML MODE you need to do something completely different (and I'm not sure what that is).

Animal
9 Sep 2010, 6:49 AM
It appears you can't turn it off. I have just tried poking the DOM to add spellcheck as false to all the DOM elements, and it won't do it.

Couldn't you have done that? It's just a bit of faddling with the developer tools.

Condor
9 Sep 2010, 6:59 AM
It appears you can't turn it off. I have just tried poking the DOM to add spellcheck as false to all the DOM elements, and it won't do it.

Don't be so quick with your conclusion! I could get it to disable spellchecking:

new Ext.form.HtmlEditor({
autoCreate: {
tag: "textarea",
style: "width:500px;height:300px;",
autocomplete: "off",
// disable spellcheck in source mode
spellcheck: "false"
},
getDocMarkup : function(){
var h = Ext.fly(this.iframe).getHeight() - this.iframePad * 2;
return String.format('<html><head><style type="text/css">body{border: 0; margin: 0; padding: {0}px; height: {1}px; cursor: text}</style></head><body ' +
// disable spellcheck in html mode
'spellcheck="false"' +
'></body></html>', this.iframePad, h);
}
})

cnicolas
9 Sep 2010, 11:23 PM
Condor, you're great. The spellcheck=false in getDocMarkup work nice. Not so obvious...

Thank's again

josephhamilton1
25 Apr 2012, 7:56 AM
@Animal
I don't understand the purpose of being a jerk to the members of the forum. If you don't like helping people with their questions, get another job, otherwise suck it up and learn to be nice.