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

Revision: 112858
Author:   christian
Date:     2012-03-02 00:27:04 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
better cut-copy-paste support

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

Modified: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js
===================================================================
--- trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js        
2012-03-02 00:26:56 UTC (rev 112857)
+++ trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js        
2012-03-02 00:27:04 UTC (rev 112858)
@@ -88,7 +88,7 @@
        console.log('cut/copy');
        var _this = this,
        rangySel = rangy.getSelection(),
-       key = rangySel.getRangeAt(0).toString().replace(/( 
|\r\n|\n|\r|\t)/gm,"");
+       key = rangySel.getRangeAt(0).toString().replace(/\s/gm,"");
 
        _this.clipboard[key] = ve.copyArray( _this.documentView.model.getData( 
_this.getSelection() ) );
 
@@ -107,22 +107,12 @@
        var     _this = this,
                insertionPoint = _this.getSelection().start,
                node = rangy.getSelection().anchorNode;
-
-_this.stopPolling();
+       
        $('#paste').html('').show().css( 'top', $(window).scrollTop() ).css(' 
left', $(window).scrollLeft() ).focus();
 
-       
-
        setTimeout( function() {
+               var key = $('#paste').hide().text().replace(/\s/gm,"");
 
-               console.log('key is: ');
-               console.log(_this.clipboard);
-               console.log('paste is: ');
-               console.log( $('#paste').hide().text().replace(/( 
|\r\n|\n|\r|\t)/gm,"") );
-
-
-               var key = $('#paste').hide().text().replace(/( 
|\r\n|\n|\r|\t)/gm,"");
-
                if ( _this.clipboard[key] ) {
                        // transact
                        var tx = _this.documentView.model.prepareInsertion( 
insertionPoint, _this.clipboard[key]);
@@ -130,12 +120,12 @@
 
                        // re-render
                        _this.getLeafNode( node ).data( 'view' 
).renderContent();
+
+                       // clear the prev information from poll object 
(probably a better way to do this)
                        _this.poll.prevText = _this.poll.prevHash = 
_this.poll.prevOffset = _this.poll.node = null;
 
                        // place cursor
-                       //_this.showCursorAt( insertionPoint + 
_this.clipboard[key].length );
-
-                       //_this.startPolling();
+                       _this.showCursorAt( insertionPoint + 
_this.clipboard[key].length );
                } else {
                        alert('i can only handle copy/paste from hybrid 
surface. sorry. :(');
                }


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

Reply via email to