keilaron's picture
Joined: 11/03/2005
Posts: 38
Interest in aspell/spellerpages plug-in for CKE 3?
EDIT: Available a few posts below along with installation instructions.

Hey everyone,

I've been working on getting the FCK 2 spellerpages feature as a plug-in in CKE 3.
So far, it's working pretty well. I've only got two issues left to clean up.

The two issues are as follows:
  • This may be unrelated to this plug-in, but there's an sporadic issue with IE7/8 where while adding the toolbar button, there's an error which causes CK not to load at all. I'm not sure if it's what I'm doing, or the panelbutton plug-in throwing a fit. Reloading always causes the problem to go away, so I wonder if it's a load-order issue...

  • The spell check action does not trigger an undo step (I don't see any publicly accessible equivalent to oEditor.FCKUndo.SaveUndoStep() anywhere!) yet.


So: Anyone interested in having this plug-in?
keilaron's picture
Joined: 11/03/2005
Posts: 38
Re: Interest in aspell/spellerpages plug-in for CKE 3?
OK, the first issue is fixed. I forgot to use the requires: attribute.
I also fixed an issue requiring manual CSS changes... now it comes with it's own CSS file to make the spellcheck icon appear on the button.

Now if only I could figure out how to trigger undo memory...
mike_b's picture
Joined: 28/09/2009
Posts: 1
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Hi,

I'd be really interested in sharing this plug in, as it is the #1 reason I can't use CKEditor 3 in my project yet...
If you can share your work it would be appreciated.
--
Mike
imoir's picture
Joined: 15/07/2009
Posts: 10
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I'd also be interested in this.
keilaron's picture
Joined: 11/03/2005
Posts: 38
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I've fixed most issues with it. The only one is that (I think) it doesn't take the language from the editor automatically. Please note I've only tested with Linux and PHP, so it may not work on Windows servers, CF/PL servers, etc..

Installation instructions:
  1. First of all, PHP or some other server-side programming language is required. This is not the Internet Explorer-only spell checker.

  2. aspell/pspell must be installed and working on the server. If it doesn't work, this doesn't work.

  3. Unzip the contents of the zip file below in ckeditor/plugins so that you have ckeditor/plugins/aspell

  4. If you aren't using PHP, edit aspell/dialogs/aspell.js, locate oSpeller.spellCheckScript and change it as appropriate.

  5. Add aspell to your plug-in list, e.g. config.extraPlugins = 'aspell'; or config.plugins += ',aspell';

  6. Add SpellCheck to your toolbar somewhere, e.g. config.toolbar =
    [
    [ 'Source', '-', 'Bold','Italic','Underline','-', 'SpellCheck']
    ];

Attachments: 

AttachmentSize
File aspell plug-in for CKE 313.49 KB
imoir's picture
Joined: 15/07/2009
Posts: 10
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Thanks many times over.
mmurdock's picture
Joined: 06/11/2009
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Ok, so how do you install this plugin into ckeditor? I have aspell installed.

Mat
adico's picture
Joined: 02/11/2009
Posts: 100
Re: Interest in aspell/spellerpages plug-in for CKE 3?
to install it, i unzipped the contents inside ckeditor/plugins folder, then I modified config.js


config.extraPlugins = 'aspell';

config.toolbar =
[
[ 'Source', '-', 'Bold','Italic','Underline','-', 'SpellCheck', 'aspell' ]
];


However, I can't get it to work right, but I am testing in windows.
ow1n's picture
Joined: 17/12/2008
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I'm with adico: We could use some install instructions!
tommo's picture
Joined: 17/11/2009
Posts: 1
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Help! Can't work out how to install this either. Tantalising...
keilaron's picture
Joined: 11/03/2005
Posts: 38
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Sorry about that!
adico is correct: You need to add SpellCheck to your toolbar.
However, you also need to remember to add "aspell" to your list of plugins!
e.g. config.plugins += ',aspell';
Other than that, I don't think anything else is needed. It's made to try to figure out where everything is. If you have any trouble, let me know.
adico's picture
Joined: 02/11/2009
Posts: 100
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I still can't get it to work...here is what i've gotten so far
and then I get a file download prompt for spellchecker.php

can you elaborate a little bit more...there is still something missing

Attachments: 

AttachmentSize
Image icon aspell.jpg11.69 KB
keilaron's picture
Joined: 11/03/2005
Posts: 38
Re: Interest in aspell/spellerpages plug-in for CKE 3?
This plug-in requires server-side scripting as well as aspell to be installed on the server.
It is set up for PHP by default; If you do not have PHP, you can select Perl or CF if I recall correctly. I have not tested Perl nor CF; they should work. There may also be an ASP version.
If you do not have any of these but have something else (e.g. Ruby) you can code your own page to handle it by basing yourself on the other available pages.

Edit: I've added instructions to the download post
randycox's picture
Joined: 14/11/2008
Posts: 1
Re: Interest in aspell/spellerpages plug-in for CKE 3?
We've found a bug in this plugin while testing it in IE (versions 6, 7, and 8). Line 81 of the aspell/dialogs/aspell.js file is where the second undo step is being saved after the spelling changes are applied to the editor content, and it causes a JavaScript runtime error several levels down the call stack.

The original code:
    function oSpeller_OnFinished(dialog, numberOCorrections) 
    {                       
        if (numberOCorrections > 0)
        {
            editor.focus();     
            editor.fire('saveSnapshot'); // Best way I could find to trigger undo steps.
            dialog.getParentEditor().setData(document.getElementById(textareaId).value);
            editor.fire('saveSnapshot'); // But there's a blank one between!
        }                       
        dialog.hide();              
    }                           

The problem is that in IE the setData call, being asynchronous, doesn't complete its work before the second firing of the saveSnaphot event. The fix is simple. The second saveSnaphot needs to be run as a callback at the completion of the setData() function:
    function oSpeller_OnFinished(dialog, numberOCorrections) 
    {                       
        if (numberOCorrections > 0)
        {
            editor.focus();     
            editor.fire('saveSnapshot'); // Best way I could find to trigger undo steps.
            dialog.getParentEditor().setData(document.getElementById(textareaId).value, function () {
                 editor.fire('saveSnapshot'); // But there's a blank one between!
            });             
        }                       
        dialog.hide();              
    }                           

Randy Cox
Compendium Blogware
johngoodell's picture
Joined: 04/01/2010
Posts: 3
Re: Interest in aspell/spellerpages plug-in for CKE 3?
thanks for the great post - I've read all of the threads, and went to the middle post where you give instructions for installation and offer the attachment for download - I'm only seeing a very small attachment (14Kb!) so I'm not sure whether something is missing, or I need to go elsewhere to download the rest of the files for the ckeditor/plugins/aspell directory.

In your instructions, you mention editing aspell/dialogs/aspell.js - I'm not sure where that is - I've created the directory ckeditor/plugins/aspell - and put your file - aspell.7z in there. Where are the other files?

Our server has aspell installed already in a root directory - should I move all of these files/folders to the ckeditor/plugins/aspell directory AND include the aspell.7z file you offered for download?

Thanks for helping...

John
alfonsoml's picture
Joined: 31/12/2006
Posts: 3759
Re: Interest in aspell/spellerpages plug-in for CKE 3?
.7z is a compressed archive. You must extract its contents: http://www.7-zip.org/
johngoodell's picture
Joined: 04/01/2010
Posts: 3
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Thank you! Hadn't heard of that file extension before...

John
lecter255's picture
Joined: 15/11/2009
Posts: 28
Re: Interest in aspell/spellerpages plug-in for CKE 3?
just wanna say thanks. works like a charm! :)
keilaron wrote:I've fixed most issues with it. The only one is that (I think) it doesn't take the language from the editor automatically. Please note I've only tested with Linux and PHP, so it may not work on Windows servers, CF/PL servers, etc..

