-
27 May 2010 3:25 PM #1
Ext.ux.form.HtmlEditor.JSpell
Ext.ux.form.HtmlEditor.JSpell
I needed a spell checker for the HTML editor component (for IE 6 indeed). So I used JSpell (look here to get an idea: http://www.jspell.com/tinymcespellchecker.html) and wrote a plugin for it. Here it is:
You can use it wth a HTMLEditorField like this:PHP Code:Ext.namespace ('Ext.ux.form.HtmlEditor');
Ext.ux.form.HtmlEditor.JSpell = function (config) {
Ext.apply(this, config);
Ext.ux.form.HtmlEditor.JSpell.superclass.constructor.call (this);
};
Ext.extend (Ext.ux.form.HtmlEditor.JSpell, Ext.util.Observable, {
jspellServerPath: '/abc',
jspellImagePath: 'images/jspell/',
scriptPath: 'js/jspellEvolution.js',
// additional config elements
jspellConfig: {},
init: function (cmp) {
for (var x in this.jspellConfig)
window[x] = this.jspellConfig[x];
window.jspellServerPath = this.jspellServerPath;
window.jspellImagePath = this.jspellImagePath;
var head = document.getElementsByTagName ('head')[0];
var script = document.createElement ('script');
script.type = 'text/javascript';
script.src = this.scriptPath;
head.appendChild (script);
cmp.on ('afterrender', function () {
cmp.on ('sync', function (cmp, html) {
this.el.dom.value = html.replace (/<span[^>]+class="?j3"?[^>]*>(.*?)<\/span>/gi, '$1');
});
var initSpellchecker = function () {
if (typeof jspellInit == 'undefined' || !cmp.iframe.contentWindow.document.body) {
initSpellchecker.defer (100);
} else {
setTimeout (function () {
cmp.iframe.id = cmp.iframe.id || Ext.id ();
window.getSpellCheckArray = function () {
return [[ document, cmp.iframe.id ]];
};
jspellInit ();
}, 10);
}
};
initSpellchecker ();
}, this);
}
});
Currently it checks it as you type (like Firefox or Word does). It would be easy to add a button for manual spell checking.PHP Code:new Ext.form.HtmlEditor ({
plugins: [
new Ext.ux.form.HtmlEditor.JSpell ({
jspellConfig: {
jspellRightClick: true
}
})
});
-
4 Apr 2012 1:50 AM #2
Syntax Error
Syntax Error
When i use your plugin, i have a syntax error in jspellEvolution.js (line 376)
Any idea ?
-
4 Apr 2012 1:50 AM #3
-
4 Apr 2012 2:47 AM #4
jspellEvolution.js:376
J6q.responseText contains a Tomcat error page. I think i've not correctly installed JSpell or ur plugin...Code:eval(J6q.responseText);
do you have an example of configuration ?
scriptPath => jspellEvolution.js url
jspellServerPath => ?
jspellImagePath => ?
-
4 Apr 2012 3:09 AM #5
ok i understand
JSpell is temporarly installed here : http://localhost:8080/jspellEvolution/
so i've done this :
jspellServerPath: 'http://localhost:8080/jspellEvolution/abc',
jspellImagePath: 'http://localhost:8080/jspellEvolution/jspellimages/',
scriptPath: 'http://localhost:8080/jspellEvolution/jspellEvolution.js',
there is no syntax error but nothing appends (no correction) when i type texte in my htmleditor
-
4 Apr 2012 6:35 AM #6
alert('jspellInit: ' + cmp.iframe.id) is called but alert('getSpellCheckArray') is never called.Code:setTimeout (function () { cmp.iframe.id = cmp.iframe.id || Ext.id (); window.getSpellCheckArray = function () { alert('getSpellCheckArray'); return [[ document, cmp.iframe.id ]]; }; alert('jspellInit: ' + cmp.iframe.id); jspellInit(); }, 10);
-
10 May 2013 4:59 AM #7
The same code is not working. Has anyone got the jspell to work. I am using .NET MVC 4 with extjs library as my UI
Similar Threads
-
Ext.ux.form.HtmlEditor.Plugins
By VinylFox in forum Ext 3.x: User Extensions and PluginsReplies: 144Last Post: 23 Apr 2012, 12:09 PM -
Creating Ext chat window and Ext.form.HtmlEditor - problem in IE after pressing enter
By ZachG in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 5 Feb 2010, 7:12 AM -
Issues with Ext.form.HtmlEditor :(
By wasp in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 5 Feb 2009, 7:39 AM -
Help with Ext.form.HtmlEditor??
By sarada in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 12 Jun 2008, 10:21 AM -
Just Like Ext.form.HtmlEditor
By chalu in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 5 Jun 2008, 4:40 AM


Reply With Quote