https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112552

Revision: 112552
Author:   rmoen
Date:     2012-02-28 00:35:17 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
prototype RTL text mode cursor handling. Need to complete the unicode regular 
expression, and make helper methods for RTL boundary

Modified Paths:
--------------
    trunk/extensions/VisualEditor/modules/ve/es/ve.es.Surface.js

Modified: trunk/extensions/VisualEditor/modules/ve/es/ve.es.Surface.js
===================================================================
--- trunk/extensions/VisualEditor/modules/ve/es/ve.es.Surface.js        
2012-02-28 00:34:42 UTC (rev 112551)
+++ trunk/extensions/VisualEditor/modules/ve/es/ve.es.Surface.js        
2012-02-28 00:35:17 UTC (rev 112552)
@@ -519,6 +519,14 @@
        _this.handleInsert();
 };
 
+/* TODO: need to complete the unicode expression for all RTL characters
+       Currently have Hebrew & and all Arabic except numbers
+ */
+ve.es.Surface.prototype.isTextRTL = function( text ) {
+       //hebrew, and arabic
+       return 
/[\u0590–\u05FF\u0600-\u06FF\u0750—\u077F\u08A0—\u08FF\uFB50—\uFDFF\uFE70—\uFEFF]/.test(
 text );
+};
+
 ve.es.Surface.prototype.resetText = function( e ) {
        this.$input.val( '' );
        this.keyboard.undoCount = 0;
@@ -923,6 +931,15 @@
                        this.model.select( selection );
                        this.keyboard.undoCount++;
                        this.model.breakpoint();
+
+                       
+                       /*      Move the cursor left if RTL
+                               TODO:   1) Create method to detect end of RTL 
and move cursor the the right
+                                               2) moveCursor is breaking IME 
for the RTL language, need to add mode switching
+                        */
+                       if( this.isRTL( val.charAt( val.length-1 ) ) ) {
+                               this.moveCursor('left', 'char');
+                       }
                }
 
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to