Fix language selection for spellchecker in html mode (#6915)

Also fix so the language is not reset when switching from html to plain
text and vice-versa.
pull/6950/head
Aleksander Machniak 5 years ago
parent c60a30c780
commit 70d342a436

@ -56,6 +56,7 @@ CHANGELOG Roundcube Webmail
- Enigma: Fix error message when trying to encrypt with a revoked key (#6607)
- Enigma: Fix "decryption oracle" bug [CVE-2019-10740] (#6638)
- Enigma: Fix bug where signature verification could have been skipped for some message structures (#6838)
- Fix language selection for spellchecker in html mode (#6915)
- Fix css styles leak from replied/forwarded message to the rest of the composed text (#6831)
- Fix invalid path to "add contact" icon when using assets_path setting
- Fix invalid path to blocked.gif when using assets_path setting (#6752)

@ -69,12 +69,15 @@ function rcube_text_editor(config, id)
}
}
// secure spellchecker requests with Roundcube token
// Note: must be registered only once (#1490311)
if (!tinymce.registered_request_token) {
tinymce.registered_request_token = true;
tinymce.util.XHR.on('beforeSend', function(e) {
// secure spellchecker requests with Roundcube token
e.xhr.setRequestHeader('X-Roundcube-Request', rcmail.env.request_token);
// A hacky way of setting spellchecker language (there's no API for this in Tiny)
if (e.settings && e.settings.data)
e.settings.data = e.settings.data.replace(/^(method=[a-zA-Z]+&lang=)([^&]+)/, '$1' + rcmail.env.spell_lang);
});
}
@ -405,12 +408,7 @@ function rcube_text_editor(config, id)
// get selected (spellchecker) language
this.get_language = function()
{
if (this.editor) {
return this.editor.settings.spellchecker_language || rcmail.env.spell_lang;
}
else if (this.spellchecker) {
return GOOGIE_CUR_LANG;
}
return rcmail.env.spell_lang;
};
// set language for spellchecking
@ -419,11 +417,14 @@ function rcube_text_editor(config, id)
var ed = this.editor;
if (ed) {
// TODO: this has no effect in recent Tiny versions
ed.settings.spellchecker_language = lang;
}
if (ed = this.spellchecker) {
ed.setCurrentLanguage(lang);
}
rcmail.env.spell_lang = lang;
};
// replace selection with text snippet

Loading…
Cancel
Save