by lflince » Thu Sep 30, 2021 9:22 pm
I tried this:
command_line->AppendSwitch("-disable-features=WinUseBrowserSpellChecker");
command_line->AppendSwitch("-enable-chrome-runtime");
And this:
CefRefPtr<CefRequestContext> rc = browser->GetHost()->GetRequestContext();
CefRefPtr<CefListValue> spellcheck_dictionary = CefListValue::Create();
spellcheck_dictionary->SetSize(1);
spellcheck_dictionary->SetString(0, "es-ES");
CefString errtext;
CefRefPtr<CefValue> spellcheck_dictionary_value = CefValue::Create();
spellcheck_dictionary_value->SetList(spellcheck_dictionary);
rc->SetPreference("spellcheck.dictionaries", spellcheck_dictionary_value, errtext);
The browser.enable_spellchecking preference is already activated as the original code says. There is no need to activate it, when I get the value of spellcheck.dictionaries there is nothing, so I assign them. It is not clear to me when I should do it, but even I have a function in javascript that tells my code that the editor is ready and at that moment I assign the dictionary. On the other hand, the dictionary that I want to add is Spanish, but I'm not sure if I should put: "es", "es-ES" or "es_ES", I tried all of them and it does not work, the red line never appears under any word . I tried the html code in chrome and immediately the red line appears. I don't know in CEF what I should do.
In the chromium source codes there are two basic compilation directives (ENABLE_SPELLCHECK AND USE_BROWSER_SPELLCHECKER) for the SPELLCHECK to work:
#if BUILDFLAG (ENABLE_SPELLCHECK)
bool UseBrowserSpellChecker () {
#if! BUILDFLAG (USE_BROWSER_SPELLCHECKER)
return false;
#elif defined (OS_WIN)
return base :: FeatureList :: IsEnabled (spellcheck :: kWinUseBrowserSpellChecker) &&
WindowsVersionSupportsSpellchecker ();
#else
return true;
#endif
}
when libcef is compiled, I have not entered to see that part, but I do not think that it must be an esoteric topic that no one in this forum knows about. The thing is, I can't activate it.