Installation instructions:
  1. First of all, PHP or some other server-side programming language is required. This is not the Internet Explorer-only spell checker.

  2. aspell/pspell must be installed and working on the server. If it doesn't work, this doesn't work.

  3. Unzip the contents of the zip file below in ckeditor/plugins so that you have ckeditor/plugins/aspell

  4. If you aren't using PHP, edit aspell/dialogs/aspell.js, locate oSpeller.spellCheckScript and change it as appropriate.

  5. Add aspell to your plug-in list, e.g. config.extraPlugins = 'aspell'; or config.plugins += ',aspell';

  6. Add SpellCheck to your toolbar somewhere, e.g. config.toolbar =
    [
    [ 'Source', '-', 'Bold','Italic','Underline','-', 'SpellCheck']
    ];
jmfc's picture
Joined: 22/10/2009
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I found an issue when using the ColdFusion version. In line 43 of spellchecker.cfm move the "trim" function inside of the "JSStringFormat" function. It was messing up the first word in the text field by adding a "\t" to escape a horizontal tab. This gets removed when you trim it first.
<cfset text = ListAppend(text, "^" & JSStringFormat(trim(line)), CRLF)>

thanks for posting this solution. works great!
kirke's picture
Joined: 25/04/2010
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Thanks for this plugin! With some effort I got it to work in JoomlaCK.

