Revision: 9031
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=9031&view=rev
Author:   dnaber
Date:     2013-01-15 20:26:17 +0000 (Tue, 15 Jan 2013)
Log Message:
-----------
online check: prevent popup menu running out of screen

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/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-15 20:07:58 UTC (rev 9030)
+++ 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js    
    2013-01-15 20:26:17 UTC (rev 9031)
@@ -679,13 +679,26 @@
               }
            });
 
-            /* show the menu please */
-            ed.selection.select(e.target);
-            p1 = dom.getPos(e.target);
-            m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
-            this.menuVisible =  true;
+           /* show the menu please */
+           ed.selection.select(e.target);
+           p1 = dom.getPos(e.target);
+           var xPos = p1.x;
+           m.showMenu(xPos, p1.y + e.target.offsetHeight - vp.y);
+           this.menuVisible =  true;
+           var menuDiv = $('#menu_checktext_spellcheckermenu_co');
+           if (menuDiv) {
+               var menuWidth = menuDiv.width();
+               var textBoxWidth = $('#checktextpara').width();  // not sure 
why we cannot directly use the textarea's width
+               if (xPos + menuWidth > textBoxWidth) {
+                   // menu runs out of screen, move it to the left
+                   var diff = xPos + menuWidth - textBoxWidth;
+                   menuDiv.css({ left: '-' + diff + 'px' });
+               } else {
+                   menuDiv.css({ left: '0px' });
+               }
+           }
 
-            return tinymce.dom.Event.cancel(e);
+           return tinymce.dom.Event.cancel(e);
          } 
          else
          {

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-15 20:07:58 UTC (rev 9030)
+++ 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
    2013-01-15 20:26:17 UTC (rev 9031)
@@ -359,13 +359,26 @@
               }
            });
 
-            /* show the menu please */
-            ed.selection.select(e.target);
-            p1 = dom.getPos(e.target);
-            m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
-            this.menuVisible =  true;
+           /* show the menu please */
+           ed.selection.select(e.target);
+           p1 = dom.getPos(e.target);
+           var xPos = p1.x;
+           m.showMenu(xPos, p1.y + e.target.offsetHeight - vp.y);
+           this.menuVisible =  true;
+           var menuDiv = $('#menu_checktext_spellcheckermenu_co');
+           if (menuDiv) {
+               var menuWidth = menuDiv.width();
+               var textBoxWidth = $('#checktextpara').width();  // not sure 
why we cannot directly use the textarea's width
+               if (xPos + menuWidth > textBoxWidth) {
+                   // menu runs out of screen, move it to the left
+                   var diff = xPos + menuWidth - textBoxWidth;
+                   menuDiv.css({ left: '-' + diff + 'px' });
+               } else {
+                   menuDiv.css({ left: '0px' });
+               }
+           }
 
-            return tinymce.dom.Event.cancel(e);
+           return tinymce.dom.Event.cancel(e);
          } 
          else
          {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to