Bug 872384 - Editor option to toggle the usage of CodeMirror
Summary: Editor option to toggle the usage of CodeMirror
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 2.0
Assignee: Patrick Huang
QA Contact: Alex Eng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-02 00:22 UTC by Hedda Peters
Modified: 2013-02-26 03:46 UTC (History)
5 users (show)

Fixed In Version: 2.0.3-SNAPSHOT (20121119-0019)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-26 03:46:31 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 872061 0 unspecified CLOSED [WebTrans] Middle mouse button cannot pasted the highlighted text with Firefox 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 875965 0 high CLOSED RFE: [WebTrans] enable visible white space in source 2021-02-22 00:41:40 UTC

Internal Links: 872061 875965

Description Hedda Peters 2012-11-02 00:22:28 UTC
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-02 00:46:40 UTC
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-05 00:30:48 UTC
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-05 02:01:38 UTC
add option to switch between code mirror and plain text area

Comment 4 Patrick Huang 2012-11-09 01:27:49 UTC
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-09 01:54:45 UTC
Shame! :-(

Might be worth looking into if and how other online translation editors solved that problem.

Comment 6 Sean Flanigan 2012-11-09 02:35:05 UTC
Do any of them use syntax highlighting editors?

Comment 7 Patrick Huang 2012-11-09 04:12:13 UTC
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 07:22:43 UTC
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 23:28:16 UTC
Raised new bug https://bugzilla.redhat.com/show_bug.cgi?id=875965 for permanent solution

Comment 10 Ding-Yi Chen 2012-11-16 02:21:06 UTC
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-16 02:23:20 UTC
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-16 03:02:18 UTC
(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-16 03:22:59 UTC
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-16 04:14:12 UTC
> 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-16 04:20:00 UTC
(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 05:19:00 UTC
Committed into release and master:
https://github.com/zanata/zanata/commit/f1f38a2bfbd9bf0db95fb9fa82f04b4068c31a2b

Comment 17 Sean Flanigan 2012-11-19 01:36:24 UTC
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-19 04:39:13 UTC
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-19 04:42:07 UTC
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-19 04:49:07 UTC
(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-19 04:50:47 UTC
Great, thanks Patrick.

Comment 22 Alex Eng 2012-11-27 01:44:21 UTC
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.