Posted by Aren Cambre on November 9, 2009 at 12:12am
Jump to:
| Project: | Wysiwyg |
| Version: | 6.x-2.1 |
| Component: | Editor - TinyMCE |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
I cannot get Firefox's native spell check to work with TinyMCE. Just upgraded to TinyMCE 3.2.7 and still have the problem.
I opened a similar issue with the old Drupal TinyMCE module: #278970: Spell check disabled in Firefox. However, a report at http://drupal.org/node/135150#comment-1695368 says my suggested fix doesn't work.
Comments
#1
I had to hack wysiwyg/editors/tinymce.inc
141 function wysiwyg_tinymce_settings($editor, $config, $theme) {
142 $settings = array(
143 'gecko_spellcheck' => TRUE,
If anyone can show us how to do it without editing the module's files, it would be appreciated.
#2
Worked for me! Setting to "needs review" to get other opinions.
#3
The problem is that moxiecode (tinymce) disabled the firefox spell checker by default two or three years ago due to some bug it caused. However, no-one seems to know what the bug was, or whether it still applies.
Until that is known, I guess that this needs to be an option somewhere with some kind of vague warning, rather than a hard-coded over-ride.
#4
If the rationale is lost, Moxiecode may have simply declined to revisit the issue. Might want to force it to true in a beta or dev and see how it pans out.
#5
+1 for that.
I've got spell checker turned on on two sites and it doesn't seem to hurt at all.
Having said that, I'm not doing anything clever - no video media or special buttons.
#6
We used the spell checker in TinyMCE on Jewcy.com for like 2 years with no incident. Anecdotal sure, but evidence nonetheless.
#7
The spellchecker plugin in the latest release of TinyMCE (3.3.3) now supports browser's native spell check.
http://tinymce.moxiecode.com/punbb/viewtopic.php?id=21197
At the moment, enabling the WYSIWYG SpellCheck module is required to enable the plugin. Hopefully this will soon be supported by WYSIWYG API alone ; ).
#8
#9
Adding the suggested line (in bold) as described in post #1, works flawlessly. I suggest someone builds a patch (I wouldn't know how to do it). Running Firefox 3.6.10, wysiwyg-6.x-2.1 module and tinymce_3_3_9_1 library
According to the changelog of the tinymce library, tinymce DOES support native spelling checkers: http://tinymce.moxiecode.com/js/tinymce/changelog.txt
So, consider updating the library.
#10
Sorry, but I won't force the gecko spellchecker to be on by hardcoding it in tinymce.inc. Once #313497: Allow configuration of advanced editor settings gets in, we can add a GUI option to toggle this on admin/settings/wysiwyg/.
Until then, you can implement hook_wysiwyg_editor_settings_alter() to turn it on, like this:
<?phpfunction MYMODULE_wysiwyg_editor_settings_alter(&$settings, &$context) {
if($context['profile']->editor == 'tinymce') {
$settings['gecko_spellcheck'] = TRUE;
}
}
?>
#11
Guess I should change this to "won't fix" then...
The reason for not forcing this on is simply that we'd like to keep our default settings as close to the editor's own defaults as possible, unless it conflicts with Drupal's way of doing things.
The builtin spellcheckes use the right-click context menu for selecting words etc, but TinyMCE blocks it by default. Disabling this would also require an alteration of the settings via the same hook.
Given this setting is easy to set by implementing the hook, I don't think not applying this change is a big issue.
(Note that the hook isn't available in D5 because of drupal_alter().
#12
Thx for clarifying. I feel embarrassed to ask this: Please, could you explain where (file name and line number) the code you suggested should be added? I am wild guessing (!) at the end of the file 'wysiwyg.module'. Unfortunately, I am having quite some trouble finding such Drupal 'basics' on this site (http://drupal.org/handbook).
#13
Actually, you don't need to modify any of Wysiwyg's files at all.
This is an example of an "hook implementation" (of an "alter-hook" to be specific). Hooks are a way for modules to let other modules execute code at specific points in their own code.
Wysiwyg calls
drupal_alter('wysiwyg_editor_settings', $some_arguments)which makes Drupal find and run all functions named MODULENAME_wysiwyg_editor_settings_alter() in all active modules.So, the above code can be placed in any module, but to avoid hacking other modules you can create one of your own. It just takes a couple of minutes, and you can use the same module to implement other hooks and do any modifications you need for that site. No worries when there's a new version of Wysiwyg out, just replace the old one and your own overrides will be safe in your own module.
Guides on creating your own module can be found at: http://drupal.org/node/231276
All you need is a folder like sites/all/modules/MYMODULE containing MYMODULE.info and MYMODULE.module, where the latter has the code. (All instances of MYMODULE are of course replaced with the name of your custom module, I often simply choose 'custom').
Don't forget to activate your module, or the hook implementing function will not be found or executed.
#14
@TwoD: Thank you so much for explaining so clearly (step by step) how AND why to build this custom module. I followed your instructions and created a MYMODULE.module file with the code as you suggested in post #10 (and changed the 'MYMODULE' within that code). No clue why Drupal requires the *.inc file, even if there is no code within that file to be included. I left its content empty, since you didn't specify otherwise. I also added a MYMODULE.info file to the folder with following content:
; $Id$name = "Firefox spelling checker enabler"
description = "Enables the build-in spelling checker of Firefox in tinyMCE editor enabled fields (more info: http://drupal.org/node/627180#comment-3504438)"
core = 6.x
dependencies[] = wysiwyg
package = User interface
After installing and enabling it, I cleared the cache with the form 'admin/settings/performance' and manually run cron with the form 'admin/reports/status/run-cron', just in case.
I then edited some content using a TinyMCE enabled editor and right-clicked to check if the spelling checker of Firefox was enabled. Lo and behold: it was!
Thank you so much for teaching and convincing me to build my very first custom module! Bit-by-bit I learn more about this subject and am happy to faithfully promise the community that I will help others with this new knowledge of mine, whenever I can. :-)
I guess, I couldn't convince you somehow to make this feature optional by adding a setting to a configuration page (like so perhaps: http://drupal.org/node/206761)? Maybe you have already explained you wouldn't, but am not sure I fully understand the reason then.
#15
Sorry, the .inc file isn't required. I meant to type .info =P
#16
not_Dries_Buytaert, where can I download your module?
#17
@Murz: As you requested in your post (#16):
http://rapidshare.com/files/429646621/custom1.zip
Hashes of this file (to check the integrity of the file transfer):
CRC32: 27FEF024
MD5: D3D3465B7FB7CF1A4715189CDE9C7779
SHA-1: D707F2ABFFD62AD79BD80E29485B15ABD1071D42
Please note: that this is considered to be off-topic.
#18
@twod - Thanks, your custom code in #10 worked great.