Hi there,

I'm using 6.x-2.3 with Tinymce. A user reported that the default Firefox browser spellchecker is not enabled by default. It works on Chrome using the default browser spellchecker, but not on Firefox. It can be enabled from the right click menu on Firefox, but I would prefer it to be activated automatically.

Thanks for any tips you might have!

Comments

Title:Firefox browser spellchecker + Tinymce disabled by defaultIn-browser spellchecker disabled by default in TinyMCE
Version:6.x-2.3» 7.x-2.x-dev
Component:User interface» Editor - TinyMCE

This is still true for the newest version of Drupal 7 and affects all browsers.

It seems that we must explicitly tell TinyMCE that we want to allow the in-browser spellchecker. TinyMCE only goes out of its way to disable spell-checking when you don't specify the gecko_spellcheck option. Might want to double-check the tinyMCE.init() call - it should look something like this in a normal non-WYIWYG module implementation:

tinyMCE.init({
        mode : "textareas",
        theme : "simple",
        gecko_spellcheck : true
});
(hat tip to Shog9)

So what does this mean for WYSIWYG? I tried to find something resembling this setting in all of WYSIWYG, but I didn't have any luck. If I only knew where to put the gecko_spellcheck setting I could patch this up.

Category:bug» support
Status:Active» Fixed

sites/default/modules/MYMODULE/MYMODULE.info:
We don't have a GUI setting for this yet, but it's possible to enable the setting without hacking Wysiwyg or TinyMCE by creating a small Drupal module (or adding the hook implementation to another custom module, of course).

name = My module
description = Enables the gecko_spellcheck option for TinyMCE via Wysiwyg module.
core = 7.x
dependencies[] = wysiwyg

sites/default/modules/MYMODULE/MYMODULE.module:

<?php
/**
* Implements hook_wysiwyg_editor_settings_alter().
*/
function MYMODULE_wysiwyg_editor_settings_alter(&$settings, $context) {
  if (
$context['profile']->editor == 'tinymce') {
   
$settings['gecko_spellcheck'] = TRUE;
   
// Any init setting taking a string, boolean, number or array/object holding those types can be overridden/forced here.
 
}
}
?>

Once this module has been activated, Wysiwyg will pick up the hook implementation and run the TinyMCE settings object through it before handing things over to the client.

Category:support» feature
Status:Fixed» Active

TwoD - totally. Hacking modules is bad and the way you suggest is the right way to make changes like this. But shouldn't this be a checkbox within the WYSIWYG module? If I knew where it should go I could write a patch or at least make a decent proposal.

Thanks - that worked like a charm! :)

@davindneedham, sorry for the late reply. Yes, that would have been ideal. It could not be done at the time this issue was discussed since the GUI could not be changed per-editor basis. But since #1650416: Allow editor specific changes to be made to the profile settings form is in now, that has changed.

If you'd like to try to patch this in, have a look at the ckeditor implementation's settings form callback (mentioned in wysiwyg.api.php and worked on for CKEditor in #746524: No Font Styles for CKeditor).

Unfortunately this doesn't seem to be a viable solution for Drupal 6.x for anyone else who wants to give this a shot.

The gecko_spellcheck setting doesn't seem to be in the array for the drupal 6 version, of course when i set it anyways it does not seem to work either...

will keep looking for a solution to auto-turn on spell check in drupal 6.

Wysiwyg module is pretty much the same in D6 and D7, except for a couple of new features in D7.

The setting is not in the array in either version because it's currently not set by Wysiwyg by default. Adding it to the array should work in both versions, if you are using the same TinyMCE version.
Simply change core = 7.x to core = 6.x (and replace MYMODUE with a custom module name everywhere) and the setting should be sent to TinyMCE.

You can verify this by typing Drupal.settings.wysiwyg.configs.tinymce into the browser's JavaScript console or Firebug and look for the gecko_spellcheck property in the settings for each format TinyMCE is assigned to.

If it's not there, the module isn't enabled or the hook is incorrectly named.
If it is there, TinyMCE should pick it up quite easily since all it does is to set the document.body.spellcheck property. If nothing happens, maybe spellchecking is disabled in the browser?

Hey TwoD,

Thanks for getting back to me. I realize now that I may have misunderstood what this custom module was trying to accomplish.

What I'm looking for is a way to make the WYSIWYG TinyMCE gui automatically turn on it's spellcheck function, but I do appreciate that this turns on the in browser function. I will leave it enabled for now.

And yes, it does work and did on the first try. I was just looking for the wrong thing unfortunately.

Cheers

@TwoD: I am using wysiwyg spellcheck. What would be the element inside settings array for that? Any idea please.

#2 works like a charm. Tested via Firefox 23.0.1

You probably should add the following as well:
$settings['browser_spellcheck'] = TRUE;

see http://www.tinymce.com/wiki.php/Configuration:browser_spellcheck

setting $settings['browser_spellcheck'] = TRUE; does not work, probably because the version of TinyMCE being used is older.

It's working for me with TinyMCE 3.5.8

Until recently, I could right-click on a word in the WYSIWYG editor window to manually enable browser spell-check for that field.
I'm not sure when that changed, but now it is not an option. Does anyone know why that may be and if it's possible for a user to change that?