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

Revision: 113660
Author:   christian
Date:     2012-03-12 20:39:08 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
switch to getSelectionRange and fixing IME native menu

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

Modified: trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.Surface.js
===================================================================
--- trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.Surface.js        
2012-03-12 20:33:47 UTC (rev 113659)
+++ trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.Surface.js        
2012-03-12 20:39:08 UTC (rev 113660)
@@ -118,8 +118,8 @@
 };
 
 ve.ce.Surface.prototype.getAnnotations = function() {
-       return this.getSelection().getLength() ?
-               this.model.getDocument().getAnnotationsFromRange( 
this.getSelection() ) :
+       return this.getSelectionRange().getLength() ?
+               this.model.getDocument().getAnnotationsFromRange( 
this.getSelectionRange() ) :
                {
                        'full': this.insertionAnnotations,
                        'partial': [],
@@ -137,7 +137,7 @@
 
 ve.ce.Surface.prototype.loadInsertionAnnotations = function( annotation ) {
        this.insertionAnnotations =
-               this.model.getDocument().getAnnotationsFromOffset( 
this.getSelection().to - 1 );
+               this.model.getDocument().getAnnotationsFromOffset( 
this.getSelectionRange().to - 1 );
        // Filter out annotations that aren't textStyles or links
        for ( var i = 0; i < this.insertionAnnotations.length; i++ ) {
                if ( !this.insertionAnnotations[i].type.match( 
/(textStyle\/|link\/)/ ) ) {
@@ -280,7 +280,7 @@
 
 ve.ce.Surface.prototype.pollContent = function() {
        var localOffset, text, hash;
-
+       
        if ( this.poll.compositionStart !== null && this.poll.compositionEnd 
!== null ) {
 
                text = ve.ce.Surface.getDOMText2( this.poll.node );
@@ -448,7 +448,7 @@
                        break;
        }
        var range = this.getSelectionRange();
-       if ( range.getLength() !== 0 ) {
+       if ( range.getLength() !== 0 && this.poll.compositionStart === null) {
                e.preventDefault();
        }
 };


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

Reply via email to