For some reason, "requires: ['toolbar']" in plugin.js gives me a double toolbar with aspell enabled. With this commented out everything seems to work good.

config.extraPlugins does not seem to be supported in JoomlaCK, but adding the plugin through config.plugins or PHP works.

It would indeed be nice to have undo working with this. Seems to me there is an undo step triggered by aspell, but it is obscured by multiple blank undo steps, something like that. Start with a fresh editor, type a misspelled word, spell check, then click undo multiple times until the undo arrow grays out. Now click redo a few times and the original misspelled word shows up. In case that helps get it working.

Thanks,

Kirk
handheldcar's picture
Joined: 14/05/2010
Posts: 1
Re: Interest in aspell/spellerpages plug-in for CKE 3?
I installed CKEditor a while ago, and I don't remember what spellchecker I installed; and I can't find any documentation of what I did. I guess I have the IE-only spellchecker b/c SCAYT works in IE, but even though I followed the directions in this thread as best as I could, spellchecking is not working in Firefox. I installed Aspell on my Linux server, I have had PHP from the start, I tested Aspell on a file and it is working.... I downloaded the plug-in and unzipped it to the appropriate directory, and I double-checked to make sure everything was in the right place.... The only steps I'm not sure about are the adding Aspell to my plug-in list and adding SpellCheck to my toolbar b/c the OP didn't clarify whether to put these lines in config.js or what, but I put 'em in that file. I'm wondering if I need to uninstall SCAYT and if so, how? I moved the scayt folder out of my plugins folder, but Aspell still didn't kick in even after a graceful Apache restart. I don't even know if this toolbar is a sign of whatever I installed to go w/ CKEditor, but I don't think the coded one is going to show up: I couldn't find much in the way of installation instructions to retrace my steps. I'm thinking I might try to completely uninstall and install again w/o SCAYT if possible and just w/ the Aspell plug-in. Even if that works, I don't know if it will work for IE.

Attachments: 

AttachmentSize
Image icon toolbar14.03 KB
obceneikon's picture
Joined: 02/09/2009
Posts: 6
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Hello there,
It looks like there is a security issue with your plugin. Thankfully its a small one. In spellchecker.php on line 18 you are setting $textinputs to $_POST['textinputs'] without cleaning the data.
guikubivan's picture
Joined: 02/02/2010
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Funny nobody has complained about this in the forum, but there is a major bug with the spell checker when misspelled words exist inside the html tags (like the title attribute on a link/image). Try this code for example:

<p>The inventors of <em>haikai no renga</em> (abbr. <em>haikai</em>) are generally considered to be
<a href="http://en.wikipedia.org/wiki/Yamazaki_Sokan" title="Yamazaki Sokan">Yamazaki Sokan</a>
(<a href="http://en.wikipedia.org/wiki/1465" title="1465">1465</a>&ndash;
<a href="http://en.wikipedia.org/wiki/1553" title="1553">1553</a>) and 
<a href="http://en.wikipedia.org/wiki/Arakida_Moritake" title="Arakida Moritake">Arakida Moritake</a> 
(<a href="http://en.wikipedia.org/wiki/1473" title="1473">1473</a>&ndash;
<a href="http://en.wikipedia.org/wiki/1549" title="1549">1549</a>).</p>


Fortunately, this has been addressed at:
http://dev.ckeditor.com/ticket/2326

I replaced the writeBody function in wordWindow.js with the function in 'writebody1.js' in the ticket above and repackaged the plugin here.

Attachments: 

AttachmentSize
File aspellv2.7z15.3 KB
bestis's picture
Joined: 17/12/2009
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Hi,

Thanks for nice work, but it has issues with 8bit characters.
Those are encoded as html entities in CKeditor, when doing spellcheck the entity coded versions of course fails.

Added one line to remove entities before running (in my case tmispell).
// Strip all tags for the text. (by FredCK - #339 / #681)
$text = preg_replace( "/<[^>]+>/", " ", $text ) ;
// Remove entities (by Jani Ollikainen)
$text = html_entity_decode($text,ENT_COMPAT,'UTF-8');

