Revision: 8899
http://languagetool.svn.sourceforge.net/languagetool/?rev=8899&view=rev
Author: dnaber
Date: 2013-01-06 15:46:21 +0000 (Sun, 06 Jan 2013)
Log Message:
-----------
fix display of suggestions if there are multiple suggestions; usability: close
popup by clicking again
Modified Paths:
--------------
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/atd.core.js
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
Modified:
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
===================================================================
---
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
2013-01-06 15:01:41 UTC (rev 8898)
+++
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
2013-01-06 15:46:21 UTC (rev 8899)
@@ -185,7 +185,7 @@
suggestion["suggestions"] = [];
var suggestionsStr = errors[i].getAttribute("replacements");
if (suggestionsStr) {
- suggestion["suggestions"] = suggestionsStr.split("#");
+ suggestion["suggestions"] = suggestionsStr;
}
var context = errors[i].getAttribute("context");
var errorOffset = errors[i].getAttribute("offset");
@@ -629,6 +629,7 @@
/*
* TinyMCE Writing Improvement Tool Plugin
* Author: Raphael Mudge ([email protected])
+ * Modified by Daniel Naber for LanguageTool (http://www.languagetool.org)
*
* http://www.afterthedeadline.com
*
@@ -654,7 +655,7 @@
return
({
longname : 'After The Deadline',
- author : 'Raphael Mudge',
+ author : 'Raphael Mudge, Daniel Naber',
authorurl : 'http://blog.afterthedeadline.com',
infourl : 'http://www.afterthedeadline.com',
version : tinymce.majorVersion + "." + tinymce.minorVersion
@@ -732,6 +733,7 @@
this.url = url;
this.editor = ed;
+ this.menuVisible = false;
ed.core = core;
/* look at the atd_ignore variable and put that stuff into a hash */
@@ -787,6 +789,9 @@
ed.suggestions = results.suggestions;
}
+ if (results.suggestions.length == 0) {
+
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No
errors were found.'));
+ }
/*if (ecount == 0 && (!callback || callback == undefined))
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No
writing errors were found.'));
else if (callback)
@@ -897,6 +902,13 @@
t._menu = m;
}
+
+ if (this.menuVisible) {
+ // second click: close popup again
+ m.hideMenu();
+ this.menuVisible = false;
+ return;
+ }
if (ed.core.isMarkedNode(e.target))
{
@@ -920,6 +932,9 @@
for (var i = 0; i < errorDescription["suggestions"].length; i++)
{
+ if (i >= 5) {
+ break;
+ }
(function(sugg)
{
m.add({
@@ -1022,12 +1037,14 @@
ed.selection.select(e.target);
p1 = dom.getPos(e.target);
m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
+ this.menuVisible = true;
return tinymce.dom.Event.cancel(e);
}
else
{
m.hideMenu();
+ this.menuVisible = false;
}
},
@@ -1036,6 +1053,8 @@
{
var t = this, ed = t.editor, dom = ed.dom, o;
+ this.menuVisible = false;
+
each(dom.select('span'), function(n)
{
if (n && dom.hasClass(n, 'mceItemHidden'))
@@ -1060,6 +1079,7 @@
if (plugin._menu)
{
plugin._menu.hideMenu();
+ this.menuVisible = false;
}
plugin.editor.nodeChanged();
Modified:
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/atd.core.js
===================================================================
--- trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/atd.core.js
2013-01-06 15:01:41 UTC (rev 8898)
+++ trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/atd.core.js
2013-01-06 15:46:21 UTC (rev 8899)
@@ -185,7 +185,7 @@
suggestion["suggestions"] = [];
var suggestionsStr = errors[i].getAttribute("replacements");
if (suggestionsStr) {
- suggestion["suggestions"] = suggestionsStr.split("#");
+ suggestion["suggestions"] = suggestionsStr;
}
var context = errors[i].getAttribute("context");
var errorOffset = errors[i].getAttribute("offset");
Modified:
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
===================================================================
---
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
2013-01-06 15:01:41 UTC (rev 8898)
+++
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
2013-01-06 15:46:21 UTC (rev 8899)
@@ -1,6 +1,7 @@
/*
* TinyMCE Writing Improvement Tool Plugin
* Author: Raphael Mudge ([email protected])
+ * Modified by Daniel Naber for LanguageTool (http://www.languagetool.org)
*
* http://www.afterthedeadline.com
*
@@ -26,7 +27,7 @@
return
({
longname : 'After The Deadline',
- author : 'Raphael Mudge',
+ author : 'Raphael Mudge, Daniel Naber',
authorurl : 'http://blog.afterthedeadline.com',
infourl : 'http://www.afterthedeadline.com',
version : tinymce.majorVersion + "." + tinymce.minorVersion
@@ -104,6 +105,7 @@
this.url = url;
this.editor = ed;
+ this.menuVisible = false;
ed.core = core;
/* look at the atd_ignore variable and put that stuff into a hash */
@@ -159,6 +161,9 @@
ed.suggestions = results.suggestions;
}
+ if (results.suggestions.length == 0) {
+
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No
errors were found.'));
+ }
/*if (ecount == 0 && (!callback || callback == undefined))
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No
writing errors were found.'));
else if (callback)
@@ -269,6 +274,13 @@
t._menu = m;
}
+
+ if (this.menuVisible) {
+ // second click: close popup again
+ m.hideMenu();
+ this.menuVisible = false;
+ return;
+ }
if (ed.core.isMarkedNode(e.target))
{
@@ -292,6 +304,9 @@
for (var i = 0; i < errorDescription["suggestions"].length; i++)
{
+ if (i >= 5) {
+ break;
+ }
(function(sugg)
{
m.add({
@@ -394,12 +409,14 @@
ed.selection.select(e.target);
p1 = dom.getPos(e.target);
m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
+ this.menuVisible = true;
return tinymce.dom.Event.cancel(e);
}
else
{
m.hideMenu();
+ this.menuVisible = false;
}
},
@@ -408,6 +425,8 @@
{
var t = this, ed = t.editor, dom = ed.dom, o;
+ this.menuVisible = false;
+
each(dom.select('span'), function(n)
{
if (n && dom.hasClass(n, 'mceItemHidden'))
@@ -432,6 +451,7 @@
if (plugin._menu)
{
plugin._menu.hideMenu();
+ this.menuVisible = false;
}
plugin.editor.nodeChanged();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits