Bug 872384 - Editor option to toggle the usage of CodeMirror
Editor option to toggle the usage of CodeMirror
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-UI (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity high
: ---
: 2.0
Assigned To: Patrick Huang
Alex Eng
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-01 20:22 EDT by Hedda Peters
Modified: 2013-02-25 22:46 EST (History)
5 users (show)

See Also:
Fixed In Version: 2.0.3-SNAPSHOT (20121119-0019)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-25 22:46:31 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Hedda Peters 2012-11-01 20:22:28 EDT
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):
2.0

Additional info:
Setting severity to high, as this is the only way for us translators to run a spell-check. We might introduce some translation errors due to this feature being buggy.
Comment 1 David Mason 2012-11-01 20:46:40 EDT
This appears to be caused by default disabling of spell check by codemirror.

From codemirror manual ( http://codemirror.net/1/manual.html ):

"disableSpellcheck
Should the editor disable spell-checking on browsers that support it (Firefox 2+). Default is true, since for most code spell-checking is useless. Can be changed with the setSpellCheck(on) method."
Comment 2 Patrick Huang 2012-11-04 19:30:48 EST
The link David gave above is for codemirror 1 and unfortunately codemirror 2 won't support spell check.
see: http://stackoverflow.com/questions/12343922/codemirror-with-spell-checker

seeking alternative solution.
Comment 3 Patrick Huang 2012-11-04 21:01:38 EST
add option to switch between code mirror and plain text area
Comment 4 Patrick Huang 2012-11-08 20:27:49 EST
committed into master and release:
https://github.com/zanata/zanata/commit/98ebe7317b85c3fdbe1462ba4678e88db1b6d320

solution is to add an option to switch between code mirror and plain textarea. Unfortunately we cannot have the cake and eat it :(
Comment 5 Hedda Peters 2012-11-08 20:54:45 EST
Shame! :-(

Might be worth looking into if and how other online translation editors solved that problem.
Comment 6 Sean Flanigan 2012-11-08 21:35:05 EST
Do any of them use syntax highlighting editors?
Comment 7 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
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)
Comment 9 Patrick Huang 2012-11-12 18:28:16 EST
Raised new bug https://bugzilla.redhat.com/show_bug.cgi?id=875965 for permanent solution
Comment 10 Ding-Yi Chen 2012-11-15 21:21:06 EST
Tested with Zanata version 2.1-SNAPSHOT (20121112-1056) and Zanata version 2.0.3-SNAPSHOT (20121116-0019)

Browser:
Google Chrome: 22.0.1229.94
Chromium: 21.0.1180.89 

Firefox 16.0.2
Firefox ESR: 10.0.10

1. Toggle the "Use CodeMirror Editor" should not clean the unsaved text.
2. On both fire fox, toggle the "Use CodeMirror Editor" cause the whole browser to freeze a couple of seconds.


Reassigned.
Comment 11 Hedda Peters 2012-11-15 21:23:20 EST
Just a thought: Please also make sure that the default setting is using the spell-check. Spell-check is way more important than syntax highlighting, I don't want people to miss out on the spell-check because they may not realize they can/need to toggle. Thanks!!
Comment 12 Ding-Yi Chen 2012-11-15 22:02:18 EST
(In reply to comment #11)
> Just a thought: Please also make sure that the default setting is using the
> spell-check. Spell-check is way more important than syntax highlighting, I
> don't want people to miss out on the spell-check because they may not
> realize they can/need to toggle. Thanks!!

This won't be the default value, as languages which do not rely on spell checking (such as CJK) will still prefer to set Code Mirror as default.

However, once Bug 874374 is verified, what you set in editor options will be kept and will be apply on the next time you sign in.
Comment 13 Hedda Peters 2012-11-15 22:22:59 EST
I still think this should be the default. People in languages that don't rely on spell-check won't have it enabled in the browser in the first place. If a user has a spell-check installed and enabled in the browser, that user obviously wants the spell-check to work. 

I urgently recommend making active spell-check the default.
Comment 14 Ding-Yi Chen 2012-11-15 23:14:12 EST
> 2. On both fire fox, toggle the "Use CodeMirror Editor" cause the whole 
> browser to freeze a couple of seconds.

This seems working when firefox in safe mode  (firefox -safe-mode).
Comment 15 Ding-Yi Chen 2012-11-15 23:20:00 EST
(In reply to comment #13)
> I still think this should be the default. People in languages that don't
> rely on spell-check won't have it enabled in the browser in the first place.
> If a user has a spell-check installed and enabled in the browser, that user
> obviously wants the spell-check to work. 
> 
> I urgently recommend making active spell-check the default.

Perhaps I should change the summary to 
"Editor option to toggle the usage of CodeMirror" to reflect the fix what Patrick has done so far.

Hedda, your need is addressed in Bug 875965. For that, yes, we definitely need to enable the spell check as default.
Comment 16 Patrick Huang 2012-11-16 00:19:00 EST
Committed into release and master:
https://github.com/zanata/zanata/commit/f1f38a2bfbd9bf0db95fb9fa82f04b4068c31a2b
Comment 17 Sean Flanigan 2012-11-18 20:36:24 EST
Bug 875965 is about implementing our own spell check, which is a long way off.  It may never happen.

I think Hedda is right, and we should make sure spell check works by default.  For most text, correct spelling will be more important than XML/HTML syntax highlighting, especially considering we have validators for XML and HTML tags.

But we should make it a persistent option.  If a user chooses to do without spell checking to get the highlighter, that's fine.
Comment 18 Patrick Huang 2012-11-18 23:39:13 EST
As discussed in scrum, default option will remain codemirror in 2.0.x but in 2.1 it's text area
Comment 19 Hedda Peters 2012-11-18 23:42:07 EST
Just to clarify - does that mean no spell-check in 2.0.x? Or does that mean there will be spell-check in 2.0.x, but it wont be set as the default yet?
Comment 20 Patrick Huang 2012-11-18 23:49:07 EST
(In reply to comment #19)
> Just to clarify - does that mean no spell-check in 2.0.x? Or does that mean
> there will be spell-check in 2.0.x, but it wont be set as the default yet?

Hi Hedda,
The switch option will be there in next release(so you can choose between spellcheck and syntax highlight). But code mirror editor will still be set as default. The reason is we have tested more thoroughly on code mirror editor but not the other. Once we fully test the plain textarea editor, we will put it as default.
Comment 21 Hedda Peters 2012-11-18 23:50:47 EST
Great, thanks Patrick.
Comment 22 Alex Eng 2012-11-26 20:44:21 EST
Verified in Zanata version 2.0.3-SNAPSHOT (20121119-0019)

Note You need to log in before you can comment on or make changes to this bug.