And changed the output to be again entity coded for that word which failed
if( $chardesc == '&' || $chardesc == '#' ) {
    $line = explode( " ", $val, 5 );
    // Change back to entities (by Jani Ollikainen)
    $line[1] = htmlentities($line[1],ENT_COMPAT,'UTF-8');

But that still leaves problems then Aspell plugin changes the contents of the editor area.
As it doesn't replace those values which has entity codes in them correctly. Something to
do with the length of the word. As it replaces only X chars from the original word which
might have X+10 characters as ä (a with two dots) is &auml; etc.

Then I've tried to figure out what to change to get that working correctly, but that javascript
doesn't seem easy to understand as what is happening where. Could someone give any
pointers on what should be done?
helavissa's picture
Joined: 12/04/2011
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
thanks a lot for the plugin! worked for me in CF.
but how do I get the misspelled words to highlight?
josepsanzcamp's picture
Joined: 25/03/2011
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Hi.

Thanks for this original FCK plugin and the needed port to CK.

I downloaded the latest aspell_v2.7z and worked as expected. Too, I added some features as:
- Detection of the language used when create the ckeditor and passed it to the server-side script (only php)
- Added the okButton to the dialog and the needed call to the controlsWindow.end_spell() function that finish the work.

If you want to use it, you can get the source code from saltos.net or some SaltOS package (at the lib/ckeditor/plugins/aspell directory).

More suggestions at josep.sanz@saltos.net.

Josep.
mikeytown2's picture
Joined: 11/05/2011
Posts: 1
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Looking at spellchecker.php

Do we need to make sure it only uses \n for new lines?
$text = str_replace(array("\r\n", "\r"), "\n", $text);

Also do we need to escapeshellcmd anything?
wizardgenx's picture
Joined: 29/07/2011
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
First time posting so forgive if this is not the right place to post but I'm currently trying to debug and fix a problem with ckeditor when it comes to the aspell plugin. All browsers besides IE 9 work successfully.

I've also managed to isolate the problem to this little tidbit:
* File: /aspell/spellerpages/spellChecker.js
* Code: see below
function openChecker() {
        this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps );
        if( !this.spellCheckerWin.opener ) {
                this.spellCheckerWin.opener = window;
        }
}


So, as people who use this probably know, the if condition is needed for certain browsers such as IE. Unfortunately, it seems IE 9 won't even accept the assignment of the window object into the spellCheckWin constructor. If I find a solution, I'll be sure to post it. However, if someone beats me to it, your response would be appreciated.
wizardgenx's picture
Joined: 29/07/2011
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
So I ended up fixing it. IE 9 apparently doesn't the same rules to "opener" as does other browsers, including earlier versions of IE.

These two fixes worked and are as follows:
* File: /aspell/spellerpages/spellchecker.html
// post the text area data to the script that populates the speller
function postWords() {
        var bodyDoc = window.frames[0].document;
        bodyDoc.open();
        bodyDoc.write('<html>');
        bodyDoc.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
        bodyDoc.write('<link rel="stylesheet" type="text/css" href="spellerStyle.css"/>');

       /* Start of new code */
       if(!opener)
        {
                opener = window.parent;
        }
       
       /* End of new code */
        if (opener) {


* File: /aspell/spellerpages/controls.html
var spellerObject;
var controlWindowObj;

if( parent.opener ) {
        spellerObject = parent.opener.speller;
}
/* Start of new code */
else if( parent.parent )
{
        spellerObject = parent.parent.speller;
}
/*End of new code */
function ignore_word() {
douglassdavis's picture
Joined: 08/06/2008
Posts: 20
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Is there a specific place in SVN for CKEditor plugins that we could put this one (I mean plugins that are not in the main distribution)?

That way we don't have to put together all of the different patches posted in this thread.
ddormont's picture
Joined: 23/08/2011
Posts: 2
Re: Interest in aspell/spellerpages plug-in for CKE 3?
Hi, I was able to get the plugin working locally in Mac OS 10.6. I only had to move wordWindow.js to the root (for some reason it was looking there) and spellchecker.pl into cgi-bin and it worked great!

I'm wondering if there's an option to have more of a SCAYT-style, or at least an inline spell-check, functionality here rather than having the checker open a modal dialog. If not, what would be the best approach to implement something like that? Would this have to be another plugin entirely?

thanks,
Dan