Bug 880444

Summary: RFE: [WebTrans] enable spell check in code mirror editor for Firefox
Product: [Retired] Zanata Reporter: Patrick Huang <pahuang>
Component: UsabilityAssignee: Patrick Huang <pahuang>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: medium Docs Contact:
Priority: unspecified    
Version: developmentCC: sflaniga, zanata-bugs
Target Milestone: ---   
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: 2.1-SNAPSHOT (20121204-0903) Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 875965 Environment:
Last Closed: 2013-02-26 04:06:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Patrick Huang 2012-11-27 02:18:18 UTC
+++ This bug was initially created as a clone of Bug #875965 +++

Description of problem:
With the newly released Zanata version 2.0 Firefox's spell check does not seem to work anymore. I experienced this on FF 3.6, Leticia confirmed this for her FF 10.0.6. The spell-check used to work on both versions with Zanata 1.7.x

Version-Release number of selected component (if applicable):

Additional info:
Original bug is 872384. We introduced an option to switch between Code mirror editor and plain textarea editor as short term solution.
This bug is for permanently enable spell check in code mirror editor.

--- Additional comment from Patrick Huang on 2012-11-12 18:28:50 EST ---

Comment copied from bug 872384:
Patrick Huang 2012-11-08 23:12:13 EST
did some research and below options seems promising:

library: http://code.google.com/p/google-api-spelling-java/ 
description: This is a simple Java API that makes it very easy to call Google's spell checker service from Java applications.
pros: simple and easy to use
cons: calling google api means external network traffic

library: https://github.com/dren-dk/HunspellJNA
description: Hunspell is the spell checker of LibreOffice, OpenOffice.org, Mozilla Firefox 3 & Thunderbird, Google Chrome.
pros: lots of dictionaries
cons: written in c++ and required a JNA binding

library: http://jazzy.sourceforge.net/
description: pure java based spellchecker and based on most of the algorithms that aspell has
pros: pure java implementation
cons: no update since 2005 and sourceforge only have English dictionary

[reply] [-] Comment 8 Sean Flanigan 2012-11-09 02:22:43 EST
Hmm, Hunspell sounds good, but deploying Zanata could become a real nightmare if we start using JNA.

I still think a toggle is the only option that makes sense for a short-term solution, but just for completeness, I did spot these quick and dirty Hunspell ports too:

Javascript: http://code.google.com/p/bjspell/

Java: http://code.google.com/p/lucene-hunspell/ (tied to Lucene for some reason)

--- Additional comment from Runa Bhattacharjee on 2012-11-26 13:17:47 EST ---

Hi, can we try to squeeze this in for the upcoming release? Thanks.

--- Additional comment from Sean Flanigan on 2012-11-26 20:17:49 EST ---

This (ie syntax highlighting editor with spell-checking) isn't the sort of thing we can squeeze in, if we want to implement it properly, and test it properly.  It's far too big.  

If we want to cover a decent number of languages in our own spell-checker, we pretty much have to have Hunspell, but there only seems to be one Java port of Hunspell, but it is designed for a different use case, and it is only a prototype.  From what I can tell, it's quite a mess, and doesn't even have a build file.

Even if we get Hunspell working, we'll have a fair bit of UI work to integrate a spell-checker into CodeMirror.  Especially if we want a pop-up suggestions features?

Alternatively, we could look for an alternative to CodeMirror.  According to http://en.wikipedia.org/wiki/Comparison_of_JavaScript-based_source_code_editors these support browser-based spell-checking:


But they could turn out to have show-stopping problems (eg focus/event problems) when integrated into Zanata.  Or cross-platform bugs.  And I can't get spell-checking to work in Chrome for either of them so far...

--- Additional comment from Patrick Huang on 2012-11-26 20:45:54 EST ---

I've got spell check working in codemirror in firefox only. It's NOT cross platform (uses firefox only attributes) and doesn't (seems to) support pop up suggestion/add to dictionary etc. BUT it highlights the word in red and it uses firefox build-in spell check facility.

We can definitely squeeze this in :)

--- Additional comment from Sean Flanigan on 2012-11-26 21:14:42 EST ---

Okay, that's good.  I suggest creating another bz for the Firefox-only implementation.  We should provide a user option to turn it off.  (Partly so that the user can turn off spell-check, and partly in case of unexpected problems.)

Comment 1 Patrick Huang 2012-11-28 01:15:24 UTC
committed into master:

Comment 2 Sean Flanigan 2012-11-28 01:24:26 UTC
I can't see an option to turn spell-checking off in the code.  Given the unusual behaviour of spell-checking in divs (eg you can't use the context menu to turn it off), it's important to be able to turn it off.

Comment 3 Patrick Huang 2012-11-30 01:20:49 UTC
committed into master:

added option to switch on/off.

Comment 4 Ding-Yi Chen 2012-12-04 05:39:07 UTC
Combinations of following are tested:
"Use CodeMirror Editor" On, "Enable Spell Check" On
"Use CodeMirror Editor" Off, "Enable Spell Check" On
"Use CodeMirror Editor" On, "Enable Spell Check" Off
"Use CodeMirror Editor" Off, "Enable Spell Check" Off

VERIFIED with Zanata version 2.1-SNAPSHOT (20121204-0903)