TinyMCE spellchecker implementation

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
dajoker
Posts: 59
Joined: Sat Jan 30, 2010 1:01 am

TinyMCE spellchecker implementation

Post by dajoker » Fri May 28, 2010 7:07 am

Anybody with experience using the 'spellchecker' module of TinyMCE, I could definitly use a little assistance. It appears to my new-at-this mind that iespell is implemented by default but that does not help me since nobody here is using IE (presumably iespell is for Internet Explorer, but correct me if I am wrong please). My goal is to be able to use TinyMCE's spell checker and be able to customize the list of words it uses. In another setup I tested enabling this and ended up bringing down Apache by having something call too many child processes of Apache each time spell-checking was done. Is there a great tutorial/FAQ somewhere on how to make this work?

Thanks,
AB

Thorsten
Posts: 15076
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: TinyMCE spellchecker implementation

Post by Thorsten » Fri May 28, 2010 7:27 am

Hi,

this should help you: http://wiki.moxiecode.com/index.php/Tin ... ellchecker

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

dajoker
Posts: 59
Joined: Sat Jan 30, 2010 1:01 am

Re: TinyMCE spellchecker implementation

Post by dajoker » Fri May 28, 2010 8:56 am

Yes, those are the instructions I have followed before (should have mentioned that).

Step #3 has the following: '# Open up the config.php file you just unziped in the spellchecker folder.'

Unzipping the tinymce archive I do not see anything that matches that name. Is that just a coincidence? Except for that config.php file everything in PMF's own TinyMCE directory looks exactly the same so could it just be working out of the box? If so then most of this is a problem with my understanding of how TinyMCE should do this. I expected recommendations for typos or something but it appears all I get are red underlines for bad words but I'm not sure if TinyMCE is doing that or if my browsers are (since they do that as well normally). Is there more to this plugin than underlining bad files?

Thanks again.

Thorsten
Posts: 15076
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: TinyMCE spellchecker implementation

Post by Thorsten » Fri May 28, 2010 10:20 am

Hi,

the PHP spellchecker package is here: http://tinymce.moxiecode.com/download.php

There's also a config.php file in it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

dajoker
Posts: 59
Joined: Sat Jan 30, 2010 1:01 am

Re: TinyMCE spellchecker implementation

Post by dajoker » Fri May 28, 2010 4:11 pm

Okay.... I was downloading TinyMCE from there and that obviously didn't help when I needed to get the SpellChecker plugin. Since the former had a spellchecker directory of its own I tried that and saw it was exactly the same as what came with PMF which is why I did not look further for the full plugin. Once dropping in the full plugin (separate download) all seems to be better.

Thanks for your patience. I seem to be hitting every tiny stone along the path.

dajoker
Posts: 59
Joined: Sat Jan 30, 2010 1:01 am

Re: TinyMCE spellchecker implementation

Post by dajoker » Wed Jun 09, 2010 4:00 pm

I do not know the best way to implement this for other customers easily but I implemented this in my system to have a custom, localized library work fairly easily. From my notes:

Verify pspell works within PHP if that is the method to be used (it is in my case):

<?php
if (function_exists('pspell_new')) {
$pspell_link = pspell_new("en");
if (!pspell_check($pspell_link, "testt")) {
$suggestions = pspell_suggest($pspell_link, "testt");
foreach ($suggestions as $suggestion) {
echo "Possible spelling: $suggestion<br />";
}
}
} else {
echo "pspell is not installed";
}
?>

This does not mean all of the other requirements like aspell or dictionaries are all installed on the system, but it's a good start. These packages are basics, plus add as many dictionaries as possible:

php5-pspell-5.2.5-9.25.1
aspell-0.60.3-20.7
aspell-en-6.0-21.6

Enable 'spellchecker' plugin disabling 'iespell' plugin within TinyMCE (the wysiwyg editor):
<quote file='./phpmyfaq/admin/footer.php' version='2.6.5'>
117c117
< theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
---
> theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,spellchecker,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
</quote>

Change PSpell.php to read in a personal list of words as well:
<quote file='./phpmyfaq/admin/editor/plugins/spellchecker/classes/PSpell.php' version='2.6.5'>
55c55,57
< $plink = pspell_new(
---
> //$plink = pspell_new( //Original being replaced to support a custom dictionary as well.
> $plink = pspell_new_personal(
> '/srv/www/htdocs/phpmyfaq/admin/editor/plugins/spellchecker/novelldict' . $lang,
</quote>

Note that this is letting the user have a specific language file for each supported language supported by TinyMCE so those need to all exist. $lang resolves to something like 'en' or 'de' as usual. The language file itself looks like the following:

<quote file='/srv/www/htdocs/phpmyfaq/admin/editor/plugins/spellchecker/dict/novelldict.en'>
personal_ws-1.1 en 16
newword
gobbledegook
morestuff
TCP
UDP
SIEM
</quote>

I think that's about it. Anyway if there is a way to make this easy to do without hacking files all over it may help others but if not feel free to hack it yourselves as well.

Post Reply